@@ -6,35 +6,35 @@ discard block |
||
6 | 6 | |
7 | 7 | class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5 |
8 | 8 | { |
9 | - public static $files = array ( |
|
9 | + public static $files = array( |
|
10 | 10 | 'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php', |
11 | 11 | '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php', |
12 | 12 | '42671a413efb740d7040437ff2a982cd' => __DIR__ . '/..' . '/ayecode/wp-super-duper/sd-functions.php', |
13 | 13 | ); |
14 | 14 | |
15 | - public static $prefixLengthsPsr4 = array ( |
|
15 | + public static $prefixLengthsPsr4 = array( |
|
16 | 16 | 'M' => |
17 | - array ( |
|
17 | + array( |
|
18 | 18 | 'MaxMind\\Db\\' => 11, |
19 | 19 | ), |
20 | 20 | 'C' => |
21 | - array ( |
|
21 | + array( |
|
22 | 22 | 'Composer\\Installers\\' => 20, |
23 | 23 | ), |
24 | 24 | ); |
25 | 25 | |
26 | - public static $prefixDirsPsr4 = array ( |
|
26 | + public static $prefixDirsPsr4 = array( |
|
27 | 27 | 'MaxMind\\Db\\' => |
28 | - array ( |
|
28 | + array( |
|
29 | 29 | 0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db', |
30 | 30 | ), |
31 | 31 | 'Composer\\Installers\\' => |
32 | - array ( |
|
32 | + array( |
|
33 | 33 | 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers', |
34 | 34 | ), |
35 | 35 | ); |
36 | 36 | |
37 | - public static $classMap = array ( |
|
37 | + public static $classMap = array( |
|
38 | 38 | 'AyeCode_Connect_Helper' => __DIR__ . '/..' . '/ayecode/ayecode-connect-helper/ayecode-connect-helper.php', |
39 | 39 | 'AyeCode_Deactivation_Survey' => __DIR__ . '/..' . '/ayecode/wp-deactivation-survey/wp-deactivation-survey.php', |
40 | 40 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public static function getInitializer(ClassLoader $loader) |
45 | 45 | { |
46 | - return \Closure::bind(function () use ($loader) { |
|
46 | + return \Closure::bind(function() use ($loader) { |
|
47 | 47 | $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4; |
48 | 48 | $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4; |
49 | 49 | $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | if (!headers_sent()) { |
7 | 7 | header('HTTP/1.1 500 Internal Server Error'); |
8 | 8 | } |
9 | - $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; |
|
9 | + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running ' . PHP_VERSION . ', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.' . PHP_EOL; |
|
10 | 10 | if (!ini_get('display_errors')) { |
11 | 11 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
12 | 12 | fwrite(STDERR, $err); |
@@ -327,11 +327,11 @@ |
||
327 | 327 | foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
328 | 328 | if (isset(self::$installedByVendor[$vendorDir])) { |
329 | 329 | $installed[] = self::$installedByVendor[$vendorDir]; |
330 | - } elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
330 | + } elseif (is_file($vendorDir . '/composer/installed.php')) { |
|
331 | 331 | /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ |
332 | - $required = require $vendorDir.'/composer/installed.php'; |
|
332 | + $required = require $vendorDir . '/composer/installed.php'; |
|
333 | 333 | $installed[] = self::$installedByVendor[$vendorDir] = $required; |
334 | - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
334 | + if (null === self::$installed && strtr($vendorDir . '/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
335 | 335 | self::$installed = $installed[count($installed) - 1]; |
336 | 336 | } |
337 | 337 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $loader->register(true); |
35 | 35 | |
36 | 36 | $filesToLoad = \Composer\Autoload\ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$files; |
37 | - $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { |
|
37 | + $requireFile = \Closure::bind(static function($fileIdentifier, $file) { |
|
38 | 38 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { |
39 | 39 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; |
40 | 40 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return string The rendered component. |
20 | 20 | */ |
21 | - public static function input( $args = array() ) { |
|
21 | + public static function input($args = array()) { |
|
22 | 22 | global $aui_bs5; |
23 | 23 | |
24 | 24 | $defaults = array( |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * Parse incoming $args into an array and merge it with $defaults |
71 | 71 | */ |
72 | - $args = wp_parse_args( $args, $defaults ); |
|
72 | + $args = wp_parse_args($args, $defaults); |
|
73 | 73 | $output = ''; |
74 | - if ( ! empty( $args['type'] ) ) { |
|
74 | + if (!empty($args['type'])) { |
|
75 | 75 | // hidden label option needs to be empty |
76 | 76 | $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type']; |
77 | 77 | |
78 | - $type = sanitize_html_class( $args['type'] ); |
|
78 | + $type = sanitize_html_class($args['type']); |
|
79 | 79 | |
80 | 80 | $help_text = ''; |
81 | 81 | $label = ''; |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | ); |
90 | 90 | |
91 | 91 | // floating labels need label after |
92 | - if ( $args['label_type'] == 'floating' && $type != 'checkbox' ) { |
|
92 | + if ($args['label_type'] == 'floating' && $type != 'checkbox') { |
|
93 | 93 | $label_after = true; |
94 | 94 | $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works. |
95 | 95 | } |
96 | 96 | |
97 | 97 | // size |
98 | 98 | $size = ''; |
99 | - if ( $args['size'] == 'lg' || $args['size'] == 'large' ) { |
|
99 | + if ($args['size'] == 'lg' || $args['size'] == 'large') { |
|
100 | 100 | $size = 'lg'; |
101 | 101 | $args['class'] .= ' form-control-lg'; |
102 | - }elseif ( $args['size'] == 'sm' || $args['size'] == 'small' ) { |
|
102 | + }elseif ($args['size'] == 'sm' || $args['size'] == 'small') { |
|
103 | 103 | $size = 'sm'; |
104 | 104 | $args['class'] .= ' form-control-sm'; |
105 | 105 | } |
@@ -108,28 +108,28 @@ discard block |
||
108 | 108 | $clear_function = 'jQuery(this).parent().parent().find(\'input\').val(\'\');'; |
109 | 109 | |
110 | 110 | // Some special sauce for files |
111 | - if ( $type == 'file' ) { |
|
111 | + if ($type == 'file') { |
|
112 | 112 | $label_after = true; // if type file we need the label after |
113 | 113 | $args['class'] .= ' custom-file-input '; |
114 | - } elseif ( $type == 'checkbox' ) { |
|
114 | + } elseif ($type == 'checkbox') { |
|
115 | 115 | $label_after = true; // if type file we need the label after |
116 | 116 | $args['class'] .= $aui_bs5 ? ' form-check-input c-pointer ' : ' custom-control-input c-pointer '; |
117 | - } elseif ( $type == 'datepicker' || $type == 'timepicker' ) { |
|
117 | + } elseif ($type == 'datepicker' || $type == 'timepicker') { |
|
118 | 118 | $orig_type = $type; |
119 | 119 | $type = 'text'; |
120 | 120 | $args['class'] .= ' bg-initial '; // @todo not sure why we have this? |
121 | - $clear_function .= "jQuery(this).parent().parent().find('input[name=\'" . esc_attr( $args['name'] ) . "\']').trigger('change');"; |
|
121 | + $clear_function .= "jQuery(this).parent().parent().find('input[name=\'" . esc_attr($args['name']) . "\']').trigger('change');"; |
|
122 | 122 | |
123 | 123 | $args['extra_attributes']['data-aui-init'] = 'flatpickr'; |
124 | 124 | |
125 | 125 | // Disable native datetime inputs. |
126 | - $disable_mobile_attr = isset( $args['extra_attributes']['data-disable-mobile'] ) ? $args['extra_attributes']['data-disable-mobile'] : 'true'; |
|
127 | - $disable_mobile_attr = apply_filters( 'aui_flatpickr_disable_disable_mobile_attr', $disable_mobile_attr, $args ); |
|
126 | + $disable_mobile_attr = isset($args['extra_attributes']['data-disable-mobile']) ? $args['extra_attributes']['data-disable-mobile'] : 'true'; |
|
127 | + $disable_mobile_attr = apply_filters('aui_flatpickr_disable_disable_mobile_attr', $disable_mobile_attr, $args); |
|
128 | 128 | |
129 | 129 | $args['extra_attributes']['data-disable-mobile'] = $disable_mobile_attr; |
130 | 130 | |
131 | 131 | // set a way to clear field if empty |
132 | - if ( $args['input_group_right'] === '' && $args['clear_icon'] !== false ) { |
|
132 | + if ($args['input_group_right'] === '' && $args['clear_icon'] !== false) { |
|
133 | 133 | $args['input_group_right_inside'] = true; |
134 | 134 | $args['clear_icon'] = true; |
135 | 135 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | // enqueue the script |
138 | 138 | $aui_settings = AyeCode_UI_Settings::instance(); |
139 | 139 | $aui_settings->enqueue_flatpickr(); |
140 | - } elseif ( $type == 'iconpicker' ) { |
|
140 | + } elseif ($type == 'iconpicker') { |
|
141 | 141 | $type = 'text'; |
142 | 142 | //$args['class'] .= ' aui-flatpickr bg-initial '; |
143 | 143 | // $args['class'] .= ' bg-initial '; |
@@ -152,104 +152,104 @@ discard block |
||
152 | 152 | $aui_settings->enqueue_iconpicker(); |
153 | 153 | } |
154 | 154 | |
155 | - if ( $type == 'checkbox' && ( ( ! empty( $args['name'] ) && strpos( $args['name'], '[' ) === false ) || ! empty( $args['with_hidden'] ) ) ) { |
|
156 | - $output .= '<input type="hidden" name="' . esc_attr( $args['name'] ) . '" value="0" />'; |
|
155 | + if ($type == 'checkbox' && ((!empty($args['name']) && strpos($args['name'], '[') === false) || !empty($args['with_hidden']))) { |
|
156 | + $output .= '<input type="hidden" name="' . esc_attr($args['name']) . '" value="0" />'; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // allow clear icon |
160 | - if ( $args['input_group_right'] === '' && $args['clear_icon'] ) { |
|
161 | - $font_size = $size == 'sm' ? '1.3' : ( $size == 'lg' ? '1.65' : '1.5' ); |
|
160 | + if ($args['input_group_right'] === '' && $args['clear_icon']) { |
|
161 | + $font_size = $size == 'sm' ? '1.3' : ($size == 'lg' ? '1.65' : '1.5'); |
|
162 | 162 | $args['input_group_right_inside'] = true; |
163 | 163 | $align_class = $aui_bs5 ? ' h-100 py-0' : ''; |
164 | - $args['input_group_right'] = '<span class="input-group-text aui-clear-input c-pointer bg-initial border-0 px-2 d-none ' . $align_class . '" onclick="' . $clear_function . '"><span style="font-size: ' . $font_size . 'rem" aria-hidden="true" class="' . ( $aui_bs5 ? 'btn-close' : 'close' ) . '">' . ( $aui_bs5 ? '' : '×' ) . '</span></span>'; |
|
164 | + $args['input_group_right'] = '<span class="input-group-text aui-clear-input c-pointer bg-initial border-0 px-2 d-none ' . $align_class . '" onclick="' . $clear_function . '"><span style="font-size: ' . $font_size . 'rem" aria-hidden="true" class="' . ($aui_bs5 ? 'btn-close' : 'close') . '">' . ($aui_bs5 ? '' : '×') . '</span></span>'; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // open/type |
168 | 168 | $output .= '<input type="' . $type . '" '; |
169 | 169 | |
170 | 170 | // name |
171 | - if ( ! empty( $args['name'] ) ) { |
|
172 | - $output .= ' name="' . esc_attr( $args['name'] ) . '" '; |
|
171 | + if (!empty($args['name'])) { |
|
172 | + $output .= ' name="' . esc_attr($args['name']) . '" '; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | // id |
176 | - if ( ! empty( $args['id'] ) ) { |
|
177 | - $output .= ' id="' . sanitize_html_class( $args['id'] ) . '" '; |
|
176 | + if (!empty($args['id'])) { |
|
177 | + $output .= ' id="' . sanitize_html_class($args['id']) . '" '; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // placeholder |
181 | - if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) { |
|
182 | - $output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" '; |
|
181 | + if (isset($args['placeholder']) && '' != $args['placeholder']) { |
|
182 | + $output .= ' placeholder="' . esc_attr($args['placeholder']) . '" '; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | // title |
186 | - if ( ! empty( $args['title'] ) ) { |
|
187 | - $output .= ' title="' . esc_attr( $args['title'] ) . '" '; |
|
186 | + if (!empty($args['title'])) { |
|
187 | + $output .= ' title="' . esc_attr($args['title']) . '" '; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | // value |
191 | - if ( ! empty( $args['value'] ) ) { |
|
192 | - $output .= AUI_Component_Helper::value( $args['value'] ); |
|
191 | + if (!empty($args['value'])) { |
|
192 | + $output .= AUI_Component_Helper::value($args['value']); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | // checked, for radio and checkboxes |
196 | - if ( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ) { |
|
196 | + if (($type == 'checkbox' || $type == 'radio') && $args['checked']) { |
|
197 | 197 | $output .= ' checked '; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // validation text |
201 | - if ( ! empty( $args['validation_text'] ) ) { |
|
202 | - $output .= ' oninvalid="setCustomValidity(\'' . esc_attr( addslashes( $args['validation_text'] ) ) . '\')" '; |
|
201 | + if (!empty($args['validation_text'])) { |
|
202 | + $output .= ' oninvalid="setCustomValidity(\'' . esc_attr(addslashes($args['validation_text'])) . '\')" '; |
|
203 | 203 | $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" '; |
204 | 204 | } |
205 | 205 | |
206 | 206 | // validation_pattern |
207 | - if ( ! empty( $args['validation_pattern'] ) ) { |
|
208 | - $output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" '; |
|
207 | + if (!empty($args['validation_pattern'])) { |
|
208 | + $output .= ' pattern="' . esc_attr($args['validation_pattern']) . '" '; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | // step (for numbers) |
212 | - if ( ! empty( $args['step'] ) ) { |
|
212 | + if (!empty($args['step'])) { |
|
213 | 213 | $output .= ' step="' . $args['step'] . '" '; |
214 | 214 | } |
215 | 215 | |
216 | 216 | // required |
217 | - if ( ! empty( $args['required'] ) ) { |
|
217 | + if (!empty($args['required'])) { |
|
218 | 218 | $output .= ' required '; |
219 | 219 | } |
220 | 220 | |
221 | 221 | // class |
222 | - $class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : ''; |
|
223 | - $output .= $aui_bs5 && $type == 'checkbox' ? ' class="' . $class . '" ' : ' class="form-control ' . $class . '" '; |
|
222 | + $class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : ''; |
|
223 | + $output .= $aui_bs5 && $type == 'checkbox' ? ' class="' . $class . '" ' : ' class="form-control ' . $class . '" '; |
|
224 | 224 | |
225 | 225 | // data-attributes |
226 | - $output .= AUI_Component_Helper::data_attributes( $args ); |
|
226 | + $output .= AUI_Component_Helper::data_attributes($args); |
|
227 | 227 | |
228 | 228 | // extra attributes |
229 | - if ( ! empty( $args['extra_attributes'] ) ) { |
|
230 | - $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] ); |
|
229 | + if (!empty($args['extra_attributes'])) { |
|
230 | + $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | // close |
234 | 234 | $output .= ' >'; |
235 | 235 | |
236 | 236 | // help text |
237 | - if ( ! empty( $args['help_text'] ) ) { |
|
238 | - $help_text = AUI_Component_Helper::help_text( $args['help_text'] ); |
|
237 | + if (!empty($args['help_text'])) { |
|
238 | + $help_text = AUI_Component_Helper::help_text($args['help_text']); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | // label |
242 | - if ( ! empty( $args['label'] ) ) { |
|
242 | + if (!empty($args['label'])) { |
|
243 | 243 | $label_base_class = ''; |
244 | - if ( $type == 'file' ) { |
|
244 | + if ($type == 'file') { |
|
245 | 245 | $label_base_class = ' custom-file-label'; |
246 | - } elseif ( $type == 'checkbox' ) { |
|
247 | - if ( ! empty( $args['label_force_left'] ) ) { |
|
248 | - $label_args['title'] = wp_kses_post( $args['help_text'] ); |
|
246 | + } elseif ($type == 'checkbox') { |
|
247 | + if (!empty($args['label_force_left'])) { |
|
248 | + $label_args['title'] = wp_kses_post($args['help_text']); |
|
249 | 249 | $help_text = ''; |
250 | 250 | //$label_args['class'] .= ' d-inline '; |
251 | 251 | $args['wrap_class'] .= ' align-items-center '; |
252 | - }else{ |
|
252 | + } else { |
|
253 | 253 | |
254 | 254 | } |
255 | 255 | |
@@ -257,49 +257,49 @@ discard block |
||
257 | 257 | } |
258 | 258 | $label_args['class'] .= $label_base_class; |
259 | 259 | $temp_label_args = $label_args; |
260 | - if(! empty( $args['label_force_left'] )){$temp_label_args['class'] = $label_base_class." text-muted";} |
|
261 | - $label = self::label( $temp_label_args, $type ); |
|
260 | + if (!empty($args['label_force_left'])) {$temp_label_args['class'] = $label_base_class . " text-muted"; } |
|
261 | + $label = self::label($temp_label_args, $type); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | 265 | |
266 | 266 | |
267 | 267 | // set help text in the correct position |
268 | - if ( $label_after ) { |
|
268 | + if ($label_after) { |
|
269 | 269 | $output .= $label . $help_text; |
270 | 270 | } |
271 | 271 | |
272 | 272 | // some input types need a separate wrap |
273 | - if ( $type == 'file' ) { |
|
274 | - $output = self::wrap( array( |
|
273 | + if ($type == 'file') { |
|
274 | + $output = self::wrap(array( |
|
275 | 275 | 'content' => $output, |
276 | 276 | 'class' => $aui_bs5 ? 'mb-3 custom-file' : 'form-group custom-file' |
277 | - ) ); |
|
278 | - } elseif ( $type == 'checkbox' ) { |
|
277 | + )); |
|
278 | + } elseif ($type == 'checkbox') { |
|
279 | 279 | |
280 | 280 | $label_args['title'] = $args['label']; |
281 | - $label_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'label' ); |
|
282 | - $label = !empty( $args['label_force_left'] ) ? self::label( $label_args, 'cb' ) : '<div class="' . $label_col . ' col-form-label"></div>'; |
|
283 | - $switch_size_class = $args['switch'] && !is_bool( $args['switch'] ) ? ' custom-switch-'.esc_attr( $args['switch'] ) : ''; |
|
284 | - if ( $aui_bs5 ) { |
|
281 | + $label_col = AUI_Component_Helper::get_column_class($args['label_col'], 'label'); |
|
282 | + $label = !empty($args['label_force_left']) ? self::label($label_args, 'cb') : '<div class="' . $label_col . ' col-form-label"></div>'; |
|
283 | + $switch_size_class = $args['switch'] && !is_bool($args['switch']) ? ' custom-switch-' . esc_attr($args['switch']) : ''; |
|
284 | + if ($aui_bs5) { |
|
285 | 285 | $wrap_class = $args['switch'] ? 'form-check form-switch' . $switch_size_class : 'form-check'; |
286 | - }else{ |
|
287 | - $wrap_class = $args['switch'] ? 'custom-switch' . $switch_size_class : 'custom-checkbox' ; |
|
286 | + } else { |
|
287 | + $wrap_class = $args['switch'] ? 'custom-switch' . $switch_size_class : 'custom-checkbox'; |
|
288 | 288 | } |
289 | - if ( ! empty( $args['label_force_left'] ) ) { |
|
289 | + if (!empty($args['label_force_left'])) { |
|
290 | 290 | $wrap_class .= $aui_bs5 ? '' : ' d-flex align-content-center'; |
291 | - $label = str_replace(array("form-check-label","custom-control-label"),"", self::label( $label_args, 'cb' ) ); |
|
291 | + $label = str_replace(array("form-check-label", "custom-control-label"), "", self::label($label_args, 'cb')); |
|
292 | 292 | } |
293 | - $output = self::wrap( array( |
|
293 | + $output = self::wrap(array( |
|
294 | 294 | 'content' => $output, |
295 | 295 | 'class' => $aui_bs5 ? $wrap_class : 'custom-control ' . $wrap_class |
296 | - ) ); |
|
296 | + )); |
|
297 | 297 | |
298 | - if ( $args['label_type'] == 'horizontal' ) { |
|
299 | - $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' ); |
|
298 | + if ($args['label_type'] == 'horizontal') { |
|
299 | + $input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input'); |
|
300 | 300 | $output = $label . '<div class="' . $input_col . '">' . $output . '</div>'; |
301 | 301 | } |
302 | - } elseif ( $type == 'password' && $args['password_toggle'] && ! $args['input_group_right'] ) { |
|
302 | + } elseif ($type == 'password' && $args['password_toggle'] && !$args['input_group_right']) { |
|
303 | 303 | |
304 | 304 | |
305 | 305 | // allow password field to toggle view |
@@ -313,70 +313,70 @@ discard block |
||
313 | 313 | } |
314 | 314 | |
315 | 315 | // input group wraps |
316 | - if ( $args['input_group_left'] || $args['input_group_right'] ) { |
|
317 | - $w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : ''; |
|
316 | + if ($args['input_group_left'] || $args['input_group_right']) { |
|
317 | + $w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : ''; |
|
318 | 318 | $group_size = $size == 'lg' ? ' input-group-lg' : ''; |
319 | 319 | $group_size = !$group_size && $size == 'sm' ? ' input-group-sm' : $group_size; |
320 | 320 | |
321 | - if ( $args['input_group_left'] ) { |
|
322 | - $output = self::wrap( array( |
|
321 | + if ($args['input_group_left']) { |
|
322 | + $output = self::wrap(array( |
|
323 | 323 | 'content' => $output, |
324 | 324 | 'class' => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 . $group_size : 'input-group' . $group_size, |
325 | 325 | 'input_group_left' => $args['input_group_left'], |
326 | 326 | 'input_group_left_inside' => $args['input_group_left_inside'] |
327 | - ) ); |
|
327 | + )); |
|
328 | 328 | } |
329 | - if ( $args['input_group_right'] ) { |
|
330 | - $output = self::wrap( array( |
|
329 | + if ($args['input_group_right']) { |
|
330 | + $output = self::wrap(array( |
|
331 | 331 | 'content' => $output, |
332 | 332 | 'class' => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 . $group_size : 'input-group' . $group_size, |
333 | 333 | 'input_group_right' => $args['input_group_right'], |
334 | 334 | 'input_group_right_inside' => $args['input_group_right_inside'] |
335 | - ) ); |
|
335 | + )); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | } |
339 | 339 | |
340 | - if ( ! $label_after ) { |
|
340 | + if (!$label_after) { |
|
341 | 341 | $output .= $help_text; |
342 | 342 | } |
343 | 343 | |
344 | 344 | |
345 | - if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) { |
|
346 | - $output = self::wrap( array( |
|
345 | + if ($args['label_type'] == 'horizontal' && $type != 'checkbox') { |
|
346 | + $output = self::wrap(array( |
|
347 | 347 | 'content' => $output, |
348 | - 'class' => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' ) |
|
349 | - ) ); |
|
348 | + 'class' => AUI_Component_Helper::get_column_class($args['label_col'], 'input') |
|
349 | + )); |
|
350 | 350 | } |
351 | 351 | |
352 | - if ( ! $label_after ) { |
|
352 | + if (!$label_after) { |
|
353 | 353 | $output = $label . $output; |
354 | 354 | } |
355 | 355 | |
356 | 356 | // wrap |
357 | - if ( ! $args['no_wrap'] ) { |
|
358 | - if ( ! empty( $args['form_group_class'] ) ) { |
|
359 | - $fg_class = esc_attr( $args['form_group_class'] ); |
|
360 | - }else{ |
|
357 | + if (!$args['no_wrap']) { |
|
358 | + if (!empty($args['form_group_class'])) { |
|
359 | + $fg_class = esc_attr($args['form_group_class']); |
|
360 | + } else { |
|
361 | 361 | $fg_class = $aui_bs5 ? 'mb-3' : 'form-group'; |
362 | 362 | } |
363 | 363 | $form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : $fg_class; |
364 | 364 | $wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class; |
365 | - $wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
366 | - $output = self::wrap( array( |
|
365 | + $wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
366 | + $output = self::wrap(array( |
|
367 | 367 | 'content' => $output, |
368 | 368 | 'class' => $wrap_class, |
369 | 369 | 'element_require' => $args['element_require'], |
370 | 370 | 'argument_id' => $args['id'], |
371 | 371 | 'wrap_attributes' => $args['wrap_attributes'], |
372 | - ) ); |
|
372 | + )); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
376 | 376 | return $output; |
377 | 377 | } |
378 | 378 | |
379 | - public static function label( $args = array(), $type = '' ) { |
|
379 | + public static function label($args = array(), $type = '') { |
|
380 | 380 | global $aui_bs5; |
381 | 381 | //<label for="exampleInputEmail1">Email address</label> |
382 | 382 | $defaults = array( |
@@ -390,35 +390,35 @@ discard block |
||
390 | 390 | /** |
391 | 391 | * Parse incoming $args into an array and merge it with $defaults |
392 | 392 | */ |
393 | - $args = wp_parse_args( $args, $defaults ); |
|
393 | + $args = wp_parse_args($args, $defaults); |
|
394 | 394 | $output = ''; |
395 | 395 | |
396 | - if ( $args['title'] ) { |
|
396 | + if ($args['title']) { |
|
397 | 397 | |
398 | 398 | // maybe hide labels //@todo set a global option for visibility class |
399 | - if ( $type == 'file' || $type == 'checkbox' || $type == 'radio' || ! empty( $args['label_type'] ) ) { |
|
399 | + if ($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type'])) { |
|
400 | 400 | $class = $args['class']; |
401 | 401 | } else { |
402 | 402 | $class = 'sr-only ' . $args['class']; |
403 | 403 | } |
404 | 404 | |
405 | 405 | // maybe horizontal |
406 | - if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) { |
|
407 | - $class .= ' ' . AUI_Component_Helper::get_column_class( $args['label_col'], 'label' ) . ' col-form-label '.$type; |
|
406 | + if ($args['label_type'] == 'horizontal' && $type != 'checkbox') { |
|
407 | + $class .= ' ' . AUI_Component_Helper::get_column_class($args['label_col'], 'label') . ' col-form-label ' . $type; |
|
408 | 408 | } |
409 | 409 | |
410 | - if( $aui_bs5 ){ $class .= ' form-label'; } |
|
410 | + if ($aui_bs5) { $class .= ' form-label'; } |
|
411 | 411 | |
412 | 412 | // open |
413 | 413 | $output .= '<label '; |
414 | 414 | |
415 | 415 | // for |
416 | - if ( ! empty( $args['for'] ) ) { |
|
417 | - $output .= ' for="' . esc_attr( $args['for'] ) . '" '; |
|
416 | + if (!empty($args['for'])) { |
|
417 | + $output .= ' for="' . esc_attr($args['for']) . '" '; |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | // class |
421 | - $class = $class ? AUI_Component_Helper::esc_classes( $class ) : ''; |
|
421 | + $class = $class ? AUI_Component_Helper::esc_classes($class) : ''; |
|
422 | 422 | $output .= ' class="' . $class . '" '; |
423 | 423 | |
424 | 424 | // close |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | |
427 | 427 | |
428 | 428 | // title, don't escape fully as can contain html |
429 | - if ( ! empty( $args['title'] ) ) { |
|
430 | - $output .= wp_kses_post( $args['title'] ); |
|
429 | + if (!empty($args['title'])) { |
|
430 | + $output .= wp_kses_post($args['title']); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | // close wrap |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * |
448 | 448 | * @return string |
449 | 449 | */ |
450 | - public static function wrap( $args = array() ) { |
|
450 | + public static function wrap($args = array()) { |
|
451 | 451 | global $aui_bs5; |
452 | 452 | $defaults = array( |
453 | 453 | 'type' => 'div', |
@@ -465,31 +465,31 @@ discard block |
||
465 | 465 | /** |
466 | 466 | * Parse incoming $args into an array and merge it with $defaults |
467 | 467 | */ |
468 | - $args = wp_parse_args( $args, $defaults ); |
|
468 | + $args = wp_parse_args($args, $defaults); |
|
469 | 469 | $output = ''; |
470 | - if ( $args['type'] ) { |
|
470 | + if ($args['type']) { |
|
471 | 471 | |
472 | 472 | // open |
473 | - $output .= '<' . sanitize_html_class( $args['type'] ); |
|
473 | + $output .= '<' . sanitize_html_class($args['type']); |
|
474 | 474 | |
475 | 475 | // element require |
476 | - if ( ! empty( $args['element_require'] ) ) { |
|
477 | - $output .= AUI_Component_Helper::element_require( $args['element_require'] ); |
|
476 | + if (!empty($args['element_require'])) { |
|
477 | + $output .= AUI_Component_Helper::element_require($args['element_require']); |
|
478 | 478 | $args['class'] .= " aui-conditional-field"; |
479 | 479 | } |
480 | 480 | |
481 | 481 | // argument_id |
482 | - if ( ! empty( $args['argument_id'] ) ) { |
|
483 | - $output .= ' data-argument="' . esc_attr( $args['argument_id'] ) . '"'; |
|
482 | + if (!empty($args['argument_id'])) { |
|
483 | + $output .= ' data-argument="' . esc_attr($args['argument_id']) . '"'; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | // class |
487 | - $class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : ''; |
|
487 | + $class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : ''; |
|
488 | 488 | $output .= ' class="' . $class . '" '; |
489 | 489 | |
490 | 490 | // Attributes |
491 | - if ( ! empty( $args['wrap_attributes'] ) ) { |
|
492 | - $output .= AUI_Component_Helper::extra_attributes( $args['wrap_attributes'] ); |
|
491 | + if (!empty($args['wrap_attributes'])) { |
|
492 | + $output .= AUI_Component_Helper::extra_attributes($args['wrap_attributes']); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | // close wrap |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | |
498 | 498 | |
499 | 499 | // Input group left |
500 | - if ( ! empty( $args['input_group_left'] ) ) { |
|
501 | - $position_class = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : ''; |
|
502 | - $input_group_left = strpos( $args['input_group_left'], '<' ) !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>'; |
|
500 | + if (!empty($args['input_group_left'])) { |
|
501 | + $position_class = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : ''; |
|
502 | + $input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>'; |
|
503 | 503 | $output .= $aui_bs5 ? $input_group_left : '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>'; |
504 | 504 | // $output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>'; |
505 | 505 | } |
@@ -508,16 +508,16 @@ discard block |
||
508 | 508 | $output .= $args['content']; |
509 | 509 | |
510 | 510 | // Input group right |
511 | - if ( ! empty( $args['input_group_right'] ) ) { |
|
512 | - $position_class = ! empty( $args['input_group_right_inside'] ) ? 'position-absolute h-100' : ''; |
|
513 | - $input_group_right = strpos( $args['input_group_right'], '<' ) !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>'; |
|
514 | - $output .= $aui_bs5 ? str_replace( 'input-group-text','input-group-text top-0 end-0', $input_group_right ) : '<div class="input-group-append ' . $position_class . '" style="top:0;right:0;">' . $input_group_right . '</div>'; |
|
511 | + if (!empty($args['input_group_right'])) { |
|
512 | + $position_class = !empty($args['input_group_right_inside']) ? 'position-absolute h-100' : ''; |
|
513 | + $input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>'; |
|
514 | + $output .= $aui_bs5 ? str_replace('input-group-text', 'input-group-text top-0 end-0', $input_group_right) : '<div class="input-group-append ' . $position_class . '" style="top:0;right:0;">' . $input_group_right . '</div>'; |
|
515 | 515 | // $output .= '<div class="input-group-append ' . $position_class . '" style="top:0;right:0;">' . $input_group_right . '</div>'; |
516 | 516 | } |
517 | 517 | |
518 | 518 | |
519 | 519 | // close wrap |
520 | - $output .= '</' . sanitize_html_class( $args['type'] ) . '>'; |
|
520 | + $output .= '</' . sanitize_html_class($args['type']) . '>'; |
|
521 | 521 | |
522 | 522 | |
523 | 523 | } else { |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @return string The rendered component. |
536 | 536 | */ |
537 | - public static function textarea( $args = array() ) { |
|
537 | + public static function textarea($args = array()) { |
|
538 | 538 | global $aui_bs5; |
539 | 539 | |
540 | 540 | $defaults = array( |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | /** |
575 | 575 | * Parse incoming $args into an array and merge it with $defaults |
576 | 576 | */ |
577 | - $args = wp_parse_args( $args, $defaults ); |
|
577 | + $args = wp_parse_args($args, $defaults); |
|
578 | 578 | $output = ''; |
579 | 579 | $label = ''; |
580 | 580 | |
@@ -582,21 +582,21 @@ discard block |
||
582 | 582 | $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type']; |
583 | 583 | |
584 | 584 | // floating labels don't work with wysiwyg so set it as top |
585 | - if ( $args['label_type'] == 'floating' && ! empty( $args['wysiwyg'] ) ) { |
|
585 | + if ($args['label_type'] == 'floating' && !empty($args['wysiwyg'])) { |
|
586 | 586 | $args['label_type'] = 'top'; |
587 | 587 | } |
588 | 588 | |
589 | 589 | $label_after = $args['label_after']; |
590 | 590 | |
591 | 591 | // floating labels need label after |
592 | - if ( $args['label_type'] == 'floating' && empty( $args['wysiwyg'] ) ) { |
|
592 | + if ($args['label_type'] == 'floating' && empty($args['wysiwyg'])) { |
|
593 | 593 | $label_after = true; |
594 | 594 | $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works. |
595 | 595 | } |
596 | 596 | |
597 | 597 | // label |
598 | - if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) { |
|
599 | - } elseif ( ! empty( $args['label'] ) && ! $label_after ) { |
|
598 | + if (!empty($args['label']) && is_array($args['label'])) { |
|
599 | + } elseif (!empty($args['label']) && !$label_after) { |
|
600 | 600 | $label_args = array( |
601 | 601 | 'title' => $args['label'], |
602 | 602 | 'for' => $args['id'], |
@@ -604,34 +604,34 @@ discard block |
||
604 | 604 | 'label_type' => $args['label_type'], |
605 | 605 | 'label_col' => $args['label_col'] |
606 | 606 | ); |
607 | - $label .= self::label( $label_args ); |
|
607 | + $label .= self::label($label_args); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | // maybe horizontal label |
611 | - if ( $args['label_type'] == 'horizontal' ) { |
|
612 | - $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' ); |
|
611 | + if ($args['label_type'] == 'horizontal') { |
|
612 | + $input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input'); |
|
613 | 613 | $label .= '<div class="' . $input_col . '">'; |
614 | 614 | } |
615 | 615 | |
616 | - if ( ! empty( $args['wysiwyg'] ) ) { |
|
616 | + if (!empty($args['wysiwyg'])) { |
|
617 | 617 | ob_start(); |
618 | 618 | $content = $args['value']; |
619 | - $editor_id = ! empty( $args['id'] ) ? sanitize_html_class( $args['id'] ) : 'wp_editor'; |
|
619 | + $editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor'; |
|
620 | 620 | $settings = array( |
621 | - 'textarea_rows' => ! empty( absint( $args['rows'] ) ) ? absint( $args['rows'] ) : 4, |
|
621 | + 'textarea_rows' => !empty(absint($args['rows'])) ? absint($args['rows']) : 4, |
|
622 | 622 | 'quicktags' => false, |
623 | 623 | 'media_buttons' => false, |
624 | 624 | 'editor_class' => 'form-control', |
625 | - 'textarea_name' => ! empty( $args['name'] ) ? sanitize_html_class( $args['name'] ) : sanitize_html_class( $args['id'] ), |
|
625 | + 'textarea_name' => !empty($args['name']) ? sanitize_html_class($args['name']) : sanitize_html_class($args['id']), |
|
626 | 626 | 'teeny' => true, |
627 | 627 | ); |
628 | 628 | |
629 | 629 | // maybe set settings if array |
630 | - if ( is_array( $args['wysiwyg'] ) ) { |
|
631 | - $settings = wp_parse_args( $args['wysiwyg'], $settings ); |
|
630 | + if (is_array($args['wysiwyg'])) { |
|
631 | + $settings = wp_parse_args($args['wysiwyg'], $settings); |
|
632 | 632 | } |
633 | 633 | |
634 | - wp_editor( $content, $editor_id, $settings ); |
|
634 | + wp_editor($content, $editor_id, $settings); |
|
635 | 635 | $output .= ob_get_clean(); |
636 | 636 | } else { |
637 | 637 | |
@@ -639,65 +639,65 @@ discard block |
||
639 | 639 | $output .= '<textarea '; |
640 | 640 | |
641 | 641 | // name |
642 | - if ( ! empty( $args['name'] ) ) { |
|
643 | - $output .= ' name="' . esc_attr( $args['name'] ) . '" '; |
|
642 | + if (!empty($args['name'])) { |
|
643 | + $output .= ' name="' . esc_attr($args['name']) . '" '; |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | // id |
647 | - if ( ! empty( $args['id'] ) ) { |
|
648 | - $output .= ' id="' . sanitize_html_class( $args['id'] ) . '" '; |
|
647 | + if (!empty($args['id'])) { |
|
648 | + $output .= ' id="' . sanitize_html_class($args['id']) . '" '; |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | // placeholder |
652 | - if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) { |
|
653 | - $output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" '; |
|
652 | + if (isset($args['placeholder']) && '' != $args['placeholder']) { |
|
653 | + $output .= ' placeholder="' . esc_attr($args['placeholder']) . '" '; |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | // title |
657 | - if ( ! empty( $args['title'] ) ) { |
|
658 | - $output .= ' title="' . esc_attr( $args['title'] ) . '" '; |
|
657 | + if (!empty($args['title'])) { |
|
658 | + $output .= ' title="' . esc_attr($args['title']) . '" '; |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | // validation text |
662 | - if ( ! empty( $args['validation_text'] ) ) { |
|
663 | - $output .= ' oninvalid="setCustomValidity(\'' . esc_attr( addslashes( $args['validation_text'] ) ) . '\')" '; |
|
662 | + if (!empty($args['validation_text'])) { |
|
663 | + $output .= ' oninvalid="setCustomValidity(\'' . esc_attr(addslashes($args['validation_text'])) . '\')" '; |
|
664 | 664 | $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" '; |
665 | 665 | } |
666 | 666 | |
667 | 667 | // validation_pattern |
668 | - if ( ! empty( $args['validation_pattern'] ) ) { |
|
669 | - $output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" '; |
|
668 | + if (!empty($args['validation_pattern'])) { |
|
669 | + $output .= ' pattern="' . esc_attr($args['validation_pattern']) . '" '; |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | // required |
673 | - if ( ! empty( $args['required'] ) ) { |
|
673 | + if (!empty($args['required'])) { |
|
674 | 674 | $output .= ' required '; |
675 | 675 | } |
676 | 676 | |
677 | 677 | // rows |
678 | - if ( ! empty( $args['rows'] ) ) { |
|
679 | - $output .= ' rows="' . absint( $args['rows'] ) . '" '; |
|
678 | + if (!empty($args['rows'])) { |
|
679 | + $output .= ' rows="' . absint($args['rows']) . '" '; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | |
683 | 683 | // class |
684 | - $class = ! empty( $args['class'] ) ? $args['class'] : ''; |
|
684 | + $class = !empty($args['class']) ? $args['class'] : ''; |
|
685 | 685 | $output .= ' class="form-control ' . $class . '" '; |
686 | 686 | |
687 | 687 | // extra attributes |
688 | - if ( ! empty( $args['extra_attributes'] ) ) { |
|
689 | - $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] ); |
|
688 | + if (!empty($args['extra_attributes'])) { |
|
689 | + $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | // close tag |
693 | 693 | $output .= ' >'; |
694 | 694 | |
695 | 695 | // value |
696 | - if ( ! empty( $args['value'] ) ) { |
|
697 | - if ( ! empty( $args['allow_tags'] ) ) { |
|
698 | - $output .= AUI_Component_Helper::sanitize_html_field( $args['value'], $args ); // Sanitize HTML. |
|
696 | + if (!empty($args['value'])) { |
|
697 | + if (!empty($args['allow_tags'])) { |
|
698 | + $output .= AUI_Component_Helper::sanitize_html_field($args['value'], $args); // Sanitize HTML. |
|
699 | 699 | } else { |
700 | - $output .= AUI_Component_Helper::sanitize_textarea_field( $args['value'] ); |
|
700 | + $output .= AUI_Component_Helper::sanitize_textarea_field($args['value']); |
|
701 | 701 | } |
702 | 702 | } |
703 | 703 | |
@@ -706,23 +706,23 @@ discard block |
||
706 | 706 | |
707 | 707 | |
708 | 708 | // input group wraps |
709 | - if ( $args['input_group_left'] || $args['input_group_right'] ) { |
|
710 | - $w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : ''; |
|
711 | - if ( $args['input_group_left'] ) { |
|
712 | - $output = self::wrap( array( |
|
709 | + if ($args['input_group_left'] || $args['input_group_right']) { |
|
710 | + $w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : ''; |
|
711 | + if ($args['input_group_left']) { |
|
712 | + $output = self::wrap(array( |
|
713 | 713 | 'content' => $output, |
714 | 714 | 'class' => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group', |
715 | 715 | 'input_group_left' => $args['input_group_left'], |
716 | 716 | 'input_group_left_inside' => $args['input_group_left_inside'] |
717 | - ) ); |
|
717 | + )); |
|
718 | 718 | } |
719 | - if ( $args['input_group_right'] ) { |
|
720 | - $output = self::wrap( array( |
|
719 | + if ($args['input_group_right']) { |
|
720 | + $output = self::wrap(array( |
|
721 | 721 | 'content' => $output, |
722 | 722 | 'class' => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group', |
723 | 723 | 'input_group_right' => $args['input_group_right'], |
724 | 724 | 'input_group_right_inside' => $args['input_group_right_inside'] |
725 | - ) ); |
|
725 | + )); |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | } |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | |
731 | 731 | } |
732 | 732 | |
733 | - if ( ! empty( $args['label'] ) && $label_after ) { |
|
733 | + if (!empty($args['label']) && $label_after) { |
|
734 | 734 | $label_args = array( |
735 | 735 | 'title' => $args['label'], |
736 | 736 | 'for' => $args['id'], |
@@ -738,41 +738,41 @@ discard block |
||
738 | 738 | 'label_type' => $args['label_type'], |
739 | 739 | 'label_col' => $args['label_col'] |
740 | 740 | ); |
741 | - $output .= self::label( $label_args ); |
|
741 | + $output .= self::label($label_args); |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | // help text |
745 | - if ( ! empty( $args['help_text'] ) ) { |
|
746 | - $output .= AUI_Component_Helper::help_text( $args['help_text'] ); |
|
745 | + if (!empty($args['help_text'])) { |
|
746 | + $output .= AUI_Component_Helper::help_text($args['help_text']); |
|
747 | 747 | } |
748 | 748 | |
749 | - if ( ! $label_after ) { |
|
749 | + if (!$label_after) { |
|
750 | 750 | $output = $label . $output; |
751 | 751 | } |
752 | 752 | |
753 | 753 | // maybe horizontal label |
754 | - if ( $args['label_type'] == 'horizontal' ) { |
|
754 | + if ($args['label_type'] == 'horizontal') { |
|
755 | 755 | $output .= '</div>'; |
756 | 756 | } |
757 | 757 | |
758 | 758 | |
759 | 759 | // wrap |
760 | - if ( ! $args['no_wrap'] ) { |
|
761 | - if ( ! empty( $args['form_group_class'] ) ) { |
|
762 | - $fg_class = esc_attr( $args['form_group_class'] ); |
|
763 | - }else{ |
|
760 | + if (!$args['no_wrap']) { |
|
761 | + if (!empty($args['form_group_class'])) { |
|
762 | + $fg_class = esc_attr($args['form_group_class']); |
|
763 | + } else { |
|
764 | 764 | $fg_class = $aui_bs5 ? 'mb-3' : 'form-group'; |
765 | 765 | } |
766 | 766 | $form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : $fg_class; |
767 | 767 | $wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class; |
768 | - $wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
769 | - $output = self::wrap( array( |
|
768 | + $wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
769 | + $output = self::wrap(array( |
|
770 | 770 | 'content' => $output, |
771 | 771 | 'class' => $wrap_class, |
772 | 772 | 'element_require' => $args['element_require'], |
773 | 773 | 'argument_id' => $args['id'], |
774 | 774 | 'wrap_attributes' => $args['wrap_attributes'], |
775 | - ) ); |
|
775 | + )); |
|
776 | 776 | } |
777 | 777 | |
778 | 778 | |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | * |
787 | 787 | * @return string The rendered component. |
788 | 788 | */ |
789 | - public static function select( $args = array() ) { |
|
789 | + public static function select($args = array()) { |
|
790 | 790 | global $aui_bs5; |
791 | 791 | $defaults = array( |
792 | 792 | 'class' => '', |
@@ -825,11 +825,11 @@ discard block |
||
825 | 825 | /** |
826 | 826 | * Parse incoming $args into an array and merge it with $defaults |
827 | 827 | */ |
828 | - $args = wp_parse_args( $args, $defaults ); |
|
828 | + $args = wp_parse_args($args, $defaults); |
|
829 | 829 | $output = ''; |
830 | 830 | |
831 | 831 | // for now lets hide floating labels |
832 | - if ( $args['label_type'] == 'floating' ) { |
|
832 | + if ($args['label_type'] == 'floating') { |
|
833 | 833 | $args['label_type'] = 'hidden'; |
834 | 834 | } |
835 | 835 | |
@@ -840,90 +840,90 @@ discard block |
||
840 | 840 | $label_after = $args['label_after']; |
841 | 841 | |
842 | 842 | // floating labels need label after |
843 | - if ( $args['label_type'] == 'floating' ) { |
|
843 | + if ($args['label_type'] == 'floating') { |
|
844 | 844 | $label_after = true; |
845 | 845 | $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works. |
846 | 846 | } |
847 | 847 | |
848 | 848 | // Maybe setup select2 |
849 | 849 | $is_select2 = false; |
850 | - if ( ! empty( $args['select2'] ) ) { |
|
850 | + if (!empty($args['select2'])) { |
|
851 | 851 | $args['class'] .= ' aui-select2'; |
852 | 852 | $is_select2 = true; |
853 | - } elseif ( strpos( $args['class'], 'aui-select2' ) !== false ) { |
|
853 | + } elseif (strpos($args['class'], 'aui-select2') !== false) { |
|
854 | 854 | $is_select2 = true; |
855 | 855 | } |
856 | 856 | |
857 | 857 | // select2 tags |
858 | - if ( ! empty( $args['select2'] ) && $args['select2'] === 'tags' ) { // triple equals needed here for some reason |
|
858 | + if (!empty($args['select2']) && $args['select2'] === 'tags') { // triple equals needed here for some reason |
|
859 | 859 | $args['data-tags'] = 'true'; |
860 | 860 | $args['data-token-separators'] = "[',']"; |
861 | 861 | $args['multiple'] = true; |
862 | 862 | } |
863 | 863 | |
864 | 864 | // select2 placeholder |
865 | - if ( $is_select2 && isset( $args['placeholder'] ) && '' != $args['placeholder'] && empty( $args['data-placeholder'] ) ) { |
|
866 | - $args['data-placeholder'] = esc_attr( $args['placeholder'] ); |
|
867 | - $args['data-allow-clear'] = isset( $args['data-allow-clear'] ) ? (bool) $args['data-allow-clear'] : true; |
|
865 | + if ($is_select2 && isset($args['placeholder']) && '' != $args['placeholder'] && empty($args['data-placeholder'])) { |
|
866 | + $args['data-placeholder'] = esc_attr($args['placeholder']); |
|
867 | + $args['data-allow-clear'] = isset($args['data-allow-clear']) ? (bool) $args['data-allow-clear'] : true; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | // Set hidden input to save empty value for multiselect. |
871 | - if ( ! empty( $args['multiple'] ) && ! empty( $args['name'] ) ) { |
|
872 | - $output .= '<input type="hidden" ' . AUI_Component_Helper::name( $args['name'] ) . ' value="" data-ignore-rule/>'; |
|
871 | + if (!empty($args['multiple']) && !empty($args['name'])) { |
|
872 | + $output .= '<input type="hidden" ' . AUI_Component_Helper::name($args['name']) . ' value="" data-ignore-rule/>'; |
|
873 | 873 | } |
874 | 874 | |
875 | 875 | // open/type |
876 | 876 | $output .= '<select '; |
877 | 877 | |
878 | 878 | // style |
879 | - if ( $is_select2 && !($args['input_group_left'] || $args['input_group_right'])) { |
|
879 | + if ($is_select2 && !($args['input_group_left'] || $args['input_group_right'])) { |
|
880 | 880 | $output .= " style='width:100%;' "; |
881 | 881 | } |
882 | 882 | |
883 | 883 | // element require |
884 | - if ( ! empty( $args['element_require'] ) ) { |
|
885 | - $output .= AUI_Component_Helper::element_require( $args['element_require'] ); |
|
884 | + if (!empty($args['element_require'])) { |
|
885 | + $output .= AUI_Component_Helper::element_require($args['element_require']); |
|
886 | 886 | $args['class'] .= " aui-conditional-field"; |
887 | 887 | } |
888 | 888 | |
889 | 889 | // class |
890 | - $class = ! empty( $args['class'] ) ? $args['class'] : ''; |
|
890 | + $class = !empty($args['class']) ? $args['class'] : ''; |
|
891 | 891 | $select_class = $aui_bs5 ? 'form-select ' : 'custom-select '; |
892 | - $output .= AUI_Component_Helper::class_attr( $select_class . $class ); |
|
892 | + $output .= AUI_Component_Helper::class_attr($select_class . $class); |
|
893 | 893 | |
894 | 894 | // name |
895 | - if ( ! empty( $args['name'] ) ) { |
|
896 | - $output .= AUI_Component_Helper::name( $args['name'], $args['multiple'] ); |
|
895 | + if (!empty($args['name'])) { |
|
896 | + $output .= AUI_Component_Helper::name($args['name'], $args['multiple']); |
|
897 | 897 | } |
898 | 898 | |
899 | 899 | // id |
900 | - if ( ! empty( $args['id'] ) ) { |
|
901 | - $output .= AUI_Component_Helper::id( $args['id'] ); |
|
900 | + if (!empty($args['id'])) { |
|
901 | + $output .= AUI_Component_Helper::id($args['id']); |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | // title |
905 | - if ( ! empty( $args['title'] ) ) { |
|
906 | - $output .= AUI_Component_Helper::title( $args['title'] ); |
|
905 | + if (!empty($args['title'])) { |
|
906 | + $output .= AUI_Component_Helper::title($args['title']); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | // data-attributes |
910 | - $output .= AUI_Component_Helper::data_attributes( $args ); |
|
910 | + $output .= AUI_Component_Helper::data_attributes($args); |
|
911 | 911 | |
912 | 912 | // aria-attributes |
913 | - $output .= AUI_Component_Helper::aria_attributes( $args ); |
|
913 | + $output .= AUI_Component_Helper::aria_attributes($args); |
|
914 | 914 | |
915 | 915 | // extra attributes |
916 | - if ( ! empty( $args['extra_attributes'] ) ) { |
|
917 | - $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] ); |
|
916 | + if (!empty($args['extra_attributes'])) { |
|
917 | + $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
|
918 | 918 | } |
919 | 919 | |
920 | 920 | // required |
921 | - if ( ! empty( $args['required'] ) ) { |
|
921 | + if (!empty($args['required'])) { |
|
922 | 922 | $output .= ' required '; |
923 | 923 | } |
924 | 924 | |
925 | 925 | // multiple |
926 | - if ( ! empty( $args['multiple'] ) ) { |
|
926 | + if (!empty($args['multiple'])) { |
|
927 | 927 | $output .= ' multiple '; |
928 | 928 | } |
929 | 929 | |
@@ -931,50 +931,50 @@ discard block |
||
931 | 931 | $output .= ' >'; |
932 | 932 | |
933 | 933 | // placeholder |
934 | - if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] && ! $is_select2 ) { |
|
935 | - $output .= '<option value="" disabled selected hidden>' . esc_attr( $args['placeholder'] ) . '</option>'; |
|
936 | - } elseif ( $is_select2 && ! empty( $args['placeholder'] ) ) { |
|
934 | + if (isset($args['placeholder']) && '' != $args['placeholder'] && !$is_select2) { |
|
935 | + $output .= '<option value="" disabled selected hidden>' . esc_attr($args['placeholder']) . '</option>'; |
|
936 | + } elseif ($is_select2 && !empty($args['placeholder'])) { |
|
937 | 937 | $output .= "<option></option>"; // select2 needs an empty select to fill the placeholder |
938 | 938 | } |
939 | 939 | |
940 | 940 | // Options |
941 | - if ( ! empty( $args['options'] ) ) { |
|
941 | + if (!empty($args['options'])) { |
|
942 | 942 | |
943 | - if ( ! is_array( $args['options'] ) ) { |
|
943 | + if (!is_array($args['options'])) { |
|
944 | 944 | $output .= $args['options']; // not the preferred way but an option |
945 | 945 | } else { |
946 | - foreach ( $args['options'] as $val => $name ) { |
|
946 | + foreach ($args['options'] as $val => $name) { |
|
947 | 947 | $selected = ''; |
948 | - if ( is_array( $name ) ) { |
|
949 | - if ( isset( $name['optgroup'] ) && ( $name['optgroup'] == 'start' || $name['optgroup'] == 'end' ) ) { |
|
950 | - $option_label = isset( $name['label'] ) ? $name['label'] : ''; |
|
948 | + if (is_array($name)) { |
|
949 | + if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) { |
|
950 | + $option_label = isset($name['label']) ? $name['label'] : ''; |
|
951 | 951 | |
952 | - $output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr( $option_label ) . '">' : '</optgroup>'; |
|
952 | + $output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
953 | 953 | } else { |
954 | - $option_label = isset( $name['label'] ) ? $name['label'] : ''; |
|
955 | - $option_value = isset( $name['value'] ) ? $name['value'] : ''; |
|
956 | - $extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes( $name['extra_attributes'] ) : ''; |
|
957 | - if ( ! empty( $args['multiple'] ) && ! empty( $args['value'] ) && is_array( $args['value'] ) ) { |
|
958 | - $selected = in_array( $option_value, stripslashes_deep( $args['value'] ) ) ? "selected" : ""; |
|
959 | - } elseif ( ! empty( $args['value'] ) ) { |
|
960 | - $selected = selected( $option_value, stripslashes_deep( $args['value'] ), false ); |
|
961 | - } elseif ( empty( $args['value'] ) && $args['value'] === $option_value ) { |
|
962 | - $selected = selected( $option_value, $args['value'], false ); |
|
954 | + $option_label = isset($name['label']) ? $name['label'] : ''; |
|
955 | + $option_value = isset($name['value']) ? $name['value'] : ''; |
|
956 | + $extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes($name['extra_attributes']) : ''; |
|
957 | + if (!empty($args['multiple']) && !empty($args['value']) && is_array($args['value'])) { |
|
958 | + $selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : ""; |
|
959 | + } elseif (!empty($args['value'])) { |
|
960 | + $selected = selected($option_value, stripslashes_deep($args['value']), false); |
|
961 | + } elseif (empty($args['value']) && $args['value'] === $option_value) { |
|
962 | + $selected = selected($option_value, $args['value'], false); |
|
963 | 963 | } |
964 | 964 | |
965 | - $output .= '<option value="' . esc_attr( $option_value ) . '" ' . $selected . ' '.$extra_attributes .'>' . $option_label . '</option>'; |
|
965 | + $output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . ' ' . $extra_attributes . '>' . $option_label . '</option>'; |
|
966 | 966 | } |
967 | 967 | } else { |
968 | - if ( ! empty( $args['value'] ) ) { |
|
969 | - if ( is_array( $args['value'] ) ) { |
|
970 | - $selected = in_array( $val, $args['value'] ) ? 'selected="selected"' : ''; |
|
971 | - } elseif ( ! empty( $args['value'] ) ) { |
|
972 | - $selected = selected( $args['value'], $val, false ); |
|
968 | + if (!empty($args['value'])) { |
|
969 | + if (is_array($args['value'])) { |
|
970 | + $selected = in_array($val, $args['value']) ? 'selected="selected"' : ''; |
|
971 | + } elseif (!empty($args['value'])) { |
|
972 | + $selected = selected($args['value'], $val, false); |
|
973 | 973 | } |
974 | - } elseif ( $args['value'] === $val ) { |
|
975 | - $selected = selected( $args['value'], $val, false ); |
|
974 | + } elseif ($args['value'] === $val) { |
|
975 | + $selected = selected($args['value'], $val, false); |
|
976 | 976 | } |
977 | - $output .= '<option value="' . esc_attr( $val ) . '" ' . $selected . '>' . esc_attr( $name ) . '</option>'; |
|
977 | + $output .= '<option value="' . esc_attr($val) . '" ' . $selected . '>' . esc_attr($name) . '</option>'; |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | } |
@@ -987,8 +987,8 @@ discard block |
||
987 | 987 | $label = ''; |
988 | 988 | $help_text = ''; |
989 | 989 | // label |
990 | - if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) { |
|
991 | - } elseif ( ! empty( $args['label'] ) && ! $label_after ) { |
|
990 | + if (!empty($args['label']) && is_array($args['label'])) { |
|
991 | + } elseif (!empty($args['label']) && !$label_after) { |
|
992 | 992 | $label_args = array( |
993 | 993 | 'title' => $args['label'], |
994 | 994 | 'for' => $args['id'], |
@@ -996,49 +996,49 @@ discard block |
||
996 | 996 | 'label_type' => $args['label_type'], |
997 | 997 | 'label_col' => $args['label_col'] |
998 | 998 | ); |
999 | - $label = self::label( $label_args ); |
|
999 | + $label = self::label($label_args); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | // help text |
1003 | - if ( ! empty( $args['help_text'] ) ) { |
|
1004 | - $help_text = AUI_Component_Helper::help_text( $args['help_text'] ); |
|
1003 | + if (!empty($args['help_text'])) { |
|
1004 | + $help_text = AUI_Component_Helper::help_text($args['help_text']); |
|
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | // input group wraps |
1008 | - if ( $args['input_group_left'] || $args['input_group_right'] ) { |
|
1009 | - $w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : ''; |
|
1010 | - if ( $args['input_group_left'] ) { |
|
1011 | - $output = self::wrap( array( |
|
1008 | + if ($args['input_group_left'] || $args['input_group_right']) { |
|
1009 | + $w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : ''; |
|
1010 | + if ($args['input_group_left']) { |
|
1011 | + $output = self::wrap(array( |
|
1012 | 1012 | 'content' => $output, |
1013 | 1013 | 'class' => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group', |
1014 | 1014 | 'input_group_left' => $args['input_group_left'], |
1015 | 1015 | 'input_group_left_inside' => $args['input_group_left_inside'] |
1016 | - ) ); |
|
1016 | + )); |
|
1017 | 1017 | } |
1018 | - if ( $args['input_group_right'] ) { |
|
1019 | - $output = self::wrap( array( |
|
1018 | + if ($args['input_group_right']) { |
|
1019 | + $output = self::wrap(array( |
|
1020 | 1020 | 'content' => $output, |
1021 | 1021 | 'class' => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group', |
1022 | 1022 | 'input_group_right' => $args['input_group_right'], |
1023 | 1023 | 'input_group_right_inside' => $args['input_group_right_inside'] |
1024 | - ) ); |
|
1024 | + )); |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - if ( ! $label_after ) { |
|
1029 | + if (!$label_after) { |
|
1030 | 1030 | $output .= $help_text; |
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | |
1034 | - if ( $args['label_type'] == 'horizontal' ) { |
|
1035 | - $output = self::wrap( array( |
|
1034 | + if ($args['label_type'] == 'horizontal') { |
|
1035 | + $output = self::wrap(array( |
|
1036 | 1036 | 'content' => $output, |
1037 | - 'class' => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' ) |
|
1038 | - ) ); |
|
1037 | + 'class' => AUI_Component_Helper::get_column_class($args['label_col'], 'input') |
|
1038 | + )); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | - if ( ! $label_after ) { |
|
1041 | + if (!$label_after) { |
|
1042 | 1042 | $output = $label . $output; |
1043 | 1043 | } |
1044 | 1044 | |
@@ -1049,21 +1049,21 @@ discard block |
||
1049 | 1049 | |
1050 | 1050 | |
1051 | 1051 | // wrap |
1052 | - if ( ! $args['no_wrap'] ) { |
|
1053 | - if ( ! empty( $args['form_group_class'] ) ) { |
|
1054 | - $fg_class = esc_attr( $args['form_group_class'] ); |
|
1055 | - }else{ |
|
1052 | + if (!$args['no_wrap']) { |
|
1053 | + if (!empty($args['form_group_class'])) { |
|
1054 | + $fg_class = esc_attr($args['form_group_class']); |
|
1055 | + } else { |
|
1056 | 1056 | $fg_class = $aui_bs5 ? 'mb-3' : 'form-group'; |
1057 | 1057 | } |
1058 | 1058 | $wrap_class = $args['label_type'] == 'horizontal' ? $fg_class . ' row' : $fg_class; |
1059 | - $wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
1060 | - $output = self::wrap( array( |
|
1059 | + $wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
1060 | + $output = self::wrap(array( |
|
1061 | 1061 | 'content' => $output, |
1062 | 1062 | 'class' => $wrap_class, |
1063 | 1063 | 'element_require' => $args['element_require'], |
1064 | 1064 | 'argument_id' => $args['id'], |
1065 | 1065 | 'wrap_attributes' => $args['wrap_attributes'], |
1066 | - ) ); |
|
1066 | + )); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | * |
1078 | 1078 | * @return string The rendered component. |
1079 | 1079 | */ |
1080 | - public static function radio( $args = array() ) { |
|
1080 | + public static function radio($args = array()) { |
|
1081 | 1081 | global $aui_bs5; |
1082 | 1082 | |
1083 | 1083 | $defaults = array( |
@@ -1109,10 +1109,10 @@ discard block |
||
1109 | 1109 | /** |
1110 | 1110 | * Parse incoming $args into an array and merge it with $defaults |
1111 | 1111 | */ |
1112 | - $args = wp_parse_args( $args, $defaults ); |
|
1112 | + $args = wp_parse_args($args, $defaults); |
|
1113 | 1113 | |
1114 | 1114 | // for now lets use horizontal for floating |
1115 | - if ( $args['label_type'] == 'floating' ) { |
|
1115 | + if ($args['label_type'] == 'floating') { |
|
1116 | 1116 | $args['label_type'] = 'horizontal'; |
1117 | 1117 | } |
1118 | 1118 | |
@@ -1123,10 +1123,10 @@ discard block |
||
1123 | 1123 | 'label_col' => $args['label_col'] |
1124 | 1124 | ); |
1125 | 1125 | |
1126 | - if ( $args['label_type'] == 'top' || $args['label_type'] == 'hidden' ) { |
|
1126 | + if ($args['label_type'] == 'top' || $args['label_type'] == 'hidden') { |
|
1127 | 1127 | $label_args['class'] .= 'd-block '; |
1128 | 1128 | |
1129 | - if ( $args['label_type'] == 'hidden' ) { |
|
1129 | + if ($args['label_type'] == 'hidden') { |
|
1130 | 1130 | $label_args['class'] .= 'sr-only '; |
1131 | 1131 | } |
1132 | 1132 | } |
@@ -1134,48 +1134,48 @@ discard block |
||
1134 | 1134 | $output = ''; |
1135 | 1135 | |
1136 | 1136 | // label before |
1137 | - if ( ! empty( $args['label'] ) ) { |
|
1138 | - $output .= self::label( $label_args, 'radio' ); |
|
1137 | + if (!empty($args['label'])) { |
|
1138 | + $output .= self::label($label_args, 'radio'); |
|
1139 | 1139 | } |
1140 | 1140 | |
1141 | 1141 | // maybe horizontal label |
1142 | - if ( $args['label_type'] == 'horizontal' ) { |
|
1143 | - $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' ); |
|
1142 | + if ($args['label_type'] == 'horizontal') { |
|
1143 | + $input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input'); |
|
1144 | 1144 | $output .= '<div class="' . $input_col . '">'; |
1145 | 1145 | } |
1146 | 1146 | |
1147 | - if ( ! empty( $args['options'] ) ) { |
|
1147 | + if (!empty($args['options'])) { |
|
1148 | 1148 | $count = 0; |
1149 | - foreach ( $args['options'] as $value => $label ) { |
|
1149 | + foreach ($args['options'] as $value => $label) { |
|
1150 | 1150 | $option_args = $args; |
1151 | 1151 | $option_args['value'] = $value; |
1152 | 1152 | $option_args['label'] = $label; |
1153 | 1153 | $option_args['checked'] = $value == $args['value'] ? true : false; |
1154 | - $output .= self::radio_option( $option_args, $count ); |
|
1155 | - $count ++; |
|
1154 | + $output .= self::radio_option($option_args, $count); |
|
1155 | + $count++; |
|
1156 | 1156 | } |
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | // help text |
1160 | - $help_text = ! empty( $args['help_text'] ) ? AUI_Component_Helper::help_text( $args['help_text'] ) : ''; |
|
1160 | + $help_text = !empty($args['help_text']) ? AUI_Component_Helper::help_text($args['help_text']) : ''; |
|
1161 | 1161 | $output .= $help_text; |
1162 | 1162 | |
1163 | 1163 | // maybe horizontal label |
1164 | - if ( $args['label_type'] == 'horizontal' ) { |
|
1164 | + if ($args['label_type'] == 'horizontal') { |
|
1165 | 1165 | $output .= '</div>'; |
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | // wrap |
1169 | 1169 | $fg_class = $aui_bs5 ? 'mb-3' : 'form-group'; |
1170 | 1170 | $wrap_class = $args['label_type'] == 'horizontal' ? $fg_class . ' row' : $fg_class; |
1171 | - $wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
1172 | - $output = self::wrap( array( |
|
1171 | + $wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
1172 | + $output = self::wrap(array( |
|
1173 | 1173 | 'content' => $output, |
1174 | 1174 | 'class' => $wrap_class, |
1175 | 1175 | 'element_require' => $args['element_require'], |
1176 | 1176 | 'argument_id' => $args['id'], |
1177 | 1177 | 'wrap_attributes' => $args['wrap_attributes'], |
1178 | - ) ); |
|
1178 | + )); |
|
1179 | 1179 | |
1180 | 1180 | |
1181 | 1181 | return $output; |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | * |
1189 | 1189 | * @return string The rendered component. |
1190 | 1190 | */ |
1191 | - public static function radio_option( $args = array(), $count = '' ) { |
|
1191 | + public static function radio_option($args = array(), $count = '') { |
|
1192 | 1192 | $defaults = array( |
1193 | 1193 | 'class' => '', |
1194 | 1194 | 'id' => '', |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | /** |
1207 | 1207 | * Parse incoming $args into an array and merge it with $defaults |
1208 | 1208 | */ |
1209 | - $args = wp_parse_args( $args, $defaults ); |
|
1209 | + $args = wp_parse_args($args, $defaults); |
|
1210 | 1210 | |
1211 | 1211 | $output = ''; |
1212 | 1212 | |
@@ -1217,43 +1217,43 @@ discard block |
||
1217 | 1217 | $output .= ' class="form-check-input" '; |
1218 | 1218 | |
1219 | 1219 | // name |
1220 | - if ( ! empty( $args['name'] ) ) { |
|
1221 | - $output .= AUI_Component_Helper::name( $args['name'] ); |
|
1220 | + if (!empty($args['name'])) { |
|
1221 | + $output .= AUI_Component_Helper::name($args['name']); |
|
1222 | 1222 | } |
1223 | 1223 | |
1224 | 1224 | // id |
1225 | - if ( ! empty( $args['id'] ) ) { |
|
1226 | - $output .= AUI_Component_Helper::id( $args['id'] . $count ); |
|
1225 | + if (!empty($args['id'])) { |
|
1226 | + $output .= AUI_Component_Helper::id($args['id'] . $count); |
|
1227 | 1227 | } |
1228 | 1228 | |
1229 | 1229 | // title |
1230 | - if ( ! empty( $args['title'] ) ) { |
|
1231 | - $output .= AUI_Component_Helper::title( $args['title'] ); |
|
1230 | + if (!empty($args['title'])) { |
|
1231 | + $output .= AUI_Component_Helper::title($args['title']); |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | // value |
1235 | - if ( isset( $args['value'] ) ) { |
|
1236 | - $output .= AUI_Component_Helper::value( $args['value'] ); |
|
1235 | + if (isset($args['value'])) { |
|
1236 | + $output .= AUI_Component_Helper::value($args['value']); |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | // checked, for radio and checkboxes |
1240 | - if ( $args['checked'] ) { |
|
1240 | + if ($args['checked']) { |
|
1241 | 1241 | $output .= ' checked '; |
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | // data-attributes |
1245 | - $output .= AUI_Component_Helper::data_attributes( $args ); |
|
1245 | + $output .= AUI_Component_Helper::data_attributes($args); |
|
1246 | 1246 | |
1247 | 1247 | // aria-attributes |
1248 | - $output .= AUI_Component_Helper::aria_attributes( $args ); |
|
1248 | + $output .= AUI_Component_Helper::aria_attributes($args); |
|
1249 | 1249 | |
1250 | 1250 | // extra attributes |
1251 | - if ( ! empty( $args['extra_attributes'] ) ) { |
|
1252 | - $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] ); |
|
1251 | + if (!empty($args['extra_attributes'])) { |
|
1252 | + $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
|
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | // required |
1256 | - if ( ! empty( $args['required'] ) ) { |
|
1256 | + if (!empty($args['required'])) { |
|
1257 | 1257 | $output .= ' required '; |
1258 | 1258 | } |
1259 | 1259 | |
@@ -1261,38 +1261,38 @@ discard block |
||
1261 | 1261 | $output .= ' >'; |
1262 | 1262 | |
1263 | 1263 | // label |
1264 | - if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) { |
|
1265 | - } elseif ( ! empty( $args['label'] ) ) { |
|
1266 | - $output .= self::label( array( |
|
1264 | + if (!empty($args['label']) && is_array($args['label'])) { |
|
1265 | + } elseif (!empty($args['label'])) { |
|
1266 | + $output .= self::label(array( |
|
1267 | 1267 | 'title' => $args['label'], |
1268 | 1268 | 'for' => $args['id'] . $count, |
1269 | 1269 | 'class' => 'form-check-label' |
1270 | - ), 'radio' ); |
|
1270 | + ), 'radio'); |
|
1271 | 1271 | } |
1272 | 1272 | |
1273 | 1273 | // wrap |
1274 | - if ( ! $args['no_wrap'] ) { |
|
1274 | + if (!$args['no_wrap']) { |
|
1275 | 1275 | $wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check'; |
1276 | 1276 | |
1277 | 1277 | // Unique wrap class |
1278 | 1278 | $uniq_class = 'fwrap'; |
1279 | - if ( ! empty( $args['name'] ) ) { |
|
1279 | + if (!empty($args['name'])) { |
|
1280 | 1280 | $uniq_class .= '-' . $args['name']; |
1281 | - } else if ( ! empty( $args['id'] ) ) { |
|
1281 | + } else if (!empty($args['id'])) { |
|
1282 | 1282 | $uniq_class .= '-' . $args['id']; |
1283 | 1283 | } |
1284 | 1284 | |
1285 | - if ( isset( $args['value'] ) || $args['value'] !== "" ) { |
|
1285 | + if (isset($args['value']) || $args['value'] !== "") { |
|
1286 | 1286 | $uniq_class .= '-' . $args['value']; |
1287 | 1287 | } else { |
1288 | 1288 | $uniq_class .= '-' . $count; |
1289 | 1289 | } |
1290 | - $wrap_class .= ' ' . sanitize_html_class( $uniq_class ); |
|
1290 | + $wrap_class .= ' ' . sanitize_html_class($uniq_class); |
|
1291 | 1291 | |
1292 | - $output = self::wrap( array( |
|
1292 | + $output = self::wrap(array( |
|
1293 | 1293 | 'content' => $output, |
1294 | 1294 | 'class' => $wrap_class |
1295 | - ) ); |
|
1295 | + )); |
|
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | return $output; |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return array|mixed|string|string[] |
15 | 15 | */ |
16 | -function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' ) { |
|
16 | +function aui_bs_convert_sd_output($output, $instance = '', $args = '', $sd = '') { |
|
17 | 17 | global $aui_bs5; |
18 | 18 | |
19 | - if ( $aui_bs5 ) { |
|
19 | + if ($aui_bs5) { |
|
20 | 20 | $convert = array( |
21 | 21 | '"ml-' => '"ms-', |
22 | 22 | '"mr-' => '"me-', |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | 'class="close"' => 'class="btn-close"', |
76 | 76 | '<span aria-hidden="true">×</span>' => '', |
77 | 77 | ); |
78 | - $output = str_replace( |
|
79 | - array_keys( $convert ), |
|
80 | - array_values( $convert ), |
|
78 | + $output = str_replace( |
|
79 | + array_keys($convert), |
|
80 | + array_values($convert), |
|
81 | 81 | $output |
82 | 82 | ); |
83 | 83 | } |
@@ -85,4 +85,4 @@ discard block |
||
85 | 85 | return $output; |
86 | 86 | } |
87 | 87 | |
88 | -add_filter( 'wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4 ); //$output, $instance, $args, $this |
|
88 | +add_filter('wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4); //$output, $instance, $args, $this |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Bail if we are not in WP. |
14 | 14 | */ |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if (!defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Only add if the class does not already exist. |
21 | 21 | */ |
22 | -if ( ! class_exists( 'AyeCode_UI_Settings' ) ) { |
|
22 | +if (!class_exists('AyeCode_UI_Settings')) { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * A Class to be able to change settings for Font Awesome. |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | * @return AyeCode_UI_Settings - Main instance. |
100 | 100 | */ |
101 | 101 | public static function instance() { |
102 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) { |
|
102 | + if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) { |
|
103 | 103 | |
104 | 104 | self::$instance = new AyeCode_UI_Settings; |
105 | 105 | |
106 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
106 | + add_action('init', array(self::$instance, 'init')); // set settings |
|
107 | 107 | |
108 | - if ( is_admin() ) { |
|
109 | - add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
110 | - add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
108 | + if (is_admin()) { |
|
109 | + add_action('admin_menu', array(self::$instance, 'menu_item')); |
|
110 | + add_action('admin_init', array(self::$instance, 'register_settings')); |
|
111 | 111 | |
112 | 112 | // Maybe show example page |
113 | - add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) ); |
|
113 | + add_action('template_redirect', array(self::$instance, 'maybe_show_examples')); |
|
114 | 114 | |
115 | - if ( defined( 'BLOCKSTRAP_VERSION' ) ) { |
|
116 | - add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 ); |
|
115 | + if (defined('BLOCKSTRAP_VERSION')) { |
|
116 | + add_filter('sd_aui_colors', array(self::$instance, 'sd_aui_colors'), 10, 3); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - add_action( 'customize_register', array( self::$instance, 'customizer_settings' )); |
|
120 | + add_action('customize_register', array(self::$instance, 'customizer_settings')); |
|
121 | 121 | |
122 | - do_action( 'ayecode_ui_settings_loaded' ); |
|
122 | + do_action('ayecode_ui_settings_loaded'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return self::$instance; |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){ |
|
137 | + public function sd_aui_colors($theme_colors, $include_outlines, $include_branding) { |
|
138 | 138 | |
139 | 139 | |
140 | 140 | $setting = wp_get_global_settings(); |
141 | 141 | |
142 | - if(!empty($setting['color']['palette']['custom'])){ |
|
143 | - foreach($setting['color']['palette']['custom'] as $color){ |
|
142 | + if (!empty($setting['color']['palette']['custom'])) { |
|
143 | + foreach ($setting['color']['palette']['custom'] as $color) { |
|
144 | 144 | $theme_colors[$color['slug']] = esc_attr($color['name']); |
145 | 145 | } |
146 | 146 | } |
@@ -151,81 +151,81 @@ discard block |
||
151 | 151 | /** |
152 | 152 | * Setup some constants. |
153 | 153 | */ |
154 | - public function constants(){ |
|
155 | - define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" ); |
|
156 | - define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' ); |
|
157 | - define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' ); |
|
158 | - define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' ); |
|
159 | - define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' ); |
|
160 | - define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' ); |
|
161 | - define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' ); |
|
162 | - define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' ); |
|
163 | - define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' ); |
|
164 | - define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' ); |
|
165 | - define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' ); |
|
166 | - define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' ); |
|
167 | - define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' ); |
|
168 | - define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' ); |
|
169 | - define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' ); |
|
170 | - define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' ); |
|
154 | + public function constants() { |
|
155 | + define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be"); |
|
156 | + define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d'); |
|
157 | + define('AUI_INFO_COLOR_ORIGINAL', '#17a2b8'); |
|
158 | + define('AUI_WARNING_COLOR_ORIGINAL', '#ffc107'); |
|
159 | + define('AUI_DANGER_COLOR_ORIGINAL', '#dc3545'); |
|
160 | + define('AUI_SUCCESS_COLOR_ORIGINAL', '#44c553'); |
|
161 | + define('AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa'); |
|
162 | + define('AUI_DARK_COLOR_ORIGINAL', '#343a40'); |
|
163 | + define('AUI_WHITE_COLOR_ORIGINAL', '#fff'); |
|
164 | + define('AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd'); |
|
165 | + define('AUI_SALMON_COLOR_ORIGINAL', '#ff977a'); |
|
166 | + define('AUI_CYAN_COLOR_ORIGINAL', '#35bdff'); |
|
167 | + define('AUI_GRAY_COLOR_ORIGINAL', '#ced4da'); |
|
168 | + define('AUI_INDIGO_COLOR_ORIGINAL', '#502c6c'); |
|
169 | + define('AUI_ORANGE_COLOR_ORIGINAL', '#orange'); |
|
170 | + define('AUI_BLACK_COLOR_ORIGINAL', '#000'); |
|
171 | 171 | |
172 | - if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) { |
|
173 | - define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL ); |
|
172 | + if (!defined('AUI_PRIMARY_COLOR')) { |
|
173 | + define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL); |
|
174 | 174 | } |
175 | - if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) { |
|
176 | - define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL ); |
|
175 | + if (!defined('AUI_SECONDARY_COLOR')) { |
|
176 | + define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL); |
|
177 | 177 | } |
178 | - if ( ! defined( 'AUI_INFO_COLOR' ) ) { |
|
179 | - define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL ); |
|
178 | + if (!defined('AUI_INFO_COLOR')) { |
|
179 | + define('AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL); |
|
180 | 180 | } |
181 | - if ( ! defined( 'AUI_WARNING_COLOR' ) ) { |
|
182 | - define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL ); |
|
181 | + if (!defined('AUI_WARNING_COLOR')) { |
|
182 | + define('AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL); |
|
183 | 183 | } |
184 | - if ( ! defined( 'AUI_DANGER_COLOR' ) ) { |
|
185 | - define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL ); |
|
184 | + if (!defined('AUI_DANGER_COLOR')) { |
|
185 | + define('AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL); |
|
186 | 186 | } |
187 | - if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) { |
|
188 | - define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL ); |
|
187 | + if (!defined('AUI_SUCCESS_COLOR')) { |
|
188 | + define('AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL); |
|
189 | 189 | } |
190 | - if ( ! defined( 'AUI_LIGHT_COLOR' ) ) { |
|
191 | - define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL ); |
|
190 | + if (!defined('AUI_LIGHT_COLOR')) { |
|
191 | + define('AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL); |
|
192 | 192 | } |
193 | - if ( ! defined( 'AUI_DARK_COLOR' ) ) { |
|
194 | - define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL ); |
|
193 | + if (!defined('AUI_DARK_COLOR')) { |
|
194 | + define('AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL); |
|
195 | 195 | } |
196 | - if ( ! defined( 'AUI_WHITE_COLOR' ) ) { |
|
197 | - define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL ); |
|
196 | + if (!defined('AUI_WHITE_COLOR')) { |
|
197 | + define('AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL); |
|
198 | 198 | } |
199 | - if ( ! defined( 'AUI_PURPLE_COLOR' ) ) { |
|
200 | - define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL ); |
|
199 | + if (!defined('AUI_PURPLE_COLOR')) { |
|
200 | + define('AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL); |
|
201 | 201 | } |
202 | - if ( ! defined( 'AUI_SALMON_COLOR' ) ) { |
|
203 | - define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL ); |
|
202 | + if (!defined('AUI_SALMON_COLOR')) { |
|
203 | + define('AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL); |
|
204 | 204 | } |
205 | - if ( ! defined( 'AUI_CYAN_COLOR' ) ) { |
|
206 | - define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL ); |
|
205 | + if (!defined('AUI_CYAN_COLOR')) { |
|
206 | + define('AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL); |
|
207 | 207 | } |
208 | - if ( ! defined( 'AUI_GRAY_COLOR' ) ) { |
|
209 | - define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL ); |
|
208 | + if (!defined('AUI_GRAY_COLOR')) { |
|
209 | + define('AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL); |
|
210 | 210 | } |
211 | - if ( ! defined( 'AUI_INDIGO_COLOR' ) ) { |
|
212 | - define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL ); |
|
211 | + if (!defined('AUI_INDIGO_COLOR')) { |
|
212 | + define('AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL); |
|
213 | 213 | } |
214 | - if ( ! defined( 'AUI_ORANGE_COLOR' ) ) { |
|
215 | - define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL ); |
|
214 | + if (!defined('AUI_ORANGE_COLOR')) { |
|
215 | + define('AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL); |
|
216 | 216 | } |
217 | - if ( ! defined( 'AUI_BLACK_COLOR' ) ) { |
|
218 | - define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL ); |
|
217 | + if (!defined('AUI_BLACK_COLOR')) { |
|
218 | + define('AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | } |
222 | 222 | |
223 | - public static function get_colors( $original = false){ |
|
223 | + public static function get_colors($original = false) { |
|
224 | 224 | |
225 | - if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) { |
|
225 | + if (!defined('AUI_PRIMARY_COLOR')) { |
|
226 | 226 | return array(); |
227 | 227 | } |
228 | - if ( $original ) { |
|
228 | + if ($original) { |
|
229 | 229 | return array( |
230 | 230 | 'primary' => AUI_PRIMARY_COLOR_ORIGINAL, |
231 | 231 | 'secondary' => AUI_SECONDARY_COLOR_ORIGINAL, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return mixed |
275 | 275 | */ |
276 | - public function add_bs5_admin_body_class( $classes = '' ) { |
|
276 | + public function add_bs5_admin_body_class($classes = '') { |
|
277 | 277 | $classes .= ' aui_bs5'; |
278 | 278 | |
279 | 279 | return $classes; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @return mixed |
288 | 288 | */ |
289 | - public function add_bs5_body_class( $classes ) { |
|
289 | + public function add_bs5_body_class($classes) { |
|
290 | 290 | $classes[] = 'aui_bs5'; |
291 | 291 | |
292 | 292 | return $classes; |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | global $aui_bs5; |
300 | 300 | |
301 | 301 | // Maybe fix settings |
302 | - if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) { |
|
303 | - $db_settings = get_option( 'ayecode-ui-settings' ); |
|
304 | - if ( ! empty( $db_settings ) ) { |
|
302 | + if (!empty($_REQUEST['aui-fix-admin']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], "aui-fix-admin")) { |
|
303 | + $db_settings = get_option('ayecode-ui-settings'); |
|
304 | + if (!empty($db_settings)) { |
|
305 | 305 | $db_settings['css_backend'] = 'compatibility'; |
306 | 306 | $db_settings['js_backend'] = 'core-popper'; |
307 | - update_option( 'ayecode-ui-settings', $db_settings ); |
|
307 | + update_option('ayecode-ui-settings', $db_settings); |
|
308 | 308 | wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true")); |
309 | 309 | } |
310 | 310 | } |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | // define the version |
317 | 317 | $aui_bs5 = $this->settings['bs_ver'] === '5'; |
318 | 318 | |
319 | - if ( $aui_bs5 ) { |
|
320 | - include_once( dirname( __FILE__ ) . '/inc/bs-conversion.php' ); |
|
321 | - add_filter( 'admin_body_class', array( $this, 'add_bs5_admin_body_class' ), 99, 1 ); |
|
322 | - add_filter( 'body_class', array( $this, 'add_bs5_body_class' ) ); |
|
319 | + if ($aui_bs5) { |
|
320 | + include_once(dirname(__FILE__) . '/inc/bs-conversion.php'); |
|
321 | + add_filter('admin_body_class', array($this, 'add_bs5_admin_body_class'), 99, 1); |
|
322 | + add_filter('body_class', array($this, 'add_bs5_body_class')); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -327,32 +327,32 @@ discard block |
||
327 | 327 | * |
328 | 328 | * We load super early in case there is a theme version that might change the colors |
329 | 329 | */ |
330 | - if ( $this->settings['css'] ) { |
|
330 | + if ($this->settings['css']) { |
|
331 | 331 | $priority = $this->is_bs3_compat() ? 100 : 1; |
332 | 332 | $priority = $aui_bs5 ? 10 : $priority; |
333 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority ); |
|
333 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), $priority); |
|
334 | 334 | } |
335 | - if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) { |
|
336 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 ); |
|
335 | + if ($this->settings['css_backend'] && $this->load_admin_scripts()) { |
|
336 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | // maybe load JS |
340 | - if ( $this->settings['js'] ) { |
|
340 | + if ($this->settings['js']) { |
|
341 | 341 | $priority = $this->is_bs3_compat() ? 100 : 1; |
342 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority ); |
|
342 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority); |
|
343 | 343 | } |
344 | - if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) { |
|
345 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 ); |
|
344 | + if ($this->settings['js_backend'] && $this->load_admin_scripts()) { |
|
345 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | // Maybe set the HTML font size |
349 | - if ( $this->settings['html_font_size'] ) { |
|
350 | - add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 ); |
|
349 | + if ($this->settings['html_font_size']) { |
|
350 | + add_action('wp_footer', array($this, 'html_font_size'), 10); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | // Maybe show backend style error |
354 | - if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){ |
|
355 | - add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) ); |
|
354 | + if ($this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper') { |
|
355 | + add_action('admin_notices', array($this, 'show_admin_style_notice')); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | } |
@@ -360,11 +360,11 @@ discard block |
||
360 | 360 | /** |
361 | 361 | * Show admin notice if backend scripts not loaded. |
362 | 362 | */ |
363 | - public function show_admin_style_notice(){ |
|
364 | - $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin')); |
|
365 | - $button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>'; |
|
366 | - $message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button; |
|
367 | - echo '<div class="notice notice-error aui-settings-error-notice"><p>'. wp_kses_post( $message ).'</p></div>'; |
|
363 | + public function show_admin_style_notice() { |
|
364 | + $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=" . wp_create_nonce('aui-fix-admin')); |
|
365 | + $button = '<a href="' . esc_url($fix_url) . '" class="button-primary">Fix Now</a>'; |
|
366 | + $message = __('<b>Style Issue:</b> AyeCode UI is disable or set wrong.') . " " . $button; |
|
367 | + echo '<div class="notice notice-error aui-settings-error-notice"><p>' . wp_kses_post($message) . '</p></div>'; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -372,14 +372,14 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @return bool |
374 | 374 | */ |
375 | - public function load_admin_scripts(){ |
|
375 | + public function load_admin_scripts() { |
|
376 | 376 | $result = true; |
377 | 377 | |
378 | 378 | // check if specifically disabled |
379 | - if(!empty($this->settings['disable_admin'])){ |
|
380 | - $url_parts = explode("\n",$this->settings['disable_admin']); |
|
381 | - foreach($url_parts as $part){ |
|
382 | - if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){ |
|
379 | + if (!empty($this->settings['disable_admin'])) { |
|
380 | + $url_parts = explode("\n", $this->settings['disable_admin']); |
|
381 | + foreach ($url_parts as $part) { |
|
382 | + if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) { |
|
383 | 383 | return false; // return early, no point checking further |
384 | 384 | } |
385 | 385 | } |
@@ -391,9 +391,9 @@ discard block |
||
391 | 391 | /** |
392 | 392 | * Add a html font size to the footer. |
393 | 393 | */ |
394 | - public function html_font_size(){ |
|
394 | + public function html_font_size() { |
|
395 | 395 | $this->settings = $this->get_settings(); |
396 | - echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>"; |
|
396 | + echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>"; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | * |
402 | 402 | * @return bool |
403 | 403 | */ |
404 | - public function is_aui_screen(){ |
|
404 | + public function is_aui_screen() { |
|
405 | 405 | // echo '###';exit; |
406 | 406 | $load = false; |
407 | 407 | // check if we should load or not |
408 | - if ( is_admin() ) { |
|
408 | + if (is_admin()) { |
|
409 | 409 | // Only enable on set pages |
410 | 410 | $aui_screens = array( |
411 | 411 | 'page', |
@@ -417,26 +417,26 @@ discard block |
||
417 | 417 | 'ayecode-ui-settings', |
418 | 418 | 'site-editor' |
419 | 419 | ); |
420 | - $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens ); |
|
420 | + $screen_ids = apply_filters('aui_screen_ids', $aui_screens); |
|
421 | 421 | |
422 | 422 | $screen = get_current_screen(); |
423 | 423 | |
424 | 424 | // echo '###'.$screen->id; |
425 | 425 | |
426 | 426 | // check if we are on a AUI screen |
427 | - if ( $screen && in_array( $screen->id, $screen_ids ) ) { |
|
427 | + if ($screen && in_array($screen->id, $screen_ids)) { |
|
428 | 428 | $load = true; |
429 | 429 | } |
430 | 430 | |
431 | 431 | //load for widget previews in WP 5.8 |
432 | - if( !empty($_REQUEST['legacy-widget-preview'])){ |
|
432 | + if (!empty($_REQUEST['legacy-widget-preview'])) { |
|
433 | 433 | $load = true; |
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | 437 | |
438 | 438 | |
439 | - return apply_filters( 'aui_load_on_admin' , $load ); |
|
439 | + return apply_filters('aui_load_on_admin', $load); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @return bool |
446 | 446 | */ |
447 | 447 | public static function is_block_theme() { |
448 | - if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) { |
|
448 | + if (function_exists('wp_is_block_theme' && wp_is_block_theme())) { |
|
449 | 449 | return true; |
450 | 450 | } |
451 | 451 | |
@@ -460,40 +460,40 @@ discard block |
||
460 | 460 | |
461 | 461 | $load_fse = false; |
462 | 462 | |
463 | - if( is_admin() && !$this->is_aui_screen()){ |
|
463 | + if (is_admin() && !$this->is_aui_screen()) { |
|
464 | 464 | // don't add wp-admin scripts if not requested to |
465 | - }else{ |
|
465 | + } else { |
|
466 | 466 | $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend'; |
467 | 467 | |
468 | - $rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : ''; |
|
468 | + $rtl = is_rtl() && !$aui_bs5 ? '-rtl' : ''; |
|
469 | 469 | |
470 | 470 | $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : ''; |
471 | 471 | |
472 | - if($this->settings[$css_setting]){ |
|
473 | - $compatibility = $this->settings[$css_setting]=='core' ? false : true; |
|
474 | - $url = $this->settings[$css_setting]=='core' ? $this->url.'assets'.$bs_ver.'/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets'.$bs_ver.'/css/ayecode-ui-compatibility'.$rtl.'.css'; |
|
472 | + if ($this->settings[$css_setting]) { |
|
473 | + $compatibility = $this->settings[$css_setting] == 'core' ? false : true; |
|
474 | + $url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets' . $bs_ver . '/css/ayecode-ui' . $rtl . '.css' : $this->url . 'assets' . $bs_ver . '/css/ayecode-ui-compatibility' . $rtl . '.css'; |
|
475 | 475 | |
476 | 476 | |
477 | 477 | |
478 | - wp_register_style( 'ayecode-ui', $url, array(), $this->version ); |
|
479 | - wp_enqueue_style( 'ayecode-ui' ); |
|
478 | + wp_register_style('ayecode-ui', $url, array(), $this->version); |
|
479 | + wp_enqueue_style('ayecode-ui'); |
|
480 | 480 | |
481 | - $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : ''; |
|
481 | + $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
|
482 | 482 | |
483 | 483 | // if ( is_admin() && !empty($_REQUEST['postType']) ) { |
484 | - if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) ) ) { |
|
485 | - $url = $this->url.'assets'.$bs_ver.'/css/ayecode-ui-fse.css'; |
|
486 | - wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version ); |
|
487 | - wp_enqueue_style( 'ayecode-ui-fse' ); |
|
484 | + if (is_admin() && (!empty($_REQUEST['postType']) || $current_screen->is_block_editor()) && (defined('BLOCKSTRAP_VERSION') || defined('AUI_FSE'))) { |
|
485 | + $url = $this->url . 'assets' . $bs_ver . '/css/ayecode-ui-fse.css'; |
|
486 | + wp_register_style('ayecode-ui-fse', $url, array(), $this->version); |
|
487 | + wp_enqueue_style('ayecode-ui-fse'); |
|
488 | 488 | $load_fse = true; |
489 | 489 | } |
490 | 490 | |
491 | 491 | |
492 | 492 | // flatpickr |
493 | - wp_register_style( 'flatpickr', $this->url.'assets'.$bs_ver.'/css/flatpickr.min.css', array(), $this->version ); |
|
493 | + wp_register_style('flatpickr', $this->url . 'assets' . $bs_ver . '/css/flatpickr.min.css', array(), $this->version); |
|
494 | 494 | |
495 | 495 | // fix some wp-admin issues |
496 | - if(is_admin()){ |
|
496 | + if (is_admin()) { |
|
497 | 497 | $custom_css = " |
498 | 498 | body{ |
499 | 499 | background-color: #f1f1f1; |
@@ -541,14 +541,14 @@ discard block |
||
541 | 541 | padding: 0; |
542 | 542 | } |
543 | 543 | "; |
544 | - wp_add_inline_style( 'ayecode-ui', $custom_css ); |
|
544 | + wp_add_inline_style('ayecode-ui', $custom_css); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | // custom changes |
548 | - if ( $load_fse ) { |
|
549 | - wp_add_inline_style( 'ayecode-ui-fse', self::custom_css($compatibility) ); |
|
550 | - }else{ |
|
551 | - wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) ); |
|
548 | + if ($load_fse) { |
|
549 | + wp_add_inline_style('ayecode-ui-fse', self::custom_css($compatibility)); |
|
550 | + } else { |
|
551 | + wp_add_inline_style('ayecode-ui', self::custom_css($compatibility)); |
|
552 | 552 | |
553 | 553 | } |
554 | 554 | |
@@ -569,10 +569,10 @@ discard block |
||
569 | 569 | $flatpickr_locale = self::flatpickr_locale(); |
570 | 570 | |
571 | 571 | ob_start(); |
572 | - if ( $aui_bs5 ) { |
|
573 | - include_once( dirname( __FILE__ ) . '/inc/bs5-js.php' ); |
|
574 | - }else{ |
|
575 | - include_once( dirname( __FILE__ ) . '/inc/bs4-js.php' ); |
|
572 | + if ($aui_bs5) { |
|
573 | + include_once(dirname(__FILE__) . '/inc/bs5-js.php'); |
|
574 | + } else { |
|
575 | + include_once(dirname(__FILE__) . '/inc/bs4-js.php'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | $output = ob_get_clean(); |
@@ -580,10 +580,10 @@ discard block |
||
580 | 580 | /* |
581 | 581 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
582 | 582 | */ |
583 | - return str_replace( array( |
|
583 | + return str_replace(array( |
|
584 | 584 | '<script>', |
585 | 585 | '</script>' |
586 | - ), '', self::minify_js($output) ); |
|
586 | + ), '', self::minify_js($output)); |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | ob_start(); |
598 | 598 | ?> |
599 | 599 | <script> |
600 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
600 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
601 | 601 | /* With Avada builder */ |
602 | 602 | |
603 | 603 | <?php } ?> |
604 | 604 | </script> |
605 | 605 | <?php |
606 | - return str_replace( array( |
|
606 | + return str_replace(array( |
|
607 | 607 | '<script>', |
608 | 608 | '</script>' |
609 | 609 | ), '', ob_get_clean()); |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * |
615 | 615 | * If this remains small then its best to use this than to add another JS file. |
616 | 616 | */ |
617 | - public function inline_script_file_browser(){ |
|
617 | + public function inline_script_file_browser() { |
|
618 | 618 | ob_start(); |
619 | 619 | ?> |
620 | 620 | <script> |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | /* |
630 | 630 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
631 | 631 | */ |
632 | - return str_replace( array( |
|
632 | + return str_replace(array( |
|
633 | 633 | '<script>', |
634 | 634 | '</script>' |
635 | - ), '', $output ); |
|
635 | + ), '', $output); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -640,59 +640,59 @@ discard block |
||
640 | 640 | */ |
641 | 641 | public function enqueue_scripts() { |
642 | 642 | |
643 | - if( is_admin() && !$this->is_aui_screen()){ |
|
643 | + if (is_admin() && !$this->is_aui_screen()) { |
|
644 | 644 | // don't add wp-admin scripts if not requested to |
645 | - }else { |
|
645 | + } else { |
|
646 | 646 | |
647 | 647 | $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend'; |
648 | 648 | |
649 | 649 | $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : ''; |
650 | 650 | |
651 | 651 | // select2 |
652 | - wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version ); |
|
652 | + wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version); |
|
653 | 653 | |
654 | 654 | // flatpickr |
655 | - wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version ); |
|
655 | + wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version); |
|
656 | 656 | |
657 | 657 | // iconpicker |
658 | - if ( defined( 'FAS_ICONPICKER_JS_URL' ) ) { |
|
659 | - wp_register_script( 'iconpicker', FAS_ICONPICKER_JS_URL, array(), $this->version ); |
|
660 | - }else{ |
|
661 | - wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version ); |
|
658 | + if (defined('FAS_ICONPICKER_JS_URL')) { |
|
659 | + wp_register_script('iconpicker', FAS_ICONPICKER_JS_URL, array(), $this->version); |
|
660 | + } else { |
|
661 | + wp_register_script('iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | // Bootstrap file browser |
665 | - wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version ); |
|
666 | - wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() ); |
|
665 | + wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version); |
|
666 | + wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser()); |
|
667 | 667 | |
668 | 668 | $load_inline = false; |
669 | 669 | |
670 | - if ( $this->settings[ $js_setting ] == 'core-popper' ) { |
|
670 | + if ($this->settings[$js_setting] == 'core-popper') { |
|
671 | 671 | // Bootstrap bundle |
672 | 672 | $url = $this->url . 'assets' . $bs_ver . '/js/bootstrap.bundle.min.js'; |
673 | - wp_register_script( 'bootstrap-js-bundle', $url, array( |
|
673 | + wp_register_script('bootstrap-js-bundle', $url, array( |
|
674 | 674 | 'select2', |
675 | 675 | 'jquery' |
676 | - ), $this->version, $this->is_bs3_compat() ); |
|
676 | + ), $this->version, $this->is_bs3_compat()); |
|
677 | 677 | // if in admin then add to footer for compatibility. |
678 | - is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' ); |
|
678 | + is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle'); |
|
679 | 679 | $script = $this->inline_script(); |
680 | - wp_add_inline_script( 'bootstrap-js-bundle', $script ); |
|
681 | - } elseif ( $this->settings[ $js_setting ] == 'popper' ) { |
|
680 | + wp_add_inline_script('bootstrap-js-bundle', $script); |
|
681 | + } elseif ($this->settings[$js_setting] == 'popper') { |
|
682 | 682 | $url = $this->url . 'assets/js/popper.min.js'; //@todo we need to update this to bs5 |
683 | - wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version ); |
|
684 | - wp_enqueue_script( 'bootstrap-js-popper' ); |
|
683 | + wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->version); |
|
684 | + wp_enqueue_script('bootstrap-js-popper'); |
|
685 | 685 | $load_inline = true; |
686 | 686 | } else { |
687 | 687 | $load_inline = true; |
688 | 688 | } |
689 | 689 | |
690 | 690 | // Load needed inline scripts by faking the loading of a script if the main script is not being loaded |
691 | - if ( $load_inline ) { |
|
692 | - wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) ); |
|
693 | - wp_enqueue_script( 'bootstrap-dummy' ); |
|
691 | + if ($load_inline) { |
|
692 | + wp_register_script('bootstrap-dummy', '', array('select2', 'jquery')); |
|
693 | + wp_enqueue_script('bootstrap-dummy'); |
|
694 | 694 | $script = $this->inline_script(); |
695 | - wp_add_inline_script( 'bootstrap-dummy', $script ); |
|
695 | + wp_add_inline_script('bootstrap-dummy', $script); |
|
696 | 696 | } |
697 | 697 | } |
698 | 698 | |
@@ -701,17 +701,17 @@ discard block |
||
701 | 701 | /** |
702 | 702 | * Enqueue flatpickr if called. |
703 | 703 | */ |
704 | - public function enqueue_flatpickr(){ |
|
705 | - wp_enqueue_style( 'flatpickr' ); |
|
706 | - wp_enqueue_script( 'flatpickr' ); |
|
704 | + public function enqueue_flatpickr() { |
|
705 | + wp_enqueue_style('flatpickr'); |
|
706 | + wp_enqueue_script('flatpickr'); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
710 | 710 | * Enqueue iconpicker if called. |
711 | 711 | */ |
712 | - public function enqueue_iconpicker(){ |
|
713 | - wp_enqueue_style( 'iconpicker' ); |
|
714 | - wp_enqueue_script( 'iconpicker' ); |
|
712 | + public function enqueue_iconpicker() { |
|
713 | + wp_enqueue_style('iconpicker'); |
|
714 | + wp_enqueue_script('iconpicker'); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -720,19 +720,19 @@ discard block |
||
720 | 720 | * @return string |
721 | 721 | */ |
722 | 722 | public function get_url() { |
723 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
724 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
723 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
724 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
725 | 725 | |
726 | 726 | // Replace http:// to https://. |
727 | - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { |
|
728 | - $content_url = str_replace( 'http://', 'https://', $content_url ); |
|
727 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
728 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
729 | 729 | } |
730 | 730 | |
731 | 731 | // Check if we are inside a plugin |
732 | - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
733 | - $url = str_replace( $content_dir, $content_url, $file_dir ); |
|
732 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
733 | + $url = str_replace($content_dir, $content_url, $file_dir); |
|
734 | 734 | |
735 | - return trailingslashit( $url ); |
|
735 | + return trailingslashit($url); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | /** |
@@ -744,15 +744,15 @@ discard block |
||
744 | 744 | |
745 | 745 | $url = ''; |
746 | 746 | // check if we are inside a plugin |
747 | - $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
747 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
748 | 748 | |
749 | 749 | // add check in-case user has changed wp-content dir name. |
750 | 750 | $wp_content_folder_name = basename(WP_CONTENT_DIR); |
751 | - $dir_parts = explode("/$wp_content_folder_name/",$file_dir); |
|
752 | - $url_parts = explode("/$wp_content_folder_name/",plugins_url()); |
|
751 | + $dir_parts = explode("/$wp_content_folder_name/", $file_dir); |
|
752 | + $url_parts = explode("/$wp_content_folder_name/", plugins_url()); |
|
753 | 753 | |
754 | - if(!empty($url_parts[0]) && !empty($dir_parts[1])){ |
|
755 | - $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] ); |
|
754 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
755 | + $url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | return $url; |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * Register the database settings with WordPress. |
763 | 763 | */ |
764 | 764 | public function register_settings() { |
765 | - register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' ); |
|
765 | + register_setting('ayecode-ui-settings', 'ayecode-ui-settings'); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -771,10 +771,10 @@ discard block |
||
771 | 771 | */ |
772 | 772 | public function menu_item() { |
773 | 773 | $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
774 | - call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array( |
|
774 | + call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array( |
|
775 | 775 | $this, |
776 | 776 | 'settings_page' |
777 | - ) ); |
|
777 | + )); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | * |
783 | 783 | * @return array |
784 | 784 | */ |
785 | - public function theme_js_settings(){ |
|
785 | + public function theme_js_settings() { |
|
786 | 786 | return array( |
787 | 787 | 'ayetheme' => 'popper', |
788 | 788 | 'listimia' => 'required', |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | $query = "SELECT MIN(user_registered) AS oldest_registration_date FROM {$wpdb->users}"; |
804 | 804 | |
805 | 805 | // Execute the query |
806 | - $date = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
|
806 | + $date = $wpdb->get_var($query); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
|
807 | 807 | |
808 | 808 | return $date ? $date : false; |
809 | 809 | } |
@@ -811,11 +811,11 @@ discard block |
||
811 | 811 | /** |
812 | 812 | * Show admin notice if backend scripts not loaded. |
813 | 813 | */ |
814 | - public function show_admin_version_notice(){ |
|
815 | - $fix_url = admin_url("options-general.php?page=ayecode-ui-settings" ); |
|
816 | - $button = '<a href="'.esc_url($fix_url).'" class="button-primary">View Settings</a>'; |
|
817 | - $message = __( '<b>Style Issue:</b> AyeCode UI has changed its default version from v4 to v5, if you notice unwanted style changes, please revert to v4 (saving the settings page will remove this notice)')." " .$button; |
|
818 | - echo '<div class="notice notice-error aui-settings-error-notice"><p>'. wp_kses_post( $message ).'</p></div>'; |
|
814 | + public function show_admin_version_notice() { |
|
815 | + $fix_url = admin_url("options-general.php?page=ayecode-ui-settings"); |
|
816 | + $button = '<a href="' . esc_url($fix_url) . '" class="button-primary">View Settings</a>'; |
|
817 | + $message = __('<b>Style Issue:</b> AyeCode UI has changed its default version from v4 to v5, if you notice unwanted style changes, please revert to v4 (saving the settings page will remove this notice)') . " " . $button; |
|
818 | + echo '<div class="notice notice-error aui-settings-error-notice"><p>' . wp_kses_post($message) . '</p></div>'; |
|
819 | 819 | } |
820 | 820 | |
821 | 821 | /** |
@@ -825,32 +825,32 @@ discard block |
||
825 | 825 | */ |
826 | 826 | public function get_settings() { |
827 | 827 | |
828 | - $db_settings = get_option( 'ayecode-ui-settings' ); |
|
828 | + $db_settings = get_option('ayecode-ui-settings'); |
|
829 | 829 | |
830 | 830 | // Maybe show default version notice |
831 | - $site_install_date = new DateTime( self::get_site_install_date() ); |
|
831 | + $site_install_date = new DateTime(self::get_site_install_date()); |
|
832 | 832 | $switch_over_date = new DateTime("2024-02-01"); |
833 | - if ( empty( $db_settings ) && $site_install_date < $switch_over_date ) { |
|
834 | - add_action( 'admin_notices', array( $this, 'show_admin_version_notice' ) ); |
|
833 | + if (empty($db_settings) && $site_install_date < $switch_over_date) { |
|
834 | + add_action('admin_notices', array($this, 'show_admin_version_notice')); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | $js_default = 'core-popper'; |
838 | 838 | $js_default_backend = $js_default; |
839 | 839 | |
840 | 840 | // maybe set defaults (if no settings set) |
841 | - if(empty($db_settings)){ |
|
842 | - $active_theme = strtolower( get_template() ); // active parent theme. |
|
841 | + if (empty($db_settings)) { |
|
842 | + $active_theme = strtolower(get_template()); // active parent theme. |
|
843 | 843 | $theme_js_settings = self::theme_js_settings(); |
844 | - if(isset($theme_js_settings[$active_theme])){ |
|
844 | + if (isset($theme_js_settings[$active_theme])) { |
|
845 | 845 | $js_default = $theme_js_settings[$active_theme]; |
846 | - $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default; |
|
846 | + $js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default; |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | |
850 | 850 | /** |
851 | 851 | * Filter the default settings. |
852 | 852 | */ |
853 | - $defaults = apply_filters( 'ayecode-ui-default-settings', array( |
|
853 | + $defaults = apply_filters('ayecode-ui-default-settings', array( |
|
854 | 854 | 'css' => 'compatibility', // core, compatibility |
855 | 855 | 'js' => $js_default, // js to load, core-popper, popper |
856 | 856 | 'html_font_size' => '16', // js to load, core-popper, popper |
@@ -858,16 +858,16 @@ discard block |
||
858 | 858 | 'js_backend' => $js_default_backend, // js to load, core-popper, popper |
859 | 859 | 'disable_admin' => '', // URL snippets to disable loading on admin |
860 | 860 | 'bs_ver' => '5', // The default bootstrap version to sue by default |
861 | - ), $db_settings ); |
|
861 | + ), $db_settings); |
|
862 | 862 | |
863 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
863 | + $settings = wp_parse_args($db_settings, $defaults); |
|
864 | 864 | |
865 | 865 | /** |
866 | 866 | * Filter the Bootstrap settings. |
867 | 867 | * |
868 | 868 | * @todo if we add this filer people might use it and then it defeats the purpose of this class :/ |
869 | 869 | */ |
870 | - return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults ); |
|
870 | + return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults); |
|
871 | 871 | } |
872 | 872 | |
873 | 873 | |
@@ -875,109 +875,109 @@ discard block |
||
875 | 875 | * The settings page html output. |
876 | 876 | */ |
877 | 877 | public function settings_page() { |
878 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
879 | - wp_die( esc_attr__( 'You do not have sufficient permissions to access this page.', 'ayecode-connect' ) ); |
|
878 | + if (!current_user_can('manage_options')) { |
|
879 | + wp_die(esc_attr__('You do not have sufficient permissions to access this page.', 'ayecode-connect')); |
|
880 | 880 | } |
881 | - $overrides = apply_filters( 'ayecode-ui-settings', array(), array(), array() ); |
|
881 | + $overrides = apply_filters('ayecode-ui-settings', array(), array(), array()); |
|
882 | 882 | |
883 | 883 | ?> |
884 | 884 | <div class="wrap"> |
885 | - <h1><?php echo esc_attr( $this->name ); ?></h1> |
|
886 | - <p><?php echo esc_html( apply_filters( 'ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.", 'ayecode-connect' ) ) );?></p> |
|
885 | + <h1><?php echo esc_attr($this->name); ?></h1> |
|
886 | + <p><?php echo esc_html(apply_filters('ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.", 'ayecode-connect'))); ?></p> |
|
887 | 887 | <form method="post" action="options.php"> |
888 | 888 | <?php |
889 | - settings_fields( 'ayecode-ui-settings' ); |
|
890 | - do_settings_sections( 'ayecode-ui-settings' ); |
|
889 | + settings_fields('ayecode-ui-settings'); |
|
890 | + do_settings_sections('ayecode-ui-settings'); |
|
891 | 891 | ?> |
892 | 892 | |
893 | - <h2><?php esc_html_e( 'BootStrap Version', 'ayecode-connect' ); ?></h2> |
|
894 | - <p><?php echo esc_html( apply_filters( 'ayecode-ui-version-settings-message', __("V5 is recommended, however if you have another plugin installed using v4, you may need to use v4 also.", 'ayecode-connect' ) ) );?></p> |
|
893 | + <h2><?php esc_html_e('BootStrap Version', 'ayecode-connect'); ?></h2> |
|
894 | + <p><?php echo esc_html(apply_filters('ayecode-ui-version-settings-message', __("V5 is recommended, however if you have another plugin installed using v4, you may need to use v4 also.", 'ayecode-connect'))); ?></p> |
|
895 | 895 | <div class="bsui"><?php |
896 | - if ( ! empty( $overrides ) ) { |
|
896 | + if (!empty($overrides)) { |
|
897 | 897 | echo aui()->alert(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
898 | 898 | 'type'=> 'info', |
899 | - 'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect' ) |
|
899 | + 'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect') |
|
900 | 900 | )); |
901 | 901 | } |
902 | 902 | ?> |
903 | 903 | </div> |
904 | 904 | <table class="form-table wpbs-table-version-settings"> |
905 | 905 | <tr valign="top"> |
906 | - <th scope="row"><label for="wpbs-css"><?php esc_html_e( 'Version', 'ayecode-connect' ); ?></label></th> |
|
906 | + <th scope="row"><label for="wpbs-css"><?php esc_html_e('Version', 'ayecode-connect'); ?></label></th> |
|
907 | 907 | <td> |
908 | 908 | <select name="ayecode-ui-settings[bs_ver]" id="wpbs-css" <?php echo !empty($overrides['bs_ver']) ? 'disabled' : ''; ?>> |
909 | - <option value="5" <?php selected( $this->settings['bs_ver'], '5' ); ?>><?php esc_html_e( 'v5 (recommended)', 'ayecode-connect' ); ?></option> |
|
910 | - <option value="4" <?php selected( $this->settings['bs_ver'], '4' ); ?>><?php esc_html_e( 'v4 (legacy)', 'ayecode-connect' ); ?></option> |
|
909 | + <option value="5" <?php selected($this->settings['bs_ver'], '5'); ?>><?php esc_html_e('v5 (recommended)', 'ayecode-connect'); ?></option> |
|
910 | + <option value="4" <?php selected($this->settings['bs_ver'], '4'); ?>><?php esc_html_e('v4 (legacy)', 'ayecode-connect'); ?></option> |
|
911 | 911 | </select> |
912 | 912 | </td> |
913 | 913 | </tr> |
914 | 914 | </table> |
915 | 915 | |
916 | - <h2><?php esc_html_e( 'Frontend', 'ayecode-connect' ); ?></h2> |
|
916 | + <h2><?php esc_html_e('Frontend', 'ayecode-connect'); ?></h2> |
|
917 | 917 | <table class="form-table wpbs-table-settings"> |
918 | 918 | <tr valign="top"> |
919 | - <th scope="row"><label for="wpbs-css"><?php esc_html_e( 'Load CSS', 'ayecode-connect' ); ?></label></th> |
|
919 | + <th scope="row"><label for="wpbs-css"><?php esc_html_e('Load CSS', 'ayecode-connect'); ?></label></th> |
|
920 | 920 | <td> |
921 | 921 | <select name="ayecode-ui-settings[css]" id="wpbs-css" <?php echo !empty($overrides['css']) ? 'disabled' : ''; ?>> |
922 | - <option value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php esc_html_e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option> |
|
923 | - <option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php esc_html_e( 'Full Mode', 'ayecode-connect' ); ?></option> |
|
924 | - <option value="" <?php selected( $this->settings['css'], '' ); ?>><?php esc_html_e( 'Disabled', 'ayecode-connect' ); ?></option> |
|
922 | + <option value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php esc_html_e('Compatibility Mode (default)', 'ayecode-connect'); ?></option> |
|
923 | + <option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php esc_html_e('Full Mode', 'ayecode-connect'); ?></option> |
|
924 | + <option value="" <?php selected($this->settings['css'], ''); ?>><?php esc_html_e('Disabled', 'ayecode-connect'); ?></option> |
|
925 | 925 | </select> |
926 | 926 | </td> |
927 | 927 | </tr> |
928 | 928 | |
929 | 929 | <tr valign="top"> |
930 | - <th scope="row"><label for="wpbs-js"><?php esc_html_e( 'Load JS', 'ayecode-connect' ); ?></label></th> |
|
930 | + <th scope="row"><label for="wpbs-js"><?php esc_html_e('Load JS', 'ayecode-connect'); ?></label></th> |
|
931 | 931 | <td> |
932 | 932 | <select name="ayecode-ui-settings[js]" id="wpbs-js" <?php echo !empty($overrides['js']) ? 'disabled' : ''; ?>> |
933 | - <option value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php esc_html_e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option> |
|
934 | - <option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php esc_html_e( 'Popper', 'ayecode-connect' ); ?></option> |
|
935 | - <option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php esc_html_e( 'Required functions only', 'ayecode-connect' ); ?></option> |
|
936 | - <option value="" <?php selected( $this->settings['js'], '' ); ?>><?php esc_html_e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option> |
|
933 | + <option value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php esc_html_e('Core + Popper (default)', 'ayecode-connect'); ?></option> |
|
934 | + <option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php esc_html_e('Popper', 'ayecode-connect'); ?></option> |
|
935 | + <option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php esc_html_e('Required functions only', 'ayecode-connect'); ?></option> |
|
936 | + <option value="" <?php selected($this->settings['js'], ''); ?>><?php esc_html_e('Disabled (not recommended)', 'ayecode-connect'); ?></option> |
|
937 | 937 | </select> |
938 | 938 | </td> |
939 | 939 | </tr> |
940 | 940 | |
941 | 941 | <tr valign="top"> |
942 | - <th scope="row"><label for="wpbs-font_size"><?php esc_html_e( 'HTML Font Size (px)', 'ayecode-connect' ); ?></label></th> |
|
942 | + <th scope="row"><label for="wpbs-font_size"><?php esc_html_e('HTML Font Size (px)', 'ayecode-connect'); ?></label></th> |
|
943 | 943 | <td> |
944 | - <input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint( $this->settings['html_font_size']); ?>" placeholder="16" <?php echo !empty($overrides['html_font_size']) ? 'disabled' : ''; ?> /> |
|
945 | - <p class="description" ><?php esc_html_e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'ayecode-connect' );?></p> |
|
944 | + <input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint($this->settings['html_font_size']); ?>" placeholder="16" <?php echo !empty($overrides['html_font_size']) ? 'disabled' : ''; ?> /> |
|
945 | + <p class="description" ><?php esc_html_e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'ayecode-connect'); ?></p> |
|
946 | 946 | </td> |
947 | 947 | </tr> |
948 | 948 | |
949 | 949 | </table> |
950 | 950 | |
951 | - <h2><?php esc_html_e( 'Backend', 'ayecode-connect' ); ?> (wp-admin)</h2> |
|
951 | + <h2><?php esc_html_e('Backend', 'ayecode-connect'); ?> (wp-admin)</h2> |
|
952 | 952 | <table class="form-table wpbs-table-settings"> |
953 | 953 | <tr valign="top"> |
954 | - <th scope="row"><label for="wpbs-css-admin"><?php esc_html_e( 'Load CSS', 'ayecode-connect' ); ?></label></th> |
|
954 | + <th scope="row"><label for="wpbs-css-admin"><?php esc_html_e('Load CSS', 'ayecode-connect'); ?></label></th> |
|
955 | 955 | <td> |
956 | 956 | <select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin" <?php echo !empty($overrides['css_backend']) ? 'disabled' : ''; ?>> |
957 | - <option value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php esc_html_e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option> |
|
958 | - <option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php esc_html_e( 'Full Mode (will cause style issues)', 'ayecode-connect' ); ?></option> |
|
959 | - <option value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php esc_html_e( 'Disabled', 'ayecode-connect' ); ?></option> |
|
957 | + <option value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php esc_html_e('Compatibility Mode (default)', 'ayecode-connect'); ?></option> |
|
958 | + <option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php esc_html_e('Full Mode (will cause style issues)', 'ayecode-connect'); ?></option> |
|
959 | + <option value="" <?php selected($this->settings['css_backend'], ''); ?>><?php esc_html_e('Disabled', 'ayecode-connect'); ?></option> |
|
960 | 960 | </select> |
961 | 961 | </td> |
962 | 962 | </tr> |
963 | 963 | |
964 | 964 | <tr valign="top"> |
965 | - <th scope="row"><label for="wpbs-js-admin"><?php esc_html_e( 'Load JS', 'ayecode-connect' ); ?></label></th> |
|
965 | + <th scope="row"><label for="wpbs-js-admin"><?php esc_html_e('Load JS', 'ayecode-connect'); ?></label></th> |
|
966 | 966 | <td> |
967 | 967 | <select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin" <?php echo !empty($overrides['js_backend']) ? 'disabled' : ''; ?>> |
968 | - <option value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php esc_html_e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option> |
|
969 | - <option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php esc_html_e( 'Popper', 'ayecode-connect' ); ?></option> |
|
970 | - <option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php esc_html_e( 'Required functions only', 'ayecode-connect' ); ?></option> |
|
971 | - <option value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php esc_html_e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option> |
|
968 | + <option value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php esc_html_e('Core + Popper (default)', 'ayecode-connect'); ?></option> |
|
969 | + <option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php esc_html_e('Popper', 'ayecode-connect'); ?></option> |
|
970 | + <option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php esc_html_e('Required functions only', 'ayecode-connect'); ?></option> |
|
971 | + <option value="" <?php selected($this->settings['js_backend'], ''); ?>><?php esc_html_e('Disabled (not recommended)', 'ayecode-connect'); ?></option> |
|
972 | 972 | </select> |
973 | 973 | </td> |
974 | 974 | </tr> |
975 | 975 | |
976 | 976 | <tr valign="top"> |
977 | - <th scope="row"><label for="wpbs-disable-admin"><?php esc_html_e( 'Disable load on URL', 'ayecode-connect' ); ?></label></th> |
|
977 | + <th scope="row"><label for="wpbs-disable-admin"><?php esc_html_e('Disable load on URL', 'ayecode-connect'); ?></label></th> |
|
978 | 978 | <td> |
979 | - <p><?php esc_html_e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'ayecode-connect' ); ?></p> |
|
980 | - <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php action=go"><?php echo esc_textarea( $this->settings['disable_admin'] );?></textarea> |
|
979 | + <p><?php esc_html_e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'ayecode-connect'); ?></p> |
|
980 | + <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php action=go"><?php echo esc_textarea($this->settings['disable_admin']); ?></textarea> |
|
981 | 981 | </td> |
982 | 982 | </tr> |
983 | 983 | </table> |
@@ -986,33 +986,33 @@ discard block |
||
986 | 986 | submit_button(); |
987 | 987 | ?> |
988 | 988 | </form> |
989 | - <div id="wpbs-version" data-aui-source="<?php echo esc_attr( $this->get_load_source() ); ?>"><?php echo esc_html( $this->version ); ?></div> |
|
989 | + <div id="wpbs-version" data-aui-source="<?php echo esc_attr($this->get_load_source()); ?>"><?php echo esc_html($this->version); ?></div> |
|
990 | 990 | </div> |
991 | 991 | <?php |
992 | 992 | } |
993 | 993 | |
994 | - public function get_load_source(){ |
|
995 | - $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) ); |
|
996 | - $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) ); |
|
994 | + public function get_load_source() { |
|
995 | + $file = str_replace(array("/", "\\"), "/", realpath(__FILE__)); |
|
996 | + $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR)); |
|
997 | 997 | |
998 | 998 | // Find source plugin/theme of SD |
999 | 999 | $source = array(); |
1000 | - if ( strpos( $file, $plugins_dir ) !== false ) { |
|
1001 | - $source = explode( "/", plugin_basename( $file ) ); |
|
1002 | - } else if ( function_exists( 'get_theme_root' ) ) { |
|
1003 | - $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) ); |
|
1000 | + if (strpos($file, $plugins_dir) !== false) { |
|
1001 | + $source = explode("/", plugin_basename($file)); |
|
1002 | + } else if (function_exists('get_theme_root')) { |
|
1003 | + $themes_dir = str_replace(array("/", "\\"), "/", realpath(get_theme_root())); |
|
1004 | 1004 | |
1005 | - if ( strpos( $file, $themes_dir ) !== false ) { |
|
1006 | - $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) ); |
|
1005 | + if (strpos($file, $themes_dir) !== false) { |
|
1006 | + $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/")); |
|
1007 | 1007 | } |
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | return isset($source[0]) ? esc_attr($source[0]) : ''; |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - public function customizer_settings($wp_customize){ |
|
1013 | + public function customizer_settings($wp_customize) { |
|
1014 | 1014 | $wp_customize->add_section('aui_settings', array( |
1015 | - 'title' => __('AyeCode UI', 'ayecode-connect' ), |
|
1015 | + 'title' => __('AyeCode UI', 'ayecode-connect'), |
|
1016 | 1016 | 'priority' => 120, |
1017 | 1017 | )); |
1018 | 1018 | |
@@ -1026,8 +1026,8 @@ discard block |
||
1026 | 1026 | 'type' => 'option', |
1027 | 1027 | 'transport' => 'refresh', |
1028 | 1028 | )); |
1029 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
1030 | - 'label' => __('Primary Color', 'ayecode-connect' ), |
|
1029 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
1030 | + 'label' => __('Primary Color', 'ayecode-connect'), |
|
1031 | 1031 | 'section' => 'aui_settings', |
1032 | 1032 | 'settings' => 'aui_options[color_primary]', |
1033 | 1033 | ))); |
@@ -1039,8 +1039,8 @@ discard block |
||
1039 | 1039 | 'type' => 'option', |
1040 | 1040 | 'transport' => 'refresh', |
1041 | 1041 | )); |
1042 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1043 | - 'label' => __('Secondary Color', 'ayecode-connect' ), |
|
1042 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1043 | + 'label' => __('Secondary Color', 'ayecode-connect'), |
|
1044 | 1044 | 'section' => 'aui_settings', |
1045 | 1045 | 'settings' => 'aui_options[color_secondary]', |
1046 | 1046 | ))); |
@@ -1066,12 +1066,12 @@ discard block |
||
1066 | 1066 | .collapse.show:not(.in){display: inherit;} |
1067 | 1067 | .fade.show{opacity: 1;} |
1068 | 1068 | |
1069 | - <?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?> |
|
1069 | + <?php if (defined('SVQ_THEME_VERSION')) { ?> |
|
1070 | 1070 | /* KLEO theme specific */ |
1071 | 1071 | .kleo-main-header .navbar-collapse.collapse.show:not(.in){display: block !important;} |
1072 | 1072 | <?php } ?> |
1073 | 1073 | |
1074 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
1074 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
1075 | 1075 | /* With Avada builder */ |
1076 | 1076 | body.modal-open .modal.in {opacity:1;z-index: 99999} |
1077 | 1077 | body.modal-open .modal.bsui.in .modal-content {box-shadow: none;} |
@@ -1082,10 +1082,10 @@ discard block |
||
1082 | 1082 | <?php } ?> |
1083 | 1083 | </style> |
1084 | 1084 | <?php |
1085 | - return str_replace( array( |
|
1085 | + return str_replace(array( |
|
1086 | 1086 | '<style>', |
1087 | 1087 | '</style>' |
1088 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
1088 | + ), '', self::minify_css(ob_get_clean())); |
|
1089 | 1089 | } |
1090 | 1090 | |
1091 | 1091 | |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | global $aui_bs5; |
1094 | 1094 | |
1095 | 1095 | $colors = array(); |
1096 | - if ( defined( 'BLOCKSTRAP_VERSION' ) ) { |
|
1096 | + if (defined('BLOCKSTRAP_VERSION')) { |
|
1097 | 1097 | |
1098 | 1098 | |
1099 | 1099 | $setting = wp_get_global_settings(); |
@@ -1102,22 +1102,22 @@ discard block |
||
1102 | 1102 | // print_r(get_default_block_editor_settings());exit; |
1103 | 1103 | |
1104 | 1104 | // print_r($setting);echo '###';exit; |
1105 | - if(!empty($setting['color']['palette']['theme'])){ |
|
1106 | - foreach($setting['color']['palette']['theme'] as $color){ |
|
1105 | + if (!empty($setting['color']['palette']['theme'])) { |
|
1106 | + foreach ($setting['color']['palette']['theme'] as $color) { |
|
1107 | 1107 | $colors[$color['slug']] = esc_attr($color['color']); |
1108 | 1108 | } |
1109 | 1109 | } |
1110 | 1110 | |
1111 | - if(!empty($setting['color']['palette']['custom'])){ |
|
1112 | - foreach($setting['color']['palette']['custom'] as $color){ |
|
1111 | + if (!empty($setting['color']['palette']['custom'])) { |
|
1112 | + foreach ($setting['color']['palette']['custom'] as $color) { |
|
1113 | 1113 | $colors[$color['slug']] = esc_attr($color['color']); |
1114 | 1114 | } |
1115 | 1115 | } |
1116 | - }else{ |
|
1116 | + } else { |
|
1117 | 1117 | $settings = get_option('aui_options'); |
1118 | 1118 | $colors = array( |
1119 | - 'primary' => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR, |
|
1120 | - 'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR |
|
1119 | + 'primary' => !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR, |
|
1120 | + 'secondary' => !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR |
|
1121 | 1121 | ); |
1122 | 1122 | } |
1123 | 1123 | |
@@ -1128,25 +1128,25 @@ discard block |
||
1128 | 1128 | <?php |
1129 | 1129 | |
1130 | 1130 | // BS v3 compat |
1131 | - if( self::is_bs3_compat() ){ |
|
1131 | + if (self::is_bs3_compat()) { |
|
1132 | 1132 | echo self::bs3_compat_css(); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
1133 | 1133 | } |
1134 | 1134 | |
1135 | - $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : ''; |
|
1135 | + $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
|
1136 | 1136 | $is_fse = false; |
1137 | - if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) ) ) { |
|
1137 | + if (is_admin() && (!empty($_REQUEST['postType']) || $current_screen->is_block_editor()) && (defined('BLOCKSTRAP_VERSION') || defined('AUI_FSE'))) { |
|
1138 | 1138 | $is_fse = true; |
1139 | 1139 | } |
1140 | 1140 | |
1141 | - if(!empty($colors)){ |
|
1141 | + if (!empty($colors)) { |
|
1142 | 1142 | $d_colors = self::get_colors(true); |
1143 | 1143 | |
1144 | 1144 | // $is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'; |
1145 | - foreach($colors as $key => $color ){ |
|
1146 | - if((empty( $d_colors[$key]) || $d_colors[$key] != $color) || $is_fse ) { |
|
1145 | + foreach ($colors as $key => $color) { |
|
1146 | + if ((empty($d_colors[$key]) || $d_colors[$key] != $color) || $is_fse) { |
|
1147 | 1147 | $var = $is_fse ? "var(--wp--preset--color--$key)" : $color; |
1148 | 1148 | $compat = $is_fse ? '.editor-styles-wrapper' : $compatibility; |
1149 | - echo $aui_bs5 ? self::css_overwrite_bs5($key,$var,$compat,$color) : self::css_overwrite($key,$var,$compat,$color); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1149 | + echo $aui_bs5 ? self::css_overwrite_bs5($key, $var, $compat, $color) : self::css_overwrite($key, $var, $compat, $color); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1150 | 1150 | } |
1151 | 1151 | } |
1152 | 1152 | // exit; |
@@ -1155,71 +1155,71 @@ discard block |
||
1155 | 1155 | // Set admin bar z-index lower when modal is open. |
1156 | 1156 | echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}'; |
1157 | 1157 | |
1158 | - if(is_admin()){ |
|
1158 | + if (is_admin()) { |
|
1159 | 1159 | echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}'; |
1160 | 1160 | } |
1161 | 1161 | |
1162 | - if( $aui_bs5 && defined( 'BLOCKSTRAP_VERSION' ) ){ |
|
1162 | + if ($aui_bs5 && defined('BLOCKSTRAP_VERSION')) { |
|
1163 | 1163 | $css = ''; |
1164 | 1164 | $theme_settings = wp_get_global_styles(); |
1165 | 1165 | |
1166 | 1166 | // print_r( $theme_settings);exit; |
1167 | 1167 | |
1168 | 1168 | // font face |
1169 | - if( !empty( $theme_settings['typography']['fontFamily'] ) ){ |
|
1170 | - $t_fontface = str_replace( array('var:preset|','font-family|'), array('--wp--preset--','font-family--'), $theme_settings['typography']['fontFamily'] ); //var(--wp--preset--font-family--poppins) |
|
1169 | + if (!empty($theme_settings['typography']['fontFamily'])) { |
|
1170 | + $t_fontface = str_replace(array('var:preset|', 'font-family|'), array('--wp--preset--', 'font-family--'), $theme_settings['typography']['fontFamily']); //var(--wp--preset--font-family--poppins) |
|
1171 | 1171 | $css .= '--bs-body-font-family: ' . esc_attr($t_fontface) . ';'; |
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // font size |
1175 | - if( !empty( $theme_settings['typography']['fontSize'] ) ){ |
|
1176 | - $css .= '--bs-body-font-size: ' . esc_attr( $theme_settings['typography']['fontSize'] ) . ' ;'; |
|
1175 | + if (!empty($theme_settings['typography']['fontSize'])) { |
|
1176 | + $css .= '--bs-body-font-size: ' . esc_attr($theme_settings['typography']['fontSize']) . ' ;'; |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | // line height |
1180 | - if( !empty( $theme_settings['typography']['lineHeight'] ) ){ |
|
1181 | - $css .= '--bs-body-line-height: ' . esc_attr( $theme_settings['typography']['lineHeight'] ) . ';'; |
|
1180 | + if (!empty($theme_settings['typography']['lineHeight'])) { |
|
1181 | + $css .= '--bs-body-line-height: ' . esc_attr($theme_settings['typography']['lineHeight']) . ';'; |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | |
1185 | 1185 | // font weight |
1186 | - if( !empty( $theme_settings['typography']['fontWeight'] ) ){ |
|
1187 | - $css .= '--bs-body-font-weight: ' . esc_attr( $theme_settings['typography']['fontWeight'] ) . ';'; |
|
1186 | + if (!empty($theme_settings['typography']['fontWeight'])) { |
|
1187 | + $css .= '--bs-body-font-weight: ' . esc_attr($theme_settings['typography']['fontWeight']) . ';'; |
|
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | // Background |
1191 | - if( !empty( $theme_settings['color']['background'] ) ){ |
|
1192 | - $css .= '--bs-body-bg: ' . esc_attr( $theme_settings['color']['background'] ) . ';'; |
|
1191 | + if (!empty($theme_settings['color']['background'])) { |
|
1192 | + $css .= '--bs-body-bg: ' . esc_attr($theme_settings['color']['background']) . ';'; |
|
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | // Background Gradient |
1196 | - if( !empty( $theme_settings['color']['gradient'] ) ){ |
|
1197 | - $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';'; |
|
1196 | + if (!empty($theme_settings['color']['gradient'])) { |
|
1197 | + $css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';'; |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | // Background Gradient |
1201 | - if( !empty( $theme_settings['color']['gradient'] ) ){ |
|
1202 | - $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';'; |
|
1201 | + if (!empty($theme_settings['color']['gradient'])) { |
|
1202 | + $css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';'; |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | // text color |
1206 | - if( !empty( $theme_settings['color']['text'] ) ){ |
|
1207 | - $css .= '--bs-body-color: ' . esc_attr( $theme_settings['color']['text'] ) . ';'; |
|
1206 | + if (!empty($theme_settings['color']['text'])) { |
|
1207 | + $css .= '--bs-body-color: ' . esc_attr($theme_settings['color']['text']) . ';'; |
|
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | |
1211 | 1211 | // link colors |
1212 | - if( !empty( $theme_settings['elements']['link']['color']['text'] ) ){ |
|
1213 | - $css .= '--bs-link-color: ' . esc_attr( $theme_settings['elements']['link']['color']['text'] ) . ';'; |
|
1212 | + if (!empty($theme_settings['elements']['link']['color']['text'])) { |
|
1213 | + $css .= '--bs-link-color: ' . esc_attr($theme_settings['elements']['link']['color']['text']) . ';'; |
|
1214 | 1214 | } |
1215 | - if( !empty( $theme_settings['elements']['link'][':hover']['color']['text'] ) ){ |
|
1216 | - $css .= '--bs-link-hover-color: ' . esc_attr( $theme_settings['elements']['link'][':hover']['color']['text'] ) . ';'; |
|
1215 | + if (!empty($theme_settings['elements']['link'][':hover']['color']['text'])) { |
|
1216 | + $css .= '--bs-link-hover-color: ' . esc_attr($theme_settings['elements']['link'][':hover']['color']['text']) . ';'; |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
1220 | 1220 | |
1221 | - if($css){ |
|
1222 | - echo $is_fse ? 'body.editor-styles-wrapper{' . esc_attr( $css ) . '}' : 'body{' . esc_attr( $css ) . '}'; |
|
1221 | + if ($css) { |
|
1222 | + echo $is_fse ? 'body.editor-styles-wrapper{' . esc_attr($css) . '}' : 'body{' . esc_attr($css) . '}'; |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | $bep = $is_fse ? 'body.editor-styles-wrapper ' : ''; |
@@ -1227,42 +1227,42 @@ discard block |
||
1227 | 1227 | |
1228 | 1228 | // Headings |
1229 | 1229 | $headings_css = ''; |
1230 | - if( !empty( $theme_settings['elements']['heading']['color']['text'] ) ){ |
|
1231 | - $headings_css .= "color: " . esc_attr( $theme_settings['elements']['heading']['color']['text'] ) . ";"; |
|
1230 | + if (!empty($theme_settings['elements']['heading']['color']['text'])) { |
|
1231 | + $headings_css .= "color: " . esc_attr($theme_settings['elements']['heading']['color']['text']) . ";"; |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | // heading background |
1235 | - if( !empty( $theme_settings['elements']['heading']['color']['background'] ) ){ |
|
1236 | - $headings_css .= 'background: ' . esc_attr( $theme_settings['elements']['heading']['color']['background'] ) . ';'; |
|
1235 | + if (!empty($theme_settings['elements']['heading']['color']['background'])) { |
|
1236 | + $headings_css .= 'background: ' . esc_attr($theme_settings['elements']['heading']['color']['background']) . ';'; |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | // heading font family |
1240 | - if( !empty( $theme_settings['elements']['heading']['typography']['fontFamily'] ) ){ |
|
1241 | - $headings_css .= 'font-family: ' . esc_attr( $theme_settings['elements']['heading']['typography']['fontFamily'] ) . ';'; |
|
1240 | + if (!empty($theme_settings['elements']['heading']['typography']['fontFamily'])) { |
|
1241 | + $headings_css .= 'font-family: ' . esc_attr($theme_settings['elements']['heading']['typography']['fontFamily']) . ';'; |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | - if( $headings_css ){ |
|
1245 | - echo "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . esc_attr( $headings_css ) . "}"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1244 | + if ($headings_css) { |
|
1245 | + echo "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . esc_attr($headings_css) . "}"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1246 | 1246 | } |
1247 | 1247 | |
1248 | - $hs = array('h1','h2','h3','h4','h5','h6'); |
|
1248 | + $hs = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'); |
|
1249 | 1249 | |
1250 | - foreach($hs as $hn){ |
|
1250 | + foreach ($hs as $hn) { |
|
1251 | 1251 | $h_css = ''; |
1252 | - if( !empty( $theme_settings['elements'][$hn]['color']['text'] ) ){ |
|
1253 | - $h_css .= 'color: ' . esc_attr( $theme_settings['elements'][$hn]['color']['text'] ) . ';'; |
|
1252 | + if (!empty($theme_settings['elements'][$hn]['color']['text'])) { |
|
1253 | + $h_css .= 'color: ' . esc_attr($theme_settings['elements'][$hn]['color']['text']) . ';'; |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | - if( !empty( $theme_settings['elements'][$hn]['typography']['fontSize'] ) ){ |
|
1257 | - $h_css .= 'font-size: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontSize'] ) . ';'; |
|
1256 | + if (!empty($theme_settings['elements'][$hn]['typography']['fontSize'])) { |
|
1257 | + $h_css .= 'font-size: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontSize']) . ';'; |
|
1258 | 1258 | } |
1259 | 1259 | |
1260 | - if( !empty( $theme_settings['elements'][$hn]['typography']['fontFamily'] ) ){ |
|
1261 | - $h_css .= 'font-family: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontFamily'] ) . ';'; |
|
1260 | + if (!empty($theme_settings['elements'][$hn]['typography']['fontFamily'])) { |
|
1261 | + $h_css .= 'font-family: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontFamily']) . ';'; |
|
1262 | 1262 | } |
1263 | 1263 | |
1264 | - if($h_css){ |
|
1265 | - echo esc_attr( $bep . $hn ) . '{'.esc_attr( $h_css ).'}'; |
|
1264 | + if ($h_css) { |
|
1265 | + echo esc_attr($bep . $hn) . '{' . esc_attr($h_css) . '}'; |
|
1266 | 1266 | } |
1267 | 1267 | } |
1268 | 1268 | |
@@ -1275,10 +1275,10 @@ discard block |
||
1275 | 1275 | /* |
1276 | 1276 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1277 | 1277 | */ |
1278 | - return str_replace( array( |
|
1278 | + return str_replace(array( |
|
1279 | 1279 | '<style>', |
1280 | 1280 | '</style>' |
1281 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
1281 | + ), '', self::minify_css(ob_get_clean())); |
|
1282 | 1282 | } |
1283 | 1283 | |
1284 | 1284 | |
@@ -1288,34 +1288,34 @@ discard block |
||
1288 | 1288 | * |
1289 | 1289 | * @return bool |
1290 | 1290 | */ |
1291 | - public static function is_bs3_compat(){ |
|
1291 | + public static function is_bs3_compat() { |
|
1292 | 1292 | return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION'); |
1293 | 1293 | } |
1294 | 1294 | |
1295 | - public static function hex_to_rgb( $hex ) { |
|
1295 | + public static function hex_to_rgb($hex) { |
|
1296 | 1296 | // Remove '#' if present |
1297 | - $hex = str_replace( '#', '', $hex ); |
|
1297 | + $hex = str_replace('#', '', $hex); |
|
1298 | 1298 | |
1299 | 1299 | // Check if input is RGB |
1300 | - if ( strpos( $hex, 'rgba(' ) === 0 || strpos( $hex, 'rgb(' ) === 0 ) { |
|
1301 | - $_rgb = explode( ',', str_replace( array( 'rgba(', 'rgb(', ')' ), '', $hex ) ); |
|
1300 | + if (strpos($hex, 'rgba(') === 0 || strpos($hex, 'rgb(') === 0) { |
|
1301 | + $_rgb = explode(',', str_replace(array('rgba(', 'rgb(', ')'), '', $hex)); |
|
1302 | 1302 | |
1303 | - $rgb = ( isset( $_rgb[0] ) ? (int) trim( $_rgb[0] ) : '0' ) . ','; |
|
1304 | - $rgb .= ( isset( $_rgb[1] ) ? (int) trim( $_rgb[1] ) : '0' ) . ','; |
|
1305 | - $rgb .= ( isset( $_rgb[2] ) ? (int) trim( $_rgb[2] ) : '0' ); |
|
1303 | + $rgb = (isset($_rgb[0]) ? (int) trim($_rgb[0]) : '0') . ','; |
|
1304 | + $rgb .= (isset($_rgb[1]) ? (int) trim($_rgb[1]) : '0') . ','; |
|
1305 | + $rgb .= (isset($_rgb[2]) ? (int) trim($_rgb[2]) : '0'); |
|
1306 | 1306 | |
1307 | 1307 | return $rgb; |
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | // Convert 3-digit hex to 6-digit hex |
1311 | - if ( strlen( $hex ) == 3 ) { |
|
1312 | - $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 ); |
|
1311 | + if (strlen($hex) == 3) { |
|
1312 | + $hex = str_repeat(substr($hex, 0, 1), 2) . str_repeat(substr($hex, 1, 1), 2) . str_repeat(substr($hex, 2, 1), 2); |
|
1313 | 1313 | } |
1314 | 1314 | |
1315 | 1315 | // Convert hex to RGB |
1316 | - $r = hexdec( substr( $hex, 0, 2 ) ); |
|
1317 | - $g = hexdec( substr( $hex, 2, 2 ) ); |
|
1318 | - $b = hexdec( substr( $hex, 4, 2 ) ); |
|
1316 | + $r = hexdec(substr($hex, 0, 2)); |
|
1317 | + $g = hexdec(substr($hex, 2, 2)); |
|
1318 | + $b = hexdec(substr($hex, 4, 2)); |
|
1319 | 1319 | |
1320 | 1320 | // Return RGB values as an array |
1321 | 1321 | return $r . ',' . $g . ',' . $b; |
@@ -1330,13 +1330,13 @@ discard block |
||
1330 | 1330 | * |
1331 | 1331 | * @return string |
1332 | 1332 | */ |
1333 | - public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex = '' ){ |
|
1333 | + public static function css_overwrite_bs5($type, $color_code, $compatibility, $hex = '') { |
|
1334 | 1334 | global $aui_bs5; |
1335 | 1335 | |
1336 | 1336 | $is_var = false; |
1337 | 1337 | $is_custom = strpos($type, 'custom-') !== false ? true : false; |
1338 | - if(!$color_code){return '';} |
|
1339 | - if(strpos($color_code, 'var') !== false){ |
|
1338 | + if (!$color_code) {return ''; } |
|
1339 | + if (strpos($color_code, 'var') !== false) { |
|
1340 | 1340 | //if(!sanitize_hex_color($color_code)){ |
1341 | 1341 | $color_code = esc_attr($color_code); |
1342 | 1342 | $is_var = true; |
@@ -1346,15 +1346,15 @@ discard block |
||
1346 | 1346 | |
1347 | 1347 | // echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit; |
1348 | 1348 | |
1349 | - if(!$color_code){return '';} |
|
1349 | + if (!$color_code) {return ''; } |
|
1350 | 1350 | |
1351 | 1351 | $rgb = self::hex_to_rgb($hex); |
1352 | 1352 | |
1353 | - if($compatibility===true || $compatibility===1){ |
|
1353 | + if ($compatibility === true || $compatibility === 1) { |
|
1354 | 1354 | $compatibility = '.bsui'; |
1355 | - }elseif(!$compatibility){ |
|
1355 | + }elseif (!$compatibility) { |
|
1356 | 1356 | $compatibility = ''; |
1357 | - }else{ |
|
1357 | + } else { |
|
1358 | 1358 | $compatibility = esc_attr($compatibility); |
1359 | 1359 | } |
1360 | 1360 | |
@@ -1371,30 +1371,30 @@ discard block |
||
1371 | 1371 | * c = color, b = background color, o = border-color, f = fill |
1372 | 1372 | */ |
1373 | 1373 | $selectors = array( |
1374 | - ".btn-{$type}" => array( 'b', 'o' ), |
|
1375 | - ".btn-{$type}.disabled" => array( 'b', 'o' ), |
|
1376 | - ".btn-{$type}:disabled" => array( 'b', 'o' ), |
|
1377 | - ".btn-outline-{$type}" => array( 'c', 'o' ), |
|
1378 | - ".btn-outline-{$type}:hover" => array( 'b', 'o' ), |
|
1379 | - ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ), |
|
1380 | - ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ), |
|
1381 | - ".show>.btn-outline-{$type}.dropdown-toggle" => array( 'b', 'o' ), |
|
1382 | - ".badge-{$type}" => array( 'b' ), |
|
1383 | - ".alert-{$type}" => array( 'b', 'o' ), |
|
1384 | - ".bg-{$type}" => array( 'b', 'f' ), |
|
1385 | - ".btn-link.btn-{$type}" => array( 'c' ), |
|
1386 | - ".text-{$type}" => array( 'c' ), |
|
1374 | + ".btn-{$type}" => array('b', 'o'), |
|
1375 | + ".btn-{$type}.disabled" => array('b', 'o'), |
|
1376 | + ".btn-{$type}:disabled" => array('b', 'o'), |
|
1377 | + ".btn-outline-{$type}" => array('c', 'o'), |
|
1378 | + ".btn-outline-{$type}:hover" => array('b', 'o'), |
|
1379 | + ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'), |
|
1380 | + ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'), |
|
1381 | + ".show>.btn-outline-{$type}.dropdown-toggle" => array('b', 'o'), |
|
1382 | + ".badge-{$type}" => array('b'), |
|
1383 | + ".alert-{$type}" => array('b', 'o'), |
|
1384 | + ".bg-{$type}" => array('b', 'f'), |
|
1385 | + ".btn-link.btn-{$type}" => array('c'), |
|
1386 | + ".text-{$type}" => array('c'), |
|
1387 | 1387 | ); |
1388 | 1388 | |
1389 | - if ( $aui_bs5 ) { |
|
1390 | - unset($selectors[".alert-{$type}" ]); |
|
1389 | + if ($aui_bs5) { |
|
1390 | + unset($selectors[".alert-{$type}"]); |
|
1391 | 1391 | } |
1392 | 1392 | |
1393 | - if ( $type == 'primary' ) { |
|
1393 | + if ($type == 'primary') { |
|
1394 | 1394 | $selectors = $selectors + array( |
1395 | - 'a' => array( 'c' ), |
|
1396 | - '.btn-link' => array( 'c' ), |
|
1397 | - '.dropdown-item.active' => array( 'b' ), |
|
1395 | + 'a' => array('c'), |
|
1396 | + '.btn-link' => array('c'), |
|
1397 | + '.dropdown-item.active' => array('b'), |
|
1398 | 1398 | '.custom-control-input:checked~.custom-control-label::before' => array( |
1399 | 1399 | 'b', |
1400 | 1400 | 'o' |
@@ -1403,57 +1403,57 @@ discard block |
||
1403 | 1403 | 'b', |
1404 | 1404 | 'o' |
1405 | 1405 | ), |
1406 | - '.nav-pills .nav-link.active' => array( 'b' ), |
|
1407 | - '.nav-pills .show>.nav-link' => array( 'b' ), |
|
1408 | - '.page-link' => array( 'c' ), |
|
1406 | + '.nav-pills .nav-link.active' => array('b'), |
|
1407 | + '.nav-pills .show>.nav-link' => array('b'), |
|
1408 | + '.page-link' => array('c'), |
|
1409 | 1409 | '.page-item.active .page-link' => array( |
1410 | 1410 | 'b', |
1411 | 1411 | 'o' |
1412 | 1412 | ), |
1413 | - '.progress-bar' => array( 'b' ), |
|
1413 | + '.progress-bar' => array('b'), |
|
1414 | 1414 | '.list-group-item.active' => array( |
1415 | 1415 | 'b', |
1416 | 1416 | 'o' |
1417 | 1417 | ), |
1418 | - '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ), |
|
1418 | + '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
|
1419 | 1419 | ); |
1420 | 1420 | } |
1421 | 1421 | |
1422 | 1422 | |
1423 | 1423 | |
1424 | 1424 | // link |
1425 | - if ( $type === 'primary' ) { |
|
1426 | - $output .= 'html body {--bs-link-hover-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .75); --bs-link-color: var(--bs-'.esc_attr($type).'); }'; |
|
1427 | - $output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: '.esc_attr($color_code).'; }'; |
|
1428 | - $output .= $prefix . ' .navbar { --bs-nav-link-hover-color: '.esc_attr($color_code).'; --bs-navbar-hover-color: '.esc_attr($color_code).'; --bs-navbar-active-color: '.esc_attr($color_code).'; }'; |
|
1425 | + if ($type === 'primary') { |
|
1426 | + $output .= 'html body {--bs-link-hover-color: rgba(var(--bs-' . esc_attr($type) . '-rgb), .75); --bs-link-color: var(--bs-' . esc_attr($type) . '); }'; |
|
1427 | + $output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: ' . esc_attr($color_code) . '; }'; |
|
1428 | + $output .= $prefix . ' .navbar { --bs-nav-link-hover-color: ' . esc_attr($color_code) . '; --bs-navbar-hover-color: ' . esc_attr($color_code) . '; --bs-navbar-active-color: ' . esc_attr($color_code) . '; }'; |
|
1429 | 1429 | |
1430 | - $output .= $prefix . ' a{color: var(--bs-'.esc_attr($type).');}'; |
|
1431 | - $output .= $prefix . ' .text-primary{color: var(--bs-'.esc_attr($type).') !important;}'; |
|
1430 | + $output .= $prefix . ' a{color: var(--bs-' . esc_attr($type) . ');}'; |
|
1431 | + $output .= $prefix . ' .text-primary{color: var(--bs-' . esc_attr($type) . ') !important;}'; |
|
1432 | 1432 | |
1433 | 1433 | // dropdown |
1434 | - $output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-'.esc_attr($type).'); --bs-dropdown-link-active-color: var(--bs-'.esc_attr($type).');}'; |
|
1434 | + $output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-' . esc_attr($type) . '); --bs-dropdown-link-active-color: var(--bs-' . esc_attr($type) . ');}'; |
|
1435 | 1435 | |
1436 | 1436 | // pagination |
1437 | - $output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-'.esc_attr($type).'); --bs-pagination-active-bg: var(--bs-'.esc_attr($type).');}'; |
|
1437 | + $output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-' . esc_attr($type) . '); --bs-pagination-active-bg: var(--bs-' . esc_attr($type) . ');}'; |
|
1438 | 1438 | |
1439 | 1439 | } |
1440 | 1440 | |
1441 | - $output .= $prefix . ' .link-'.esc_attr($type).' {color: var(--bs-'.esc_attr($type).'-rgb) !important;}'; |
|
1442 | - $output .= $prefix . ' .link-'.esc_attr($type).':hover {color: rgba(var(--bs-'.esc_attr($type).'-rgb), .8) !important;}'; |
|
1441 | + $output .= $prefix . ' .link-' . esc_attr($type) . ' {color: var(--bs-' . esc_attr($type) . '-rgb) !important;}'; |
|
1442 | + $output .= $prefix . ' .link-' . esc_attr($type) . ':hover {color: rgba(var(--bs-' . esc_attr($type) . '-rgb), .8) !important;}'; |
|
1443 | 1443 | |
1444 | 1444 | // buttons |
1445 | - $output .= $prefix . ' .btn-'.esc_attr($type).'{'; |
|
1445 | + $output .= $prefix . ' .btn-' . esc_attr($type) . '{'; |
|
1446 | 1446 | $output .= ' |
1447 | - --bs-btn-bg: '.esc_attr($color_code).'; |
|
1448 | - --bs-btn-border-color: '.esc_attr($color_code).'; |
|
1449 | - --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1450 | - --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1451 | - --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb; |
|
1452 | - --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1453 | - --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1447 | + --bs-btn-bg: '.esc_attr($color_code) . '; |
|
1448 | + --bs-btn-border-color: '.esc_attr($color_code) . '; |
|
1449 | + --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1450 | + --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1451 | + --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type) . '-rgb; |
|
1452 | + --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1453 | + --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1454 | 1454 | --bs-btn-active-shadow: unset; |
1455 | - --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5); |
|
1456 | - --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1); |
|
1455 | + --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .5); |
|
1456 | + --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .1); |
|
1457 | 1457 | '; |
1458 | 1458 | // $output .= ' |
1459 | 1459 | // --bs-btn-color: #fff; |
@@ -1464,18 +1464,18 @@ discard block |
||
1464 | 1464 | $output .= '}'; |
1465 | 1465 | |
1466 | 1466 | // buttons outline |
1467 | - $output .= $prefix . ' .btn-outline-'.esc_attr($type).'{'; |
|
1467 | + $output .= $prefix . ' .btn-outline-' . esc_attr($type) . '{'; |
|
1468 | 1468 | $output .= ' |
1469 | - --bs-btn-color: '.esc_attr($color_code).'; |
|
1470 | - --bs-btn-border-color: '.esc_attr($color_code).'; |
|
1471 | - --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1472 | - --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1473 | - --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb; |
|
1474 | - --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1475 | - --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1469 | + --bs-btn-color: '.esc_attr($color_code) . '; |
|
1470 | + --bs-btn-border-color: '.esc_attr($color_code) . '; |
|
1471 | + --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1472 | + --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1473 | + --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type) . '-rgb; |
|
1474 | + --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1475 | + --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1476 | 1476 | --bs-btn-active-shadow: unset; |
1477 | - --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5); |
|
1478 | - --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1); |
|
1477 | + --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .5); |
|
1478 | + --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .1); |
|
1479 | 1479 | '; |
1480 | 1480 | // $output .= ' |
1481 | 1481 | // --bs-btn-color: #fff; |
@@ -1487,32 +1487,32 @@ discard block |
||
1487 | 1487 | |
1488 | 1488 | |
1489 | 1489 | // button hover |
1490 | - $output .= $prefix . ' .btn-'.esc_attr($type).':hover{'; |
|
1490 | + $output .= $prefix . ' .btn-' . esc_attr($type) . ':hover{'; |
|
1491 | 1491 | $output .= ' |
1492 | - box-shadow: 0 0.25rem 0.25rem 0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb), .1), 0 0.375rem 0.75rem -0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb) , .4); |
|
1492 | + box-shadow: 0 0.25rem 0.25rem 0.125rem rgb(var(--bs-'.esc_attr($type) . '-rgb), .1), 0 0.375rem 0.75rem -0.125rem rgb(var(--bs-' . esc_attr($type) . '-rgb) , .4); |
|
1493 | 1493 | } |
1494 | 1494 | '; |
1495 | 1495 | |
1496 | 1496 | |
1497 | - if ( $aui_bs5 ) { |
|
1497 | + if ($aui_bs5) { |
|
1498 | 1498 | // $output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }'; |
1499 | - $output .= 'html body {--bs-'.esc_attr($type).': '.esc_attr($color_code).'; }'; |
|
1500 | - $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }'; |
|
1499 | + $output .= 'html body {--bs-' . esc_attr($type) . ': ' . esc_attr($color_code) . '; }'; |
|
1500 | + $output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }'; |
|
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | |
1504 | - if ( $is_custom ) { |
|
1504 | + if ($is_custom) { |
|
1505 | 1505 | |
1506 | 1506 | // echo '###'.$type;exit; |
1507 | 1507 | |
1508 | 1508 | // build rules into each type |
1509 | - foreach($selectors as $selector => $types){ |
|
1510 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
1511 | - $types = array_combine($types,$types); |
|
1512 | - if(isset($types['c'])){$color[] = $selector;} |
|
1513 | - if(isset($types['b'])){$background[] = $selector;} |
|
1514 | - if(isset($types['o'])){$border[] = $selector;} |
|
1515 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1509 | + foreach ($selectors as $selector => $types) { |
|
1510 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
1511 | + $types = array_combine($types, $types); |
|
1512 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1513 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1514 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1515 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1516 | 1516 | } |
1517 | 1517 | |
1518 | 1518 | // // build rules into each type |
@@ -1526,36 +1526,36 @@ discard block |
||
1526 | 1526 | // } |
1527 | 1527 | |
1528 | 1528 | // add any color rules |
1529 | - if(!empty($color)){ |
|
1530 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1529 | + if (!empty($color)) { |
|
1530 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1531 | 1531 | } |
1532 | - if(!empty($color_i)){ |
|
1533 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1532 | + if (!empty($color_i)) { |
|
1533 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | // add any background color rules |
1537 | - if(!empty($background)){ |
|
1538 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1537 | + if (!empty($background)) { |
|
1538 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1539 | 1539 | } |
1540 | - if(!empty($background_i)){ |
|
1541 | - $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1540 | + if (!empty($background_i)) { |
|
1541 | + $output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1542 | 1542 | // $output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} "; |
1543 | 1543 | } |
1544 | 1544 | |
1545 | 1545 | // add any border color rules |
1546 | - if(!empty($border)){ |
|
1547 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1546 | + if (!empty($border)) { |
|
1547 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1548 | 1548 | } |
1549 | - if(!empty($border_i)){ |
|
1550 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1549 | + if (!empty($border_i)) { |
|
1550 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1551 | 1551 | } |
1552 | 1552 | |
1553 | 1553 | // add any fill color rules |
1554 | - if(!empty($fill)){ |
|
1555 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1554 | + if (!empty($fill)) { |
|
1555 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1556 | 1556 | } |
1557 | - if(!empty($fill_i)){ |
|
1558 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1557 | + if (!empty($fill_i)) { |
|
1558 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1559 | 1559 | } |
1560 | 1560 | |
1561 | 1561 | } |
@@ -1565,25 +1565,25 @@ discard block |
||
1565 | 1565 | |
1566 | 1566 | $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;' : ''; |
1567 | 1567 | // darken |
1568 | - $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075"); |
|
1569 | - $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10"); |
|
1570 | - $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125"); |
|
1571 | - $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4"); |
|
1568 | + $darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075"); |
|
1569 | + $darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10"); |
|
1570 | + $darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125"); |
|
1571 | + $darker_40 = $is_var ? $color_code . ';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code, "-0.4"); |
|
1572 | 1572 | |
1573 | 1573 | // lighten |
1574 | - $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25"); |
|
1574 | + $lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25"); |
|
1575 | 1575 | |
1576 | 1576 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1577 | - $op_25 = $color_code."40"; // 25% opacity |
|
1577 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1578 | 1578 | |
1579 | 1579 | |
1580 | 1580 | // button states |
1581 | - $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : ''; |
|
1582 | - $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
1581 | + $output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : ''; |
|
1582 | + $output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
1583 | 1583 | // $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000; border-color: #000;} "; |
1584 | - $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;} "; |
|
1585 | - $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.";} "; |
|
1586 | - $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;} "; |
|
1584 | + $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;} "; |
|
1585 | + $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 . ";} "; |
|
1586 | + $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;} "; |
|
1587 | 1587 | |
1588 | 1588 | // text |
1589 | 1589 | // $output .= $prefix .".xxx, .text-{$type} {color: var(--bs-".esc_attr($type).");} "; |
@@ -1601,9 +1601,9 @@ discard block |
||
1601 | 1601 | // } |
1602 | 1602 | |
1603 | 1603 | // alerts |
1604 | - if ( $aui_bs5 ) { |
|
1604 | + if ($aui_bs5) { |
|
1605 | 1605 | // $output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20; border-color: ".$color_code."30;color:$darker_40} "; |
1606 | - $output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} "; |
|
1606 | + $output .= $prefix . " .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} "; |
|
1607 | 1607 | } |
1608 | 1608 | |
1609 | 1609 | return $output; |
@@ -1618,12 +1618,12 @@ discard block |
||
1618 | 1618 | * |
1619 | 1619 | * @return string |
1620 | 1620 | */ |
1621 | - public static function css_overwrite($type,$color_code,$compatibility, $hex = '' ){ |
|
1621 | + public static function css_overwrite($type, $color_code, $compatibility, $hex = '') { |
|
1622 | 1622 | global $aui_bs5; |
1623 | 1623 | |
1624 | 1624 | $is_var = false; |
1625 | - if(!$color_code){return '';} |
|
1626 | - if(strpos($color_code, 'var') !== false){ |
|
1625 | + if (!$color_code) {return ''; } |
|
1626 | + if (strpos($color_code, 'var') !== false) { |
|
1627 | 1627 | //if(!sanitize_hex_color($color_code)){ |
1628 | 1628 | $color_code = esc_attr($color_code); |
1629 | 1629 | $is_var = true; |
@@ -1633,15 +1633,15 @@ discard block |
||
1633 | 1633 | |
1634 | 1634 | // echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit; |
1635 | 1635 | |
1636 | - if(!$color_code){return '';} |
|
1636 | + if (!$color_code) {return ''; } |
|
1637 | 1637 | |
1638 | 1638 | $rgb = self::hex_to_rgb($hex); |
1639 | 1639 | |
1640 | - if($compatibility===true || $compatibility===1){ |
|
1640 | + if ($compatibility === true || $compatibility === 1) { |
|
1641 | 1641 | $compatibility = '.bsui'; |
1642 | - }elseif(!$compatibility){ |
|
1642 | + }elseif (!$compatibility) { |
|
1643 | 1643 | $compatibility = ''; |
1644 | - }else{ |
|
1644 | + } else { |
|
1645 | 1645 | $compatibility = esc_attr($compatibility); |
1646 | 1646 | } |
1647 | 1647 | |
@@ -1655,29 +1655,29 @@ discard block |
||
1655 | 1655 | * c = color, b = background color, o = border-color, f = fill |
1656 | 1656 | */ |
1657 | 1657 | $selectors = array( |
1658 | - ".btn-{$type}" => array( 'b', 'o' ), |
|
1659 | - ".btn-{$type}.disabled" => array( 'b', 'o' ), |
|
1660 | - ".btn-{$type}:disabled" => array( 'b', 'o' ), |
|
1661 | - ".btn-outline-{$type}" => array( 'c', 'o' ), |
|
1662 | - ".btn-outline-{$type}:hover" => array( 'b', 'o' ), |
|
1663 | - ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ), |
|
1664 | - ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ), |
|
1665 | - ".show>.btn-outline-{$type}.dropdown-toggle" => array( 'b', 'o' ), |
|
1666 | - ".badge-{$type}" => array( 'b' ), |
|
1667 | - ".alert-{$type}" => array( 'b', 'o' ), |
|
1668 | - ".bg-{$type}" => array( 'b', 'f' ), |
|
1669 | - ".btn-link.btn-{$type}" => array( 'c' ), |
|
1658 | + ".btn-{$type}" => array('b', 'o'), |
|
1659 | + ".btn-{$type}.disabled" => array('b', 'o'), |
|
1660 | + ".btn-{$type}:disabled" => array('b', 'o'), |
|
1661 | + ".btn-outline-{$type}" => array('c', 'o'), |
|
1662 | + ".btn-outline-{$type}:hover" => array('b', 'o'), |
|
1663 | + ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'), |
|
1664 | + ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'), |
|
1665 | + ".show>.btn-outline-{$type}.dropdown-toggle" => array('b', 'o'), |
|
1666 | + ".badge-{$type}" => array('b'), |
|
1667 | + ".alert-{$type}" => array('b', 'o'), |
|
1668 | + ".bg-{$type}" => array('b', 'f'), |
|
1669 | + ".btn-link.btn-{$type}" => array('c'), |
|
1670 | 1670 | ); |
1671 | 1671 | |
1672 | - if ( $aui_bs5 ) { |
|
1673 | - unset($selectors[".alert-{$type}" ]); |
|
1672 | + if ($aui_bs5) { |
|
1673 | + unset($selectors[".alert-{$type}"]); |
|
1674 | 1674 | } |
1675 | 1675 | |
1676 | - if ( $type == 'primary' ) { |
|
1676 | + if ($type == 'primary') { |
|
1677 | 1677 | $selectors = $selectors + array( |
1678 | - 'a' => array( 'c' ), |
|
1679 | - '.btn-link' => array( 'c' ), |
|
1680 | - '.dropdown-item.active' => array( 'b' ), |
|
1678 | + 'a' => array('c'), |
|
1679 | + '.btn-link' => array('c'), |
|
1680 | + '.dropdown-item.active' => array('b'), |
|
1681 | 1681 | '.custom-control-input:checked~.custom-control-label::before' => array( |
1682 | 1682 | 'b', |
1683 | 1683 | 'o' |
@@ -1686,19 +1686,19 @@ discard block |
||
1686 | 1686 | 'b', |
1687 | 1687 | 'o' |
1688 | 1688 | ), |
1689 | - '.nav-pills .nav-link.active' => array( 'b' ), |
|
1690 | - '.nav-pills .show>.nav-link' => array( 'b' ), |
|
1691 | - '.page-link' => array( 'c' ), |
|
1689 | + '.nav-pills .nav-link.active' => array('b'), |
|
1690 | + '.nav-pills .show>.nav-link' => array('b'), |
|
1691 | + '.page-link' => array('c'), |
|
1692 | 1692 | '.page-item.active .page-link' => array( |
1693 | 1693 | 'b', |
1694 | 1694 | 'o' |
1695 | 1695 | ), |
1696 | - '.progress-bar' => array( 'b' ), |
|
1696 | + '.progress-bar' => array('b'), |
|
1697 | 1697 | '.list-group-item.active' => array( |
1698 | 1698 | 'b', |
1699 | 1699 | 'o' |
1700 | 1700 | ), |
1701 | - '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ), |
|
1701 | + '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
|
1702 | 1702 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
1703 | 1703 | // '.custom-range::-moz-range-thumb' => array('b'), |
1704 | 1704 | // '.custom-range::-ms-thumb' => array('b'), |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | } |
1707 | 1707 | |
1708 | 1708 | $important_selectors = array( |
1709 | - ".bg-{$type}" => array('b','f'), |
|
1709 | + ".bg-{$type}" => array('b', 'f'), |
|
1710 | 1710 | ".border-{$type}" => array('o'), |
1711 | 1711 | ".text-{$type}" => array('c'), |
1712 | 1712 | ); |
@@ -1722,62 +1722,62 @@ discard block |
||
1722 | 1722 | |
1723 | 1723 | $output = ''; |
1724 | 1724 | |
1725 | - if ( $aui_bs5 ) { |
|
1725 | + if ($aui_bs5) { |
|
1726 | 1726 | // $output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }'; |
1727 | - $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }'; |
|
1727 | + $output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }'; |
|
1728 | 1728 | } |
1729 | 1729 | |
1730 | 1730 | // build rules into each type |
1731 | - foreach($selectors as $selector => $types){ |
|
1732 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
1733 | - $types = array_combine($types,$types); |
|
1734 | - if(isset($types['c'])){$color[] = $selector;} |
|
1735 | - if(isset($types['b'])){$background[] = $selector;} |
|
1736 | - if(isset($types['o'])){$border[] = $selector;} |
|
1737 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1731 | + foreach ($selectors as $selector => $types) { |
|
1732 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
1733 | + $types = array_combine($types, $types); |
|
1734 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1735 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1736 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1737 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1738 | 1738 | } |
1739 | 1739 | |
1740 | 1740 | // build rules into each type |
1741 | - foreach($important_selectors as $selector => $types){ |
|
1742 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
1743 | - $types = array_combine($types,$types); |
|
1744 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
1745 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
1746 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
1747 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
1741 | + foreach ($important_selectors as $selector => $types) { |
|
1742 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
1743 | + $types = array_combine($types, $types); |
|
1744 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
1745 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
1746 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
1747 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
1748 | 1748 | } |
1749 | 1749 | |
1750 | 1750 | // add any color rules |
1751 | - if(!empty($color)){ |
|
1752 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1751 | + if (!empty($color)) { |
|
1752 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1753 | 1753 | } |
1754 | - if(!empty($color_i)){ |
|
1755 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1754 | + if (!empty($color_i)) { |
|
1755 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1756 | 1756 | } |
1757 | 1757 | |
1758 | 1758 | // add any background color rules |
1759 | - if(!empty($background)){ |
|
1760 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1759 | + if (!empty($background)) { |
|
1760 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1761 | 1761 | } |
1762 | - if(!empty($background_i)){ |
|
1763 | - $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1762 | + if (!empty($background_i)) { |
|
1763 | + $output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1764 | 1764 | // $output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} "; |
1765 | 1765 | } |
1766 | 1766 | |
1767 | 1767 | // add any border color rules |
1768 | - if(!empty($border)){ |
|
1769 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1768 | + if (!empty($border)) { |
|
1769 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1770 | 1770 | } |
1771 | - if(!empty($border_i)){ |
|
1772 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1771 | + if (!empty($border_i)) { |
|
1772 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1773 | 1773 | } |
1774 | 1774 | |
1775 | 1775 | // add any fill color rules |
1776 | - if(!empty($fill)){ |
|
1777 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1776 | + if (!empty($fill)) { |
|
1777 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1778 | 1778 | } |
1779 | - if(!empty($fill_i)){ |
|
1780 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1779 | + if (!empty($fill_i)) { |
|
1780 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1781 | 1781 | } |
1782 | 1782 | |
1783 | 1783 | |
@@ -1785,27 +1785,27 @@ discard block |
||
1785 | 1785 | |
1786 | 1786 | $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;' : ''; |
1787 | 1787 | // darken |
1788 | - $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075"); |
|
1789 | - $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10"); |
|
1790 | - $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125"); |
|
1791 | - $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4"); |
|
1788 | + $darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075"); |
|
1789 | + $darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10"); |
|
1790 | + $darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125"); |
|
1791 | + $darker_40 = $is_var ? $color_code . ';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code, "-0.4"); |
|
1792 | 1792 | |
1793 | 1793 | // lighten |
1794 | - $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25"); |
|
1794 | + $lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25"); |
|
1795 | 1795 | |
1796 | 1796 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1797 | - $op_25 = $color_code."40"; // 25% opacity |
|
1797 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1798 | 1798 | |
1799 | 1799 | |
1800 | 1800 | // button states |
1801 | - $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : ''; |
|
1802 | - $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
1801 | + $output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : ''; |
|
1802 | + $output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
1803 | 1803 | // $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000; border-color: #000;} "; |
1804 | - $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;} "; |
|
1805 | - $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.";} "; |
|
1806 | - $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;} "; |
|
1804 | + $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;} "; |
|
1805 | + $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 . ";} "; |
|
1806 | + $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;} "; |
|
1807 | 1807 | |
1808 | - if ( $type == 'primary' ) { |
|
1808 | + if ($type == 'primary') { |
|
1809 | 1809 | // dropdown's |
1810 | 1810 | $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
1811 | 1811 | |
@@ -1817,9 +1817,9 @@ discard block |
||
1817 | 1817 | } |
1818 | 1818 | |
1819 | 1819 | // alerts |
1820 | - if ( $aui_bs5 ) { |
|
1820 | + if ($aui_bs5) { |
|
1821 | 1821 | // $output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20; border-color: ".$color_code."30;color:$darker_40} "; |
1822 | - $output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} "; |
|
1822 | + $output .= $prefix . " .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} "; |
|
1823 | 1823 | } |
1824 | 1824 | |
1825 | 1825 | return $output; |
@@ -1835,11 +1835,11 @@ discard block |
||
1835 | 1835 | * |
1836 | 1836 | * @return string |
1837 | 1837 | */ |
1838 | - public static function css_primary($color_code,$compatibility, $use_variable = false){ |
|
1838 | + public static function css_primary($color_code, $compatibility, $use_variable = false) { |
|
1839 | 1839 | |
1840 | - if(!$use_variable){ |
|
1840 | + if (!$use_variable) { |
|
1841 | 1841 | $color_code = sanitize_hex_color($color_code); |
1842 | - if(!$color_code){return '';} |
|
1842 | + if (!$color_code) {return ''; } |
|
1843 | 1843 | } |
1844 | 1844 | |
1845 | 1845 | /** |
@@ -1847,36 +1847,36 @@ discard block |
||
1847 | 1847 | */ |
1848 | 1848 | $selectors = array( |
1849 | 1849 | 'a' => array('c'), |
1850 | - '.btn-primary' => array('b','o'), |
|
1851 | - '.btn-primary.disabled' => array('b','o'), |
|
1852 | - '.btn-primary:disabled' => array('b','o'), |
|
1853 | - '.btn-outline-primary' => array('c','o'), |
|
1854 | - '.btn-outline-primary:hover' => array('b','o'), |
|
1855 | - '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
1856 | - '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
1857 | - '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'), |
|
1850 | + '.btn-primary' => array('b', 'o'), |
|
1851 | + '.btn-primary.disabled' => array('b', 'o'), |
|
1852 | + '.btn-primary:disabled' => array('b', 'o'), |
|
1853 | + '.btn-outline-primary' => array('c', 'o'), |
|
1854 | + '.btn-outline-primary:hover' => array('b', 'o'), |
|
1855 | + '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
1856 | + '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
1857 | + '.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'), |
|
1858 | 1858 | '.btn-link' => array('c'), |
1859 | 1859 | '.dropdown-item.active' => array('b'), |
1860 | - '.custom-control-input:checked~.custom-control-label::before' => array('b','o'), |
|
1861 | - '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'), |
|
1860 | + '.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'), |
|
1861 | + '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'), |
|
1862 | 1862 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
1863 | 1863 | // '.custom-range::-moz-range-thumb' => array('b'), |
1864 | 1864 | // '.custom-range::-ms-thumb' => array('b'), |
1865 | 1865 | '.nav-pills .nav-link.active' => array('b'), |
1866 | 1866 | '.nav-pills .show>.nav-link' => array('b'), |
1867 | 1867 | '.page-link' => array('c'), |
1868 | - '.page-item.active .page-link' => array('b','o'), |
|
1868 | + '.page-item.active .page-link' => array('b', 'o'), |
|
1869 | 1869 | '.badge-primary' => array('b'), |
1870 | - '.alert-primary' => array('b','o'), |
|
1870 | + '.alert-primary' => array('b', 'o'), |
|
1871 | 1871 | '.progress-bar' => array('b'), |
1872 | - '.list-group-item.active' => array('b','o'), |
|
1873 | - '.bg-primary' => array('b','f'), |
|
1872 | + '.list-group-item.active' => array('b', 'o'), |
|
1873 | + '.bg-primary' => array('b', 'f'), |
|
1874 | 1874 | '.btn-link.btn-primary' => array('c'), |
1875 | 1875 | '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
1876 | 1876 | ); |
1877 | 1877 | |
1878 | 1878 | $important_selectors = array( |
1879 | - '.bg-primary' => array('b','f'), |
|
1879 | + '.bg-primary' => array('b', 'f'), |
|
1880 | 1880 | '.border-primary' => array('o'), |
1881 | 1881 | '.text-primary' => array('c'), |
1882 | 1882 | ); |
@@ -1893,88 +1893,88 @@ discard block |
||
1893 | 1893 | $output = ''; |
1894 | 1894 | |
1895 | 1895 | // build rules into each type |
1896 | - foreach($selectors as $selector => $types){ |
|
1897 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
1898 | - $types = array_combine($types,$types); |
|
1899 | - if(isset($types['c'])){$color[] = $selector;} |
|
1900 | - if(isset($types['b'])){$background[] = $selector;} |
|
1901 | - if(isset($types['o'])){$border[] = $selector;} |
|
1902 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1896 | + foreach ($selectors as $selector => $types) { |
|
1897 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
1898 | + $types = array_combine($types, $types); |
|
1899 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1900 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1901 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1902 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1903 | 1903 | } |
1904 | 1904 | |
1905 | 1905 | // build rules into each type |
1906 | - foreach($important_selectors as $selector => $types){ |
|
1907 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
1908 | - $types = array_combine($types,$types); |
|
1909 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
1910 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
1911 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
1912 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
1906 | + foreach ($important_selectors as $selector => $types) { |
|
1907 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
1908 | + $types = array_combine($types, $types); |
|
1909 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
1910 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
1911 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
1912 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | // add any color rules |
1916 | - if(!empty($color)){ |
|
1917 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1916 | + if (!empty($color)) { |
|
1917 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1918 | 1918 | } |
1919 | - if(!empty($color_i)){ |
|
1920 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1919 | + if (!empty($color_i)) { |
|
1920 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1921 | 1921 | } |
1922 | 1922 | |
1923 | 1923 | // add any background color rules |
1924 | - if(!empty($background)){ |
|
1925 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1924 | + if (!empty($background)) { |
|
1925 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1926 | 1926 | } |
1927 | - if(!empty($background_i)){ |
|
1928 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1927 | + if (!empty($background_i)) { |
|
1928 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1929 | 1929 | } |
1930 | 1930 | |
1931 | 1931 | // add any border color rules |
1932 | - if(!empty($border)){ |
|
1933 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1932 | + if (!empty($border)) { |
|
1933 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1934 | 1934 | } |
1935 | - if(!empty($border_i)){ |
|
1936 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1935 | + if (!empty($border_i)) { |
|
1936 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | // add any fill color rules |
1940 | - if(!empty($fill)){ |
|
1941 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1940 | + if (!empty($fill)) { |
|
1941 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1942 | 1942 | } |
1943 | - if(!empty($fill_i)){ |
|
1944 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1943 | + if (!empty($fill_i)) { |
|
1944 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1945 | 1945 | } |
1946 | 1946 | |
1947 | 1947 | |
1948 | 1948 | $prefix = $compatibility ? ".bsui " : ""; |
1949 | 1949 | |
1950 | 1950 | // darken |
1951 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
1952 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
1953 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
1951 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
1952 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
1953 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
1954 | 1954 | |
1955 | 1955 | // lighten |
1956 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
1956 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
1957 | 1957 | |
1958 | 1958 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1959 | - $op_25 = $color_code."40"; // 25% opacity |
|
1959 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1960 | 1960 | |
1961 | 1961 | |
1962 | 1962 | // button states |
1963 | - $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
1964 | - $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;} "; |
|
1965 | - $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.";} "; |
|
1966 | - $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;} "; |
|
1963 | + $output .= $prefix . " .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
1964 | + $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;} "; |
|
1965 | + $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 . ";} "; |
|
1966 | + $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;} "; |
|
1967 | 1967 | |
1968 | 1968 | |
1969 | 1969 | // dropdown's |
1970 | - $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
1970 | + $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
1971 | 1971 | |
1972 | 1972 | |
1973 | 1973 | // input states |
1974 | - $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1974 | + $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1975 | 1975 | |
1976 | 1976 | // page link |
1977 | - $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1977 | + $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1978 | 1978 | |
1979 | 1979 | return $output; |
1980 | 1980 | } |
@@ -1988,30 +1988,30 @@ discard block |
||
1988 | 1988 | * |
1989 | 1989 | * @return string |
1990 | 1990 | */ |
1991 | - public static function css_secondary($color_code,$compatibility){; |
|
1991 | + public static function css_secondary($color_code, $compatibility) {; |
|
1992 | 1992 | $color_code = sanitize_hex_color($color_code); |
1993 | - if(!$color_code){return '';} |
|
1993 | + if (!$color_code) {return ''; } |
|
1994 | 1994 | /** |
1995 | 1995 | * c = color, b = background color, o = border-color, f = fill |
1996 | 1996 | */ |
1997 | 1997 | $selectors = array( |
1998 | - '.btn-secondary' => array('b','o'), |
|
1999 | - '.btn-secondary.disabled' => array('b','o'), |
|
2000 | - '.btn-secondary:disabled' => array('b','o'), |
|
2001 | - '.btn-outline-secondary' => array('c','o'), |
|
2002 | - '.btn-outline-secondary:hover' => array('b','o'), |
|
1998 | + '.btn-secondary' => array('b', 'o'), |
|
1999 | + '.btn-secondary.disabled' => array('b', 'o'), |
|
2000 | + '.btn-secondary:disabled' => array('b', 'o'), |
|
2001 | + '.btn-outline-secondary' => array('c', 'o'), |
|
2002 | + '.btn-outline-secondary:hover' => array('b', 'o'), |
|
2003 | 2003 | '.btn-outline-secondary.disabled' => array('c'), |
2004 | 2004 | '.btn-outline-secondary:disabled' => array('c'), |
2005 | - '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
2006 | - '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
2007 | - '.btn-outline-secondary.dropdown-toggle' => array('b','o'), |
|
2005 | + '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
2006 | + '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
2007 | + '.btn-outline-secondary.dropdown-toggle' => array('b', 'o'), |
|
2008 | 2008 | '.badge-secondary' => array('b'), |
2009 | - '.alert-secondary' => array('b','o'), |
|
2009 | + '.alert-secondary' => array('b', 'o'), |
|
2010 | 2010 | '.btn-link.btn-secondary' => array('c'), |
2011 | 2011 | ); |
2012 | 2012 | |
2013 | 2013 | $important_selectors = array( |
2014 | - '.bg-secondary' => array('b','f'), |
|
2014 | + '.bg-secondary' => array('b', 'f'), |
|
2015 | 2015 | '.border-secondary' => array('o'), |
2016 | 2016 | '.text-secondary' => array('c'), |
2017 | 2017 | ); |
@@ -2028,77 +2028,77 @@ discard block |
||
2028 | 2028 | $output = ''; |
2029 | 2029 | |
2030 | 2030 | // build rules into each type |
2031 | - foreach($selectors as $selector => $types){ |
|
2032 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
2033 | - $types = array_combine($types,$types); |
|
2034 | - if(isset($types['c'])){$color[] = $selector;} |
|
2035 | - if(isset($types['b'])){$background[] = $selector;} |
|
2036 | - if(isset($types['o'])){$border[] = $selector;} |
|
2037 | - if(isset($types['f'])){$fill[] = $selector;} |
|
2031 | + foreach ($selectors as $selector => $types) { |
|
2032 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
2033 | + $types = array_combine($types, $types); |
|
2034 | + if (isset($types['c'])) {$color[] = $selector; } |
|
2035 | + if (isset($types['b'])) {$background[] = $selector; } |
|
2036 | + if (isset($types['o'])) {$border[] = $selector; } |
|
2037 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
2038 | 2038 | } |
2039 | 2039 | |
2040 | 2040 | // build rules into each type |
2041 | - foreach($important_selectors as $selector => $types){ |
|
2042 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
2043 | - $types = array_combine($types,$types); |
|
2044 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
2045 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
2046 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
2047 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
2041 | + foreach ($important_selectors as $selector => $types) { |
|
2042 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
2043 | + $types = array_combine($types, $types); |
|
2044 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
2045 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
2046 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
2047 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
2048 | 2048 | } |
2049 | 2049 | |
2050 | 2050 | // add any color rules |
2051 | - if(!empty($color)){ |
|
2052 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
2051 | + if (!empty($color)) { |
|
2052 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
2053 | 2053 | } |
2054 | - if(!empty($color_i)){ |
|
2055 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
2054 | + if (!empty($color_i)) { |
|
2055 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
2056 | 2056 | } |
2057 | 2057 | |
2058 | 2058 | // add any background color rules |
2059 | - if(!empty($background)){ |
|
2060 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
2059 | + if (!empty($background)) { |
|
2060 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
2061 | 2061 | } |
2062 | - if(!empty($background_i)){ |
|
2063 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
2062 | + if (!empty($background_i)) { |
|
2063 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
2064 | 2064 | } |
2065 | 2065 | |
2066 | 2066 | // add any border color rules |
2067 | - if(!empty($border)){ |
|
2068 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
2067 | + if (!empty($border)) { |
|
2068 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
2069 | 2069 | } |
2070 | - if(!empty($border_i)){ |
|
2071 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
2070 | + if (!empty($border_i)) { |
|
2071 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
2072 | 2072 | } |
2073 | 2073 | |
2074 | 2074 | // add any fill color rules |
2075 | - if(!empty($fill)){ |
|
2076 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
2075 | + if (!empty($fill)) { |
|
2076 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
2077 | 2077 | } |
2078 | - if(!empty($fill_i)){ |
|
2079 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
2078 | + if (!empty($fill_i)) { |
|
2079 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
2080 | 2080 | } |
2081 | 2081 | |
2082 | 2082 | |
2083 | 2083 | $prefix = $compatibility ? ".bsui " : ""; |
2084 | 2084 | |
2085 | 2085 | // darken |
2086 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
2087 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
2088 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
2086 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
2087 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
2088 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
2089 | 2089 | |
2090 | 2090 | // lighten |
2091 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
2091 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
2092 | 2092 | |
2093 | 2093 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
2094 | - $op_25 = $color_code."40"; // 25% opacity |
|
2094 | + $op_25 = $color_code . "40"; // 25% opacity |
|
2095 | 2095 | |
2096 | 2096 | |
2097 | 2097 | // button states |
2098 | - $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
2099 | - $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;} "; |
|
2100 | - $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.";} "; |
|
2101 | - $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;} "; |
|
2098 | + $output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
2099 | + $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;} "; |
|
2100 | + $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 . ";} "; |
|
2101 | + $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;} "; |
|
2102 | 2102 | |
2103 | 2103 | |
2104 | 2104 | return $output; |
@@ -2115,7 +2115,7 @@ discard block |
||
2115 | 2115 | public static function css_hex_lighten_darken($hexCode, $adjustPercent) { |
2116 | 2116 | $hexCode = ltrim($hexCode, '#'); |
2117 | 2117 | |
2118 | - if ( strpos( $hexCode, 'rgba(' ) !== false || strpos( $hexCode, 'rgb(' ) !== false ) { |
|
2118 | + if (strpos($hexCode, 'rgba(') !== false || strpos($hexCode, 'rgb(') !== false) { |
|
2119 | 2119 | return $hexCode; |
2120 | 2120 | } |
2121 | 2121 | |
@@ -2138,8 +2138,8 @@ discard block |
||
2138 | 2138 | /** |
2139 | 2139 | * Check if we should display examples. |
2140 | 2140 | */ |
2141 | - public function maybe_show_examples(){ |
|
2142 | - if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){ |
|
2141 | + public function maybe_show_examples() { |
|
2142 | + if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) { |
|
2143 | 2143 | echo "<head>"; |
2144 | 2144 | wp_head(); |
2145 | 2145 | echo "</head>"; |
@@ -2155,7 +2155,7 @@ discard block |
||
2155 | 2155 | * |
2156 | 2156 | * @return string |
2157 | 2157 | */ |
2158 | - public function get_examples(){ |
|
2158 | + public function get_examples() { |
|
2159 | 2159 | $output = ''; |
2160 | 2160 | |
2161 | 2161 | |
@@ -2261,74 +2261,74 @@ discard block |
||
2261 | 2261 | */ |
2262 | 2262 | public static function calendar_params() { |
2263 | 2263 | $params = array( |
2264 | - 'month_long_1' => __( 'January', 'ayecode-connect' ), |
|
2265 | - 'month_long_2' => __( 'February', 'ayecode-connect' ), |
|
2266 | - 'month_long_3' => __( 'March', 'ayecode-connect' ), |
|
2267 | - 'month_long_4' => __( 'April', 'ayecode-connect' ), |
|
2268 | - 'month_long_5' => __( 'May', 'ayecode-connect' ), |
|
2269 | - 'month_long_6' => __( 'June', 'ayecode-connect' ), |
|
2270 | - 'month_long_7' => __( 'July', 'ayecode-connect' ), |
|
2271 | - 'month_long_8' => __( 'August', 'ayecode-connect' ), |
|
2272 | - 'month_long_9' => __( 'September', 'ayecode-connect' ), |
|
2273 | - 'month_long_10' => __( 'October', 'ayecode-connect' ), |
|
2274 | - 'month_long_11' => __( 'November', 'ayecode-connect' ), |
|
2275 | - 'month_long_12' => __( 'December', 'ayecode-connect' ), |
|
2276 | - 'month_s_1' => _x( 'Jan', 'January abbreviation', 'ayecode-connect' ), |
|
2277 | - 'month_s_2' => _x( 'Feb', 'February abbreviation', 'ayecode-connect' ), |
|
2278 | - 'month_s_3' => _x( 'Mar', 'March abbreviation', 'ayecode-connect' ), |
|
2279 | - 'month_s_4' => _x( 'Apr', 'April abbreviation', 'ayecode-connect' ), |
|
2280 | - 'month_s_5' => _x( 'May', 'May abbreviation', 'ayecode-connect' ), |
|
2281 | - 'month_s_6' => _x( 'Jun', 'June abbreviation', 'ayecode-connect' ), |
|
2282 | - 'month_s_7' => _x( 'Jul', 'July abbreviation', 'ayecode-connect' ), |
|
2283 | - 'month_s_8' => _x( 'Aug', 'August abbreviation', 'ayecode-connect' ), |
|
2284 | - 'month_s_9' => _x( 'Sep', 'September abbreviation', 'ayecode-connect' ), |
|
2285 | - 'month_s_10' => _x( 'Oct', 'October abbreviation', 'ayecode-connect' ), |
|
2286 | - 'month_s_11' => _x( 'Nov', 'November abbreviation', 'ayecode-connect' ), |
|
2287 | - 'month_s_12' => _x( 'Dec', 'December abbreviation', 'ayecode-connect' ), |
|
2288 | - 'day_s1_1' => _x( 'S', 'Sunday initial', 'ayecode-connect' ), |
|
2289 | - 'day_s1_2' => _x( 'M', 'Monday initial', 'ayecode-connect' ), |
|
2290 | - 'day_s1_3' => _x( 'T', 'Tuesday initial', 'ayecode-connect' ), |
|
2291 | - 'day_s1_4' => _x( 'W', 'Wednesday initial', 'ayecode-connect' ), |
|
2292 | - 'day_s1_5' => _x( 'T', 'Friday initial', 'ayecode-connect' ), |
|
2293 | - 'day_s1_6' => _x( 'F', 'Thursday initial', 'ayecode-connect' ), |
|
2294 | - 'day_s1_7' => _x( 'S', 'Saturday initial', 'ayecode-connect' ), |
|
2295 | - 'day_s2_1' => __( 'Su', 'ayecode-connect' ), |
|
2296 | - 'day_s2_2' => __( 'Mo', 'ayecode-connect' ), |
|
2297 | - 'day_s2_3' => __( 'Tu', 'ayecode-connect' ), |
|
2298 | - 'day_s2_4' => __( 'We', 'ayecode-connect' ), |
|
2299 | - 'day_s2_5' => __( 'Th', 'ayecode-connect' ), |
|
2300 | - 'day_s2_6' => __( 'Fr', 'ayecode-connect' ), |
|
2301 | - 'day_s2_7' => __( 'Sa', 'ayecode-connect' ), |
|
2302 | - 'day_s3_1' => __( 'Sun', 'ayecode-connect' ), |
|
2303 | - 'day_s3_2' => __( 'Mon', 'ayecode-connect' ), |
|
2304 | - 'day_s3_3' => __( 'Tue', 'ayecode-connect' ), |
|
2305 | - 'day_s3_4' => __( 'Wed', 'ayecode-connect' ), |
|
2306 | - 'day_s3_5' => __( 'Thu', 'ayecode-connect' ), |
|
2307 | - 'day_s3_6' => __( 'Fri', 'ayecode-connect' ), |
|
2308 | - 'day_s3_7' => __( 'Sat', 'ayecode-connect' ), |
|
2309 | - 'day_s5_1' => __( 'Sunday', 'ayecode-connect' ), |
|
2310 | - 'day_s5_2' => __( 'Monday', 'ayecode-connect' ), |
|
2311 | - 'day_s5_3' => __( 'Tuesday', 'ayecode-connect' ), |
|
2312 | - 'day_s5_4' => __( 'Wednesday', 'ayecode-connect' ), |
|
2313 | - 'day_s5_5' => __( 'Thursday', 'ayecode-connect' ), |
|
2314 | - 'day_s5_6' => __( 'Friday', 'ayecode-connect' ), |
|
2315 | - 'day_s5_7' => __( 'Saturday', 'ayecode-connect' ), |
|
2316 | - 'am_lower' => __( 'am', 'ayecode-connect' ), |
|
2317 | - 'pm_lower' => __( 'pm', 'ayecode-connect' ), |
|
2318 | - 'am_upper' => __( 'AM', 'ayecode-connect' ), |
|
2319 | - 'pm_upper' => __( 'PM', 'ayecode-connect' ), |
|
2320 | - 'firstDayOfWeek' => (int) get_option( 'start_of_week' ), |
|
2264 | + 'month_long_1' => __('January', 'ayecode-connect'), |
|
2265 | + 'month_long_2' => __('February', 'ayecode-connect'), |
|
2266 | + 'month_long_3' => __('March', 'ayecode-connect'), |
|
2267 | + 'month_long_4' => __('April', 'ayecode-connect'), |
|
2268 | + 'month_long_5' => __('May', 'ayecode-connect'), |
|
2269 | + 'month_long_6' => __('June', 'ayecode-connect'), |
|
2270 | + 'month_long_7' => __('July', 'ayecode-connect'), |
|
2271 | + 'month_long_8' => __('August', 'ayecode-connect'), |
|
2272 | + 'month_long_9' => __('September', 'ayecode-connect'), |
|
2273 | + 'month_long_10' => __('October', 'ayecode-connect'), |
|
2274 | + 'month_long_11' => __('November', 'ayecode-connect'), |
|
2275 | + 'month_long_12' => __('December', 'ayecode-connect'), |
|
2276 | + 'month_s_1' => _x('Jan', 'January abbreviation', 'ayecode-connect'), |
|
2277 | + 'month_s_2' => _x('Feb', 'February abbreviation', 'ayecode-connect'), |
|
2278 | + 'month_s_3' => _x('Mar', 'March abbreviation', 'ayecode-connect'), |
|
2279 | + 'month_s_4' => _x('Apr', 'April abbreviation', 'ayecode-connect'), |
|
2280 | + 'month_s_5' => _x('May', 'May abbreviation', 'ayecode-connect'), |
|
2281 | + 'month_s_6' => _x('Jun', 'June abbreviation', 'ayecode-connect'), |
|
2282 | + 'month_s_7' => _x('Jul', 'July abbreviation', 'ayecode-connect'), |
|
2283 | + 'month_s_8' => _x('Aug', 'August abbreviation', 'ayecode-connect'), |
|
2284 | + 'month_s_9' => _x('Sep', 'September abbreviation', 'ayecode-connect'), |
|
2285 | + 'month_s_10' => _x('Oct', 'October abbreviation', 'ayecode-connect'), |
|
2286 | + 'month_s_11' => _x('Nov', 'November abbreviation', 'ayecode-connect'), |
|
2287 | + 'month_s_12' => _x('Dec', 'December abbreviation', 'ayecode-connect'), |
|
2288 | + 'day_s1_1' => _x('S', 'Sunday initial', 'ayecode-connect'), |
|
2289 | + 'day_s1_2' => _x('M', 'Monday initial', 'ayecode-connect'), |
|
2290 | + 'day_s1_3' => _x('T', 'Tuesday initial', 'ayecode-connect'), |
|
2291 | + 'day_s1_4' => _x('W', 'Wednesday initial', 'ayecode-connect'), |
|
2292 | + 'day_s1_5' => _x('T', 'Friday initial', 'ayecode-connect'), |
|
2293 | + 'day_s1_6' => _x('F', 'Thursday initial', 'ayecode-connect'), |
|
2294 | + 'day_s1_7' => _x('S', 'Saturday initial', 'ayecode-connect'), |
|
2295 | + 'day_s2_1' => __('Su', 'ayecode-connect'), |
|
2296 | + 'day_s2_2' => __('Mo', 'ayecode-connect'), |
|
2297 | + 'day_s2_3' => __('Tu', 'ayecode-connect'), |
|
2298 | + 'day_s2_4' => __('We', 'ayecode-connect'), |
|
2299 | + 'day_s2_5' => __('Th', 'ayecode-connect'), |
|
2300 | + 'day_s2_6' => __('Fr', 'ayecode-connect'), |
|
2301 | + 'day_s2_7' => __('Sa', 'ayecode-connect'), |
|
2302 | + 'day_s3_1' => __('Sun', 'ayecode-connect'), |
|
2303 | + 'day_s3_2' => __('Mon', 'ayecode-connect'), |
|
2304 | + 'day_s3_3' => __('Tue', 'ayecode-connect'), |
|
2305 | + 'day_s3_4' => __('Wed', 'ayecode-connect'), |
|
2306 | + 'day_s3_5' => __('Thu', 'ayecode-connect'), |
|
2307 | + 'day_s3_6' => __('Fri', 'ayecode-connect'), |
|
2308 | + 'day_s3_7' => __('Sat', 'ayecode-connect'), |
|
2309 | + 'day_s5_1' => __('Sunday', 'ayecode-connect'), |
|
2310 | + 'day_s5_2' => __('Monday', 'ayecode-connect'), |
|
2311 | + 'day_s5_3' => __('Tuesday', 'ayecode-connect'), |
|
2312 | + 'day_s5_4' => __('Wednesday', 'ayecode-connect'), |
|
2313 | + 'day_s5_5' => __('Thursday', 'ayecode-connect'), |
|
2314 | + 'day_s5_6' => __('Friday', 'ayecode-connect'), |
|
2315 | + 'day_s5_7' => __('Saturday', 'ayecode-connect'), |
|
2316 | + 'am_lower' => __('am', 'ayecode-connect'), |
|
2317 | + 'pm_lower' => __('pm', 'ayecode-connect'), |
|
2318 | + 'am_upper' => __('AM', 'ayecode-connect'), |
|
2319 | + 'pm_upper' => __('PM', 'ayecode-connect'), |
|
2320 | + 'firstDayOfWeek' => (int) get_option('start_of_week'), |
|
2321 | 2321 | 'time_24hr' => false, |
2322 | - 'year' => __( 'Year', 'ayecode-connect' ), |
|
2323 | - 'hour' => __( 'Hour', 'ayecode-connect' ), |
|
2324 | - 'minute' => __( 'Minute', 'ayecode-connect' ), |
|
2325 | - 'weekAbbreviation' => __( 'Wk', 'ayecode-connect' ), |
|
2326 | - 'rangeSeparator' => __( ' to ', 'ayecode-connect' ), |
|
2327 | - 'scrollTitle' => __( 'Scroll to increment', 'ayecode-connect' ), |
|
2328 | - 'toggleTitle' => __( 'Click to toggle', 'ayecode-connect' ) |
|
2322 | + 'year' => __('Year', 'ayecode-connect'), |
|
2323 | + 'hour' => __('Hour', 'ayecode-connect'), |
|
2324 | + 'minute' => __('Minute', 'ayecode-connect'), |
|
2325 | + 'weekAbbreviation' => __('Wk', 'ayecode-connect'), |
|
2326 | + 'rangeSeparator' => __(' to ', 'ayecode-connect'), |
|
2327 | + 'scrollTitle' => __('Scroll to increment', 'ayecode-connect'), |
|
2328 | + 'toggleTitle' => __('Click to toggle', 'ayecode-connect') |
|
2329 | 2329 | ); |
2330 | 2330 | |
2331 | - return apply_filters( 'ayecode_ui_calendar_params', $params ); |
|
2331 | + return apply_filters('ayecode_ui_calendar_params', $params); |
|
2332 | 2332 | } |
2333 | 2333 | |
2334 | 2334 | /** |
@@ -2341,47 +2341,47 @@ discard block |
||
2341 | 2341 | public static function flatpickr_locale() { |
2342 | 2342 | $params = self::calendar_params(); |
2343 | 2343 | |
2344 | - if ( is_string( $params ) ) { |
|
2345 | - $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' ); |
|
2344 | + if (is_string($params)) { |
|
2345 | + $params = html_entity_decode($params, ENT_QUOTES, 'UTF-8'); |
|
2346 | 2346 | } else { |
2347 | - foreach ( (array) $params as $key => $value ) { |
|
2348 | - if ( ! is_scalar( $value ) ) { |
|
2347 | + foreach ((array) $params as $key => $value) { |
|
2348 | + if (!is_scalar($value)) { |
|
2349 | 2349 | continue; |
2350 | 2350 | } |
2351 | 2351 | |
2352 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2352 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2353 | 2353 | } |
2354 | 2354 | } |
2355 | 2355 | |
2356 | 2356 | $day_s3 = array(); |
2357 | 2357 | $day_s5 = array(); |
2358 | 2358 | |
2359 | - for ( $i = 1; $i <= 7; $i ++ ) { |
|
2360 | - $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2361 | - $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2359 | + for ($i = 1; $i <= 7; $i++) { |
|
2360 | + $day_s3[] = addslashes($params['day_s3_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2361 | + $day_s5[] = addslashes($params['day_s3_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2362 | 2362 | } |
2363 | 2363 | |
2364 | 2364 | $month_s = array(); |
2365 | 2365 | $month_long = array(); |
2366 | 2366 | |
2367 | - for ( $i = 1; $i <= 12; $i ++ ) { |
|
2368 | - $month_s[] = addslashes( $params[ 'month_s_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2369 | - $month_long[] = addslashes( $params[ 'month_long_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2367 | + for ($i = 1; $i <= 12; $i++) { |
|
2368 | + $month_s[] = addslashes($params['month_s_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2369 | + $month_long[] = addslashes($params['month_long_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2370 | 2370 | } |
2371 | 2371 | |
2372 | 2372 | ob_start(); |
2373 | - if ( 0 ) { ?><script><?php } ?> |
|
2373 | + if (0) { ?><script><?php } ?> |
|
2374 | 2374 | { |
2375 | 2375 | weekdays: { |
2376 | - shorthand: ['<?php echo implode( "','", $day_s3 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2377 | - longhand: ['<?php echo implode( "','", $day_s5 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2376 | + shorthand: ['<?php echo implode("','", $day_s3); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2377 | + longhand: ['<?php echo implode("','", $day_s5); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2378 | 2378 | }, |
2379 | 2379 | months: { |
2380 | - shorthand: ['<?php echo implode( "','", $month_s ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2381 | - longhand: ['<?php echo implode( "','", $month_long ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2380 | + shorthand: ['<?php echo implode("','", $month_s); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2381 | + longhand: ['<?php echo implode("','", $month_long); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2382 | 2382 | }, |
2383 | 2383 | daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31], |
2384 | - firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>, |
|
2384 | + firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>, |
|
2385 | 2385 | ordinal: function (nth) { |
2386 | 2386 | var s = nth % 100; |
2387 | 2387 | if (s > 3 && s < 21) |
@@ -2397,21 +2397,21 @@ discard block |
||
2397 | 2397 | return "th"; |
2398 | 2398 | } |
2399 | 2399 | }, |
2400 | - rangeSeparator: '<?php echo esc_attr( $params[ 'rangeSeparator' ] ); ?>', |
|
2401 | - weekAbbreviation: '<?php echo esc_attr( $params[ 'weekAbbreviation' ] ); ?>', |
|
2402 | - scrollTitle: '<?php echo esc_attr( $params[ 'scrollTitle' ] ); ?>', |
|
2403 | - toggleTitle: '<?php echo esc_attr( $params[ 'toggleTitle' ] ); ?>', |
|
2404 | - amPM: ['<?php echo esc_attr( $params[ 'am_upper' ] ); ?>','<?php echo esc_attr( $params[ 'pm_upper' ] ); ?>'], |
|
2405 | - yearAriaLabel: '<?php echo esc_attr( $params[ 'year' ] ); ?>', |
|
2406 | - hourAriaLabel: '<?php echo esc_attr( $params[ 'hour' ] ); ?>', |
|
2407 | - minuteAriaLabel: '<?php echo esc_attr( $params[ 'minute' ] ); ?>', |
|
2408 | - time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?> |
|
2400 | + rangeSeparator: '<?php echo esc_attr($params['rangeSeparator']); ?>', |
|
2401 | + weekAbbreviation: '<?php echo esc_attr($params['weekAbbreviation']); ?>', |
|
2402 | + scrollTitle: '<?php echo esc_attr($params['scrollTitle']); ?>', |
|
2403 | + toggleTitle: '<?php echo esc_attr($params['toggleTitle']); ?>', |
|
2404 | + amPM: ['<?php echo esc_attr($params['am_upper']); ?>','<?php echo esc_attr($params['pm_upper']); ?>'], |
|
2405 | + yearAriaLabel: '<?php echo esc_attr($params['year']); ?>', |
|
2406 | + hourAriaLabel: '<?php echo esc_attr($params['hour']); ?>', |
|
2407 | + minuteAriaLabel: '<?php echo esc_attr($params['minute']); ?>', |
|
2408 | + time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?> |
|
2409 | 2409 | } |
2410 | - <?php if ( 0 ) { ?></script><?php } ?> |
|
2410 | + <?php if (0) { ?></script><?php } ?> |
|
2411 | 2411 | <?php |
2412 | 2412 | $locale = ob_get_clean(); |
2413 | 2413 | |
2414 | - return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) ); |
|
2414 | + return apply_filters('ayecode_ui_flatpickr_locale', trim($locale)); |
|
2415 | 2415 | } |
2416 | 2416 | |
2417 | 2417 | /** |
@@ -2423,20 +2423,20 @@ discard block |
||
2423 | 2423 | */ |
2424 | 2424 | public static function select2_params() { |
2425 | 2425 | $params = array( |
2426 | - 'i18n_select_state_text' => esc_attr__( 'Select an option…', 'ayecode-connect' ), |
|
2427 | - 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'ayecode-connect' ), |
|
2428 | - 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'ayecode-connect' ), |
|
2429 | - 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'ayecode-connect' ), |
|
2430 | - 'i18n_input_too_short_n' => _x( 'Please enter %item% or more characters', 'enhanced select', 'ayecode-connect' ), |
|
2431 | - 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'ayecode-connect' ), |
|
2432 | - 'i18n_input_too_long_n' => _x( 'Please delete %item% characters', 'enhanced select', 'ayecode-connect' ), |
|
2433 | - 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'ayecode-connect' ), |
|
2434 | - 'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'ayecode-connect' ), |
|
2435 | - 'i18n_load_more' => _x( 'Loading more results…', 'enhanced select', 'ayecode-connect' ), |
|
2436 | - 'i18n_searching' => _x( 'Searching…', 'enhanced select', 'ayecode-connect' ) |
|
2426 | + 'i18n_select_state_text' => esc_attr__('Select an option…', 'ayecode-connect'), |
|
2427 | + 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'ayecode-connect'), |
|
2428 | + 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'ayecode-connect'), |
|
2429 | + 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'ayecode-connect'), |
|
2430 | + 'i18n_input_too_short_n' => _x('Please enter %item% or more characters', 'enhanced select', 'ayecode-connect'), |
|
2431 | + 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'ayecode-connect'), |
|
2432 | + 'i18n_input_too_long_n' => _x('Please delete %item% characters', 'enhanced select', 'ayecode-connect'), |
|
2433 | + 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'ayecode-connect'), |
|
2434 | + 'i18n_selection_too_long_n' => _x('You can only select %item% items', 'enhanced select', 'ayecode-connect'), |
|
2435 | + 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'ayecode-connect'), |
|
2436 | + 'i18n_searching' => _x('Searching…', 'enhanced select', 'ayecode-connect') |
|
2437 | 2437 | ); |
2438 | 2438 | |
2439 | - return apply_filters( 'ayecode_ui_select2_params', $params ); |
|
2439 | + return apply_filters('ayecode_ui_select2_params', $params); |
|
2440 | 2440 | } |
2441 | 2441 | |
2442 | 2442 | /** |
@@ -2449,17 +2449,17 @@ discard block |
||
2449 | 2449 | public static function select2_locale() { |
2450 | 2450 | $params = self::select2_params(); |
2451 | 2451 | |
2452 | - foreach ( (array) $params as $key => $value ) { |
|
2453 | - if ( ! is_scalar( $value ) ) { |
|
2452 | + foreach ((array) $params as $key => $value) { |
|
2453 | + if (!is_scalar($value)) { |
|
2454 | 2454 | continue; |
2455 | 2455 | } |
2456 | 2456 | |
2457 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2457 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2458 | 2458 | } |
2459 | 2459 | |
2460 | - $locale = json_encode( $params ); |
|
2460 | + $locale = json_encode($params); |
|
2461 | 2461 | |
2462 | - return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) ); |
|
2462 | + return apply_filters('ayecode_ui_select2_locale', trim($locale)); |
|
2463 | 2463 | } |
2464 | 2464 | |
2465 | 2465 | /** |
@@ -2472,35 +2472,35 @@ discard block |
||
2472 | 2472 | public static function timeago_locale() { |
2473 | 2473 | $params = array( |
2474 | 2474 | 'prefix_ago' => '', |
2475 | - 'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'ayecode-connect' ), |
|
2476 | - 'prefix_after' => _x( 'after', 'time ago', 'ayecode-connect' ) . ' ', |
|
2475 | + 'suffix_ago' => ' ' . _x('ago', 'time ago', 'ayecode-connect'), |
|
2476 | + 'prefix_after' => _x('after', 'time ago', 'ayecode-connect') . ' ', |
|
2477 | 2477 | 'suffix_after' => '', |
2478 | - 'seconds' => _x( 'less than a minute', 'time ago', 'ayecode-connect' ), |
|
2479 | - 'minute' => _x( 'about a minute', 'time ago', 'ayecode-connect' ), |
|
2480 | - 'minutes' => _x( '%d minutes', 'time ago', 'ayecode-connect' ), |
|
2481 | - 'hour' => _x( 'about an hour', 'time ago', 'ayecode-connect' ), |
|
2482 | - 'hours' => _x( 'about %d hours', 'time ago', 'ayecode-connect' ), |
|
2483 | - 'day' => _x( 'a day', 'time ago', 'ayecode-connect' ), |
|
2484 | - 'days' => _x( '%d days', 'time ago', 'ayecode-connect' ), |
|
2485 | - 'month' => _x( 'about a month', 'time ago', 'ayecode-connect' ), |
|
2486 | - 'months' => _x( '%d months', 'time ago', 'ayecode-connect' ), |
|
2487 | - 'year' => _x( 'about a year', 'time ago', 'ayecode-connect' ), |
|
2488 | - 'years' => _x( '%d years', 'time ago', 'ayecode-connect' ), |
|
2478 | + 'seconds' => _x('less than a minute', 'time ago', 'ayecode-connect'), |
|
2479 | + 'minute' => _x('about a minute', 'time ago', 'ayecode-connect'), |
|
2480 | + 'minutes' => _x('%d minutes', 'time ago', 'ayecode-connect'), |
|
2481 | + 'hour' => _x('about an hour', 'time ago', 'ayecode-connect'), |
|
2482 | + 'hours' => _x('about %d hours', 'time ago', 'ayecode-connect'), |
|
2483 | + 'day' => _x('a day', 'time ago', 'ayecode-connect'), |
|
2484 | + 'days' => _x('%d days', 'time ago', 'ayecode-connect'), |
|
2485 | + 'month' => _x('about a month', 'time ago', 'ayecode-connect'), |
|
2486 | + 'months' => _x('%d months', 'time ago', 'ayecode-connect'), |
|
2487 | + 'year' => _x('about a year', 'time ago', 'ayecode-connect'), |
|
2488 | + 'years' => _x('%d years', 'time ago', 'ayecode-connect'), |
|
2489 | 2489 | ); |
2490 | 2490 | |
2491 | - $params = apply_filters( 'ayecode_ui_timeago_params', $params ); |
|
2491 | + $params = apply_filters('ayecode_ui_timeago_params', $params); |
|
2492 | 2492 | |
2493 | - foreach ( (array) $params as $key => $value ) { |
|
2494 | - if ( ! is_scalar( $value ) ) { |
|
2493 | + foreach ((array) $params as $key => $value) { |
|
2494 | + if (!is_scalar($value)) { |
|
2495 | 2495 | continue; |
2496 | 2496 | } |
2497 | 2497 | |
2498 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2498 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2499 | 2499 | } |
2500 | 2500 | |
2501 | - $locale = json_encode( $params ); |
|
2501 | + $locale = json_encode($params); |
|
2502 | 2502 | |
2503 | - return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) ); |
|
2503 | + return apply_filters('ayecode_ui_timeago_locale', trim($locale)); |
|
2504 | 2504 | } |
2505 | 2505 | |
2506 | 2506 | /** |
@@ -2511,7 +2511,7 @@ discard block |
||
2511 | 2511 | * @return mixed |
2512 | 2512 | */ |
2513 | 2513 | public static function minify_js($input) { |
2514 | - if(trim($input) === "") return $input; |
|
2514 | + if (trim($input) === "") return $input; |
|
2515 | 2515 | return preg_replace( |
2516 | 2516 | array( |
2517 | 2517 | // Remove comment(s) |
@@ -2543,7 +2543,7 @@ discard block |
||
2543 | 2543 | * @return mixed |
2544 | 2544 | */ |
2545 | 2545 | public static function minify_css($input) { |
2546 | - if(trim($input) === "") return $input; |
|
2546 | + if (trim($input) === "") return $input; |
|
2547 | 2547 | return preg_replace( |
2548 | 2548 | array( |
2549 | 2549 | // Remove comment(s) |
@@ -3109,12 +3109,12 @@ discard block |
||
3109 | 3109 | }); |
3110 | 3110 | } |
3111 | 3111 | } |
3112 | - <?php do_action( 'aui_conditional_fields_js', $this ); ?> |
|
3112 | + <?php do_action('aui_conditional_fields_js', $this); ?> |
|
3113 | 3113 | </script> |
3114 | 3114 | <?php |
3115 | 3115 | $output = ob_get_clean(); |
3116 | 3116 | |
3117 | - return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) ); |
|
3117 | + return str_replace(array('<script>', '</script>'), '', self::minify_js($output)); |
|
3118 | 3118 | } |
3119 | 3119 | } |
3120 | 3120 |
@@ -6,39 +6,39 @@ |
||
6 | 6 | /** |
7 | 7 | * Bail if we are not in WP. |
8 | 8 | */ |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if (!defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Set the version only if its the current newest while loading. |
15 | 15 | */ |
16 | -add_action('after_setup_theme', function () { |
|
17 | - global $ayecode_ui_version,$ayecode_ui_file_key; |
|
16 | +add_action('after_setup_theme', function() { |
|
17 | + global $ayecode_ui_version, $ayecode_ui_file_key; |
|
18 | 18 | $this_version = "0.2.15"; |
19 | - if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){ |
|
20 | - $ayecode_ui_version = $this_version ; |
|
21 | - $ayecode_ui_file_key = wp_hash( __FILE__ ); |
|
19 | + if (empty($ayecode_ui_version) || version_compare($this_version, $ayecode_ui_version, '>')) { |
|
20 | + $ayecode_ui_version = $this_version; |
|
21 | + $ayecode_ui_file_key = wp_hash(__FILE__); |
|
22 | 22 | } |
23 | 23 | },0); |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Load this version of WP Bootstrap Settings only if the file hash is the current one. |
27 | 27 | */ |
28 | -add_action('after_setup_theme', function () { |
|
28 | +add_action('after_setup_theme', function() { |
|
29 | 29 | global $ayecode_ui_file_key; |
30 | - if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){ |
|
31 | - include_once( dirname( __FILE__ ) . '/includes/class-aui.php' ); |
|
32 | - include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' ); |
|
30 | + if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) { |
|
31 | + include_once(dirname(__FILE__) . '/includes/class-aui.php'); |
|
32 | + include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php'); |
|
33 | 33 | } |
34 | 34 | },1); |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Add the function that calls the class. |
38 | 38 | */ |
39 | -if(!function_exists('aui')){ |
|
40 | - function aui(){ |
|
41 | - if(!class_exists("AUI",false)){ |
|
39 | +if (!function_exists('aui')) { |
|
40 | + function aui() { |
|
41 | + if (!class_exists("AUI", false)) { |
|
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | return AUI::instance(); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | -if ( ! class_exists( 'WP_Super_Duper' ) ) { |
|
6 | +if (!class_exists('WP_Super_Duper')) { |
|
7 | 7 | |
8 | - define( 'SUPER_DUPER_VER', '1.1.43' ); |
|
8 | + define('SUPER_DUPER_VER', '1.1.43'); |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress. |
@@ -38,40 +38,40 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Take the array options and use them to build. |
40 | 40 | */ |
41 | - public function __construct( $options ) { |
|
41 | + public function __construct($options) { |
|
42 | 42 | global $sd_widgets; |
43 | 43 | |
44 | - $sd_widgets[ $options['base_id'] ] = array( |
|
44 | + $sd_widgets[$options['base_id']] = array( |
|
45 | 45 | 'name' => $options['name'], |
46 | 46 | 'class_name' => $options['class_name'], |
47 | 47 | 'output_types' => !empty($options['output_types']) ? $options['output_types'] : array() |
48 | 48 | ); |
49 | - $this->base_id = $options['base_id']; |
|
49 | + $this->base_id = $options['base_id']; |
|
50 | 50 | // lets filter the options before we do anything |
51 | - $options = apply_filters( "wp_super_duper_options", $options ); |
|
52 | - $options = apply_filters( "wp_super_duper_options_{$this->base_id}", $options ); |
|
53 | - $options = $this->add_name_from_key( $options ); |
|
51 | + $options = apply_filters("wp_super_duper_options", $options); |
|
52 | + $options = apply_filters("wp_super_duper_options_{$this->base_id}", $options); |
|
53 | + $options = $this->add_name_from_key($options); |
|
54 | 54 | $this->options = $options; |
55 | 55 | |
56 | 56 | $this->base_id = $options['base_id']; |
57 | - $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array(); |
|
57 | + $this->arguments = isset($options['arguments']) ? $options['arguments'] : array(); |
|
58 | 58 | |
59 | 59 | // nested blocks can't work as a widget |
60 | - if(!empty($this->options['nested-block'])){ |
|
61 | - if(empty($this->options['output_types'])){ |
|
62 | - $this->options['output_types'] = array('shortcode','block'); |
|
60 | + if (!empty($this->options['nested-block'])) { |
|
61 | + if (empty($this->options['output_types'])) { |
|
62 | + $this->options['output_types'] = array('shortcode', 'block'); |
|
63 | 63 | }elseif (($key = array_search('widget', $this->options['output_types'])) !== false) { |
64 | 64 | unset($this->options['output_types'][$key]); |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | 68 | // init parent |
69 | - if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ |
|
70 | - parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] ); |
|
69 | + if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) { |
|
70 | + parent::__construct($options['base_id'], $options['name'], $options['widget_ops']); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | - if ( isset( $options['class_name'] ) ) { |
|
74 | + if (isset($options['class_name'])) { |
|
75 | 75 | // register widget |
76 | 76 | $this->class_name = $options['class_name']; |
77 | 77 | |
@@ -80,61 +80,61 @@ discard block |
||
80 | 80 | |
81 | 81 | |
82 | 82 | // Fusion Builder (avada) support |
83 | - if ( function_exists( 'fusion_builder_map' ) ) { |
|
84 | - add_action( 'init', array( $this, 'register_fusion_element' ) ); |
|
83 | + if (function_exists('fusion_builder_map')) { |
|
84 | + add_action('init', array($this, 'register_fusion_element')); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | // register block |
88 | - if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){ |
|
89 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) ); |
|
88 | + if (empty($this->options['output_types']) || in_array('block', $this->options['output_types'])) { |
|
89 | + add_action('admin_enqueue_scripts', array($this, 'register_block')); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | 93 | // add the CSS and JS we need ONCE |
94 | 94 | global $sd_widget_scripts; |
95 | 95 | |
96 | - if ( ! $sd_widget_scripts ) { |
|
97 | - wp_add_inline_script( 'admin-widgets', $this->widget_js() ); |
|
98 | - wp_add_inline_script( 'customize-controls', $this->widget_js() ); |
|
99 | - wp_add_inline_style( 'widgets', $this->widget_css() ); |
|
96 | + if (!$sd_widget_scripts) { |
|
97 | + wp_add_inline_script('admin-widgets', $this->widget_js()); |
|
98 | + wp_add_inline_script('customize-controls', $this->widget_js()); |
|
99 | + wp_add_inline_style('widgets', $this->widget_css()); |
|
100 | 100 | |
101 | 101 | // maybe add elementor editor styles |
102 | - add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) ); |
|
102 | + add_action('elementor/editor/after_enqueue_styles', array($this, 'elementor_editor_styles')); |
|
103 | 103 | |
104 | 104 | $sd_widget_scripts = true; |
105 | 105 | |
106 | 106 | // add shortcode insert button once |
107 | - add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) ); |
|
107 | + add_action('media_buttons', array($this, 'shortcode_insert_button')); |
|
108 | 108 | // generatepress theme sections compatibility |
109 | - if ( function_exists( 'generate_sections_sections_metabox' ) ) { |
|
110 | - add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) ); |
|
109 | + if (function_exists('generate_sections_sections_metabox')) { |
|
110 | + add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script')); |
|
111 | 111 | } |
112 | 112 | /* Load script on Divi theme builder page */ |
113 | - if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { |
|
113 | + if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { |
|
114 | 114 | add_thickbox(); |
115 | - add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) ); |
|
115 | + add_action('admin_footer', array($this, 'shortcode_insert_button_script')); |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( $this->is_preview() ) { |
|
119 | - add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) ); |
|
118 | + if ($this->is_preview()) { |
|
119 | + add_action('wp_footer', array($this, 'shortcode_insert_button_script')); |
|
120 | 120 | // this makes the insert button work for elementor |
121 | - add_action( 'elementor/editor/after_enqueue_scripts', array( |
|
121 | + add_action('elementor/editor/after_enqueue_scripts', array( |
|
122 | 122 | $this, |
123 | 123 | 'shortcode_insert_button_script' |
124 | - ) ); // for elementor |
|
124 | + )); // for elementor |
|
125 | 125 | } |
126 | 126 | // this makes the insert button work for cornerstone |
127 | - add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) ); |
|
127 | + add_action('wp_print_footer_scripts', array(__CLASS__, 'maybe_cornerstone_builder')); |
|
128 | 128 | |
129 | - add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) ); |
|
130 | - add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) ); |
|
129 | + add_action('wp_ajax_super_duper_get_widget_settings', array(__CLASS__, 'get_widget_settings')); |
|
130 | + add_action('wp_ajax_super_duper_get_picker', array(__CLASS__, 'get_picker')); |
|
131 | 131 | |
132 | 132 | // add generator text to head |
133 | - add_action( 'admin_head', array( $this, 'generator' ), 99 ); |
|
134 | - add_action( 'wp_head', array( $this, 'generator' ), 99 ); |
|
133 | + add_action('admin_head', array($this, 'generator'), 99); |
|
134 | + add_action('wp_head', array($this, 'generator'), 99); |
|
135 | 135 | } |
136 | 136 | |
137 | - do_action( 'wp_super_duper_widget_init', $options, $this ); |
|
137 | + do_action('wp_super_duper_widget_init', $options, $this); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @return void |
143 | 143 | */ |
144 | 144 | public function _register() { |
145 | - if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ |
|
145 | + if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) { |
|
146 | 146 | parent::_register(); |
147 | 147 | } |
148 | 148 | } |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | * Add our widget CSS to elementor editor. |
152 | 152 | */ |
153 | 153 | public function elementor_editor_styles() { |
154 | - wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) ); |
|
154 | + wp_add_inline_style('elementor-editor', $this->widget_css(false)); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | public function register_fusion_element() { |
158 | 158 | |
159 | 159 | $options = $this->options; |
160 | 160 | |
161 | - if ( $this->base_id ) { |
|
161 | + if ($this->base_id) { |
|
162 | 162 | |
163 | 163 | $params = $this->get_fusion_params(); |
164 | 164 | |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | 'allow_generator' => true, |
170 | 170 | ); |
171 | 171 | |
172 | - if ( ! empty( $params ) ) { |
|
172 | + if (!empty($params)) { |
|
173 | 173 | $args['params'] = $params; |
174 | 174 | } |
175 | 175 | |
176 | - fusion_builder_map( $args ); |
|
176 | + fusion_builder_map($args); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | } |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | $params = array(); |
183 | 183 | $arguments = $this->get_arguments(); |
184 | 184 | |
185 | - if ( ! empty( $arguments ) ) { |
|
186 | - foreach ( $arguments as $key => $val ) { |
|
185 | + if (!empty($arguments)) { |
|
186 | + foreach ($arguments as $key => $val) { |
|
187 | 187 | $param = array(); |
188 | 188 | // type |
189 | 189 | $param['type'] = str_replace( |
@@ -205,38 +205,38 @@ discard block |
||
205 | 205 | $val['type'] ); |
206 | 206 | |
207 | 207 | // multiselect |
208 | - if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) { |
|
208 | + if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) { |
|
209 | 209 | $param['type'] = 'multiple_select'; |
210 | 210 | $param['multiple'] = true; |
211 | 211 | } |
212 | 212 | |
213 | 213 | // heading |
214 | - $param['heading'] = isset( $val['title'] ) ? $val['title'] : ''; |
|
214 | + $param['heading'] = isset($val['title']) ? $val['title'] : ''; |
|
215 | 215 | |
216 | 216 | // description |
217 | - $param['description'] = isset( $val['desc'] ) ? $val['desc'] : ''; |
|
217 | + $param['description'] = isset($val['desc']) ? $val['desc'] : ''; |
|
218 | 218 | |
219 | 219 | // param_name |
220 | 220 | $param['param_name'] = $key; |
221 | 221 | |
222 | 222 | // Default |
223 | - $param['default'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
223 | + $param['default'] = isset($val['default']) ? $val['default'] : ''; |
|
224 | 224 | |
225 | 225 | // Group |
226 | - if ( isset( $val['group'] ) ) { |
|
226 | + if (isset($val['group'])) { |
|
227 | 227 | $param['group'] = $val['group']; |
228 | 228 | } |
229 | 229 | |
230 | 230 | // value |
231 | - if ( $val['type'] == 'checkbox' ) { |
|
232 | - if ( isset( $val['default'] ) && $val['default'] == '0' ) { |
|
233 | - unset( $param['default'] ); |
|
231 | + if ($val['type'] == 'checkbox') { |
|
232 | + if (isset($val['default']) && $val['default'] == '0') { |
|
233 | + unset($param['default']); |
|
234 | 234 | } |
235 | - $param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) ); |
|
236 | - } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) { |
|
237 | - $param['value'] = isset( $val['options'] ) ? $val['options'] : array(); |
|
235 | + $param['value'] = array('0' => __("No", 'ayecode-connect'), '1' => __("Yes", 'ayecode-connect')); |
|
236 | + } elseif ($param['type'] == 'select' || $param['type'] == 'multiple_select') { |
|
237 | + $param['value'] = isset($val['options']) ? $val['options'] : array(); |
|
238 | 238 | } else { |
239 | - $param['value'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
239 | + $param['value'] = isset($val['default']) ? $val['default'] : ''; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | // setup the param |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder |
254 | 254 | */ |
255 | 255 | public static function maybe_cornerstone_builder() { |
256 | - if ( did_action( 'cornerstone_before_boot_app' ) ) { |
|
256 | + if (did_action('cornerstone_before_boot_app')) { |
|
257 | 257 | self::shortcode_insert_button_script(); |
258 | 258 | } |
259 | 259 | } |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return string |
267 | 267 | */ |
268 | - public static function get_picker( $editor_id = '' ) { |
|
268 | + public static function get_picker($editor_id = '') { |
|
269 | 269 | |
270 | 270 | ob_start(); |
271 | - if ( isset( $_POST['editor_id'] ) ) { |
|
272 | - $editor_id = esc_attr( $_POST['editor_id'] ); |
|
273 | - } elseif ( isset( $_REQUEST['et_fb'] ) ) { |
|
271 | + if (isset($_POST['editor_id'])) { |
|
272 | + $editor_id = esc_attr($_POST['editor_id']); |
|
273 | + } elseif (isset($_REQUEST['et_fb'])) { |
|
274 | 274 | $editor_id = 'main_content_content_vb_tiny_mce'; |
275 | 275 | } |
276 | 276 | |
@@ -281,14 +281,14 @@ discard block |
||
281 | 281 | |
282 | 282 | <div class="sd-shortcode-left-wrap"> |
283 | 283 | <?php |
284 | - ksort( $sd_widgets ); |
|
284 | + ksort($sd_widgets); |
|
285 | 285 | // print_r($sd_widgets);exit; |
286 | - if ( ! empty( $sd_widgets ) ) { |
|
286 | + if (!empty($sd_widgets)) { |
|
287 | 287 | echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">'; |
288 | - echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>"; |
|
289 | - foreach ( $sd_widgets as $shortcode => $class ) { |
|
290 | - if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; } |
|
291 | - echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>"; |
|
288 | + echo "<option>" . __('Select shortcode', 'ayecode-connect') . "</option>"; |
|
289 | + foreach ($sd_widgets as $shortcode => $class) { |
|
290 | + if (!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])) { continue; } |
|
291 | + echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>"; |
|
292 | 292 | } |
293 | 293 | echo "</select>"; |
294 | 294 | |
@@ -301,37 +301,37 @@ discard block |
||
301 | 301 | <div class="sd-shortcode-right-wrap"> |
302 | 302 | <textarea id='sd-shortcode-output' disabled></textarea> |
303 | 303 | <div id='sd-shortcode-output-actions'> |
304 | - <?php if ( $editor_id != '' ) { ?> |
|
304 | + <?php if ($editor_id != '') { ?> |
|
305 | 305 | <button class="button sd-insert-shortcode-button" |
306 | - onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { |
|
306 | + onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) { |
|
307 | 307 | echo "'" . $editor_id . "'"; |
308 | - } ?>)"><?php _e( 'Insert shortcode', 'ayecode-connect' ); ?></button> |
|
308 | + } ?>)"><?php _e('Insert shortcode', 'ayecode-connect'); ?></button> |
|
309 | 309 | <?php } ?> |
310 | 310 | <button class="button" |
311 | - onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button> |
|
311 | + onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button> |
|
312 | 312 | </div> |
313 | 313 | </div> |
314 | 314 | <?php |
315 | 315 | |
316 | 316 | $html = ob_get_clean(); |
317 | 317 | |
318 | - if ( wp_doing_ajax() ) { |
|
318 | + if (wp_doing_ajax()) { |
|
319 | 319 | echo $html; |
320 | 320 | $should_die = true; |
321 | 321 | |
322 | 322 | // some builder get the editor via ajax so we should not die on those occasions |
323 | 323 | $dont_die = array( |
324 | - 'parent_tag',// WP Bakery |
|
324 | + 'parent_tag', // WP Bakery |
|
325 | 325 | 'avia_request' // enfold |
326 | 326 | ); |
327 | 327 | |
328 | - foreach ( $dont_die as $request ) { |
|
329 | - if ( isset( $_REQUEST[ $request ] ) ) { |
|
328 | + foreach ($dont_die as $request) { |
|
329 | + if (isset($_REQUEST[$request])) { |
|
330 | 330 | $should_die = false; |
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | - if ( $should_die ) { |
|
334 | + if ($should_die) { |
|
335 | 335 | wp_die(); |
336 | 336 | } |
337 | 337 | |
@@ -347,22 +347,22 @@ discard block |
||
347 | 347 | * Output the version in the header. |
348 | 348 | */ |
349 | 349 | public function generator() { |
350 | - $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) ); |
|
351 | - $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) ); |
|
350 | + $file = str_replace(array("/", "\\"), "/", realpath(__FILE__)); |
|
351 | + $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR)); |
|
352 | 352 | |
353 | 353 | // Find source plugin/theme of SD |
354 | 354 | $source = array(); |
355 | - if ( strpos( $file, $plugins_dir ) !== false ) { |
|
356 | - $source = explode( "/", plugin_basename( $file ) ); |
|
357 | - } else if ( function_exists( 'get_theme_root' ) ) { |
|
358 | - $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) ); |
|
355 | + if (strpos($file, $plugins_dir) !== false) { |
|
356 | + $source = explode("/", plugin_basename($file)); |
|
357 | + } else if (function_exists('get_theme_root')) { |
|
358 | + $themes_dir = str_replace(array("/", "\\"), "/", realpath(get_theme_root())); |
|
359 | 359 | |
360 | - if ( strpos( $file, $themes_dir ) !== false ) { |
|
361 | - $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) ); |
|
360 | + if (strpos($file, $themes_dir) !== false) { |
|
361 | + $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/")); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | - echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />'; |
|
365 | + echo '<meta name="generator" content="WP Super Duper v' . esc_attr($this->version) . '"' . (!empty($source[0]) ? ' data-sd-source="' . esc_attr($source[0]) . '"' : '') . ' />'; |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -373,16 +373,16 @@ discard block |
||
373 | 373 | public static function get_widget_settings() { |
374 | 374 | global $sd_widgets; |
375 | 375 | |
376 | - $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : ''; |
|
377 | - if ( ! $shortcode ) { |
|
376 | + $shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : ''; |
|
377 | + if (!$shortcode) { |
|
378 | 378 | wp_die(); |
379 | 379 | } |
380 | - $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : ''; |
|
381 | - if ( ! $widget_args ) { |
|
380 | + $widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : ''; |
|
381 | + if (!$widget_args) { |
|
382 | 382 | wp_die(); |
383 | 383 | } |
384 | - $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
385 | - if ( ! $class_name ) { |
|
384 | + $class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
385 | + if (!$class_name) { |
|
386 | 386 | wp_die(); |
387 | 387 | } |
388 | 388 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $widget = new $class_name; |
391 | 391 | |
392 | 392 | ob_start(); |
393 | - $widget->form( array() ); |
|
393 | + $widget->form(array()); |
|
394 | 394 | $form = ob_get_clean(); |
395 | 395 | echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>"; |
396 | 396 | echo "<style>" . $widget->widget_css() . "</style>"; |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | *@since 1.0.0 |
410 | 410 | * |
411 | 411 | */ |
412 | - public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) { |
|
412 | + public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') { |
|
413 | 413 | global $sd_widgets, $shortcode_insert_button_once; |
414 | - if ( $shortcode_insert_button_once ) { |
|
414 | + if ($shortcode_insert_button_once) { |
|
415 | 415 | return; |
416 | 416 | } |
417 | 417 | add_thickbox(); |
@@ -421,21 +421,21 @@ discard block |
||
421 | 421 | * Cornerstone makes us play dirty tricks :/ |
422 | 422 | * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed. |
423 | 423 | */ |
424 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
424 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
425 | 425 | echo '<span id="insert-media-button">'; |
426 | 426 | } |
427 | 427 | |
428 | - echo self::shortcode_button( 'this', 'true' ); |
|
428 | + echo self::shortcode_button('this', 'true'); |
|
429 | 429 | |
430 | 430 | // see opening note |
431 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
431 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
432 | 432 | echo '</span>'; // end #insert-media-button |
433 | 433 | } |
434 | 434 | |
435 | 435 | // Add separate script for generatepress theme sections |
436 | - if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) { |
|
436 | + if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) { |
|
437 | 437 | } else { |
438 | - self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function ); |
|
438 | + self::shortcode_insert_button_script($editor_id, $insert_shortcode_function); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | $shortcode_insert_button_once = true; |
@@ -449,12 +449,12 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @return mixed |
451 | 451 | */ |
452 | - public static function shortcode_button( $id = '', $search_for_id = '' ) { |
|
452 | + public static function shortcode_button($id = '', $search_for_id = '') { |
|
453 | 453 | ob_start(); |
454 | 454 | ?> |
455 | 455 | <span class="sd-lable-shortcode-inserter"> |
456 | 456 | <a onclick="sd_ajax_get_picker(<?php echo $id; |
457 | - if ( $search_for_id ) { |
|
457 | + if ($search_for_id) { |
|
458 | 458 | echo "," . $search_for_id; |
459 | 459 | } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed" |
460 | 460 | class="thickbox button super-duper-content-open" title="Add Shortcode"> |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $html = ob_get_clean(); |
471 | 471 | |
472 | 472 | // remove line breaks so we can use it in js |
473 | - return preg_replace( "/\r|\n/", "", trim( $html ) ); |
|
473 | + return preg_replace("/\r|\n/", "", trim($html)); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | jQuery($this).data('sd-widget-enabled', true); |
529 | 529 | } |
530 | 530 | |
531 | - var $button = '<button title="<?php _e( 'Advanced Settings', 'ayecode-connect' );?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>'; |
|
531 | + var $button = '<button title="<?php _e('Advanced Settings', 'ayecode-connect'); ?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>'; |
|
532 | 532 | var form = jQuery($this).parents('' + $selector + ''); |
533 | 533 | |
534 | 534 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -563,10 +563,10 @@ discard block |
||
563 | 563 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
564 | 564 | */ |
565 | 565 | |
566 | - return str_replace( array( |
|
566 | + return str_replace(array( |
|
567 | 567 | '<script>', |
568 | 568 | '</script>' |
569 | - ), '', $output ); |
|
569 | + ), '', $output); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | /** |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | *@since 1.0.6 |
579 | 579 | * |
580 | 580 | */ |
581 | - public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) { |
|
581 | + public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') { |
|
582 | 582 | ?> |
583 | 583 | <style> |
584 | 584 | .sd-shortcode-left-wrap { |
@@ -697,25 +697,25 @@ discard block |
||
697 | 697 | width: 100%; |
698 | 698 | } |
699 | 699 | |
700 | - <?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?> |
|
700 | + <?php if (function_exists('generate_sections_sections_metabox')) { ?> |
|
701 | 701 | .generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter { |
702 | 702 | display: inline; |
703 | 703 | } |
704 | 704 | <?php } ?> |
705 | - <?php if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { ?> |
|
705 | + <?php if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { ?> |
|
706 | 706 | body.divi_page_et_theme_builder div#TB_window.gd-tb-window{z-index:9999999} |
707 | 707 | <?php } ?> |
708 | 708 | </style> |
709 | 709 | <?php |
710 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
710 | + if (class_exists('SiteOrigin_Panels')) { |
|
711 | 711 | echo "<script>" . self::siteorigin_js() . "</script>"; |
712 | 712 | } |
713 | 713 | ?> |
714 | 714 | <script> |
715 | 715 | <?php |
716 | - if(! empty( $insert_shortcode_function )){ |
|
716 | + if (!empty($insert_shortcode_function)) { |
|
717 | 717 | echo $insert_shortcode_function; |
718 | - }else{ |
|
718 | + } else { |
|
719 | 719 | |
720 | 720 | /** |
721 | 721 | * Function for super duper insert shortcode. |
@@ -728,9 +728,9 @@ discard block |
||
728 | 728 | if ($shortcode) { |
729 | 729 | if (!$editor_id) { |
730 | 730 | <?php |
731 | - if ( isset( $_REQUEST['et_fb'] ) ) { |
|
731 | + if (isset($_REQUEST['et_fb'])) { |
|
732 | 732 | echo '$editor_id = "#main_content_content_vb_tiny_mce";'; |
733 | - } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) { |
|
733 | + } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') { |
|
734 | 734 | echo '$editor_id = "#elementor-controls .wp-editor-container textarea";'; |
735 | 735 | } else { |
736 | 736 | echo '$editor_id = "#wp-content-editor-container textarea";'; |
@@ -813,11 +813,11 @@ discard block |
||
813 | 813 | 'shortcode': $short_code, |
814 | 814 | 'attributes': 123, |
815 | 815 | 'post_id': 321, |
816 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
816 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
817 | 817 | }; |
818 | 818 | |
819 | 819 | if (typeof ajaxurl === 'undefined') { |
820 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>"; |
|
820 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1016,11 +1016,11 @@ discard block |
||
1016 | 1016 | var data = { |
1017 | 1017 | 'action': 'super_duper_get_picker', |
1018 | 1018 | 'editor_id': $id, |
1019 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>' |
|
1019 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>' |
|
1020 | 1020 | }; |
1021 | 1021 | |
1022 | 1022 | if (!ajaxurl) { |
1023 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>"; |
|
1023 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1042,9 +1042,9 @@ discard block |
||
1042 | 1042 | */ |
1043 | 1043 | function sd_shortcode_button($id) { |
1044 | 1044 | if ($id) { |
1045 | - return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>'; |
|
1045 | + return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>'; |
|
1046 | 1046 | } else { |
1047 | - return '<?php echo self::shortcode_button();?>'; |
|
1047 | + return '<?php echo self::shortcode_button(); ?>'; |
|
1048 | 1048 | } |
1049 | 1049 | } |
1050 | 1050 | </script> |
@@ -1058,11 +1058,11 @@ discard block |
||
1058 | 1058 | * |
1059 | 1059 | * @return mixed |
1060 | 1060 | */ |
1061 | - public function widget_css( $advanced = true ) { |
|
1061 | + public function widget_css($advanced = true) { |
|
1062 | 1062 | ob_start(); |
1063 | 1063 | ?> |
1064 | 1064 | <style> |
1065 | - <?php if( $advanced ){ ?> |
|
1065 | + <?php if ($advanced) { ?> |
|
1066 | 1066 | .sd-advanced-setting { |
1067 | 1067 | display: none; |
1068 | 1068 | } |
@@ -1106,10 +1106,10 @@ discard block |
||
1106 | 1106 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1107 | 1107 | */ |
1108 | 1108 | |
1109 | - return str_replace( array( |
|
1109 | + return str_replace(array( |
|
1110 | 1110 | '<style>', |
1111 | 1111 | '</style>' |
1112 | - ), '', $output ); |
|
1112 | + ), '', $output); |
|
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | /** |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | jQuery($this).data('sd-widget-enabled', true); |
1177 | 1177 | } |
1178 | 1178 | |
1179 | - var $button = '<button title="<?php _e( 'Advanced Settings', 'ayecode-connect' );?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>'; |
|
1179 | + var $button = '<button title="<?php _e('Advanced Settings', 'ayecode-connect'); ?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>'; |
|
1180 | 1180 | var form = $form ? $form : jQuery($this).parents('' + $selector + ''); |
1181 | 1181 | |
1182 | 1182 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | }); |
1268 | 1268 | |
1269 | 1269 | } |
1270 | - <?php do_action( 'wp_super_duper_widget_js', $this ); ?> |
|
1270 | + <?php do_action('wp_super_duper_widget_js', $this); ?> |
|
1271 | 1271 | </script> |
1272 | 1272 | <?php |
1273 | 1273 | $output = ob_get_clean(); |
@@ -1276,10 +1276,10 @@ discard block |
||
1276 | 1276 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1277 | 1277 | */ |
1278 | 1278 | |
1279 | - return str_replace( array( |
|
1279 | + return str_replace(array( |
|
1280 | 1280 | '<script>', |
1281 | 1281 | '</script>' |
1282 | - ), '', $output ); |
|
1282 | + ), '', $output); |
|
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | |
@@ -1290,14 +1290,14 @@ discard block |
||
1290 | 1290 | * |
1291 | 1291 | * @return mixed |
1292 | 1292 | */ |
1293 | - private function add_name_from_key( $options, $arguments = false ) { |
|
1294 | - if ( ! empty( $options['arguments'] ) ) { |
|
1295 | - foreach ( $options['arguments'] as $key => $val ) { |
|
1296 | - $options['arguments'][ $key ]['name'] = $key; |
|
1293 | + private function add_name_from_key($options, $arguments = false) { |
|
1294 | + if (!empty($options['arguments'])) { |
|
1295 | + foreach ($options['arguments'] as $key => $val) { |
|
1296 | + $options['arguments'][$key]['name'] = $key; |
|
1297 | 1297 | } |
1298 | - } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) { |
|
1299 | - foreach ( $options as $key => $val ) { |
|
1300 | - $options[ $key ]['name'] = $key; |
|
1298 | + } elseif ($arguments && is_array($options) && !empty($options)) { |
|
1299 | + foreach ($options as $key => $val) { |
|
1300 | + $options[$key]['name'] = $key; |
|
1301 | 1301 | } |
1302 | 1302 | } |
1303 | 1303 | |
@@ -1310,8 +1310,8 @@ discard block |
||
1310 | 1310 | * @since 1.0.0 |
1311 | 1311 | */ |
1312 | 1312 | public function register_shortcode() { |
1313 | - add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) ); |
|
1314 | - add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) ); |
|
1313 | + add_shortcode($this->base_id, array($this, 'shortcode_output')); |
|
1314 | + add_action('wp_ajax_super_duper_output_shortcode', array($this, 'render_shortcode')); |
|
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | /** |
@@ -1320,50 +1320,50 @@ discard block |
||
1320 | 1320 | * @since 1.0.0 |
1321 | 1321 | */ |
1322 | 1322 | public function render_shortcode() { |
1323 | - check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true ); |
|
1324 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
1323 | + check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true); |
|
1324 | + if (!current_user_can('manage_options')) { |
|
1325 | 1325 | wp_die(); |
1326 | 1326 | } |
1327 | 1327 | |
1328 | 1328 | // we might need the $post value here so lets set it. |
1329 | - if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) { |
|
1330 | - $post_obj = get_post( absint( $_POST['post_id'] ) ); |
|
1331 | - if ( ! empty( $post_obj ) && empty( $post ) ) { |
|
1329 | + if (isset($_POST['post_id']) && $_POST['post_id']) { |
|
1330 | + $post_obj = get_post(absint($_POST['post_id'])); |
|
1331 | + if (!empty($post_obj) && empty($post)) { |
|
1332 | 1332 | global $post; |
1333 | 1333 | $post = $post_obj; |
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | |
1337 | - if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) { |
|
1337 | + if (isset($_POST['shortcode']) && $_POST['shortcode']) { |
|
1338 | 1338 | $is_preview = $this->is_preview(); |
1339 | - $shortcode_name = sanitize_title_with_dashes( $_POST['shortcode'] ); |
|
1340 | - $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
1339 | + $shortcode_name = sanitize_title_with_dashes($_POST['shortcode']); |
|
1340 | + $attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
1341 | 1341 | $attributes = ''; |
1342 | - if ( ! empty( $attributes_array ) ) { |
|
1343 | - foreach ( $attributes_array as $key => $value ) { |
|
1344 | - if ( is_array( $value ) ) { |
|
1345 | - $value = implode( ",", $value ); |
|
1342 | + if (!empty($attributes_array)) { |
|
1343 | + foreach ($attributes_array as $key => $value) { |
|
1344 | + if (is_array($value)) { |
|
1345 | + $value = implode(",", $value); |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | - if ( ! empty( $value ) ) { |
|
1349 | - $value = wp_unslash( $value ); |
|
1348 | + if (!empty($value)) { |
|
1349 | + $value = wp_unslash($value); |
|
1350 | 1350 | |
1351 | 1351 | // Encode [ and ]. |
1352 | - if ( $is_preview ) { |
|
1353 | - $value = $this->encode_shortcodes( $value ); |
|
1352 | + if ($is_preview) { |
|
1353 | + $value = $this->encode_shortcodes($value); |
|
1354 | 1354 | } |
1355 | 1355 | } |
1356 | - $attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' "; |
|
1356 | + $attributes .= " " . esc_attr(sanitize_title_with_dashes($key)) . "='" . esc_attr($value) . "' "; |
|
1357 | 1357 | } |
1358 | 1358 | } |
1359 | 1359 | |
1360 | - $shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]"; |
|
1360 | + $shortcode = "[" . esc_attr($shortcode_name) . " " . $attributes . "]"; |
|
1361 | 1361 | |
1362 | - $content = do_shortcode( $shortcode ); |
|
1362 | + $content = do_shortcode($shortcode); |
|
1363 | 1363 | |
1364 | 1364 | // Decode [ and ]. |
1365 | - if ( ! empty( $content ) && $is_preview ) { |
|
1366 | - $content = $this->decode_shortcodes( $content ); |
|
1365 | + if (!empty($content) && $is_preview) { |
|
1366 | + $content = $this->decode_shortcodes($content); |
|
1367 | 1367 | } |
1368 | 1368 | |
1369 | 1369 | echo $content; |
@@ -1379,21 +1379,21 @@ discard block |
||
1379 | 1379 | * |
1380 | 1380 | * @return string |
1381 | 1381 | */ |
1382 | - public function shortcode_output( $args = array(), $content = '' ) { |
|
1382 | + public function shortcode_output($args = array(), $content = '') { |
|
1383 | 1383 | $_instance = $args; |
1384 | 1384 | |
1385 | - $args = $this->argument_values( $args ); |
|
1385 | + $args = $this->argument_values($args); |
|
1386 | 1386 | |
1387 | 1387 | // add extra argument so we know its a output to gutenberg |
1388 | 1388 | //$args |
1389 | - $args = $this->string_to_bool( $args ); |
|
1389 | + $args = $this->string_to_bool($args); |
|
1390 | 1390 | |
1391 | 1391 | // if we have a enclosed shortcode we add it to the special `html` argument |
1392 | - if ( ! empty( $content ) ) { |
|
1392 | + if (!empty($content)) { |
|
1393 | 1393 | $args['html'] = $content; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | - if ( ! $this->is_preview() ) { |
|
1396 | + if (!$this->is_preview()) { |
|
1397 | 1397 | /** |
1398 | 1398 | * Filters the settings for a particular widget args. |
1399 | 1399 | * |
@@ -1404,40 +1404,40 @@ discard block |
||
1404 | 1404 | *@since 1.0.28 |
1405 | 1405 | * |
1406 | 1406 | */ |
1407 | - $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance ); |
|
1407 | + $args = apply_filters('wp_super_duper_widget_display_callback', $args, $this, $_instance); |
|
1408 | 1408 | |
1409 | - if ( ! is_array( $args ) ) { |
|
1409 | + if (!is_array($args)) { |
|
1410 | 1410 | return $args; |
1411 | 1411 | } |
1412 | 1412 | } |
1413 | 1413 | |
1414 | - $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : ''; |
|
1415 | - $class .= " sdel-".$this->get_instance_hash(); |
|
1414 | + $class = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : ''; |
|
1415 | + $class .= " sdel-" . $this->get_instance_hash(); |
|
1416 | 1416 | |
1417 | - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); |
|
1418 | - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); |
|
1417 | + $class = apply_filters('wp_super_duper_div_classname', $class, $args, $this); |
|
1418 | + $class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this); |
|
1419 | 1419 | |
1420 | - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); |
|
1421 | - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); |
|
1420 | + $attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this); |
|
1421 | + $attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); |
|
1422 | 1422 | |
1423 | 1423 | $shortcode_args = array(); |
1424 | 1424 | $output = ''; |
1425 | - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; |
|
1426 | - if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) { |
|
1425 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
1426 | + if (isset($args['no_wrap']) && $args['no_wrap']) { |
|
1427 | 1427 | $no_wrap = true; |
1428 | 1428 | } |
1429 | - $main_content = $this->output( $args, $shortcode_args, $content ); |
|
1430 | - if ( $main_content && ! $no_wrap ) { |
|
1429 | + $main_content = $this->output($args, $shortcode_args, $content); |
|
1430 | + if ($main_content && !$no_wrap) { |
|
1431 | 1431 | // wrap the shortcode in a div with the same class as the widget |
1432 | 1432 | $output .= '<div class="' . $class . '" ' . $attrs . '>'; |
1433 | - if ( ! empty( $args['title'] ) ) { |
|
1433 | + if (!empty($args['title'])) { |
|
1434 | 1434 | // if its a shortcode and there is a title try to grab the title wrappers |
1435 | - $shortcode_args = array( 'before_title' => '', 'after_title' => '' ); |
|
1436 | - if ( empty( $instance ) ) { |
|
1435 | + $shortcode_args = array('before_title' => '', 'after_title' => ''); |
|
1436 | + if (empty($instance)) { |
|
1437 | 1437 | global $wp_registered_sidebars; |
1438 | - if ( ! empty( $wp_registered_sidebars ) ) { |
|
1439 | - foreach ( $wp_registered_sidebars as $sidebar ) { |
|
1440 | - if ( ! empty( $sidebar['before_title'] ) ) { |
|
1438 | + if (!empty($wp_registered_sidebars)) { |
|
1439 | + foreach ($wp_registered_sidebars as $sidebar) { |
|
1440 | + if (!empty($sidebar['before_title'])) { |
|
1441 | 1441 | $shortcode_args['before_title'] = $sidebar['before_title']; |
1442 | 1442 | $shortcode_args['after_title'] = $sidebar['after_title']; |
1443 | 1443 | break; |
@@ -1445,20 +1445,20 @@ discard block |
||
1445 | 1445 | } |
1446 | 1446 | } |
1447 | 1447 | } |
1448 | - $output .= $this->output_title( $shortcode_args, $args ); |
|
1448 | + $output .= $this->output_title($shortcode_args, $args); |
|
1449 | 1449 | } |
1450 | 1450 | $output .= $main_content; |
1451 | 1451 | $output .= '</div>'; |
1452 | - } elseif ( $main_content && $no_wrap ) { |
|
1452 | + } elseif ($main_content && $no_wrap) { |
|
1453 | 1453 | $output .= $main_content; |
1454 | 1454 | } |
1455 | 1455 | |
1456 | 1456 | // if preview show a placeholder if empty |
1457 | - if ( $this->is_preview() && $output == '' ) { |
|
1458 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
1457 | + if ($this->is_preview() && $output == '') { |
|
1458 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
1459 | 1459 | } |
1460 | 1460 | |
1461 | - return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this ); |
|
1461 | + return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this); |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | /** |
@@ -1468,8 +1468,8 @@ discard block |
||
1468 | 1468 | * |
1469 | 1469 | * @return string |
1470 | 1470 | */ |
1471 | - public function preview_placeholder_text( $name = '' ) { |
|
1472 | - return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>"; |
|
1471 | + public function preview_placeholder_text($name = '') { |
|
1472 | + return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf(__('Placeholder for: %s', 'ayecode-connect'), $name) . "</div>"; |
|
1473 | 1473 | } |
1474 | 1474 | |
1475 | 1475 | /** |
@@ -1479,13 +1479,13 @@ discard block |
||
1479 | 1479 | * |
1480 | 1480 | * @return mixed |
1481 | 1481 | */ |
1482 | - public function string_to_bool( $options ) { |
|
1482 | + public function string_to_bool($options) { |
|
1483 | 1483 | // convert bool strings to booleans |
1484 | - foreach ( $options as $key => $val ) { |
|
1485 | - if ( $val == 'false' ) { |
|
1486 | - $options[ $key ] = false; |
|
1487 | - } elseif ( $val == 'true' ) { |
|
1488 | - $options[ $key ] = true; |
|
1484 | + foreach ($options as $key => $val) { |
|
1485 | + if ($val == 'false') { |
|
1486 | + $options[$key] = false; |
|
1487 | + } elseif ($val == 'true') { |
|
1488 | + $options[$key] = true; |
|
1489 | 1489 | } |
1490 | 1490 | } |
1491 | 1491 | |
@@ -1501,26 +1501,26 @@ discard block |
||
1501 | 1501 | *@since 1.0.12 Don't set checkbox default value if the value is empty. |
1502 | 1502 | * |
1503 | 1503 | */ |
1504 | - public function argument_values( $instance ) { |
|
1504 | + public function argument_values($instance) { |
|
1505 | 1505 | $argument_values = array(); |
1506 | 1506 | |
1507 | 1507 | // set widget instance |
1508 | 1508 | $this->instance = $instance; |
1509 | 1509 | |
1510 | - if ( empty( $this->arguments ) ) { |
|
1510 | + if (empty($this->arguments)) { |
|
1511 | 1511 | $this->arguments = $this->get_arguments(); |
1512 | 1512 | } |
1513 | 1513 | |
1514 | - if ( ! empty( $this->arguments ) ) { |
|
1515 | - foreach ( $this->arguments as $key => $args ) { |
|
1514 | + if (!empty($this->arguments)) { |
|
1515 | + foreach ($this->arguments as $key => $args) { |
|
1516 | 1516 | // set the input name from the key |
1517 | 1517 | $args['name'] = $key; |
1518 | 1518 | // |
1519 | - $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; |
|
1520 | - if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) { |
|
1519 | + $argument_values[$key] = isset($instance[$key]) ? $instance[$key] : ''; |
|
1520 | + if ($args['type'] == 'checkbox' && $argument_values[$key] == '') { |
|
1521 | 1521 | // don't set default for an empty checkbox |
1522 | - } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
1523 | - $argument_values[ $key ] = $args['default']; |
|
1522 | + } elseif ($argument_values[$key] == '' && isset($args['default'])) { |
|
1523 | + $argument_values[$key] = $args['default']; |
|
1524 | 1524 | } |
1525 | 1525 | } |
1526 | 1526 | } |
@@ -1547,12 +1547,12 @@ discard block |
||
1547 | 1547 | * |
1548 | 1548 | */ |
1549 | 1549 | public function get_arguments() { |
1550 | - if ( empty( $this->arguments ) ) { |
|
1550 | + if (empty($this->arguments)) { |
|
1551 | 1551 | $this->arguments = $this->set_arguments(); |
1552 | 1552 | } |
1553 | 1553 | |
1554 | - $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance ); |
|
1555 | - $this->arguments = $this->add_name_from_key( $this->arguments, true ); |
|
1554 | + $this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance); |
|
1555 | + $this->arguments = $this->add_name_from_key($this->arguments, true); |
|
1556 | 1556 | |
1557 | 1557 | return $this->arguments; |
1558 | 1558 | } |
@@ -1564,7 +1564,7 @@ discard block |
||
1564 | 1564 | * @param array $widget_args |
1565 | 1565 | * @param string $content |
1566 | 1566 | */ |
1567 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
1567 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
1568 | 1568 | |
1569 | 1569 | } |
1570 | 1570 | |
@@ -1572,9 +1572,9 @@ discard block |
||
1572 | 1572 | * Add the dynamic block code inline when the wp-block in enqueued. |
1573 | 1573 | */ |
1574 | 1574 | public function register_block() { |
1575 | - wp_add_inline_script( 'wp-blocks', $this->block() ); |
|
1576 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
1577 | - wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() ); |
|
1575 | + wp_add_inline_script('wp-blocks', $this->block()); |
|
1576 | + if (class_exists('SiteOrigin_Panels')) { |
|
1577 | + wp_add_inline_script('wp-blocks', $this->siteorigin_js()); |
|
1578 | 1578 | } |
1579 | 1579 | } |
1580 | 1580 | |
@@ -1588,9 +1588,9 @@ discard block |
||
1588 | 1588 | $show = false; |
1589 | 1589 | $arguments = $this->get_arguments(); |
1590 | 1590 | |
1591 | - if ( ! empty( $arguments ) ) { |
|
1592 | - foreach ( $arguments as $argument ) { |
|
1593 | - if ( isset( $argument['advanced'] ) && $argument['advanced'] ) { |
|
1591 | + if (!empty($arguments)) { |
|
1592 | + foreach ($arguments as $argument) { |
|
1593 | + if (isset($argument['advanced']) && $argument['advanced']) { |
|
1594 | 1594 | $show = true; |
1595 | 1595 | break; // no need to continue if we know we have it |
1596 | 1596 | } |
@@ -1608,19 +1608,19 @@ discard block |
||
1608 | 1608 | public function get_url() { |
1609 | 1609 | $url = $this->url; |
1610 | 1610 | |
1611 | - if ( ! $url ) { |
|
1612 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
1613 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
1611 | + if (!$url) { |
|
1612 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
1613 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
1614 | 1614 | |
1615 | 1615 | // Replace http:// to https://. |
1616 | - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { |
|
1617 | - $content_url = str_replace( 'http://', 'https://', $content_url ); |
|
1616 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
1617 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | // Check if we are inside a plugin |
1621 | - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
1622 | - $url = str_replace( $content_dir, $content_url, $file_dir ); |
|
1623 | - $url = trailingslashit( $url ); |
|
1621 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
1622 | + $url = str_replace($content_dir, $content_url, $file_dir); |
|
1623 | + $url = trailingslashit($url); |
|
1624 | 1624 | $this->url = $url; |
1625 | 1625 | } |
1626 | 1626 | |
@@ -1636,15 +1636,15 @@ discard block |
||
1636 | 1636 | |
1637 | 1637 | $url = $this->url; |
1638 | 1638 | |
1639 | - if ( ! $url ) { |
|
1639 | + if (!$url) { |
|
1640 | 1640 | // check if we are inside a plugin |
1641 | - $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) ); |
|
1641 | + $file_dir = str_replace("/includes", "", dirname(__FILE__)); |
|
1642 | 1642 | |
1643 | - $dir_parts = explode( "/wp-content/", $file_dir ); |
|
1644 | - $url_parts = explode( "/wp-content/", plugins_url() ); |
|
1643 | + $dir_parts = explode("/wp-content/", $file_dir); |
|
1644 | + $url_parts = explode("/wp-content/", plugins_url()); |
|
1645 | 1645 | |
1646 | - if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) { |
|
1647 | - $url = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] ); |
|
1646 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
1647 | + $url = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]); |
|
1648 | 1648 | $this->url = $url; |
1649 | 1649 | } |
1650 | 1650 | } |
@@ -1665,45 +1665,45 @@ discard block |
||
1665 | 1665 | * @return string |
1666 | 1666 | *@since 1.1.0 |
1667 | 1667 | */ |
1668 | - public function get_block_icon( $icon ) { |
|
1668 | + public function get_block_icon($icon) { |
|
1669 | 1669 | |
1670 | 1670 | // check if we have a Font Awesome icon |
1671 | 1671 | $fa_type = ''; |
1672 | - if ( substr( $icon, 0, 7 ) === "fas fa-" ) { |
|
1672 | + if (substr($icon, 0, 7) === "fas fa-") { |
|
1673 | 1673 | $fa_type = 'solid'; |
1674 | - } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) { |
|
1674 | + } elseif (substr($icon, 0, 7) === "far fa-") { |
|
1675 | 1675 | $fa_type = 'regular'; |
1676 | - } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) { |
|
1676 | + } elseif (substr($icon, 0, 7) === "fab fa-") { |
|
1677 | 1677 | $fa_type = 'brands'; |
1678 | 1678 | } else { |
1679 | 1679 | $icon = "'" . $icon . "'"; |
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | // set the icon if we found one |
1683 | - if ( $fa_type ) { |
|
1684 | - $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon ); |
|
1683 | + if ($fa_type) { |
|
1684 | + $fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon); |
|
1685 | 1685 | $icon = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))"; |
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | return $icon; |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - public function group_arguments( $arguments ) { |
|
1692 | - if ( ! empty( $arguments ) ) { |
|
1691 | + public function group_arguments($arguments) { |
|
1692 | + if (!empty($arguments)) { |
|
1693 | 1693 | $temp_arguments = array(); |
1694 | - $general = __( "General", 'ayecode-connect' ); |
|
1694 | + $general = __("General", 'ayecode-connect'); |
|
1695 | 1695 | $add_sections = false; |
1696 | - foreach ( $arguments as $key => $args ) { |
|
1697 | - if ( isset( $args['group'] ) ) { |
|
1698 | - $temp_arguments[ $args['group'] ][ $key ] = $args; |
|
1696 | + foreach ($arguments as $key => $args) { |
|
1697 | + if (isset($args['group'])) { |
|
1698 | + $temp_arguments[$args['group']][$key] = $args; |
|
1699 | 1699 | $add_sections = true; |
1700 | 1700 | } else { |
1701 | - $temp_arguments[ $general ][ $key ] = $args; |
|
1701 | + $temp_arguments[$general][$key] = $args; |
|
1702 | 1702 | } |
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | // only add sections if more than one |
1706 | - if ( $add_sections ) { |
|
1706 | + if ($add_sections) { |
|
1707 | 1707 | $arguments = $temp_arguments; |
1708 | 1708 | } |
1709 | 1709 | } |
@@ -1716,38 +1716,38 @@ discard block |
||
1716 | 1716 | * |
1717 | 1717 | * @since 1.1.17 |
1718 | 1718 | */ |
1719 | - public function group_block_tabs( $tabs, $arguments ) { |
|
1720 | - if ( ! empty( $tabs ) && ! empty( $arguments ) ) { |
|
1719 | + public function group_block_tabs($tabs, $arguments) { |
|
1720 | + if (!empty($tabs) && !empty($arguments)) { |
|
1721 | 1721 | $has_sections = false; |
1722 | 1722 | |
1723 | - foreach ( $this->arguments as $key => $args ) { |
|
1724 | - if ( isset( $args['group'] ) ) { |
|
1723 | + foreach ($this->arguments as $key => $args) { |
|
1724 | + if (isset($args['group'])) { |
|
1725 | 1725 | $has_sections = true; |
1726 | 1726 | break; |
1727 | 1727 | } |
1728 | 1728 | } |
1729 | 1729 | |
1730 | - if ( ! $has_sections ) { |
|
1730 | + if (!$has_sections) { |
|
1731 | 1731 | return $tabs; |
1732 | 1732 | } |
1733 | 1733 | |
1734 | 1734 | $new_tabs = array(); |
1735 | 1735 | |
1736 | - foreach ( $tabs as $tab_key => $tab ) { |
|
1736 | + foreach ($tabs as $tab_key => $tab) { |
|
1737 | 1737 | $new_groups = array(); |
1738 | 1738 | |
1739 | - if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) { |
|
1740 | - foreach ( $tab['groups'] as $group ) { |
|
1741 | - if ( isset( $arguments[ $group ] ) ) { |
|
1739 | + if (!empty($tab['groups']) && is_array($tab['groups'])) { |
|
1740 | + foreach ($tab['groups'] as $group) { |
|
1741 | + if (isset($arguments[$group])) { |
|
1742 | 1742 | $new_groups[] = $group; |
1743 | 1743 | } |
1744 | 1744 | } |
1745 | 1745 | } |
1746 | 1746 | |
1747 | - if ( ! empty( $new_groups ) ) { |
|
1747 | + if (!empty($new_groups)) { |
|
1748 | 1748 | $tab['groups'] = $new_groups; |
1749 | 1749 | |
1750 | - $new_tabs[ $tab_key ] = $tab; |
|
1750 | + $new_tabs[$tab_key] = $tab; |
|
1751 | 1751 | } |
1752 | 1752 | } |
1753 | 1753 | |
@@ -1774,7 +1774,7 @@ discard block |
||
1774 | 1774 | ?> |
1775 | 1775 | <script> |
1776 | 1776 | <?php |
1777 | - if ( ! $sd_is_js_functions_loaded ) { |
|
1777 | + if (!$sd_is_js_functions_loaded) { |
|
1778 | 1778 | $sd_is_js_functions_loaded = true; |
1779 | 1779 | ?> |
1780 | 1780 | function sd_show_view_options($this){ |
@@ -2040,7 +2040,7 @@ discard block |
||
2040 | 2040 | } |
2041 | 2041 | } |
2042 | 2042 | |
2043 | -<?php if( !isset( $_REQUEST['sd-block-recover-debug'] ) ){ ?> |
|
2043 | +<?php if (!isset($_REQUEST['sd-block-recover-debug'])) { ?> |
|
2044 | 2044 | // Wait will window is loaded before calling. |
2045 | 2045 | window.onload = function() { |
2046 | 2046 | sd_auto_recover_blocks(); |
@@ -2219,7 +2219,7 @@ discard block |
||
2219 | 2219 | $classes = []; |
2220 | 2220 | |
2221 | 2221 | <?php |
2222 | - if($aui_bs5){ |
|
2222 | + if ($aui_bs5) { |
|
2223 | 2223 | ?> |
2224 | 2224 | $aui_bs5 = true; |
2225 | 2225 | $p_ml = 'ms-'; |
@@ -2228,7 +2228,7 @@ discard block |
||
2228 | 2228 | $p_pl = 'ps-'; |
2229 | 2229 | $p_pr = 'pe-'; |
2230 | 2230 | <?php |
2231 | - }else{ |
|
2231 | + } else { |
|
2232 | 2232 | ?> |
2233 | 2233 | $aui_bs5 = false; |
2234 | 2234 | $p_ml = 'ml-'; |
@@ -2413,7 +2413,7 @@ discard block |
||
2413 | 2413 | } |
2414 | 2414 | |
2415 | 2415 | function sd_get_class_build_keys(){ |
2416 | - return <?php echo json_encode(sd_get_class_build_keys());?>; |
|
2416 | + return <?php echo json_encode(sd_get_class_build_keys()); ?>; |
|
2417 | 2417 | } |
2418 | 2418 | |
2419 | 2419 | <?php |
@@ -2421,7 +2421,7 @@ discard block |
||
2421 | 2421 | |
2422 | 2422 | } |
2423 | 2423 | |
2424 | - if(method_exists($this,'block_global_js')){ |
|
2424 | + if (method_exists($this, 'block_global_js')) { |
|
2425 | 2425 | echo $this->block_global_js(); |
2426 | 2426 | } |
2427 | 2427 | ?> |
@@ -2450,9 +2450,9 @@ discard block |
||
2450 | 2450 | var InnerBlocks = blockEditor.InnerBlocks; |
2451 | 2451 | |
2452 | 2452 | var term_query_type = ''; |
2453 | - 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 "[]";} ?>; |
|
2454 | - const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
2455 | - const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
2453 | + 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 "[]"; } ?>; |
|
2454 | + const taxonomies_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
2455 | + const sort_by_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
2456 | 2456 | const MediaUpload = wp.blockEditor.MediaUpload; |
2457 | 2457 | |
2458 | 2458 | /** |
@@ -2467,87 +2467,87 @@ discard block |
||
2467 | 2467 | * @return {?WPBlock} The block, if it has been successfully |
2468 | 2468 | * registered; otherwise `undefined`. |
2469 | 2469 | */ |
2470 | - 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. |
|
2471 | - apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2 ; ?>, |
|
2472 | - title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title. |
|
2473 | - description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title. |
|
2474 | - 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/. |
|
2470 | + 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. |
|
2471 | + apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2; ?>, |
|
2472 | + title: '<?php echo addslashes($this->options['name']); ?>', // Block title. |
|
2473 | + description: '<?php echo addslashes($this->options['widget_ops']['description'])?>', // Block title. |
|
2474 | + 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/. |
|
2475 | 2475 | supports: { |
2476 | 2476 | <?php |
2477 | - if(!isset($this->options['block-supports']['renaming'])){ |
|
2477 | + if (!isset($this->options['block-supports']['renaming'])) { |
|
2478 | 2478 | $this->options['block-supports']['renaming'] = false; |
2479 | 2479 | } |
2480 | - if ( isset( $this->options['block-supports'] ) ) { |
|
2481 | - echo $this->array_to_attributes( $this->options['block-supports'] ); |
|
2480 | + if (isset($this->options['block-supports'])) { |
|
2481 | + echo $this->array_to_attributes($this->options['block-supports']); |
|
2482 | 2482 | } |
2483 | 2483 | ?> |
2484 | 2484 | }, |
2485 | 2485 | __experimentalLabel( attributes, { context } ) { |
2486 | 2486 | var visibility_html = attributes && attributes.visibility_conditions ? ' 👁' : ''; |
2487 | 2487 | var metadata_name = attributes && attributes.metadata && attributes.metadata.name ? attributes.metadata.name : ''; |
2488 | - var label_name = <?php echo !empty($this->options['block-label']) ? $this->options['block-label'] : "'" . esc_attr( addslashes( $this->options['name'] ) ) . "'"; ?>; |
|
2488 | + var label_name = <?php echo !empty($this->options['block-label']) ? $this->options['block-label'] : "'" . esc_attr(addslashes($this->options['name'])) . "'"; ?>; |
|
2489 | 2489 | return metadata_name ? metadata_name + visibility_html : label_name + visibility_html; |
2490 | 2490 | }, |
2491 | - 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. |
|
2492 | - <?php if ( isset( $this->options['block-keywords'] ) ) { |
|
2491 | + 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. |
|
2492 | + <?php if (isset($this->options['block-keywords'])) { |
|
2493 | 2493 | echo "keywords : " . $this->options['block-keywords'] . ","; |
2494 | 2494 | } |
2495 | 2495 | |
2496 | 2496 | |
2497 | 2497 | // block hover preview. |
2498 | 2498 | $example_args = array(); |
2499 | - if(!empty($this->arguments)){ |
|
2500 | - foreach($this->arguments as $key => $a_args){ |
|
2501 | - if(isset($a_args['example'])){ |
|
2499 | + if (!empty($this->arguments)) { |
|
2500 | + foreach ($this->arguments as $key => $a_args) { |
|
2501 | + if (isset($a_args['example'])) { |
|
2502 | 2502 | $example_args[$key] = $a_args['example']; |
2503 | 2503 | } |
2504 | 2504 | } |
2505 | 2505 | } |
2506 | - $viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : ''; |
|
2506 | + $viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: ' . absint($this->options['example']['viewportWidth']) : ''; |
|
2507 | 2507 | $example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : ''; |
2508 | - if( isset( $this->options['example'] ) && $this->options['example'] === false ){ |
|
2508 | + if (isset($this->options['example']) && $this->options['example'] === false) { |
|
2509 | 2509 | // no preview if set to false |
2510 | - }elseif( !empty( $example_args ) ){ |
|
2511 | - echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},"; |
|
2512 | - }elseif( !empty( $this->options['example'] ) ){ |
|
2510 | + }elseif (!empty($example_args)) { |
|
2511 | + echo "example : {attributes:{" . $this->array_to_attributes($example_args) . "},$viewport_width},"; |
|
2512 | + }elseif (!empty($this->options['example'])) { |
|
2513 | 2513 | unset($this->options['example']['viewportWidth']); |
2514 | 2514 | unset($this->options['example']['innerBlocks']); |
2515 | - $example_atts = $this->array_to_attributes( $this->options['example'] ); |
|
2515 | + $example_atts = $this->array_to_attributes($this->options['example']); |
|
2516 | 2516 | $example_parts = array(); |
2517 | - if($example_atts){ |
|
2518 | - $example_parts[] = rtrim($example_atts,","); |
|
2517 | + if ($example_atts) { |
|
2518 | + $example_parts[] = rtrim($example_atts, ","); |
|
2519 | 2519 | } |
2520 | - if($viewport_width){ |
|
2520 | + if ($viewport_width) { |
|
2521 | 2521 | $example_parts[] = $viewport_width; |
2522 | 2522 | } |
2523 | - if($example_inner_blocks){ |
|
2523 | + if ($example_inner_blocks) { |
|
2524 | 2524 | $example_parts[] = $example_inner_blocks; |
2525 | 2525 | } |
2526 | - if(!empty($example_parts)){ |
|
2527 | - echo "example : {".implode(',', $example_parts)."},"; |
|
2526 | + if (!empty($example_parts)) { |
|
2527 | + echo "example : {" . implode(',', $example_parts) . "},"; |
|
2528 | 2528 | } |
2529 | - }else{ |
|
2529 | + } else { |
|
2530 | 2530 | echo 'example : {viewportWidth: 500},'; |
2531 | 2531 | } |
2532 | 2532 | |
2533 | 2533 | |
2534 | 2534 | |
2535 | 2535 | // limit to parent |
2536 | - if( !empty( $this->options['parent'] ) ){ |
|
2537 | - echo "parent : " . wp_json_encode( $this->options['parent'] ) . ","; |
|
2536 | + if (!empty($this->options['parent'])) { |
|
2537 | + echo "parent : " . wp_json_encode($this->options['parent']) . ","; |
|
2538 | 2538 | } |
2539 | 2539 | |
2540 | 2540 | // limit allowed blocks |
2541 | - if( !empty( $this->options['allowed-blocks'] ) ){ |
|
2542 | - echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ","; |
|
2541 | + if (!empty($this->options['allowed-blocks'])) { |
|
2542 | + echo "allowedBlocks : " . wp_json_encode($this->options['allowed-blocks']) . ","; |
|
2543 | 2543 | } |
2544 | 2544 | |
2545 | 2545 | // maybe set no_wrap |
2546 | - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; |
|
2547 | - if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) { |
|
2546 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
2547 | + if (isset($this->arguments['no_wrap']) && $this->arguments['no_wrap']) { |
|
2548 | 2548 | $no_wrap = true; |
2549 | 2549 | } |
2550 | - if ( $no_wrap ) { |
|
2550 | + if ($no_wrap) { |
|
2551 | 2551 | $this->options['block-wrap'] = ''; |
2552 | 2552 | } |
2553 | 2553 | |
@@ -2561,10 +2561,10 @@ discard block |
||
2561 | 2561 | echo " html: false"; |
2562 | 2562 | echo "},";*/ |
2563 | 2563 | |
2564 | - if ( ! empty( $this->arguments ) ) { |
|
2564 | + if (!empty($this->arguments)) { |
|
2565 | 2565 | echo "attributes : {"; |
2566 | 2566 | |
2567 | - if ( $show_advanced ) { |
|
2567 | + if ($show_advanced) { |
|
2568 | 2568 | echo "show_advanced: {"; |
2569 | 2569 | echo " type: 'boolean',"; |
2570 | 2570 | echo " default: false,"; |
@@ -2572,56 +2572,56 @@ discard block |
||
2572 | 2572 | } |
2573 | 2573 | |
2574 | 2574 | // block wrap element |
2575 | - if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this? |
|
2575 | + if (!empty($this->options['block-wrap'])) { //@todo we should validate this? |
|
2576 | 2576 | echo "block_wrap: {"; |
2577 | 2577 | echo " type: 'string',"; |
2578 | - echo " default: '" . esc_attr( $this->options['block-wrap'] ) . "',"; |
|
2578 | + echo " default: '" . esc_attr($this->options['block-wrap']) . "',"; |
|
2579 | 2579 | echo "},"; |
2580 | 2580 | } |
2581 | 2581 | |
2582 | 2582 | |
2583 | 2583 | |
2584 | - foreach ( $this->arguments as $key => $args ) { |
|
2584 | + foreach ($this->arguments as $key => $args) { |
|
2585 | 2585 | |
2586 | - if( $args['type'] == 'image' || $args['type'] == 'images' ){ |
|
2586 | + if ($args['type'] == 'image' || $args['type'] == 'images') { |
|
2587 | 2587 | $img_drag_drop = true; |
2588 | 2588 | } |
2589 | 2589 | |
2590 | 2590 | // set if we should show alignment |
2591 | - if ( $key == 'alignment' ) { |
|
2591 | + if ($key == 'alignment') { |
|
2592 | 2592 | $show_alignment = true; |
2593 | 2593 | } |
2594 | 2594 | |
2595 | 2595 | $extra = ''; |
2596 | 2596 | |
2597 | - if ( $args['type'] == 'notice' || $args['type'] == 'tab' ) { |
|
2597 | + if ($args['type'] == 'notice' || $args['type'] == 'tab') { |
|
2598 | 2598 | continue; |
2599 | 2599 | } |
2600 | - elseif ( $args['type'] == 'checkbox' ) { |
|
2600 | + elseif ($args['type'] == 'checkbox') { |
|
2601 | 2601 | $type = 'boolean'; |
2602 | - $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false'; |
|
2603 | - } elseif ( $args['type'] == 'number' ) { |
|
2602 | + $default = isset($args['default']) && $args['default'] ? 'true' : 'false'; |
|
2603 | + } elseif ($args['type'] == 'number') { |
|
2604 | 2604 | $type = 'number'; |
2605 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2606 | - } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) { |
|
2605 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2606 | + } elseif ($args['type'] == 'select' && !empty($args['multiple'])) { |
|
2607 | 2607 | $type = 'array'; |
2608 | - if ( isset( $args['default'] ) && is_array( $args['default'] ) ) { |
|
2609 | - $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]"; |
|
2608 | + if (isset($args['default']) && is_array($args['default'])) { |
|
2609 | + $default = !empty($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]"; |
|
2610 | 2610 | } else { |
2611 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2611 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2612 | 2612 | } |
2613 | - } elseif ( $args['type'] == 'tagselect' ) { |
|
2613 | + } elseif ($args['type'] == 'tagselect') { |
|
2614 | 2614 | $type = 'array'; |
2615 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2616 | - } elseif ( $args['type'] == 'multiselect' ) { |
|
2615 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2616 | + } elseif ($args['type'] == 'multiselect') { |
|
2617 | 2617 | $type = 'array'; |
2618 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2619 | - } elseif ( $args['type'] == 'image_xy' ) { |
|
2618 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2619 | + } elseif ($args['type'] == 'image_xy') { |
|
2620 | 2620 | $type = 'object'; |
2621 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2622 | - } elseif ( $args['type'] == 'image' ) { |
|
2621 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2622 | + } elseif ($args['type'] == 'image') { |
|
2623 | 2623 | $type = 'string'; |
2624 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2624 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2625 | 2625 | |
2626 | 2626 | // add a field for ID |
2627 | 2627 | // echo $key . "_id : {"; |
@@ -2633,7 +2633,7 @@ discard block |
||
2633 | 2633 | |
2634 | 2634 | } else { |
2635 | 2635 | $type = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string'; |
2636 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2636 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2637 | 2637 | |
2638 | 2638 | } |
2639 | 2639 | echo $key . " : {"; |
@@ -2657,7 +2657,7 @@ discard block |
||
2657 | 2657 | |
2658 | 2658 | <?php |
2659 | 2659 | // only include the drag/drop functions if required. |
2660 | -if( $img_drag_drop ){ |
|
2660 | +if ($img_drag_drop) { |
|
2661 | 2661 | |
2662 | 2662 | ?> |
2663 | 2663 | |
@@ -2723,9 +2723,9 @@ discard block |
||
2723 | 2723 | } |
2724 | 2724 | |
2725 | 2725 | <?php |
2726 | - if(!empty($this->options['block-edit-raw'])) { |
|
2726 | + if (!empty($this->options['block-edit-raw'])) { |
|
2727 | 2727 | echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues |
2728 | - }else{ |
|
2728 | + } else { |
|
2729 | 2729 | ?> |
2730 | 2730 | |
2731 | 2731 | function hasSelectedInnerBlock(props) { |
@@ -2749,7 +2749,7 @@ discard block |
||
2749 | 2749 | var $value = ''; |
2750 | 2750 | <?php |
2751 | 2751 | // if we have a post_type and a category then link them |
2752 | - if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){ |
|
2752 | + if (isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked'])) { |
|
2753 | 2753 | ?> |
2754 | 2754 | if(typeof(prev_attributes[props.clientId]) != 'undefined'){ |
2755 | 2755 | $pt = props.attributes.post_type; |
@@ -2764,9 +2764,9 @@ discard block |
||
2764 | 2764 | } |
2765 | 2765 | <?php |
2766 | 2766 | $cat_path = ''; |
2767 | - if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) { |
|
2768 | - $cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) ); |
|
2769 | - $cat_path = str_replace( array( '"', ''' ), array( '"', "'" ), $cat_path ); |
|
2767 | + if (!empty($this->arguments['post_type']['onchange_rest']['path'])) { |
|
2768 | + $cat_path = esc_js(strip_tags($this->arguments['post_type']['onchange_rest']['path'])); |
|
2769 | + $cat_path = str_replace(array('"', '''), array('"', "'"), $cat_path); |
|
2770 | 2770 | } |
2771 | 2771 | ?> |
2772 | 2772 | /* taxonomies */ |
@@ -2774,15 +2774,15 @@ discard block |
||
2774 | 2774 | if (!window.gdCPTCats) { |
2775 | 2775 | window.gdCPTCats = []; |
2776 | 2776 | } |
2777 | - var gdCatPath = "<?php echo ( ! empty( $cat_path ) ? $cat_path : "/wp/v2/" + $value + "/categories/?per_page=100" ); ?>"; |
|
2777 | + var gdCatPath = "<?php echo (!empty($cat_path) ? $cat_path : "/wp/v2/" +$value + "/categories/?per_page=100"); ?>"; |
|
2778 | 2778 | if (window.gdCPTCats[gdCatPath]) { |
2779 | 2779 | terms = window.gdCPTCats[gdCatPath]; |
2780 | - while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2781 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2780 | + while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2781 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2782 | 2782 | } |
2783 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0}); |
|
2783 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0}); |
|
2784 | 2784 | jQuery.each( terms, function( key, val ) { |
2785 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id}); |
|
2785 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id}); |
|
2786 | 2786 | }); |
2787 | 2787 | |
2788 | 2788 | /* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */ |
@@ -2792,12 +2792,12 @@ discard block |
||
2792 | 2792 | } else { |
2793 | 2793 | wp.apiFetch({path: gdCatPath}).then(terms => { |
2794 | 2794 | window.gdCPTCats[gdCatPath] = terms; |
2795 | - while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2796 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2795 | + while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2796 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2797 | 2797 | } |
2798 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0}); |
|
2798 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0}); |
|
2799 | 2799 | jQuery.each( terms, function( key, val ) { |
2800 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id}); |
|
2800 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id}); |
|
2801 | 2801 | }); |
2802 | 2802 | |
2803 | 2803 | /* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */ |
@@ -2805,7 +2805,7 @@ discard block |
||
2805 | 2805 | props.setAttributes({category: [0] }); |
2806 | 2806 | props.setAttributes({category: $old_cat_value }); |
2807 | 2807 | |
2808 | - return taxonomies_<?php echo str_replace("-","_", $this->id);?>; |
|
2808 | + return taxonomies_<?php echo str_replace("-", "_", $this->id); ?>; |
|
2809 | 2809 | }); |
2810 | 2810 | } |
2811 | 2811 | } |
@@ -2817,12 +2817,12 @@ discard block |
||
2817 | 2817 | } |
2818 | 2818 | if (window.gdCPTSort[$pt]) { |
2819 | 2819 | response = window.gdCPTSort[$pt]; |
2820 | - while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2821 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2820 | + while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2821 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2822 | 2822 | } |
2823 | 2823 | |
2824 | 2824 | jQuery.each( response, function( key, val ) { |
2825 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key}); |
|
2825 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key}); |
|
2826 | 2826 | }); |
2827 | 2827 | |
2828 | 2828 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2837,12 +2837,12 @@ discard block |
||
2837 | 2837 | jQuery.post(ajaxurl, data, function(response) { |
2838 | 2838 | response = JSON.parse(response); |
2839 | 2839 | window.gdCPTSort[$pt] = response; |
2840 | - while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2841 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2840 | + while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2841 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2842 | 2842 | } |
2843 | 2843 | |
2844 | 2844 | jQuery.each( response, function( key, val ) { |
2845 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key}); |
|
2845 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key}); |
|
2846 | 2846 | }); |
2847 | 2847 | |
2848 | 2848 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2850,7 +2850,7 @@ discard block |
||
2850 | 2850 | props.setAttributes({sort_by: [0] }); |
2851 | 2851 | props.setAttributes({sort_by: $old_sort_by_value }); |
2852 | 2852 | |
2853 | - return sort_by_<?php echo str_replace("-","_", $this->id);?>; |
|
2853 | + return sort_by_<?php echo str_replace("-", "_", $this->id); ?>; |
|
2854 | 2854 | }); |
2855 | 2855 | } |
2856 | 2856 | } |
@@ -2858,9 +2858,9 @@ discard block |
||
2858 | 2858 | <?php } ?> |
2859 | 2859 | <?php |
2860 | 2860 | $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
2861 | -if(!empty($current_screen->base) && $current_screen->base==='widgets'){ |
|
2861 | +if (!empty($current_screen->base) && $current_screen->base === 'widgets') { |
|
2862 | 2862 | echo 'const { deviceType } = "";'; |
2863 | -}else{ |
|
2863 | +} else { |
|
2864 | 2864 | ?> |
2865 | 2865 | /** Get device type const. */ |
2866 | 2866 | const { deviceType } = wp.data.useSelect != 'undefined' ? wp.data.useSelect(select => { |
@@ -2889,13 +2889,13 @@ discard block |
||
2889 | 2889 | |
2890 | 2890 | var data = { |
2891 | 2891 | 'action': 'super_duper_output_shortcode', |
2892 | - 'shortcode': '<?php echo $this->options['base_id'];?>', |
|
2892 | + 'shortcode': '<?php echo $this->options['base_id']; ?>', |
|
2893 | 2893 | 'attributes': props.attributes, |
2894 | 2894 | 'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '', |
2895 | - 'post_id': <?php global $post; if ( isset( $post->ID ) ) { |
|
2895 | + 'post_id': <?php global $post; if (isset($post->ID)) { |
|
2896 | 2896 | echo $post->ID; |
2897 | - }else{echo '0';}?>, |
|
2898 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
2897 | + } else {echo '0'; }?>, |
|
2898 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
2899 | 2899 | }; |
2900 | 2900 | |
2901 | 2901 | jQuery.post(ajaxurl, data, function (response) { |
@@ -2904,17 +2904,17 @@ discard block |
||
2904 | 2904 | |
2905 | 2905 | // if the content is empty then we place some placeholder text |
2906 | 2906 | if (env == '') { |
2907 | - env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for:', 'ayecode-connect' );?> " + props.name + "</div>"; |
|
2907 | + env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for:', 'ayecode-connect'); ?> " + props.name + "</div>"; |
|
2908 | 2908 | } |
2909 | 2909 | |
2910 | 2910 | <?php |
2911 | - if(!empty($this->options['nested-block'])){ |
|
2911 | + if (!empty($this->options['nested-block'])) { |
|
2912 | 2912 | ?> |
2913 | 2913 | // props.setAttributes({content: env}); |
2914 | 2914 | is_fetching = false; |
2915 | 2915 | prev_attributes[props.clientId] = props.attributes; |
2916 | 2916 | <?php |
2917 | - }else{ |
|
2917 | + } else { |
|
2918 | 2918 | ?> |
2919 | 2919 | props.setAttributes({content: env}); |
2920 | 2920 | is_fetching = false; |
@@ -2939,8 +2939,8 @@ discard block |
||
2939 | 2939 | } |
2940 | 2940 | |
2941 | 2941 | <?php |
2942 | - if(!empty($this->options['block-edit-js'])) { |
|
2943 | - echo $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues |
|
2942 | + if (!empty($this->options['block-edit-js'])) { |
|
2943 | + echo $this->options['block-edit-js']; // strings have to be in single quotes, may cause issues |
|
2944 | 2944 | } |
2945 | 2945 | |
2946 | 2946 | |
@@ -2952,7 +2952,7 @@ discard block |
||
2952 | 2952 | |
2953 | 2953 | el(wp.blockEditor.BlockControls, {key: 'controls'}, |
2954 | 2954 | |
2955 | - <?php if($show_alignment){?> |
|
2955 | + <?php if ($show_alignment) {?> |
|
2956 | 2956 | el( |
2957 | 2957 | wp.blockEditor.AlignmentToolbar, |
2958 | 2958 | { |
@@ -2970,9 +2970,9 @@ discard block |
||
2970 | 2970 | |
2971 | 2971 | <?php |
2972 | 2972 | |
2973 | - if(! empty( $this->arguments )){ |
|
2973 | + if (!empty($this->arguments)) { |
|
2974 | 2974 | |
2975 | - if ( $show_advanced ) { |
|
2975 | + if ($show_advanced) { |
|
2976 | 2976 | ?> |
2977 | 2977 | el('div', { |
2978 | 2978 | style: {'padding-left': '16px','padding-right': '16px'} |
@@ -2992,42 +2992,42 @@ discard block |
||
2992 | 2992 | <?php |
2993 | 2993 | } |
2994 | 2994 | |
2995 | - $arguments = $this->group_arguments( $this->arguments ); |
|
2996 | - $block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array(); |
|
2995 | + $arguments = $this->group_arguments($this->arguments); |
|
2996 | + $block_group_tabs = !empty($this->options['block_group_tabs']) ? $this->group_block_tabs($this->options['block_group_tabs'], $arguments) : array(); |
|
2997 | 2997 | |
2998 | 2998 | // Do we have sections? |
2999 | 2999 | $has_sections = $arguments == $this->arguments ? false : true; |
3000 | 3000 | |
3001 | - if($has_sections){ |
|
3001 | + if ($has_sections) { |
|
3002 | 3002 | $panel_count = 0; |
3003 | 3003 | $open_tab = ''; |
3004 | 3004 | |
3005 | 3005 | $open_tab_groups = array(); |
3006 | 3006 | $used_tabs = array(); |
3007 | 3007 | |
3008 | - foreach ( $arguments as $key => $args ) { |
|
3008 | + foreach ($arguments as $key => $args) { |
|
3009 | 3009 | $close_tab = false; |
3010 | 3010 | $close_tabs = false; |
3011 | 3011 | |
3012 | - if ( ! empty( $block_group_tabs ) ) { |
|
3013 | - foreach ( $block_group_tabs as $tab_name => $tab_args ) { |
|
3014 | - if ( in_array( $key, $tab_args['groups'] ) ) { |
|
3012 | + if (!empty($block_group_tabs)) { |
|
3013 | + foreach ($block_group_tabs as $tab_name => $tab_args) { |
|
3014 | + if (in_array($key, $tab_args['groups'])) { |
|
3015 | 3015 | $open_tab_groups[] = $key; |
3016 | 3016 | |
3017 | - if ( $open_tab != $tab_name ) { |
|
3017 | + if ($open_tab != $tab_name) { |
|
3018 | 3018 | $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false; |
3019 | 3019 | $tab_args['tab']['open'] = true; |
3020 | 3020 | |
3021 | - $this->block_tab_start( '', $tab_args ); |
|
3021 | + $this->block_tab_start('', $tab_args); |
|
3022 | 3022 | $open_tab = $tab_name; |
3023 | 3023 | $used_tabs[] = $tab_name; |
3024 | 3024 | } |
3025 | 3025 | |
3026 | - if ( $open_tab_groups == $tab_args['groups'] ) { |
|
3026 | + if ($open_tab_groups == $tab_args['groups']) { |
|
3027 | 3027 | $close_tab = true; |
3028 | 3028 | $open_tab_groups = array(); |
3029 | 3029 | |
3030 | - if ( $used_tabs == array_keys( $block_group_tabs ) ) { |
|
3030 | + if ($used_tabs == array_keys($block_group_tabs)) { |
|
3031 | 3031 | $close_tabs = true; |
3032 | 3032 | } |
3033 | 3033 | } |
@@ -3036,27 +3036,27 @@ discard block |
||
3036 | 3036 | } |
3037 | 3037 | ?> |
3038 | 3038 | el(wp.components.PanelBody, { |
3039 | - title: '<?php esc_attr_e( $key ); ?>', |
|
3040 | - initialOpen: <?php if ( $panel_count ) { |
|
3039 | + title: '<?php esc_attr_e($key); ?>', |
|
3040 | + initialOpen: <?php if ($panel_count) { |
|
3041 | 3041 | echo "false"; |
3042 | 3042 | } else { |
3043 | 3043 | echo "true"; |
3044 | 3044 | }?> |
3045 | 3045 | }, |
3046 | 3046 | <?php |
3047 | - foreach ( $args as $k => $a ) { |
|
3048 | - $this->block_tab_start( $k, $a ); |
|
3049 | - $this->block_row_start( $k, $a ); |
|
3050 | - $this->build_block_arguments( $k, $a ); |
|
3051 | - $this->block_row_end( $k, $a ); |
|
3052 | - $this->block_tab_end( $k, $a ); |
|
3047 | + foreach ($args as $k => $a) { |
|
3048 | + $this->block_tab_start($k, $a); |
|
3049 | + $this->block_row_start($k, $a); |
|
3050 | + $this->build_block_arguments($k, $a); |
|
3051 | + $this->block_row_end($k, $a); |
|
3052 | + $this->block_tab_end($k, $a); |
|
3053 | 3053 | } |
3054 | 3054 | ?> |
3055 | 3055 | ), |
3056 | 3056 | <?php |
3057 | - $panel_count ++; |
|
3057 | + $panel_count++; |
|
3058 | 3058 | |
3059 | - if($close_tab || $close_tabs){ |
|
3059 | + if ($close_tab || $close_tabs) { |
|
3060 | 3060 | $tab_args = array( |
3061 | 3061 | 'tab' => array( |
3062 | 3062 | 'tabs_close' => $close_tabs, |
@@ -3064,24 +3064,24 @@ discard block |
||
3064 | 3064 | ) |
3065 | 3065 | |
3066 | 3066 | ); |
3067 | - $this->block_tab_end( '', $tab_args ); |
|
3067 | + $this->block_tab_end('', $tab_args); |
|
3068 | 3068 | // echo '###close'; print_r($tab_args); |
3069 | 3069 | $panel_count = 0; |
3070 | 3070 | } |
3071 | 3071 | // |
3072 | 3072 | |
3073 | 3073 | } |
3074 | - }else { |
|
3074 | + } else { |
|
3075 | 3075 | ?> |
3076 | 3076 | el(wp.components.PanelBody, { |
3077 | - title: '<?php esc_attr_e( "Settings", 'ayecode-connect' ); ?>', |
|
3077 | + title: '<?php esc_attr_e("Settings", 'ayecode-connect'); ?>', |
|
3078 | 3078 | initialOpen: true |
3079 | 3079 | }, |
3080 | 3080 | <?php |
3081 | - foreach ( $this->arguments as $key => $args ) { |
|
3082 | - $this->block_row_start( $key, $args ); |
|
3083 | - $this->build_block_arguments( $key, $args ); |
|
3084 | - $this->block_row_end( $key, $args ); |
|
3081 | + foreach ($this->arguments as $key => $args) { |
|
3082 | + $this->block_row_start($key, $args); |
|
3083 | + $this->build_block_arguments($key, $args); |
|
3084 | + $this->block_row_end($key, $args); |
|
3085 | 3085 | } |
3086 | 3086 | ?> |
3087 | 3087 | ), |
@@ -3095,11 +3095,11 @@ discard block |
||
3095 | 3095 | |
3096 | 3096 | <?php |
3097 | 3097 | // If the user sets block-output array then build it |
3098 | - if ( ! empty( $this->options['block-output'] ) ) { |
|
3099 | - $this->block_element( $this->options['block-output'] ); |
|
3100 | - }elseif(!empty($this->options['block-edit-return'])){ |
|
3098 | + if (!empty($this->options['block-output'])) { |
|
3099 | + $this->block_element($this->options['block-output']); |
|
3100 | + }elseif (!empty($this->options['block-edit-return'])) { |
|
3101 | 3101 | echo $this->options['block-edit-return']; |
3102 | - }else{ |
|
3102 | + } else { |
|
3103 | 3103 | // if no block-output is set then we try and get the shortcode html output via ajax. |
3104 | 3104 | $block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div'; |
3105 | 3105 | ?> |
@@ -3126,27 +3126,27 @@ discard block |
||
3126 | 3126 | var align = ''; |
3127 | 3127 | |
3128 | 3128 | // build the shortcode. |
3129 | - var content = "[<?php echo $this->options['base_id'];?>"; |
|
3129 | + var content = "[<?php echo $this->options['base_id']; ?>"; |
|
3130 | 3130 | $html = ''; |
3131 | 3131 | <?php |
3132 | 3132 | |
3133 | - if(! empty( $this->arguments )){ |
|
3133 | + if (!empty($this->arguments)) { |
|
3134 | 3134 | |
3135 | - foreach($this->arguments as $key => $args){ |
|
3135 | + foreach ($this->arguments as $key => $args) { |
|
3136 | 3136 | // if($args['type']=='tabs'){continue;} |
3137 | 3137 | |
3138 | 3138 | // don't add metadata arguments |
3139 | - if (substr($key, 0, 9 ) === 'metadata_') { |
|
3139 | + if (substr($key, 0, 9) === 'metadata_') { |
|
3140 | 3140 | continue; |
3141 | 3141 | } |
3142 | 3142 | ?> |
3143 | - if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) { |
|
3144 | - if ('<?php echo esc_attr( $key );?>' == 'html') { |
|
3145 | - $html = attr.<?php echo esc_attr( $key );?>; |
|
3146 | - } else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') { |
|
3147 | - content += " <?php echo esc_attr( $key );?>='{x:" + attr.<?php echo esc_attr( $key );?>.x + ",y:"+attr.<?php echo esc_attr( $key );?>.y +"}' "; |
|
3143 | + if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) { |
|
3144 | + if ('<?php echo esc_attr($key); ?>' == 'html') { |
|
3145 | + $html = attr.<?php echo esc_attr($key); ?>; |
|
3146 | + } else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') { |
|
3147 | + content += " <?php echo esc_attr($key); ?>='{x:" + attr.<?php echo esc_attr($key); ?>.x + ",y:"+attr.<?php echo esc_attr($key); ?>.y +"}' "; |
|
3148 | 3148 | } else { |
3149 | - content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>.toString().replace('\'',''') + "' "; |
|
3149 | + content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>.toString().replace('\'',''') + "' "; |
|
3150 | 3150 | } |
3151 | 3151 | } |
3152 | 3152 | <?php |
@@ -3165,7 +3165,7 @@ discard block |
||
3165 | 3165 | ?> |
3166 | 3166 | // if has html element |
3167 | 3167 | if ($html) { |
3168 | - content += $html + "[/<?php echo $this->options['base_id'];?>]"; |
|
3168 | + content += $html + "[/<?php echo $this->options['base_id']; ?>]"; |
|
3169 | 3169 | } |
3170 | 3170 | |
3171 | 3171 | // @todo should we add inline style here or just css classes? |
@@ -3195,7 +3195,7 @@ discard block |
||
3195 | 3195 | // <x?php |
3196 | 3196 | // }else |
3197 | 3197 | |
3198 | - if(!empty($this->options['block-output'])){ |
|
3198 | + if (!empty($this->options['block-output'])) { |
|
3199 | 3199 | // echo "return"; |
3200 | 3200 | // $this->block_element( $this->options['block-output'], true ); |
3201 | 3201 | // echo ";"; |
@@ -3205,30 +3205,30 @@ discard block |
||
3205 | 3205 | '', |
3206 | 3206 | {}, |
3207 | 3207 | el('', {dangerouslySetInnerHTML: {__html: content}}), |
3208 | - <?php $this->block_element( $this->options['block-output'], true ); ?> |
|
3209 | - el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
3208 | + <?php $this->block_element($this->options['block-output'], true); ?> |
|
3209 | + el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}}) |
|
3210 | 3210 | ); |
3211 | 3211 | <?php |
3212 | 3212 | |
3213 | - }elseif(!empty($this->options['block-save-return'])){ |
|
3213 | + }elseif (!empty($this->options['block-save-return'])) { |
|
3214 | 3214 | echo 'return ' . $this->options['block-save-return']; |
3215 | - }elseif(!empty($this->options['nested-block'])){ |
|
3215 | + }elseif (!empty($this->options['nested-block'])) { |
|
3216 | 3216 | ?> |
3217 | 3217 | return el( |
3218 | 3218 | '', |
3219 | 3219 | {}, |
3220 | 3220 | el('', {dangerouslySetInnerHTML: {__html: content+"\n"}}), |
3221 | 3221 | InnerBlocks.Content ? el( InnerBlocks.Content ) : '', // @todo i think we need a comma here |
3222 | - el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
3222 | + el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}}) |
|
3223 | 3223 | ); |
3224 | 3224 | <?php |
3225 | - }elseif(!empty( $this->options['block-save-return'] ) ){ |
|
3226 | - echo "return ". $this->options['block-edit-return'].";"; |
|
3227 | - }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){ |
|
3225 | + }elseif (!empty($this->options['block-save-return'])) { |
|
3226 | + echo "return " . $this->options['block-edit-return'] . ";"; |
|
3227 | + }elseif (isset($this->options['block-wrap']) && $this->options['block-wrap'] == '') { |
|
3228 | 3228 | ?> |
3229 | 3229 | return content; |
3230 | 3230 | <?php |
3231 | - }else{ |
|
3231 | + } else { |
|
3232 | 3232 | ?> |
3233 | 3233 | var block_wrap = 'div'; |
3234 | 3234 | if (attr.hasOwnProperty("block_wrap")) { |
@@ -3257,48 +3257,48 @@ discard block |
||
3257 | 3257 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
3258 | 3258 | */ |
3259 | 3259 | |
3260 | - return str_replace( array( |
|
3260 | + return str_replace(array( |
|
3261 | 3261 | '<script>', |
3262 | 3262 | '</script>' |
3263 | - ), '', $output ); |
|
3263 | + ), '', $output); |
|
3264 | 3264 | } |
3265 | 3265 | |
3266 | 3266 | |
3267 | 3267 | |
3268 | - public function block_row_start($key, $args){ |
|
3268 | + public function block_row_start($key, $args) { |
|
3269 | 3269 | |
3270 | 3270 | // check for row |
3271 | - if(!empty($args['row'])){ |
|
3271 | + if (!empty($args['row'])) { |
|
3272 | 3272 | |
3273 | - if(!empty($args['row']['open'])){ |
|
3273 | + if (!empty($args['row']['open'])) { |
|
3274 | 3274 | |
3275 | 3275 | // element require |
3276 | - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; |
|
3277 | - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; |
|
3278 | - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3276 | + $element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : ""; |
|
3277 | + $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : ''; |
|
3278 | + $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3279 | 3279 | $device_type_icon = ''; |
3280 | - if($device_type=='Desktop'){ |
|
3280 | + if ($device_type == 'Desktop') { |
|
3281 | 3281 | $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3282 | - }elseif($device_type=='Tablet'){ |
|
3282 | + }elseif ($device_type == 'Tablet') { |
|
3283 | 3283 | $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3284 | - }elseif($device_type=='Mobile'){ |
|
3284 | + }elseif ($device_type == 'Mobile') { |
|
3285 | 3285 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3286 | 3286 | } |
3287 | 3287 | echo $element_require; |
3288 | 3288 | echo $device_type_require; |
3289 | 3289 | |
3290 | - if(false){?><script><?php }?> |
|
3290 | + if (false) {?><script><?php }?> |
|
3291 | 3291 | el('div', { |
3292 | 3292 | className: 'bsui components-base-control', |
3293 | 3293 | }, |
3294 | - <?php if(!empty($args['row']['title'])){ ?> |
|
3294 | + <?php if (!empty($args['row']['title'])) { ?> |
|
3295 | 3295 | el('label', { |
3296 | 3296 | className: 'components-base-control__label position-relative', |
3297 | 3297 | style: {width:"100%"} |
3298 | 3298 | }, |
3299 | - el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['row']['title'] ) ?>'}}), |
|
3300 | - <?php if($device_type_icon){ ?> |
|
3301 | - 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)"}}) |
|
3299 | + el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['row']['title']) ?>'}}), |
|
3300 | + <?php if ($device_type_icon) { ?> |
|
3301 | + 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)"}}) |
|
3302 | 3302 | <?php |
3303 | 3303 | } |
3304 | 3304 | ?> |
@@ -3306,17 +3306,17 @@ discard block |
||
3306 | 3306 | |
3307 | 3307 | ), |
3308 | 3308 | <?php }?> |
3309 | - <?php if(!empty($args['row']['desc'])){ ?> |
|
3309 | + <?php if (!empty($args['row']['desc'])) { ?> |
|
3310 | 3310 | el('p', { |
3311 | 3311 | className: 'components-base-control__help mb-0', |
3312 | 3312 | }, |
3313 | - '<?php echo addslashes( $args['row']['desc'] ); ?>' |
|
3313 | + '<?php echo addslashes($args['row']['desc']); ?>' |
|
3314 | 3314 | ), |
3315 | 3315 | <?php }?> |
3316 | 3316 | el( |
3317 | 3317 | 'div', |
3318 | 3318 | { |
3319 | - className: 'row mb-n2 <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>', |
|
3319 | + className: 'row mb-n2 <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>', |
|
3320 | 3320 | }, |
3321 | 3321 | el( |
3322 | 3322 | 'div', |
@@ -3325,36 +3325,36 @@ discard block |
||
3325 | 3325 | }, |
3326 | 3326 | |
3327 | 3327 | <?php |
3328 | - if(false){?></script><?php } |
|
3329 | - }elseif(!empty($args['row']['close'])){ |
|
3330 | - if(false){?><script><?php }?> |
|
3328 | + if (false) {?></script><?php } |
|
3329 | + }elseif (!empty($args['row']['close'])) { |
|
3330 | + if (false) {?><script><?php }?> |
|
3331 | 3331 | el( |
3332 | 3332 | 'div', |
3333 | 3333 | { |
3334 | 3334 | className: 'col pl-0 ps-0', |
3335 | 3335 | }, |
3336 | 3336 | <?php |
3337 | - if(false){?></script><?php } |
|
3338 | - }else{ |
|
3339 | - if(false){?><script><?php }?> |
|
3337 | + if (false) {?></script><?php } |
|
3338 | + } else { |
|
3339 | + if (false) {?><script><?php }?> |
|
3340 | 3340 | el( |
3341 | 3341 | 'div', |
3342 | 3342 | { |
3343 | 3343 | className: 'col pl-0 ps-0 pr-2 pe-2', |
3344 | 3344 | }, |
3345 | 3345 | <?php |
3346 | - if(false){?></script><?php } |
|
3346 | + if (false) {?></script><?php } |
|
3347 | 3347 | } |
3348 | 3348 | |
3349 | 3349 | } |
3350 | 3350 | |
3351 | 3351 | } |
3352 | 3352 | |
3353 | - public function block_row_end($key, $args){ |
|
3353 | + public function block_row_end($key, $args) { |
|
3354 | 3354 | |
3355 | - if(!empty($args['row'])){ |
|
3355 | + if (!empty($args['row'])) { |
|
3356 | 3356 | // maybe close |
3357 | - if(!empty($args['row']['close'])){ |
|
3357 | + if (!empty($args['row']['close'])) { |
|
3358 | 3358 | echo "))"; |
3359 | 3359 | } |
3360 | 3360 | |
@@ -3362,14 +3362,14 @@ discard block |
||
3362 | 3362 | } |
3363 | 3363 | } |
3364 | 3364 | |
3365 | - public function block_tab_start($key, $args){ |
|
3365 | + public function block_tab_start($key, $args) { |
|
3366 | 3366 | |
3367 | 3367 | // check for row |
3368 | - if(!empty($args['tab'])){ |
|
3368 | + if (!empty($args['tab'])) { |
|
3369 | 3369 | |
3370 | - if(!empty($args['tab']['tabs_open'])){ |
|
3370 | + if (!empty($args['tab']['tabs_open'])) { |
|
3371 | 3371 | |
3372 | - if(false){?><script><?php }?> |
|
3372 | + if (false) {?><script><?php }?> |
|
3373 | 3373 | |
3374 | 3374 | el('div',{className: 'bsui'}, |
3375 | 3375 | |
@@ -3378,52 +3378,52 @@ discard block |
||
3378 | 3378 | { |
3379 | 3379 | activeClass: 'is-active', |
3380 | 3380 | className: 'btn-groupx', |
3381 | - initialTabName: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
3381 | + initialTabName: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
3382 | 3382 | tabs: [ |
3383 | 3383 | |
3384 | 3384 | <?php |
3385 | - if(false){?></script><?php } |
|
3385 | + if (false) {?></script><?php } |
|
3386 | 3386 | } |
3387 | 3387 | |
3388 | - if(!empty($args['tab']['open'])){ |
|
3388 | + if (!empty($args['tab']['open'])) { |
|
3389 | 3389 | |
3390 | - if(false){?><script><?php }?> |
|
3390 | + if (false) {?><script><?php }?> |
|
3391 | 3391 | { |
3392 | - name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
3393 | - title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}), |
|
3394 | - className: '<?php echo addslashes( esc_attr( $args['tab']['class']) ); ?>', |
|
3395 | - content: el('div',{}, <?php if(!empty($args['tab']['desc'])){ ?>el('p', { |
|
3392 | + name: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
3393 | + title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes(esc_attr($args['tab']['title'])); ?>'}}), |
|
3394 | + className: '<?php echo addslashes(esc_attr($args['tab']['class'])); ?>', |
|
3395 | + content: el('div',{}, <?php if (!empty($args['tab']['desc'])) { ?>el('p', { |
|
3396 | 3396 | className: 'components-base-control__help mb-0', |
3397 | - dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'} |
|
3397 | + dangerouslySetInnerHTML: {__html:'<?php echo addslashes($args['tab']['desc']); ?>'} |
|
3398 | 3398 | }),<?php } |
3399 | - if(false){?></script><?php } |
|
3399 | + if (false) {?></script><?php } |
|
3400 | 3400 | } |
3401 | 3401 | |
3402 | 3402 | } |
3403 | 3403 | |
3404 | 3404 | } |
3405 | 3405 | |
3406 | - public function block_tab_end($key, $args){ |
|
3406 | + public function block_tab_end($key, $args) { |
|
3407 | 3407 | |
3408 | - if(!empty($args['tab'])){ |
|
3408 | + if (!empty($args['tab'])) { |
|
3409 | 3409 | // maybe close |
3410 | - if(!empty($args['tab']['close'])){ |
|
3410 | + if (!empty($args['tab']['close'])) { |
|
3411 | 3411 | echo ")}, /* tab close */"; |
3412 | 3412 | } |
3413 | 3413 | |
3414 | - if(!empty($args['tab']['tabs_close'])){ |
|
3415 | - if(false){?><script><?php }?> |
|
3414 | + if (!empty($args['tab']['tabs_close'])) { |
|
3415 | + if (false) {?><script><?php }?> |
|
3416 | 3416 | ]}, ( tab ) => { |
3417 | 3417 | return tab.content; |
3418 | 3418 | } |
3419 | 3419 | )), /* tabs close */ |
3420 | - <?php if(false){ ?></script><?php } |
|
3420 | + <?php if (false) { ?></script><?php } |
|
3421 | 3421 | } |
3422 | 3422 | } |
3423 | 3423 | } |
3424 | 3424 | |
3425 | - public function build_block_arguments( $key, $args ) { |
|
3426 | - $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : ''; |
|
3425 | + public function build_block_arguments($key, $args) { |
|
3426 | + $custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : ''; |
|
3427 | 3427 | $options = ''; |
3428 | 3428 | $extra = ''; |
3429 | 3429 | $require = ''; |
@@ -3431,28 +3431,28 @@ discard block |
||
3431 | 3431 | $after_elements = ''; |
3432 | 3432 | |
3433 | 3433 | // `content` is a protected and special argument |
3434 | - if ( $key == 'content' ) { |
|
3434 | + if ($key == 'content') { |
|
3435 | 3435 | return; |
3436 | 3436 | } |
3437 | 3437 | |
3438 | - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; |
|
3439 | - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3438 | + $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : ''; |
|
3439 | + $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3440 | 3440 | $device_type_icon = ''; |
3441 | - if($device_type=='Desktop'){ |
|
3441 | + if ($device_type == 'Desktop') { |
|
3442 | 3442 | $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3443 | - }elseif($device_type=='Tablet'){ |
|
3443 | + }elseif ($device_type == 'Tablet') { |
|
3444 | 3444 | $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3445 | - }elseif($device_type=='Mobile'){ |
|
3445 | + }elseif ($device_type == 'Mobile') { |
|
3446 | 3446 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3447 | 3447 | } |
3448 | 3448 | |
3449 | 3449 | // icon |
3450 | 3450 | $icon = ''; |
3451 | - if( !empty( $args['icon'] ) ){ |
|
3451 | + if (!empty($args['icon'])) { |
|
3452 | 3452 | $icon .= "el('div', {"; |
3453 | - $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},"; |
|
3453 | + $icon .= "dangerouslySetInnerHTML: {__html: '" . self::get_widget_icon(esc_attr($args['icon'])) . "'},"; |
|
3454 | 3454 | $icon .= "className: 'text-center',"; |
3455 | - $icon .= "title: '".addslashes( $args['title'] )."',"; |
|
3455 | + $icon .= "title: '" . addslashes($args['title']) . "',"; |
|
3456 | 3456 | $icon .= "}),"; |
3457 | 3457 | |
3458 | 3458 | // blank title as its added to the icon. |
@@ -3460,27 +3460,27 @@ discard block |
||
3460 | 3460 | } |
3461 | 3461 | |
3462 | 3462 | // require advanced |
3463 | - $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : ""; |
|
3463 | + $require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : ""; |
|
3464 | 3464 | |
3465 | 3465 | // element require |
3466 | - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; |
|
3466 | + $element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : ""; |
|
3467 | 3467 | |
3468 | 3468 | |
3469 | 3469 | $onchange = "props.setAttributes({ $key: $key } )"; |
3470 | - $onchangecomplete = ""; |
|
3470 | + $onchangecomplete = ""; |
|
3471 | 3471 | $value = "props.attributes.$key"; |
3472 | - $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' ); |
|
3473 | - if ( in_array( $args['type'], $text_type ) ) { |
|
3472 | + $text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx', 'range'); |
|
3473 | + if (in_array($args['type'], $text_type)) { |
|
3474 | 3474 | $type = 'TextControl'; |
3475 | 3475 | // Save numbers as numbers and not strings |
3476 | - if ( $args['type'] == 'number' ) { |
|
3476 | + if ($args['type'] == 'number') { |
|
3477 | 3477 | $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )"; |
3478 | 3478 | } |
3479 | 3479 | |
3480 | - if (substr($key, 0, 9 ) === 'metadata_') { |
|
3481 | - $real_key = str_replace('metadata_','', $key ); |
|
3480 | + if (substr($key, 0, 9) === 'metadata_') { |
|
3481 | + $real_key = str_replace('metadata_', '', $key); |
|
3482 | 3482 | $onchange = "props.setAttributes({ metadata: { $real_key: $key } } )"; |
3483 | - $value = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''"; |
|
3483 | + $value = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''"; |
|
3484 | 3484 | } |
3485 | 3485 | } |
3486 | 3486 | // else if ( $args['type'] == 'popup' ) { |
@@ -3500,12 +3500,12 @@ discard block |
||
3500 | 3500 | // |
3501 | 3501 | // $value = "props.attributes.$key ? props.attributes.$key : ''"; |
3502 | 3502 | // } |
3503 | - else if ( $args['type'] == 'styleid' ) { |
|
3503 | + else if ($args['type'] == 'styleid') { |
|
3504 | 3504 | $type = 'TextControl'; |
3505 | 3505 | $args['type'] == 'text'; |
3506 | 3506 | // Save numbers as numbers and not strings |
3507 | - $value = "props.attributes.$key ? props.attributes.$key : ''"; |
|
3508 | - }else if ( $args['type'] == 'notice' ) { |
|
3507 | + $value = "props.attributes.$key ? props.attributes.$key : ''"; |
|
3508 | + } else if ($args['type'] == 'notice') { |
|
3509 | 3509 | |
3510 | 3510 | $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : ''; |
3511 | 3511 | $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info'; |
@@ -3567,11 +3567,11 @@ discard block |
||
3567 | 3567 | return; |
3568 | 3568 | } |
3569 | 3569 | */ |
3570 | - elseif ( $args['type'] == 'color' ) { |
|
3570 | + elseif ($args['type'] == 'color') { |
|
3571 | 3571 | $type = 'ColorPicker'; |
3572 | 3572 | $onchange = ""; |
3573 | 3573 | $extra = "color: $value,"; |
3574 | - if(!empty($args['disable_alpha'])){ |
|
3574 | + if (!empty($args['disable_alpha'])) { |
|
3575 | 3575 | $extra .= "disableAlpha: true,"; |
3576 | 3576 | } |
3577 | 3577 | $onchangecomplete = "onChangeComplete: function($key) { |
@@ -3580,7 +3580,7 @@ discard block |
||
3580 | 3580 | $key: value |
3581 | 3581 | }); |
3582 | 3582 | },"; |
3583 | - }elseif ( $args['type'] == 'gradient' ) { |
|
3583 | + }elseif ($args['type'] == 'gradient') { |
|
3584 | 3584 | $type = 'GradientPicker'; |
3585 | 3585 | $extra .= "gradients: [{ |
3586 | 3586 | name: 'Vivid cyan blue to vivid purple', |
@@ -3619,7 +3619,7 @@ discard block |
||
3619 | 3619 | slug: 'cool-to-warm-spectrum', |
3620 | 3620 | }],"; |
3621 | 3621 | |
3622 | - }elseif ( $args['type'] == 'image' ) { |
|
3622 | + }elseif ($args['type'] == 'image') { |
|
3623 | 3623 | // print_r($args); |
3624 | 3624 | |
3625 | 3625 | $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,{ |
@@ -3681,7 +3681,7 @@ discard block |
||
3681 | 3681 | $onchange = ""; |
3682 | 3682 | |
3683 | 3683 | //$inside_elements = ",el('div',{},'file upload')"; |
3684 | - } else if ( $args['type'] == 'images' ) { |
|
3684 | + } else if ($args['type'] == 'images') { |
|
3685 | 3685 | $img_preview = "props.attributes.$key && (function() { |
3686 | 3686 | let uploads = JSON.parse('['+props.attributes.$key+']'); |
3687 | 3687 | let images = []; |
@@ -3694,7 +3694,7 @@ discard block |
||
3694 | 3694 | el('i',{ |
3695 | 3695 | className: 'fas fa-times-circle text-danger position-absolute ml-n2 mt-n1 bg-white rounded-circle c-pointer', |
3696 | 3696 | onClick: function() { |
3697 | - aui_confirm('".esc_attr__('Are you sure?')."', '".esc_attr__('Delete')."', '".esc_attr__('Cancel')."', true).then(function(confirmed) { |
|
3697 | + aui_confirm('" . esc_attr__('Are you sure?') . "', '" . esc_attr__('Delete') . "', '" . esc_attr__('Cancel') . "', true).then(function(confirmed) { |
|
3698 | 3698 | if (confirmed) { |
3699 | 3699 | let new_uploads = JSON.parse('['+props.attributes.$key+']'); |
3700 | 3700 | new_uploads.splice(index, 1); |
@@ -3757,36 +3757,36 @@ discard block |
||
3757 | 3757 | |
3758 | 3758 | //$inside_elements = ",el('div',{},'file upload')"; |
3759 | 3759 | } |
3760 | - elseif ( $args['type'] == 'checkbox' ) { |
|
3760 | + elseif ($args['type'] == 'checkbox') { |
|
3761 | 3761 | $type = 'CheckboxControl'; |
3762 | 3762 | $extra .= "checked: props.attributes.$key,"; |
3763 | 3763 | $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; |
3764 | - } elseif ( $args['type'] == 'textarea' ) { |
|
3764 | + } elseif ($args['type'] == 'textarea') { |
|
3765 | 3765 | $type = 'TextareaControl'; |
3766 | 3766 | |
3767 | - } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) { |
|
3767 | + } elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') { |
|
3768 | 3768 | $type = 'SelectControl'; |
3769 | 3769 | |
3770 | - if($args['name'] == 'category' && !empty($args['post_type_linked'])){ |
|
3771 | - $options .= "options: taxonomies_".str_replace("-","_", $this->id).","; |
|
3772 | - }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){ |
|
3773 | - $options .= "options: sort_by_".str_replace("-","_", $this->id).","; |
|
3774 | - }else { |
|
3770 | + if ($args['name'] == 'category' && !empty($args['post_type_linked'])) { |
|
3771 | + $options .= "options: taxonomies_" . str_replace("-", "_", $this->id) . ","; |
|
3772 | + }elseif ($args['name'] == 'sort_by' && !empty($args['post_type_linked'])) { |
|
3773 | + $options .= "options: sort_by_" . str_replace("-", "_", $this->id) . ","; |
|
3774 | + } else { |
|
3775 | 3775 | |
3776 | - if ( ! empty( $args['options'] ) ) { |
|
3776 | + if (!empty($args['options'])) { |
|
3777 | 3777 | $options .= "options: ["; |
3778 | - foreach ( $args['options'] as $option_val => $option_label ) { |
|
3779 | - $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },"; |
|
3778 | + foreach ($args['options'] as $option_val => $option_label) { |
|
3779 | + $options .= "{ value: '" . esc_attr($option_val) . "', label: '" . esc_js(addslashes($option_label)) . "' },"; |
|
3780 | 3780 | } |
3781 | 3781 | $options .= "],"; |
3782 | 3782 | } |
3783 | 3783 | } |
3784 | - if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
3784 | + if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
3785 | 3785 | $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, '; |
3786 | 3786 | } |
3787 | 3787 | |
3788 | - if($args['type'] == 'multiselect' || ( isset( $args['multiple'] ) && $args['multiple'] ) ){ |
|
3789 | - $after_elements .= "props.attributes.$key && el( wp.components.Button, { |
|
3788 | + if ($args['type'] == 'multiselect' || (isset($args['multiple']) && $args['multiple'])) { |
|
3789 | + $after_elements .= "props.attributes.$key && el( wp.components.Button, { |
|
3790 | 3790 | className: 'components-button components-circular-option-picker__clear is-secondary is-small', |
3791 | 3791 | style: {margin:'-8px 0 8px 0',display: 'block'}, |
3792 | 3792 | onClick: function(){ |
@@ -3798,7 +3798,7 @@ discard block |
||
3798 | 3798 | 'Clear' |
3799 | 3799 | ),"; |
3800 | 3800 | } |
3801 | - } elseif ( $args['type'] == 'tagselect' ) { |
|
3801 | + } elseif ($args['type'] == 'tagselect') { |
|
3802 | 3802 | // $type = 'FormTokenField'; |
3803 | 3803 | // |
3804 | 3804 | // if ( ! empty( $args['options'] ) ) { |
@@ -3833,19 +3833,19 @@ discard block |
||
3833 | 3833 | // $value = "[]"; |
3834 | 3834 | // $extra .= ' __experimentalExpandOnFocus: true,'; |
3835 | 3835 | |
3836 | - } else if ( $args['type'] == 'alignment' ) { |
|
3836 | + } else if ($args['type'] == 'alignment') { |
|
3837 | 3837 | $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example |
3838 | - } else if ( $args['type'] == 'margins' ) { |
|
3838 | + } else if ($args['type'] == 'margins') { |
|
3839 | 3839 | |
3840 | - } else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) { |
|
3840 | + } else if ($args['type'] == 'visibility_conditions' && (function_exists('wp_is_block_theme') && wp_is_block_theme())) { |
|
3841 | 3841 | $type = 'TextControl'; |
3842 | 3842 | $value = "(props.attributes.$key ? props.attributes.$key : '')"; |
3843 | 3843 | $args['type'] = 'text'; |
3844 | 3844 | $options .= 'disabled:true,'; |
3845 | - $bsvc_title = esc_attr( addslashes( $args['title'] ) ); |
|
3846 | - $bsvc_body = $this->block_visibility_fields( $args ); |
|
3845 | + $bsvc_title = esc_attr(addslashes($args['title'])); |
|
3846 | + $bsvc_body = $this->block_visibility_fields($args); |
|
3847 | 3847 | // @TODO reset button |
3848 | - $bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __( 'Reset', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __( 'Close', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __( 'Save Rules', 'ayecode-connect' ) . '</button>'; |
|
3848 | + $bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __('Reset', 'ayecode-connect') . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __('Close', 'ayecode-connect') . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __('Save Rules', 'ayecode-connect') . '</button>'; |
|
3849 | 3849 | $after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, { |
3850 | 3850 | className: 'components-button components-circular-option-picker__clear is-primary is-smallx', |
3851 | 3851 | onClick: function() { |
@@ -3864,25 +3864,25 @@ discard block |
||
3864 | 3864 | jQuery('.bs-vc-modal-form').trigger('change'); |
3865 | 3865 | } |
3866 | 3866 | }); |
3867 | - aui_modal('" . $bsvc_title . "', '" . addslashes( $bsvc_body ) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); |
|
3867 | + aui_modal('" . $bsvc_title . "', '" . addslashes($bsvc_body) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); |
|
3868 | 3868 | jQuery(document).off('change', '#bsvc_raw_value').on('change', '#bsvc_raw_value', function(e) { |
3869 | 3869 | props.setAttributes({" . $key . ": e.target.value}); |
3870 | 3870 | }); |
3871 | 3871 | } |
3872 | 3872 | }, |
3873 | - '" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "' |
|
3873 | + '" . addslashes(!empty($args['button_title']) ? $args['button_title'] : $args['title']) . "' |
|
3874 | 3874 | ) ),"; |
3875 | 3875 | } else { |
3876 | - return;// if we have not implemented the control then don't break the JS. |
|
3876 | + return; // if we have not implemented the control then don't break the JS. |
|
3877 | 3877 | } |
3878 | 3878 | |
3879 | 3879 | // color input does not show the labels so we add them |
3880 | - if($args['type']=='color'){ |
|
3880 | + if ($args['type'] == 'color') { |
|
3881 | 3881 | // add show only if advanced |
3882 | 3882 | echo $require_advanced; |
3883 | 3883 | // add setting require if defined |
3884 | 3884 | echo $element_require; |
3885 | - echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),"; |
|
3885 | + echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),"; |
|
3886 | 3886 | } |
3887 | 3887 | |
3888 | 3888 | // add show only if advanced |
@@ -3894,22 +3894,22 @@ discard block |
||
3894 | 3894 | // icon |
3895 | 3895 | echo $icon; |
3896 | 3896 | ?> |
3897 | - el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components.".$type; ?>, { |
|
3898 | - label: <?php if ( empty( $args['title'] ) ) { echo "''"; } else if ( empty( $args['row'] ) && ! empty( $args['device_type'] ) ) { ?>el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['title'] ) ?>'}}),<?php if ( $device_type_icon ) { ?>deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})<?php } ?>)<?php |
|
3899 | - } else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>, |
|
3900 | - help: <?php echo ( isset( $args['desc'] ) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim( wp_kses_post( addslashes( $args['desc'] ) ) ) . "'}})" : "''" ); ?>, |
|
3897 | + el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components." . $type; ?>, { |
|
3898 | + label: <?php if (empty($args['title'])) { echo "''"; } else if (empty($args['row']) && !empty($args['device_type'])) { ?>el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['title']) ?>'}}),<?php if ($device_type_icon) { ?>deviceType == '<?php echo $device_type; ?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})<?php } ?>)<?php |
|
3899 | + } else { ?>'<?php echo addslashes(trim(esc_html($args['title']))); ?>'<?php } ?>, |
|
3900 | + help: <?php echo (isset($args['desc']) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim(wp_kses_post(addslashes($args['desc']))) . "'}})" : "''"); ?>, |
|
3901 | 3901 | value: <?php echo $value; ?>, |
3902 | - <?php if ( $type == 'TextControl' && $args['type'] != 'text' ) { |
|
3903 | - echo "type: '" . addslashes( $args['type'] ) . "',"; |
|
3902 | + <?php if ($type == 'TextControl' && $args['type'] != 'text') { |
|
3903 | + echo "type: '" . addslashes($args['type']) . "',"; |
|
3904 | 3904 | } ?> |
3905 | - <?php if ( ! empty( $args['placeholder'] ) ) { |
|
3906 | - echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',"; |
|
3905 | + <?php if (!empty($args['placeholder'])) { |
|
3906 | + echo "placeholder: '" . esc_js(addslashes(trim(esc_html($args['placeholder'])))) . "',"; |
|
3907 | 3907 | } ?> |
3908 | 3908 | <?php echo $options; ?> |
3909 | 3909 | <?php echo $extra; ?> |
3910 | 3910 | <?php echo $custom_attributes; ?> |
3911 | 3911 | <?php echo $onchangecomplete; ?> |
3912 | - <?php if ( $onchange ) { ?> |
|
3912 | + <?php if ($onchange) { ?> |
|
3913 | 3913 | onChange: function ( <?php echo $key; ?> ) { |
3914 | 3914 | <?php echo $onchange; ?> |
3915 | 3915 | } |
@@ -3928,15 +3928,15 @@ discard block |
||
3928 | 3928 | *@todo there is prob a faster way to do this, also we could add some validation here. |
3929 | 3929 | * |
3930 | 3930 | */ |
3931 | - public function array_to_attributes( $custom_attributes, $html = false ) { |
|
3931 | + public function array_to_attributes($custom_attributes, $html = false) { |
|
3932 | 3932 | $attributes = ''; |
3933 | - if ( ! empty( $custom_attributes ) ) { |
|
3933 | + if (!empty($custom_attributes)) { |
|
3934 | 3934 | |
3935 | - foreach ( $custom_attributes as $key => $val ) { |
|
3936 | - if(is_array($val)){ |
|
3937 | - $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},'; |
|
3938 | - }else{ |
|
3939 | - $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; |
|
3935 | + foreach ($custom_attributes as $key => $val) { |
|
3936 | + if (is_array($val)) { |
|
3937 | + $attributes .= $key . ': {' . $this->array_to_attributes($val, $html) . '},'; |
|
3938 | + } else { |
|
3939 | + $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; |
|
3940 | 3940 | } |
3941 | 3941 | } |
3942 | 3942 | |
@@ -3954,112 +3954,112 @@ discard block |
||
3954 | 3954 | * |
3955 | 3955 | * @param $args |
3956 | 3956 | */ |
3957 | - public function block_element( $args, $save = false ) { |
|
3957 | + public function block_element($args, $save = false) { |
|
3958 | 3958 | |
3959 | 3959 | |
3960 | - if ( ! empty( $args ) ) { |
|
3961 | - foreach ( $args as $element => $new_args ) { |
|
3960 | + if (!empty($args)) { |
|
3961 | + foreach ($args as $element => $new_args) { |
|
3962 | 3962 | |
3963 | - if ( is_array( $new_args ) ) { // its an element |
|
3963 | + if (is_array($new_args)) { // its an element |
|
3964 | 3964 | |
3965 | 3965 | |
3966 | - if ( isset( $new_args['element'] ) ) { |
|
3966 | + if (isset($new_args['element'])) { |
|
3967 | 3967 | |
3968 | - if ( isset( $new_args['element_require'] ) ) { |
|
3969 | - echo str_replace( array( |
|
3968 | + if (isset($new_args['element_require'])) { |
|
3969 | + echo str_replace(array( |
|
3970 | 3970 | "'+", |
3971 | 3971 | "+'" |
3972 | - ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " && "; |
|
3973 | - unset( $new_args['element_require'] ); |
|
3972 | + ), '', $this->block_props_replace($new_args['element_require'])) . " && "; |
|
3973 | + unset($new_args['element_require']); |
|
3974 | 3974 | } |
3975 | 3975 | |
3976 | - if($new_args['element']=='InnerBlocks'){ |
|
3976 | + if ($new_args['element'] == 'InnerBlocks') { |
|
3977 | 3977 | echo "\n el( InnerBlocks, {"; |
3978 | - }elseif($new_args['element']=='innerBlocksProps'){ |
|
3978 | + }elseif ($new_args['element'] == 'innerBlocksProps') { |
|
3979 | 3979 | $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div'; |
3980 | 3980 | // echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {"; |
3981 | 3981 | // echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; |
3982 | 3982 | echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; |
3983 | 3983 | echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {"; |
3984 | - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; |
|
3984 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
3985 | 3985 | |
3986 | 3986 | echo "} ), {"; |
3987 | - echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : ''; |
|
3987 | + echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element($new_args['innerBlocksProps'], $save) : ''; |
|
3988 | 3988 | // echo '###'; |
3989 | 3989 | |
3990 | 3990 | // echo '###'; |
3991 | - }elseif($new_args['element']=='BlocksProps'){ |
|
3991 | + }elseif ($new_args['element'] == 'BlocksProps') { |
|
3992 | 3992 | |
3993 | - if ( isset($new_args['if_inner_element']) ) { |
|
3993 | + if (isset($new_args['if_inner_element'])) { |
|
3994 | 3994 | $element = $new_args['if_inner_element']; |
3995 | - }else { |
|
3996 | - $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'"; |
|
3995 | + } else { |
|
3996 | + $element = isset($new_args['inner_element']) ? "'" . esc_attr($new_args['inner_element']) . "'" : "'div'"; |
|
3997 | 3997 | } |
3998 | 3998 | |
3999 | 3999 | unset($new_args['inner_element']); |
4000 | 4000 | echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {"; |
4001 | - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; |
|
4001 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
4002 | 4002 | |
4003 | 4003 | |
4004 | 4004 | // echo "} ),"; |
4005 | 4005 | |
4006 | - }else{ |
|
4006 | + } else { |
|
4007 | 4007 | echo "\n el( '" . $new_args['element'] . "', {"; |
4008 | 4008 | } |
4009 | 4009 | |
4010 | 4010 | |
4011 | 4011 | // get the attributes |
4012 | - foreach ( $new_args as $new_key => $new_value ) { |
|
4012 | + foreach ($new_args as $new_key => $new_value) { |
|
4013 | 4013 | |
4014 | 4014 | |
4015 | - if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) { |
|
4015 | + if ($new_key == 'element' || $new_key == 'content' || $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) { |
|
4016 | 4016 | // do nothing |
4017 | 4017 | } else { |
4018 | - echo $this->block_element( array( $new_key => $new_value ),$save ); |
|
4018 | + echo $this->block_element(array($new_key => $new_value), $save); |
|
4019 | 4019 | } |
4020 | 4020 | } |
4021 | 4021 | |
4022 | - echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes |
|
4022 | + echo $new_args['element'] == 'BlocksProps' ? '} ),' : "},"; // end attributes |
|
4023 | 4023 | |
4024 | 4024 | // get the content |
4025 | 4025 | $first_item = 0; |
4026 | - foreach ( $new_args as $new_key => $new_value ) { |
|
4027 | - if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) { |
|
4026 | + foreach ($new_args as $new_key => $new_value) { |
|
4027 | + if ($new_key === 'content' || $new_key === 'if_content' || is_array($new_value)) { |
|
4028 | 4028 | |
4029 | - if ( $new_key === 'content' ) { |
|
4030 | - echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'"; |
|
4031 | - }else if ( $new_key === 'if_content' ) { |
|
4032 | - echo $this->block_props_replace( $new_value ); |
|
4029 | + if ($new_key === 'content') { |
|
4030 | + echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'"; |
|
4031 | + } else if ($new_key === 'if_content') { |
|
4032 | + echo $this->block_props_replace($new_value); |
|
4033 | 4033 | } |
4034 | 4034 | |
4035 | - if ( is_array( $new_value ) ) { |
|
4035 | + if (is_array($new_value)) { |
|
4036 | 4036 | |
4037 | - if ( isset( $new_value['element_require'] ) ) { |
|
4038 | - echo str_replace( array( |
|
4037 | + if (isset($new_value['element_require'])) { |
|
4038 | + echo str_replace(array( |
|
4039 | 4039 | "'+", |
4040 | 4040 | "+'" |
4041 | - ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " && "; |
|
4042 | - unset( $new_value['element_require'] ); |
|
4041 | + ), '', $this->block_props_replace($new_value['element_require'])) . " && "; |
|
4042 | + unset($new_value['element_require']); |
|
4043 | 4043 | } |
4044 | 4044 | |
4045 | - if ( isset( $new_value['element_repeat'] ) ) { |
|
4045 | + if (isset($new_value['element_repeat'])) { |
|
4046 | 4046 | $x = 1; |
4047 | - while ( $x <= absint( $new_value['element_repeat'] ) ) { |
|
4048 | - $this->block_element( array( '' => $new_value ),$save ); |
|
4049 | - $x ++; |
|
4047 | + while ($x <= absint($new_value['element_repeat'])) { |
|
4048 | + $this->block_element(array('' => $new_value), $save); |
|
4049 | + $x++; |
|
4050 | 4050 | } |
4051 | 4051 | } else { |
4052 | - $this->block_element( array( '' => $new_value ),$save ); |
|
4052 | + $this->block_element(array('' => $new_value), $save); |
|
4053 | 4053 | } |
4054 | 4054 | } |
4055 | - $first_item ++; |
|
4055 | + $first_item++; |
|
4056 | 4056 | } |
4057 | 4057 | } |
4058 | 4058 | |
4059 | - if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){ |
|
4060 | - echo "))";// end content |
|
4061 | - }else{ |
|
4062 | - echo ")";// end content |
|
4059 | + if ($new_args['element'] == 'innerBlocksProps' || $new_args['element'] == 'xBlocksProps') { |
|
4060 | + echo "))"; // end content |
|
4061 | + } else { |
|
4062 | + echo ")"; // end content |
|
4063 | 4063 | } |
4064 | 4064 | |
4065 | 4065 | |
@@ -4068,26 +4068,26 @@ discard block |
||
4068 | 4068 | } |
4069 | 4069 | } else { |
4070 | 4070 | |
4071 | - if ( substr( $element, 0, 3 ) === "if_" ) { |
|
4071 | + if (substr($element, 0, 3) === "if_") { |
|
4072 | 4072 | $extra = ''; |
4073 | - if( strpos($new_args, '[%WrapClass%]') !== false ){ |
|
4074 | - $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args); |
|
4075 | - $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args); |
|
4073 | + if (strpos($new_args, '[%WrapClass%]') !== false) { |
|
4074 | + $new_args = str_replace('[%WrapClass%]"', '" + sd_build_aui_class(props.attributes)', $new_args); |
|
4075 | + $new_args = str_replace('[%WrapClass%]', '+ sd_build_aui_class(props.attributes)', $new_args); |
|
4076 | 4076 | } |
4077 | - echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ","; |
|
4078 | - } elseif ( $element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false ) { |
|
4079 | - $new_args = str_replace('[%WrapStyle%]','',$new_args); |
|
4080 | - echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },"; |
|
4077 | + echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ","; |
|
4078 | + } elseif ($element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false) { |
|
4079 | + $new_args = str_replace('[%WrapStyle%]', '', $new_args); |
|
4080 | + echo $element . ": {..." . $this->block_props_replace($new_args) . " , ...sd_build_aui_styles(props.attributes) },"; |
|
4081 | 4081 | // echo $element . ": " . $this->block_props_replace( $new_args ) . ","; |
4082 | - } elseif ( $element == 'style' ) { |
|
4083 | - echo $element . ": " . $this->block_props_replace( $new_args ) . ","; |
|
4084 | - } elseif ( ( $element == 'class' || $element == 'className' ) && strpos($new_args, '[%WrapClass%]') !== false ) { |
|
4085 | - $new_args = str_replace('[%WrapClass%]','',$new_args); |
|
4086 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),"; |
|
4087 | - } elseif ( $element == 'template' && $new_args ) { |
|
4082 | + } elseif ($element == 'style') { |
|
4083 | + echo $element . ": " . $this->block_props_replace($new_args) . ","; |
|
4084 | + } elseif (($element == 'class' || $element == 'className') && strpos($new_args, '[%WrapClass%]') !== false) { |
|
4085 | + $new_args = str_replace('[%WrapClass%]', '', $new_args); |
|
4086 | + echo $element . ": '" . $this->block_props_replace($new_args) . "' + sd_build_aui_class(props.attributes),"; |
|
4087 | + } elseif ($element == 'template' && $new_args) { |
|
4088 | 4088 | echo $element . ": $new_args,"; |
4089 | 4089 | } else { |
4090 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "',"; |
|
4090 | + echo $element . ": '" . $this->block_props_replace($new_args) . "',"; |
|
4091 | 4091 | } |
4092 | 4092 | |
4093 | 4093 | } |
@@ -4102,11 +4102,11 @@ discard block |
||
4102 | 4102 | * |
4103 | 4103 | * @return mixed |
4104 | 4104 | */ |
4105 | - public function block_props_replace( $string, $no_wrap = false ) { |
|
4106 | - if ( $no_wrap ) { |
|
4107 | - $string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string ); |
|
4105 | + public function block_props_replace($string, $no_wrap = false) { |
|
4106 | + if ($no_wrap) { |
|
4107 | + $string = str_replace(array("[%", "%]", "%:checked]"), array("props.attributes.", "", ""), $string); |
|
4108 | 4108 | } else { |
4109 | - $string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string ); |
|
4109 | + $string = str_replace(array("![%", "[%", "%]", "%:checked]"), array("'+!props.attributes.", "'+props.attributes.", "+'", "+'"), $string); |
|
4110 | 4110 | } |
4111 | 4111 | |
4112 | 4112 | return $string; |
@@ -4118,65 +4118,65 @@ discard block |
||
4118 | 4118 | * @param array $args |
4119 | 4119 | * @param array $instance |
4120 | 4120 | */ |
4121 | - public function widget( $args, $instance ) { |
|
4122 | - if ( ! is_array( $args ) ) { |
|
4121 | + public function widget($args, $instance) { |
|
4122 | + if (!is_array($args)) { |
|
4123 | 4123 | $args = array(); |
4124 | 4124 | } |
4125 | 4125 | |
4126 | 4126 | // Get the filtered values |
4127 | - $argument_values = $this->argument_values( $instance ); |
|
4128 | - $argument_values = $this->string_to_bool( $argument_values ); |
|
4129 | - $output = $this->output( $argument_values, $args ); |
|
4127 | + $argument_values = $this->argument_values($instance); |
|
4128 | + $argument_values = $this->string_to_bool($argument_values); |
|
4129 | + $output = $this->output($argument_values, $args); |
|
4130 | 4130 | |
4131 | 4131 | $no_wrap = false; |
4132 | - if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) { |
|
4132 | + if (isset($argument_values['no_wrap']) && $argument_values['no_wrap']) { |
|
4133 | 4133 | $no_wrap = true; |
4134 | 4134 | } |
4135 | 4135 | |
4136 | 4136 | ob_start(); |
4137 | - if ( $output && ! $no_wrap ) { |
|
4137 | + if ($output && !$no_wrap) { |
|
4138 | 4138 | |
4139 | 4139 | $class_original = $this->options['widget_ops']['classname']; |
4140 | - $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash(); |
|
4140 | + $class = $this->options['widget_ops']['classname'] . " sdel-" . $this->get_instance_hash(); |
|
4141 | 4141 | |
4142 | 4142 | // Before widget |
4143 | - $before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : ''; |
|
4144 | - $before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget; |
|
4145 | - $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this ); |
|
4146 | - $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this ); |
|
4143 | + $before_widget = !empty($args['before_widget']) ? $args['before_widget'] : ''; |
|
4144 | + $before_widget = $before_widget ? str_replace($class_original, $class, $before_widget) : $before_widget; |
|
4145 | + $before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this); |
|
4146 | + $before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this); |
|
4147 | 4147 | |
4148 | 4148 | // After widget |
4149 | - $after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : ''; |
|
4150 | - $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this ); |
|
4151 | - $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this ); |
|
4149 | + $after_widget = !empty($args['after_widget']) ? $args['after_widget'] : ''; |
|
4150 | + $after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this); |
|
4151 | + $after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this); |
|
4152 | 4152 | |
4153 | 4153 | echo $before_widget; |
4154 | 4154 | // elementor strips the widget wrapping div so we check for and add it back if needed |
4155 | - if ( $this->is_elementor_widget_output() ) { |
|
4155 | + if ($this->is_elementor_widget_output()) { |
|
4156 | 4156 | // Filter class & attrs for elementor widget output. |
4157 | - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); |
|
4158 | - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); |
|
4157 | + $class = apply_filters('wp_super_duper_div_classname', $class, $args, $this); |
|
4158 | + $class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this); |
|
4159 | 4159 | |
4160 | - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); |
|
4161 | - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); |
|
4160 | + $attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this); |
|
4161 | + $attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); |
|
4162 | 4162 | |
4163 | - echo "<span class='" . esc_attr( $class ) . "' " . $attrs . ">"; |
|
4163 | + echo "<span class='" . esc_attr($class) . "' " . $attrs . ">"; |
|
4164 | 4164 | } |
4165 | - echo $this->output_title( $args, $instance ); |
|
4165 | + echo $this->output_title($args, $instance); |
|
4166 | 4166 | echo $output; |
4167 | - if ( $this->is_elementor_widget_output() ) { |
|
4167 | + if ($this->is_elementor_widget_output()) { |
|
4168 | 4168 | echo "</span>"; |
4169 | 4169 | } |
4170 | 4170 | echo $after_widget; |
4171 | - } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty |
|
4172 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
4171 | + } elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty |
|
4172 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
4173 | 4173 | echo $output; |
4174 | - } elseif ( $output && $no_wrap ) { |
|
4174 | + } elseif ($output && $no_wrap) { |
|
4175 | 4175 | echo $output; |
4176 | 4176 | } |
4177 | 4177 | $output = ob_get_clean(); |
4178 | 4178 | |
4179 | - $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this ); |
|
4179 | + $output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this); |
|
4180 | 4180 | |
4181 | 4181 | echo $output; |
4182 | 4182 | } |
@@ -4189,7 +4189,7 @@ discard block |
||
4189 | 4189 | */ |
4190 | 4190 | public function is_elementor_widget_output() { |
4191 | 4191 | $result = false; |
4192 | - if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) { |
|
4192 | + if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') { |
|
4193 | 4193 | $result = true; |
4194 | 4194 | } |
4195 | 4195 | |
@@ -4204,7 +4204,7 @@ discard block |
||
4204 | 4204 | */ |
4205 | 4205 | public function is_elementor_preview() { |
4206 | 4206 | $result = false; |
4207 | - if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) { |
|
4207 | + if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) { |
|
4208 | 4208 | $result = true; |
4209 | 4209 | } |
4210 | 4210 | |
@@ -4219,7 +4219,7 @@ discard block |
||
4219 | 4219 | */ |
4220 | 4220 | public function is_divi_preview() { |
4221 | 4221 | $result = false; |
4222 | - if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) { |
|
4222 | + if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) { |
|
4223 | 4223 | $result = true; |
4224 | 4224 | } |
4225 | 4225 | |
@@ -4234,7 +4234,7 @@ discard block |
||
4234 | 4234 | */ |
4235 | 4235 | public function is_beaver_preview() { |
4236 | 4236 | $result = false; |
4237 | - if ( isset( $_REQUEST['fl_builder'] ) ) { |
|
4237 | + if (isset($_REQUEST['fl_builder'])) { |
|
4238 | 4238 | $result = true; |
4239 | 4239 | } |
4240 | 4240 | |
@@ -4249,7 +4249,7 @@ discard block |
||
4249 | 4249 | */ |
4250 | 4250 | public function is_siteorigin_preview() { |
4251 | 4251 | $result = false; |
4252 | - if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) { |
|
4252 | + if (!empty($_REQUEST['siteorigin_panels_live_editor'])) { |
|
4253 | 4253 | $result = true; |
4254 | 4254 | } |
4255 | 4255 | |
@@ -4264,7 +4264,7 @@ discard block |
||
4264 | 4264 | */ |
4265 | 4265 | public function is_cornerstone_preview() { |
4266 | 4266 | $result = false; |
4267 | - if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) { |
|
4267 | + if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') { |
|
4268 | 4268 | $result = true; |
4269 | 4269 | } |
4270 | 4270 | |
@@ -4279,7 +4279,7 @@ discard block |
||
4279 | 4279 | */ |
4280 | 4280 | public function is_fusion_preview() { |
4281 | 4281 | $result = false; |
4282 | - if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) { |
|
4282 | + if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) { |
|
4283 | 4283 | $result = true; |
4284 | 4284 | } |
4285 | 4285 | |
@@ -4294,7 +4294,7 @@ discard block |
||
4294 | 4294 | */ |
4295 | 4295 | public function is_oxygen_preview() { |
4296 | 4296 | $result = false; |
4297 | - if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) { |
|
4297 | + if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) { |
|
4298 | 4298 | $result = true; |
4299 | 4299 | } |
4300 | 4300 | |
@@ -4311,7 +4311,7 @@ discard block |
||
4311 | 4311 | public function is_kallyas_zion_preview() { |
4312 | 4312 | $result = false; |
4313 | 4313 | |
4314 | - if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) { |
|
4314 | + if (function_exists('znhg_kallyas_theme_config') && !empty($_REQUEST['zn_pb_edit'])) { |
|
4315 | 4315 | $result = true; |
4316 | 4316 | } |
4317 | 4317 | |
@@ -4328,7 +4328,7 @@ discard block |
||
4328 | 4328 | public function is_bricks_preview() { |
4329 | 4329 | $result = false; |
4330 | 4330 | |
4331 | - if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) { |
|
4331 | + if (function_exists('bricks_is_builder') && (bricks_is_builder() || bricks_is_builder_call())) { |
|
4332 | 4332 | $result = true; |
4333 | 4333 | } |
4334 | 4334 | |
@@ -4343,25 +4343,25 @@ discard block |
||
4343 | 4343 | */ |
4344 | 4344 | public function is_preview() { |
4345 | 4345 | $preview = false; |
4346 | - if ( $this->is_divi_preview() ) { |
|
4346 | + if ($this->is_divi_preview()) { |
|
4347 | 4347 | $preview = true; |
4348 | - } elseif ( $this->is_elementor_preview() ) { |
|
4348 | + } elseif ($this->is_elementor_preview()) { |
|
4349 | 4349 | $preview = true; |
4350 | - } elseif ( $this->is_beaver_preview() ) { |
|
4350 | + } elseif ($this->is_beaver_preview()) { |
|
4351 | 4351 | $preview = true; |
4352 | - } elseif ( $this->is_siteorigin_preview() ) { |
|
4352 | + } elseif ($this->is_siteorigin_preview()) { |
|
4353 | 4353 | $preview = true; |
4354 | - } elseif ( $this->is_cornerstone_preview() ) { |
|
4354 | + } elseif ($this->is_cornerstone_preview()) { |
|
4355 | 4355 | $preview = true; |
4356 | - } elseif ( $this->is_fusion_preview() ) { |
|
4356 | + } elseif ($this->is_fusion_preview()) { |
|
4357 | 4357 | $preview = true; |
4358 | - } elseif ( $this->is_oxygen_preview() ) { |
|
4358 | + } elseif ($this->is_oxygen_preview()) { |
|
4359 | 4359 | $preview = true; |
4360 | - } elseif( $this->is_kallyas_zion_preview() ) { |
|
4360 | + } elseif ($this->is_kallyas_zion_preview()) { |
|
4361 | 4361 | $preview = true; |
4362 | - } elseif( $this->is_block_content_call() ) { |
|
4362 | + } elseif ($this->is_block_content_call()) { |
|
4363 | 4363 | $preview = true; |
4364 | - } elseif( $this->is_bricks_preview() ) { |
|
4364 | + } elseif ($this->is_bricks_preview()) { |
|
4365 | 4365 | $preview = true; |
4366 | 4366 | } |
4367 | 4367 | |
@@ -4376,34 +4376,34 @@ discard block |
||
4376 | 4376 | * |
4377 | 4377 | * @return string |
4378 | 4378 | */ |
4379 | - public function output_title( $args, $instance = array() ) { |
|
4379 | + public function output_title($args, $instance = array()) { |
|
4380 | 4380 | $output = ''; |
4381 | - if ( ! empty( $instance['title'] ) ) { |
|
4381 | + if (!empty($instance['title'])) { |
|
4382 | 4382 | /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ |
4383 | - $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
|
4383 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); |
|
4384 | 4384 | |
4385 | - if(empty($instance['widget_title_tag'])){ |
|
4385 | + if (empty($instance['widget_title_tag'])) { |
|
4386 | 4386 | $output = $args['before_title'] . $title . $args['after_title']; |
4387 | - }else{ |
|
4388 | - $title_tag = esc_attr( $instance['widget_title_tag'] ); |
|
4387 | + } else { |
|
4388 | + $title_tag = esc_attr($instance['widget_title_tag']); |
|
4389 | 4389 | |
4390 | 4390 | // classes |
4391 | 4391 | $title_classes = array(); |
4392 | - $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : ''; |
|
4393 | - $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : ''; |
|
4394 | - $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : ''; |
|
4395 | - $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : ''; |
|
4396 | - $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : ''; |
|
4397 | - $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : ''; |
|
4398 | - $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : ''; |
|
4399 | - $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : ''; |
|
4400 | - $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : ''; |
|
4401 | - $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : ''; |
|
4402 | - $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : ''; |
|
4403 | - $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : ''; |
|
4404 | - $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : ''; |
|
4405 | - |
|
4406 | - $class = !empty( $title_classes ) ? implode(" ",$title_classes) : ''; |
|
4392 | + $title_classes[] = !empty($instance['widget_title_size_class']) ? sanitize_html_class($instance['widget_title_size_class']) : ''; |
|
4393 | + $title_classes[] = !empty($instance['widget_title_align_class']) ? sanitize_html_class($instance['widget_title_align_class']) : ''; |
|
4394 | + $title_classes[] = !empty($instance['widget_title_color_class']) ? "text-" . sanitize_html_class($instance['widget_title_color_class']) : ''; |
|
4395 | + $title_classes[] = !empty($instance['widget_title_border_class']) ? sanitize_html_class($instance['widget_title_border_class']) : ''; |
|
4396 | + $title_classes[] = !empty($instance['widget_title_border_color_class']) ? "border-" . sanitize_html_class($instance['widget_title_border_color_class']) : ''; |
|
4397 | + $title_classes[] = !empty($instance['widget_title_mt_class']) ? "mt-" . absint($instance['widget_title_mt_class']) : ''; |
|
4398 | + $title_classes[] = !empty($instance['widget_title_mr_class']) ? "mr-" . absint($instance['widget_title_mr_class']) : ''; |
|
4399 | + $title_classes[] = !empty($instance['widget_title_mb_class']) ? "mb-" . absint($instance['widget_title_mb_class']) : ''; |
|
4400 | + $title_classes[] = !empty($instance['widget_title_ml_class']) ? "ml-" . absint($instance['widget_title_ml_class']) : ''; |
|
4401 | + $title_classes[] = !empty($instance['widget_title_pt_class']) ? "pt-" . absint($instance['widget_title_pt_class']) : ''; |
|
4402 | + $title_classes[] = !empty($instance['widget_title_pr_class']) ? "pr-" . absint($instance['widget_title_pr_class']) : ''; |
|
4403 | + $title_classes[] = !empty($instance['widget_title_pb_class']) ? "pb-" . absint($instance['widget_title_pb_class']) : ''; |
|
4404 | + $title_classes[] = !empty($instance['widget_title_pl_class']) ? "pl-" . absint($instance['widget_title_pl_class']) : ''; |
|
4405 | + |
|
4406 | + $class = !empty($title_classes) ? implode(" ", $title_classes) : ''; |
|
4407 | 4407 | $output = "<$title_tag class='$class' >$title</$title_tag>"; |
4408 | 4408 | } |
4409 | 4409 | |
@@ -4417,7 +4417,7 @@ discard block |
||
4417 | 4417 | * |
4418 | 4418 | * @param array $instance The widget options. |
4419 | 4419 | */ |
4420 | - public function form( $instance ) { |
|
4420 | + public function form($instance) { |
|
4421 | 4421 | |
4422 | 4422 | // set widget instance |
4423 | 4423 | $this->instance = $instance; |
@@ -4425,20 +4425,20 @@ discard block |
||
4425 | 4425 | // set it as a SD widget |
4426 | 4426 | echo $this->widget_advanced_toggle(); |
4427 | 4427 | |
4428 | - echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>"; |
|
4428 | + echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>"; |
|
4429 | 4429 | $arguments_raw = $this->get_arguments(); |
4430 | 4430 | |
4431 | - if ( is_array( $arguments_raw ) ) { |
|
4431 | + if (is_array($arguments_raw)) { |
|
4432 | 4432 | |
4433 | - $arguments = $this->group_arguments( $arguments_raw ); |
|
4433 | + $arguments = $this->group_arguments($arguments_raw); |
|
4434 | 4434 | |
4435 | 4435 | // Do we have sections? |
4436 | 4436 | $has_sections = $arguments == $arguments_raw ? false : true; |
4437 | 4437 | |
4438 | 4438 | |
4439 | - if ( $has_sections ) { |
|
4439 | + if ($has_sections) { |
|
4440 | 4440 | $panel_count = 0; |
4441 | - foreach ( $arguments as $key => $args ) { |
|
4441 | + foreach ($arguments as $key => $args) { |
|
4442 | 4442 | |
4443 | 4443 | ?> |
4444 | 4444 | <script> |
@@ -4448,26 +4448,26 @@ discard block |
||
4448 | 4448 | |
4449 | 4449 | $hide = $panel_count ? ' style="display:none;" ' : ''; |
4450 | 4450 | $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down'; |
4451 | - 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>"; |
|
4452 | - echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>"; |
|
4451 | + 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>"; |
|
4452 | + echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>"; |
|
4453 | 4453 | |
4454 | - foreach ( $args as $k => $a ) { |
|
4454 | + foreach ($args as $k => $a) { |
|
4455 | 4455 | |
4456 | 4456 | $this->widget_inputs_row_start($k, $a); |
4457 | - $this->widget_inputs( $a, $instance ); |
|
4457 | + $this->widget_inputs($a, $instance); |
|
4458 | 4458 | $this->widget_inputs_row_end($k, $a); |
4459 | 4459 | |
4460 | 4460 | } |
4461 | 4461 | |
4462 | 4462 | echo "</div>"; |
4463 | 4463 | |
4464 | - $panel_count ++; |
|
4464 | + $panel_count++; |
|
4465 | 4465 | |
4466 | 4466 | } |
4467 | 4467 | } else { |
4468 | - foreach ( $arguments as $key => $args ) { |
|
4468 | + foreach ($arguments as $key => $args) { |
|
4469 | 4469 | $this->widget_inputs_row_start($key, $args); |
4470 | - $this->widget_inputs( $args, $instance ); |
|
4470 | + $this->widget_inputs($args, $instance); |
|
4471 | 4471 | $this->widget_inputs_row_end($key, $args); |
4472 | 4472 | } |
4473 | 4473 | } |
@@ -4475,28 +4475,28 @@ discard block |
||
4475 | 4475 | } |
4476 | 4476 | } |
4477 | 4477 | |
4478 | - public function widget_inputs_row_start( $key, $args ) { |
|
4479 | - if ( ! empty( $args['row'] ) ) { |
|
4478 | + public function widget_inputs_row_start($key, $args) { |
|
4479 | + if (!empty($args['row'])) { |
|
4480 | 4480 | // Maybe open |
4481 | - if ( ! empty( $args['row']['open'] ) ) { |
|
4481 | + if (!empty($args['row']['open'])) { |
|
4482 | 4482 | ?> |
4483 | - <div class='bsui sd-argument' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php echo ( ! empty( $args['row']['element_require'] ) ? $this->convert_element_require( $args['row']['element_require'] ) : '' ); ?>'> |
|
4484 | - <?php if ( ! empty( $args['row']['title'] ) ) { ?> |
|
4483 | + <div class='bsui sd-argument' data-argument='<?php echo esc_attr($args['row']['key']); ?>' data-element_require='<?php echo (!empty($args['row']['element_require']) ? $this->convert_element_require($args['row']['element_require']) : ''); ?>'> |
|
4484 | + <?php if (!empty($args['row']['title'])) { ?> |
|
4485 | 4485 | <?php |
4486 | - if ( isset( $args['row']['icon'] ) ) { |
|
4486 | + if (isset($args['row']['icon'])) { |
|
4487 | 4487 | $args['row']['icon'] = ''; |
4488 | 4488 | } |
4489 | 4489 | |
4490 | - if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) { |
|
4490 | + if (!isset($args['row']['device_type']) && isset($args['device_type'])) { |
|
4491 | 4491 | $args['row']['device_type'] = $args['device_type']; |
4492 | 4492 | } |
4493 | 4493 | ?> |
4494 | - <label class="mb-0"><?php echo $this->widget_field_title( $args['row'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label> |
|
4494 | + <label class="mb-0"><?php echo $this->widget_field_title($args['row']); ?><?php echo $this->widget_field_desc($args['row']); ?></label> |
|
4495 | 4495 | <?php } ?> |
4496 | - <div class='row<?php echo ( ! empty( $args['row']['class'] ) ? ' ' . esc_attr( $args['row']['class'] ) : '' ); ?>'> |
|
4496 | + <div class='row<?php echo (!empty($args['row']['class']) ? ' ' . esc_attr($args['row']['class']) : ''); ?>'> |
|
4497 | 4497 | <div class='col pr-2'> |
4498 | 4498 | <?php |
4499 | - } else if ( ! empty( $args['row']['close'] ) ) { |
|
4499 | + } else if (!empty($args['row']['close'])) { |
|
4500 | 4500 | echo "<div class='col pl-0 ps-0'>"; |
4501 | 4501 | } else { |
4502 | 4502 | echo "<div class='col pl-0 ps-0 pr-2 pe-2'>"; |
@@ -4504,10 +4504,10 @@ discard block |
||
4504 | 4504 | } |
4505 | 4505 | } |
4506 | 4506 | |
4507 | - public function widget_inputs_row_end( $key, $args ) { |
|
4508 | - if ( ! empty( $args['row'] ) ) { |
|
4507 | + public function widget_inputs_row_end($key, $args) { |
|
4508 | + if (!empty($args['row'])) { |
|
4509 | 4509 | // Maybe close |
4510 | - if ( ! empty( $args['row']['close'] ) ) { |
|
4510 | + if (!empty($args['row']['close'])) { |
|
4511 | 4511 | echo "</div></div>"; |
4512 | 4512 | } |
4513 | 4513 | echo "</div>"; |
@@ -4522,7 +4522,7 @@ discard block |
||
4522 | 4522 | public function widget_advanced_toggle() { |
4523 | 4523 | |
4524 | 4524 | $output = ''; |
4525 | - if ( $this->block_show_advanced() ) { |
|
4525 | + if ($this->block_show_advanced()) { |
|
4526 | 4526 | $val = 1; |
4527 | 4527 | } else { |
4528 | 4528 | $val = 0; |
@@ -4542,14 +4542,14 @@ discard block |
||
4542 | 4542 | *@since 1.0.0 |
4543 | 4543 | * |
4544 | 4544 | */ |
4545 | - public function convert_element_require( $input ) { |
|
4546 | - $input = str_replace( "'", '"', $input );// we only want double quotes |
|
4545 | + public function convert_element_require($input) { |
|
4546 | + $input = str_replace("'", '"', $input); // we only want double quotes |
|
4547 | 4547 | |
4548 | - $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array( |
|
4548 | + $output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array( |
|
4549 | 4549 | "jQuery(form).find('[data-argument=\"", |
4550 | 4550 | "\"]').find('input,select,textarea').val()", |
4551 | 4551 | "\"]').find('input:checked').val()" |
4552 | - ), $input ) ); |
|
4552 | + ), $input)); |
|
4553 | 4553 | |
4554 | 4554 | return $output; |
4555 | 4555 | } |
@@ -4560,48 +4560,48 @@ discard block |
||
4560 | 4560 | * @param $args |
4561 | 4561 | * @param $instance |
4562 | 4562 | */ |
4563 | - public function widget_inputs( $args, $instance ) { |
|
4563 | + public function widget_inputs($args, $instance) { |
|
4564 | 4564 | |
4565 | 4565 | $class = ""; |
4566 | 4566 | $element_require = ""; |
4567 | 4567 | $custom_attributes = ""; |
4568 | 4568 | |
4569 | 4569 | // get value |
4570 | - if ( isset( $instance[ $args['name'] ] ) ) { |
|
4571 | - $value = $instance[ $args['name'] ]; |
|
4572 | - } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) { |
|
4573 | - $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] ); |
|
4570 | + if (isset($instance[$args['name']])) { |
|
4571 | + $value = $instance[$args['name']]; |
|
4572 | + } elseif (!isset($instance[$args['name']]) && !empty($args['default'])) { |
|
4573 | + $value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']); |
|
4574 | 4574 | } else { |
4575 | 4575 | $value = ''; |
4576 | 4576 | } |
4577 | 4577 | |
4578 | 4578 | // get placeholder |
4579 | - if ( ! empty( $args['placeholder'] ) ) { |
|
4580 | - $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'"; |
|
4579 | + if (!empty($args['placeholder'])) { |
|
4580 | + $placeholder = "placeholder='" . esc_html($args['placeholder']) . "'"; |
|
4581 | 4581 | } else { |
4582 | 4582 | $placeholder = ''; |
4583 | 4583 | } |
4584 | 4584 | |
4585 | 4585 | // get if advanced |
4586 | - if ( isset( $args['advanced'] ) && $args['advanced'] ) { |
|
4586 | + if (isset($args['advanced']) && $args['advanced']) { |
|
4587 | 4587 | $class .= " sd-advanced-setting "; |
4588 | 4588 | } |
4589 | 4589 | |
4590 | 4590 | // element_require |
4591 | - if ( isset( $args['element_require'] ) && $args['element_require'] ) { |
|
4591 | + if (isset($args['element_require']) && $args['element_require']) { |
|
4592 | 4592 | $element_require = $args['element_require']; |
4593 | 4593 | } |
4594 | 4594 | |
4595 | 4595 | // custom_attributes |
4596 | - if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) { |
|
4597 | - $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true ); |
|
4596 | + if (isset($args['custom_attributes']) && $args['custom_attributes']) { |
|
4597 | + $custom_attributes = $this->array_to_attributes($args['custom_attributes'], true); |
|
4598 | 4598 | } |
4599 | 4599 | |
4600 | 4600 | // before wrapper |
4601 | 4601 | ?> |
4602 | - <p class="sd-argument <?php echo esc_attr( $class ); ?>" data-argument='<?php echo esc_attr( $args['name'] ); ?>' data-element_require='<?php if ( $element_require ) { echo $this->convert_element_require( $element_require );} ?>'> |
|
4602 | + <p class="sd-argument <?php echo esc_attr($class); ?>" data-argument='<?php echo esc_attr($args['name']); ?>' data-element_require='<?php if ($element_require) { echo $this->convert_element_require($element_require); } ?>'> |
|
4603 | 4603 | <?php |
4604 | - switch ( $args['type'] ) { |
|
4604 | + switch ($args['type']) { |
|
4605 | 4605 | //array('text','password','number','email','tel','url','color') |
4606 | 4606 | case "text": |
4607 | 4607 | case "password": |
@@ -4611,33 +4611,33 @@ discard block |
||
4611 | 4611 | case "url": |
4612 | 4612 | case "color": |
4613 | 4613 | ?> |
4614 | - <label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
4615 | - <input <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="<?php echo esc_attr( $args['type'] ); ?>" value="<?php echo esc_attr( $value ); ?>"> |
|
4614 | + <label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
4615 | + <input <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="<?php echo esc_attr($args['type']); ?>" value="<?php echo esc_attr($value); ?>"> |
|
4616 | 4616 | <?php |
4617 | 4617 | |
4618 | 4618 | break; |
4619 | 4619 | case "select": |
4620 | - $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false; |
|
4621 | - if ( $multiple ) { |
|
4622 | - if ( empty( $value ) ) { |
|
4620 | + $multiple = isset($args['multiple']) && $args['multiple'] ? true : false; |
|
4621 | + if ($multiple) { |
|
4622 | + if (empty($value)) { |
|
4623 | 4623 | $value = array(); |
4624 | 4624 | } |
4625 | 4625 | } |
4626 | 4626 | ?> |
4627 | - <label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
4628 | - <select <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); if ( $multiple ) { echo "[]"; } ?>" |
|
4629 | - <?php if ( $multiple ) { |
|
4627 | + <label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
4628 | + <select <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); if ($multiple) { echo "[]"; } ?>" |
|
4629 | + <?php if ($multiple) { |
|
4630 | 4630 | echo "multiple"; |
4631 | 4631 | } //@todo not implemented yet due to gutenberg not supporting it |
4632 | 4632 | ?>> |
4633 | 4633 | <?php |
4634 | 4634 | |
4635 | - if ( ! empty( $args['options'] ) ) { |
|
4636 | - foreach ( $args['options'] as $val => $label ) { |
|
4637 | - if ( $multiple ) { |
|
4638 | - $selected = in_array( $val, $value ) ? 'selected="selected"' : ''; |
|
4635 | + if (!empty($args['options'])) { |
|
4636 | + foreach ($args['options'] as $val => $label) { |
|
4637 | + if ($multiple) { |
|
4638 | + $selected = in_array($val, $value) ? 'selected="selected"' : ''; |
|
4639 | 4639 | } else { |
4640 | - $selected = selected( $value, $val, false ); |
|
4640 | + $selected = selected($value, $val, false); |
|
4641 | 4641 | } |
4642 | 4642 | echo "<option value='$val' " . $selected . ">$label</option>"; |
4643 | 4643 | } |
@@ -4648,20 +4648,20 @@ discard block |
||
4648 | 4648 | break; |
4649 | 4649 | case "checkbox": |
4650 | 4650 | ?> |
4651 | - <input <?php echo $placeholder; ?> <?php checked( 1, $value, true ) ?> <?php echo $custom_attributes; ?> class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox" value="1"> |
|
4652 | - <label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
4651 | + <input <?php echo $placeholder; ?> <?php checked(1, $value, true) ?> <?php echo $custom_attributes; ?> class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox" value="1"> |
|
4652 | + <label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
4653 | 4653 | <?php |
4654 | 4654 | break; |
4655 | 4655 | case "textarea": |
4656 | 4656 | ?> |
4657 | - <label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
4658 | - <textarea <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"><?php echo esc_attr( $value ); ?></textarea> |
|
4657 | + <label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
4658 | + <textarea <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"><?php echo esc_attr($value); ?></textarea> |
|
4659 | 4659 | <?php |
4660 | 4660 | |
4661 | 4661 | break; |
4662 | 4662 | case "hidden": |
4663 | 4663 | ?> |
4664 | - <input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>"> |
|
4664 | + <input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden" value="<?php echo esc_attr($value); ?>"> |
|
4665 | 4665 | <?php |
4666 | 4666 | break; |
4667 | 4667 | default: |
@@ -4671,15 +4671,15 @@ discard block |
||
4671 | 4671 | ?></p><?php |
4672 | 4672 | } |
4673 | 4673 | |
4674 | - public function get_widget_icon($icon = 'box-top', $title = ''){ |
|
4675 | - if($icon=='box-top'){ |
|
4676 | - 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>'; |
|
4677 | - }elseif($icon=='box-right'){ |
|
4678 | - 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>'; |
|
4679 | - }elseif($icon=='box-bottom'){ |
|
4680 | - 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>'; |
|
4681 | - }elseif($icon=='box-left'){ |
|
4682 | - 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>'; |
|
4674 | + public function get_widget_icon($icon = 'box-top', $title = '') { |
|
4675 | + if ($icon == 'box-top') { |
|
4676 | + 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>'; |
|
4677 | + }elseif ($icon == 'box-right') { |
|
4678 | + 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>'; |
|
4679 | + }elseif ($icon == 'box-bottom') { |
|
4680 | + 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>'; |
|
4681 | + }elseif ($icon == 'box-left') { |
|
4682 | + 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>'; |
|
4683 | 4683 | } |
4684 | 4684 | } |
4685 | 4685 | |
@@ -4691,14 +4691,14 @@ discard block |
||
4691 | 4691 | * @return string |
4692 | 4692 | * @todo, need to make its own tooltip script |
4693 | 4693 | */ |
4694 | - public function widget_field_desc( $args ) { |
|
4694 | + public function widget_field_desc($args) { |
|
4695 | 4695 | |
4696 | 4696 | $description = ''; |
4697 | - if ( isset( $args['desc'] ) && $args['desc'] ) { |
|
4698 | - if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) { |
|
4699 | - $description = $this->desc_tip( $args['desc'] ); |
|
4697 | + if (isset($args['desc']) && $args['desc']) { |
|
4698 | + if (isset($args['desc_tip']) && $args['desc_tip']) { |
|
4699 | + $description = $this->desc_tip($args['desc']); |
|
4700 | 4700 | } else { |
4701 | - $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>'; |
|
4701 | + $description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>'; |
|
4702 | 4702 | } |
4703 | 4703 | } |
4704 | 4704 | |
@@ -4712,18 +4712,18 @@ discard block |
||
4712 | 4712 | * |
4713 | 4713 | * @return string |
4714 | 4714 | */ |
4715 | - public function widget_field_title( $args ) { |
|
4715 | + public function widget_field_title($args) { |
|
4716 | 4716 | $title = ''; |
4717 | 4717 | |
4718 | - if ( isset( $args['title'] ) && $args['title'] ) { |
|
4719 | - if ( ! empty( $args['device_type'] ) ) { |
|
4718 | + if (isset($args['title']) && $args['title']) { |
|
4719 | + if (!empty($args['device_type'])) { |
|
4720 | 4720 | $args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title. |
4721 | 4721 | } |
4722 | 4722 | |
4723 | - if ( isset( $args['icon'] ) && $args['icon'] ) { |
|
4724 | - $title = self::get_widget_icon( $args['icon'], $args['title'] ); |
|
4723 | + if (isset($args['icon']) && $args['icon']) { |
|
4724 | + $title = self::get_widget_icon($args['icon'], $args['title']); |
|
4725 | 4725 | } else { |
4726 | - $title = esc_attr( $args['title'] ); |
|
4726 | + $title = esc_attr($args['title']); |
|
4727 | 4727 | } |
4728 | 4728 | } |
4729 | 4729 | |
@@ -4738,11 +4738,11 @@ discard block |
||
4738 | 4738 | * |
4739 | 4739 | * @return string |
4740 | 4740 | */ |
4741 | - function desc_tip( $tip, $allow_html = false ) { |
|
4742 | - if ( $allow_html ) { |
|
4743 | - $tip = $this->sanitize_tooltip( $tip ); |
|
4741 | + function desc_tip($tip, $allow_html = false) { |
|
4742 | + if ($allow_html) { |
|
4743 | + $tip = $this->sanitize_tooltip($tip); |
|
4744 | 4744 | } else { |
4745 | - $tip = esc_attr( $tip ); |
|
4745 | + $tip = esc_attr($tip); |
|
4746 | 4746 | } |
4747 | 4747 | |
4748 | 4748 | return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>'; |
@@ -4755,8 +4755,8 @@ discard block |
||
4755 | 4755 | * |
4756 | 4756 | * @return string |
4757 | 4757 | */ |
4758 | - public function sanitize_tooltip( $var ) { |
|
4759 | - return htmlspecialchars( wp_kses( html_entity_decode( $var ), array( |
|
4758 | + public function sanitize_tooltip($var) { |
|
4759 | + return htmlspecialchars(wp_kses(html_entity_decode($var), array( |
|
4760 | 4760 | 'br' => array(), |
4761 | 4761 | 'em' => array(), |
4762 | 4762 | 'strong' => array(), |
@@ -4766,7 +4766,7 @@ discard block |
||
4766 | 4766 | 'li' => array(), |
4767 | 4767 | 'ol' => array(), |
4768 | 4768 | 'p' => array(), |
4769 | - ) ) ); |
|
4769 | + ))); |
|
4770 | 4770 | } |
4771 | 4771 | |
4772 | 4772 | /** |
@@ -4778,23 +4778,23 @@ discard block |
||
4778 | 4778 | * @return array |
4779 | 4779 | * @todo we should add some sanitation here. |
4780 | 4780 | */ |
4781 | - public function update( $new_instance, $old_instance ) { |
|
4781 | + public function update($new_instance, $old_instance) { |
|
4782 | 4782 | |
4783 | 4783 | //save the widget |
4784 | - $instance = array_merge( (array) $old_instance, (array) $new_instance ); |
|
4784 | + $instance = array_merge((array) $old_instance, (array) $new_instance); |
|
4785 | 4785 | |
4786 | 4786 | // set widget instance |
4787 | 4787 | $this->instance = $instance; |
4788 | 4788 | |
4789 | - if ( empty( $this->arguments ) ) { |
|
4789 | + if (empty($this->arguments)) { |
|
4790 | 4790 | $this->get_arguments(); |
4791 | 4791 | } |
4792 | 4792 | |
4793 | 4793 | // check for checkboxes |
4794 | - if ( ! empty( $this->arguments ) ) { |
|
4795 | - foreach ( $this->arguments as $argument ) { |
|
4796 | - if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) { |
|
4797 | - $instance[ $argument['name'] ] = '0'; |
|
4794 | + if (!empty($this->arguments)) { |
|
4795 | + foreach ($this->arguments as $argument) { |
|
4796 | + if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) { |
|
4797 | + $instance[$argument['name']] = '0'; |
|
4798 | 4798 | } |
4799 | 4799 | } |
4800 | 4800 | } |
@@ -4812,7 +4812,7 @@ discard block |
||
4812 | 4812 | */ |
4813 | 4813 | public function is_block_content_call() { |
4814 | 4814 | $result = false; |
4815 | - if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) { |
|
4815 | + if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') { |
|
4816 | 4816 | $result = true; |
4817 | 4817 | } |
4818 | 4818 | |
@@ -4825,9 +4825,9 @@ discard block |
||
4825 | 4825 | * @return string |
4826 | 4826 | *@since 1.0.20 |
4827 | 4827 | */ |
4828 | - public function get_instance_hash(){ |
|
4829 | - $instance_string = $this->base_id.serialize($this->instance); |
|
4830 | - return hash('crc32b',$instance_string); |
|
4828 | + public function get_instance_hash() { |
|
4829 | + $instance_string = $this->base_id . serialize($this->instance); |
|
4830 | + return hash('crc32b', $instance_string); |
|
4831 | 4831 | } |
4832 | 4832 | |
4833 | 4833 | /** |
@@ -4838,14 +4838,14 @@ discard block |
||
4838 | 4838 | * @return string |
4839 | 4839 | *@since 1.0.20 |
4840 | 4840 | */ |
4841 | - public function get_instance_style($rules = array()){ |
|
4841 | + public function get_instance_style($rules = array()) { |
|
4842 | 4842 | $css = ''; |
4843 | 4843 | |
4844 | - if(!empty($rules)){ |
|
4844 | + if (!empty($rules)) { |
|
4845 | 4845 | $rules = array_unique($rules); |
4846 | 4846 | $instance_hash = $this->get_instance_hash(); |
4847 | 4847 | $css .= "<style>"; |
4848 | - foreach($rules as $rule){ |
|
4848 | + foreach ($rules as $rule) { |
|
4849 | 4849 | $css .= ".sdel-$instance_hash $rule"; |
4850 | 4850 | } |
4851 | 4851 | $css .= "</style>"; |
@@ -4863,9 +4863,9 @@ discard block |
||
4863 | 4863 | *@since 1.0.28 |
4864 | 4864 | * |
4865 | 4865 | */ |
4866 | - public function encode_shortcodes( $content ) { |
|
4866 | + public function encode_shortcodes($content) { |
|
4867 | 4867 | // Avoids existing encoded tags. |
4868 | - $trans = array( |
|
4868 | + $trans = array( |
|
4869 | 4869 | '[' => '[', |
4870 | 4870 | ']' => ']', |
4871 | 4871 | '&#91;' => '[', |
@@ -4876,7 +4876,7 @@ discard block |
||
4876 | 4876 | '&gt;' => '&0gt;', |
4877 | 4877 | ); |
4878 | 4878 | |
4879 | - $content = strtr( $content, $trans ); |
|
4879 | + $content = strtr($content, $trans); |
|
4880 | 4880 | |
4881 | 4881 | $trans = array( |
4882 | 4882 | '[' => '[', |
@@ -4887,7 +4887,7 @@ discard block |
||
4887 | 4887 | "'" => ''', |
4888 | 4888 | ); |
4889 | 4889 | |
4890 | - $content = strtr( $content, $trans ); |
|
4890 | + $content = strtr($content, $trans); |
|
4891 | 4891 | |
4892 | 4892 | return $content; |
4893 | 4893 | } |
@@ -4901,8 +4901,8 @@ discard block |
||
4901 | 4901 | *@since 1.0.28 |
4902 | 4902 | * |
4903 | 4903 | */ |
4904 | - public function decode_shortcodes( $content ) { |
|
4905 | - $trans = array( |
|
4904 | + public function decode_shortcodes($content) { |
|
4905 | + $trans = array( |
|
4906 | 4906 | '[' => '[', |
4907 | 4907 | ']' => ']', |
4908 | 4908 | '&#91;' => '[', |
@@ -4915,7 +4915,7 @@ discard block |
||
4915 | 4915 | ''' => "'", |
4916 | 4916 | ); |
4917 | 4917 | |
4918 | - $content = strtr( $content, $trans ); |
|
4918 | + $content = strtr($content, $trans); |
|
4919 | 4919 | |
4920 | 4920 | $trans = array( |
4921 | 4921 | '[' => '[', |
@@ -4928,31 +4928,31 @@ discard block |
||
4928 | 4928 | '&0gt;' => '>', |
4929 | 4929 | ); |
4930 | 4930 | |
4931 | - $content = strtr( $content, $trans ); |
|
4931 | + $content = strtr($content, $trans); |
|
4932 | 4932 | |
4933 | 4933 | return $content; |
4934 | 4934 | } |
4935 | 4935 | |
4936 | - public function block_visibility_fields( $args ) { |
|
4937 | - $value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : ''; |
|
4936 | + public function block_visibility_fields($args) { |
|
4937 | + $value = !empty($args['value']) ? esc_attr($args['value']) : ''; |
|
4938 | 4938 | $content = '<div class="bs-vc-rule-template d-none">'; |
4939 | 4939 | $content .= '<div class="p-3 pb-0 mb-3 border border-1 rounded-1 position-relative bs-vc-rule" data-bs-index="BSVCINDEX" >'; |
4940 | 4940 | $content .= '<div class="row">'; |
4941 | 4941 | $content .= '<div class="col-sm-12">'; |
4942 | - $content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__( 'Remove Rule', 'ayecode-connect' ) . '"><i class="fas fa-circle-minus fs-6"></i></span></div>'; |
|
4942 | + $content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__('Remove Rule', 'ayecode-connect') . '"><i class="fas fa-circle-minus fs-6"></i></span></div>'; |
|
4943 | 4943 | $content .= aui()->select( |
4944 | 4944 | array( |
4945 | 4945 | 'id' => 'bsvc_rule_BSVCINDEX', |
4946 | 4946 | 'name' => 'bsvc_rule_BSVCINDEX', |
4947 | - 'label' => __( 'Rule', 'ayecode-connect' ), |
|
4948 | - 'placeholder' => __( 'Select Rule...', 'ayecode-connect' ), |
|
4947 | + 'label' => __('Rule', 'ayecode-connect'), |
|
4948 | + 'placeholder' => __('Select Rule...', 'ayecode-connect'), |
|
4949 | 4949 | 'class' => 'bsvc_rule form-select-sm no-select2 mw-100', |
4950 | 4950 | 'options' => sd_visibility_rules_options(), |
4951 | 4951 | 'default' => '', |
4952 | 4952 | 'value' => '', |
4953 | 4953 | 'label_type' => '', |
4954 | 4954 | 'select2' => false, |
4955 | - 'input_group_left' => __( 'Rule:', 'ayecode-connect' ), |
|
4955 | + 'input_group_left' => __('Rule:', 'ayecode-connect'), |
|
4956 | 4956 | 'extra_attributes' => array( |
4957 | 4957 | 'data-minimum-results-for-search' => '-1' |
4958 | 4958 | ) |
@@ -4961,15 +4961,15 @@ discard block |
||
4961 | 4961 | |
4962 | 4962 | $content .= '</div>'; |
4963 | 4963 | |
4964 | - if ( class_exists( 'GeoDirectory' ) ) { |
|
4964 | + if (class_exists('GeoDirectory')) { |
|
4965 | 4965 | $content .= '<div class="col-md-7 col-sm-12">'; |
4966 | 4966 | |
4967 | 4967 | $content .= aui()->select( |
4968 | 4968 | array( |
4969 | 4969 | 'id' => 'bsvc_gd_field_BSVCINDEX', |
4970 | 4970 | 'name' => 'bsvc_gd_field_BSVCINDEX', |
4971 | - 'label' => __( 'FIELD', 'ayecode-connect' ), |
|
4972 | - 'placeholder' => __( 'FIELD', 'ayecode-connect' ), |
|
4971 | + 'label' => __('FIELD', 'ayecode-connect'), |
|
4972 | + 'placeholder' => __('FIELD', 'ayecode-connect'), |
|
4973 | 4973 | 'class' => 'bsvc_gd_field form-select-sm no-select2 mw-100', |
4974 | 4974 | 'options' => sd_visibility_gd_field_options(), |
4975 | 4975 | 'default' => '', |
@@ -4990,8 +4990,8 @@ discard block |
||
4990 | 4990 | array( |
4991 | 4991 | 'id' => 'bsvc_gd_field_condition_BSVCINDEX', |
4992 | 4992 | 'name' => 'bsvc_gd_field_condition_BSVCINDEX', |
4993 | - 'label' => __( 'CONDITION', 'ayecode-connect' ), |
|
4994 | - 'placeholder' => __( 'CONDITION', 'ayecode-connect' ), |
|
4993 | + 'label' => __('CONDITION', 'ayecode-connect'), |
|
4994 | + 'placeholder' => __('CONDITION', 'ayecode-connect'), |
|
4995 | 4995 | 'class' => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100', |
4996 | 4996 | 'options' => sd_visibility_field_condition_options(), |
4997 | 4997 | 'default' => '', |
@@ -5013,9 +5013,9 @@ discard block |
||
5013 | 5013 | 'type' => 'text', |
5014 | 5014 | 'id' => 'bsvc_gd_field_search_BSVCINDEX', |
5015 | 5015 | 'name' => 'bsvc_gd_field_search_BSVCINDEX', |
5016 | - 'label' => __( 'VALUE TO MATCH', 'ayecode-connect' ), |
|
5016 | + 'label' => __('VALUE TO MATCH', 'ayecode-connect'), |
|
5017 | 5017 | 'class' => 'bsvc_gd_field_search form-control-sm', |
5018 | - 'placeholder' => __( 'VALUE TO MATCH', 'ayecode-connect' ), |
|
5018 | + 'placeholder' => __('VALUE TO MATCH', 'ayecode-connect'), |
|
5019 | 5019 | 'label_type' => '', |
5020 | 5020 | 'value' => '', |
5021 | 5021 | 'element_require' => '([%bsvc_rule_BSVCINDEX%]=="gd_field" && [%bsvc_gd_field_condition_BSVCINDEX%] && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_empty" && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_not_empty")' |
@@ -5027,11 +5027,11 @@ discard block |
||
5027 | 5027 | |
5028 | 5028 | $content .= '</div>'; |
5029 | 5029 | |
5030 | - $content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __( 'Select User Roles:', 'ayecode-connect' ) . '</label>'; |
|
5030 | + $content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __('Select User Roles:', 'ayecode-connect') . '</label>'; |
|
5031 | 5031 | $role_options = sd_user_roles_options(); |
5032 | 5032 | |
5033 | 5033 | $role_option_i = 0; |
5034 | - foreach ( $role_options as $role_option_key => $role_option_name ) { |
|
5034 | + foreach ($role_options as $role_option_key => $role_option_name) { |
|
5035 | 5035 | $role_option_i++; |
5036 | 5036 | |
5037 | 5037 | $content .= '<div class="col-sm-6">'; |
@@ -5055,14 +5055,14 @@ discard block |
||
5055 | 5055 | $content .= '</div>'; |
5056 | 5056 | $content .= '<form id="bs-vc-modal-form" class="bs-vc-modal-form">'; |
5057 | 5057 | $content .= '<div class="bs-vc-rule-sets"></div>'; |
5058 | - $content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __( 'Add Rule', 'ayecode-connect' ) . '</button></div></div>'; |
|
5058 | + $content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __('Add Rule', 'ayecode-connect') . '</button></div></div>'; |
|
5059 | 5059 | $content .= '<div class="row"><div class="col-md-6 col-sm-12">'; |
5060 | 5060 | $content .= aui()->select( |
5061 | 5061 | array( |
5062 | 5062 | 'id' => 'bsvc_output', |
5063 | 5063 | 'name' => 'bsvc_output', |
5064 | - 'label' => __( 'What should happen if rules met.', 'ayecode-connect' ), |
|
5065 | - 'placeholder' => __( 'Default Output', 'ayecode-connect' ), |
|
5064 | + 'label' => __('What should happen if rules met.', 'ayecode-connect'), |
|
5065 | + 'placeholder' => __('Default Output', 'ayecode-connect'), |
|
5066 | 5066 | 'class' => 'bsvc_output form-select-sm no-select2 mw-100', |
5067 | 5067 | 'options' => sd_visibility_output_options(), |
5068 | 5068 | 'default' => '', |
@@ -5081,8 +5081,8 @@ discard block |
||
5081 | 5081 | array( |
5082 | 5082 | 'id' => 'bsvc_page', |
5083 | 5083 | 'name' => 'bsvc_page', |
5084 | - 'label' => __( 'Page Content', 'ayecode-connect' ), |
|
5085 | - 'placeholder' => __( 'Select Page ID...', 'ayecode-connect' ), |
|
5084 | + 'label' => __('Page Content', 'ayecode-connect'), |
|
5085 | + 'placeholder' => __('Select Page ID...', 'ayecode-connect'), |
|
5086 | 5086 | 'class' => 'bsvc_page form-select-sm no-select2 mw-100', |
5087 | 5087 | 'options' => sd_template_page_options(), |
5088 | 5088 | 'default' => '', |
@@ -5097,8 +5097,8 @@ discard block |
||
5097 | 5097 | array( |
5098 | 5098 | 'id' => 'bsvc_tmpl_part', |
5099 | 5099 | 'name' => 'bsvc_tmpl_part', |
5100 | - 'label' => __( 'Template Part', 'ayecode-connect' ), |
|
5101 | - 'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ), |
|
5100 | + 'label' => __('Template Part', 'ayecode-connect'), |
|
5101 | + 'placeholder' => __('Select Template Part...', 'ayecode-connect'), |
|
5102 | 5102 | 'class' => 'bsvc_tmpl_part form-select-sm no-select2 mw-100', |
5103 | 5103 | 'options' => sd_template_part_options(), |
5104 | 5104 | 'default' => '', |
@@ -5116,8 +5116,8 @@ discard block |
||
5116 | 5116 | array( |
5117 | 5117 | 'id' => 'bsvc_message_type', |
5118 | 5118 | 'name' => 'bsvc_message_type', |
5119 | - 'label' => __( 'Custom Message Type', 'ayecode-connect' ), |
|
5120 | - 'placeholder' => __( 'Default (none)', 'ayecode-connect' ), |
|
5119 | + 'label' => __('Custom Message Type', 'ayecode-connect'), |
|
5120 | + 'placeholder' => __('Default (none)', 'ayecode-connect'), |
|
5121 | 5121 | 'class' => 'bsvc_message_type form-select-sm no-select2 mw-100', |
5122 | 5122 | 'options' => sd_aui_colors(), |
5123 | 5123 | 'default' => '', |
@@ -5140,7 +5140,7 @@ discard block |
||
5140 | 5140 | 'name' => 'bsvc_message', |
5141 | 5141 | 'label' => '', |
5142 | 5142 | 'class' => 'bsvc_message form-control-sm', |
5143 | - 'placeholder' => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ), |
|
5143 | + 'placeholder' => __('CUSTOM MESSAGE TO SHOW', 'ayecode-connect'), |
|
5144 | 5144 | 'label_type' => '', |
5145 | 5145 | 'value' => '', |
5146 | 5146 | 'form_group_class' => ' ', |