@@ -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 | '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php', |
11 | 11 | '42671a413efb740d7040437ff2a982cd' => __DIR__ . '/..' . '/ayecode/wp-super-duper/sd-functions.php', |
12 | 12 | 'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.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; |
@@ -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' : ' custom-control-input '; |
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 | |
@@ -1127,48 +1127,48 @@ discard block |
||
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | // label before |
1130 | - if ( ! empty( $args['label'] ) ) { |
|
1131 | - $output .= self::label( $label_args, 'radio' ); |
|
1130 | + if (!empty($args['label'])) { |
|
1131 | + $output .= self::label($label_args, 'radio'); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | // maybe horizontal label |
1135 | - if ( $args['label_type'] == 'horizontal' ) { |
|
1136 | - $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' ); |
|
1135 | + if ($args['label_type'] == 'horizontal') { |
|
1136 | + $input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input'); |
|
1137 | 1137 | $output .= '<div class="' . $input_col . '">'; |
1138 | 1138 | } |
1139 | 1139 | |
1140 | - if ( ! empty( $args['options'] ) ) { |
|
1140 | + if (!empty($args['options'])) { |
|
1141 | 1141 | $count = 0; |
1142 | - foreach ( $args['options'] as $value => $label ) { |
|
1142 | + foreach ($args['options'] as $value => $label) { |
|
1143 | 1143 | $option_args = $args; |
1144 | 1144 | $option_args['value'] = $value; |
1145 | 1145 | $option_args['label'] = $label; |
1146 | 1146 | $option_args['checked'] = $value == $args['value'] ? true : false; |
1147 | - $output .= self::radio_option( $option_args, $count ); |
|
1148 | - $count ++; |
|
1147 | + $output .= self::radio_option($option_args, $count); |
|
1148 | + $count++; |
|
1149 | 1149 | } |
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | // help text |
1153 | - $help_text = ! empty( $args['help_text'] ) ? AUI_Component_Helper::help_text( $args['help_text'] ) : ''; |
|
1153 | + $help_text = !empty($args['help_text']) ? AUI_Component_Helper::help_text($args['help_text']) : ''; |
|
1154 | 1154 | $output .= $help_text; |
1155 | 1155 | |
1156 | 1156 | // maybe horizontal label |
1157 | - if ( $args['label_type'] == 'horizontal' ) { |
|
1157 | + if ($args['label_type'] == 'horizontal') { |
|
1158 | 1158 | $output .= '</div>'; |
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | // wrap |
1162 | 1162 | $fg_class = $aui_bs5 ? 'mb-3' : 'form-group'; |
1163 | 1163 | $wrap_class = $args['label_type'] == 'horizontal' ? $fg_class . ' row' : $fg_class; |
1164 | - $wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
1165 | - $output = self::wrap( array( |
|
1164 | + $wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
1165 | + $output = self::wrap(array( |
|
1166 | 1166 | 'content' => $output, |
1167 | 1167 | 'class' => $wrap_class, |
1168 | 1168 | 'element_require' => $args['element_require'], |
1169 | 1169 | 'argument_id' => $args['id'], |
1170 | 1170 | 'wrap_attributes' => $args['wrap_attributes'], |
1171 | - ) ); |
|
1171 | + )); |
|
1172 | 1172 | |
1173 | 1173 | |
1174 | 1174 | return $output; |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | * |
1182 | 1182 | * @return string The rendered component. |
1183 | 1183 | */ |
1184 | - public static function radio_option( $args = array(), $count = '' ) { |
|
1184 | + public static function radio_option($args = array(), $count = '') { |
|
1185 | 1185 | $defaults = array( |
1186 | 1186 | 'class' => '', |
1187 | 1187 | 'id' => '', |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | /** |
1200 | 1200 | * Parse incoming $args into an array and merge it with $defaults |
1201 | 1201 | */ |
1202 | - $args = wp_parse_args( $args, $defaults ); |
|
1202 | + $args = wp_parse_args($args, $defaults); |
|
1203 | 1203 | |
1204 | 1204 | $output = ''; |
1205 | 1205 | |
@@ -1210,43 +1210,43 @@ discard block |
||
1210 | 1210 | $output .= ' class="form-check-input" '; |
1211 | 1211 | |
1212 | 1212 | // name |
1213 | - if ( ! empty( $args['name'] ) ) { |
|
1214 | - $output .= AUI_Component_Helper::name( $args['name'] ); |
|
1213 | + if (!empty($args['name'])) { |
|
1214 | + $output .= AUI_Component_Helper::name($args['name']); |
|
1215 | 1215 | } |
1216 | 1216 | |
1217 | 1217 | // id |
1218 | - if ( ! empty( $args['id'] ) ) { |
|
1219 | - $output .= AUI_Component_Helper::id( $args['id'] . $count ); |
|
1218 | + if (!empty($args['id'])) { |
|
1219 | + $output .= AUI_Component_Helper::id($args['id'] . $count); |
|
1220 | 1220 | } |
1221 | 1221 | |
1222 | 1222 | // title |
1223 | - if ( ! empty( $args['title'] ) ) { |
|
1224 | - $output .= AUI_Component_Helper::title( $args['title'] ); |
|
1223 | + if (!empty($args['title'])) { |
|
1224 | + $output .= AUI_Component_Helper::title($args['title']); |
|
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | // value |
1228 | - if ( isset( $args['value'] ) ) { |
|
1229 | - $output .= AUI_Component_Helper::value( $args['value'] ); |
|
1228 | + if (isset($args['value'])) { |
|
1229 | + $output .= AUI_Component_Helper::value($args['value']); |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | // checked, for radio and checkboxes |
1233 | - if ( $args['checked'] ) { |
|
1233 | + if ($args['checked']) { |
|
1234 | 1234 | $output .= ' checked '; |
1235 | 1235 | } |
1236 | 1236 | |
1237 | 1237 | // data-attributes |
1238 | - $output .= AUI_Component_Helper::data_attributes( $args ); |
|
1238 | + $output .= AUI_Component_Helper::data_attributes($args); |
|
1239 | 1239 | |
1240 | 1240 | // aria-attributes |
1241 | - $output .= AUI_Component_Helper::aria_attributes( $args ); |
|
1241 | + $output .= AUI_Component_Helper::aria_attributes($args); |
|
1242 | 1242 | |
1243 | 1243 | // extra attributes |
1244 | - if ( ! empty( $args['extra_attributes'] ) ) { |
|
1245 | - $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] ); |
|
1244 | + if (!empty($args['extra_attributes'])) { |
|
1245 | + $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
|
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | // required |
1249 | - if ( ! empty( $args['required'] ) ) { |
|
1249 | + if (!empty($args['required'])) { |
|
1250 | 1250 | $output .= ' required '; |
1251 | 1251 | } |
1252 | 1252 | |
@@ -1254,38 +1254,38 @@ discard block |
||
1254 | 1254 | $output .= ' >'; |
1255 | 1255 | |
1256 | 1256 | // label |
1257 | - if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) { |
|
1258 | - } elseif ( ! empty( $args['label'] ) ) { |
|
1259 | - $output .= self::label( array( |
|
1257 | + if (!empty($args['label']) && is_array($args['label'])) { |
|
1258 | + } elseif (!empty($args['label'])) { |
|
1259 | + $output .= self::label(array( |
|
1260 | 1260 | 'title' => $args['label'], |
1261 | 1261 | 'for' => $args['id'] . $count, |
1262 | 1262 | 'class' => 'form-check-label' |
1263 | - ), 'radio' ); |
|
1263 | + ), 'radio'); |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | // wrap |
1267 | - if ( ! $args['no_wrap'] ) { |
|
1267 | + if (!$args['no_wrap']) { |
|
1268 | 1268 | $wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check'; |
1269 | 1269 | |
1270 | 1270 | // Unique wrap class |
1271 | 1271 | $uniq_class = 'fwrap'; |
1272 | - if ( ! empty( $args['name'] ) ) { |
|
1272 | + if (!empty($args['name'])) { |
|
1273 | 1273 | $uniq_class .= '-' . $args['name']; |
1274 | - } else if ( ! empty( $args['id'] ) ) { |
|
1274 | + } else if (!empty($args['id'])) { |
|
1275 | 1275 | $uniq_class .= '-' . $args['id']; |
1276 | 1276 | } |
1277 | 1277 | |
1278 | - if ( isset( $args['value'] ) || $args['value'] !== "" ) { |
|
1278 | + if (isset($args['value']) || $args['value'] !== "") { |
|
1279 | 1279 | $uniq_class .= '-' . $args['value']; |
1280 | 1280 | } else { |
1281 | 1281 | $uniq_class .= '-' . $count; |
1282 | 1282 | } |
1283 | - $wrap_class .= ' ' . sanitize_html_class( $uniq_class ); |
|
1283 | + $wrap_class .= ' ' . sanitize_html_class($uniq_class); |
|
1284 | 1284 | |
1285 | - $output = self::wrap( array( |
|
1285 | + $output = self::wrap(array( |
|
1286 | 1286 | 'content' => $output, |
1287 | 1287 | 'class' => $wrap_class |
1288 | - ) ); |
|
1288 | + )); |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | 1291 | return $output; |
@@ -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 get( $args = array() ) { |
|
21 | + public static function get($args = array()) { |
|
22 | 22 | global $wp_query, $aui_bs5; |
23 | 23 | |
24 | 24 | $defaults = array( |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | 'mid_size' => 2, |
27 | 27 | 'prev_text' => '<i class="fas fa-chevron-left"></i>', |
28 | 28 | 'next_text' => '<i class="fas fa-chevron-right"></i>', |
29 | - 'screen_reader_text' => __( 'Posts navigation', 'ayecode-connect' ), |
|
29 | + 'screen_reader_text' => __('Posts navigation', 'ayecode-connect'), |
|
30 | 30 | 'before_paging' => '', |
31 | 31 | 'after_paging' => '', |
32 | 32 | 'type' => 'array', |
33 | - 'total' => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1, |
|
33 | + 'total' => isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1, |
|
34 | 34 | 'links' => array(), // an array of links if using custom links, this includes the a tag. |
35 | 35 | 'rounded_style' => false, |
36 | 36 | 'custom_next_text' => '', // Custom next page text |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Parse incoming $args into an array and merge it with $defaults |
42 | 42 | */ |
43 | - $args = wp_parse_args( $args, $defaults ); |
|
43 | + $args = wp_parse_args($args, $defaults); |
|
44 | 44 | |
45 | 45 | $output = ''; |
46 | 46 | |
47 | 47 | // Don't print empty markup if there's only one page. |
48 | - if ( $args['total'] > 1 ) { |
|
48 | + if ($args['total'] > 1) { |
|
49 | 49 | // Set up paginated links. |
50 | - $links = !empty( $args['links'] ) ? $args['links'] : paginate_links( $args ); |
|
50 | + $links = !empty($args['links']) ? $args['links'] : paginate_links($args); |
|
51 | 51 | |
52 | 52 | $class = !empty($args['class']) ? $args['class'] : ''; |
53 | 53 | |
@@ -56,62 +56,62 @@ discard block |
||
56 | 56 | |
57 | 57 | // make the output bootstrap ready |
58 | 58 | $links_html = "<ul class='pagination m-0 p-0 $class'>"; |
59 | - if ( ! empty( $links ) ) { |
|
60 | - foreach ( $links as $link ) { |
|
59 | + if (!empty($links)) { |
|
60 | + foreach ($links as $link) { |
|
61 | 61 | $_link = $link; |
62 | 62 | |
63 | - if ( $aui_bs5 ) { |
|
63 | + if ($aui_bs5) { |
|
64 | 64 | $link_class = $args['rounded_style'] ? 'page-link badge rounded-pill border-0 mx-1 fs-base text-dark link-primary' : 'page-link'; |
65 | 65 | $link_class_active = $args['rounded_style'] ? ' current active fw-bold badge rounded-pill' : ' current active'; |
66 | 66 | $links_html .= "<li class='page-item mx-0'>"; |
67 | - $link = str_replace( array( "page-numbers", " current" ), array( $link_class, $link_class_active ), $link ); |
|
68 | - $link = str_replace( 'text-dark link-primary current', 'current', $link ); |
|
69 | - $links_html .= $link; |
|
67 | + $link = str_replace(array("page-numbers", " current"), array($link_class, $link_class_active), $link); |
|
68 | + $link = str_replace('text-dark link-primary current', 'current', $link); |
|
69 | + $links_html .= $link; |
|
70 | 70 | $links_html .= "</li>"; |
71 | 71 | } else { |
72 | - $active = strpos( $link, 'current' ) !== false ? 'active' : ''; |
|
72 | + $active = strpos($link, 'current') !== false ? 'active' : ''; |
|
73 | 73 | $links_html .= "<li class='page-item $active'>"; |
74 | - $links_html .= str_replace( "page-numbers", "page-link", $link ); |
|
74 | + $links_html .= str_replace("page-numbers", "page-link", $link); |
|
75 | 75 | $links_html .= "</li>"; |
76 | 76 | } |
77 | 77 | |
78 | - if ( strpos( $_link, 'next page-numbers' ) || strpos( $_link, 'prev page-numbers' ) ) { |
|
79 | - $link = str_replace( array( "page-numbers", " current" ), array( 'btn btn-outline-primary rounded' . ( $args['rounded_style'] ? '-pill' : '' ) . ' mx-1 fs-base text-dark link-primary', ' current active fw-bold badge rounded-pill' ), $_link ); |
|
80 | - $link = str_replace( 'text-dark link-primary current', 'current', $link ); |
|
78 | + if (strpos($_link, 'next page-numbers') || strpos($_link, 'prev page-numbers')) { |
|
79 | + $link = str_replace(array("page-numbers", " current"), array('btn btn-outline-primary rounded' . ($args['rounded_style'] ? '-pill' : '') . ' mx-1 fs-base text-dark link-primary', ' current active fw-bold badge rounded-pill'), $_link); |
|
80 | + $link = str_replace('text-dark link-primary current', 'current', $link); |
|
81 | 81 | |
82 | - if ( strpos( $_link, 'next page-numbers' ) && ! empty( $args['custom_next_text'] ) ) { |
|
83 | - $custom_next_link = str_replace( $args['next_text'], $args['custom_next_text'], $link ); |
|
84 | - } else if ( strpos( $_link, 'prev page-numbers' ) && ! empty( $args['custom_prev_text'] ) ) { |
|
85 | - $custom_prev_link = str_replace( $args['prev_text'], $args['custom_prev_text'], $link ); |
|
82 | + if (strpos($_link, 'next page-numbers') && !empty($args['custom_next_text'])) { |
|
83 | + $custom_next_link = str_replace($args['next_text'], $args['custom_next_text'], $link); |
|
84 | + } else if (strpos($_link, 'prev page-numbers') && !empty($args['custom_prev_text'])) { |
|
85 | + $custom_prev_link = str_replace($args['prev_text'], $args['custom_prev_text'], $link); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
90 | 90 | $links_html .= "</ul>"; |
91 | 91 | |
92 | - if ( $links ) { |
|
92 | + if ($links) { |
|
93 | 93 | $output .= '<section class="px-0 py-2 w-100">'; |
94 | - $output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] ); |
|
94 | + $output .= _navigation_markup($links_html, 'aui-pagination', $args['screen_reader_text']); |
|
95 | 95 | $output .= '</section>'; |
96 | 96 | } |
97 | 97 | |
98 | - $output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output ); |
|
99 | - $output = str_replace( "nav-links", "aui-nav-links", $output ); |
|
98 | + $output = str_replace("screen-reader-text", "screen-reader-text sr-only", $output); |
|
99 | + $output = str_replace("nav-links", "aui-nav-links", $output); |
|
100 | 100 | } |
101 | 101 | |
102 | - if ( $output ) { |
|
103 | - if ( $custom_next_link || $custom_prev_link ) { |
|
104 | - $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1; |
|
105 | - $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1; |
|
102 | + if ($output) { |
|
103 | + if ($custom_next_link || $custom_prev_link) { |
|
104 | + $total = isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1; |
|
105 | + $current = get_query_var('paged') ? (int) get_query_var('paged') : 1; |
|
106 | 106 | |
107 | 107 | $output = '<div class="row d-flex align-items-center justify-content-between"><div class="col text-start">' . $custom_prev_link . '</div><div class="col text-center d-none d-md-block">' . $output . '</div><div class="col text-center d-md-none">' . $current . '/' . $args['total'] . '</div><div class="col text-end">' . $custom_next_link . '</div></div>'; |
108 | 108 | } |
109 | 109 | |
110 | - if ( ! empty( $args['before_paging'] ) ) { |
|
110 | + if (!empty($args['before_paging'])) { |
|
111 | 111 | $output = $args['before_paging'] . $output; |
112 | 112 | } |
113 | 113 | |
114 | - if ( ! empty( $args['after_paging'] ) ) { |
|
114 | + if (!empty($args['after_paging'])) { |
|
115 | 115 | $output = $output . $args['after_paging']; |
116 | 116 | } |
117 | 117 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | function aui_init_flatpickr(){ |
253 | 253 | if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) { |
254 | 254 | $aui_doing_init_flatpickr = true; |
255 | - <?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
255 | + <?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
256 | 256 | jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr(); |
257 | 257 | } |
258 | 258 | $aui_doing_init_flatpickr = false; |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | |
1003 | 1003 | <?php |
1004 | 1004 | // FSE tweaks. |
1005 | - if(!empty($_REQUEST['postType'])){ ?> |
|
1005 | + if (!empty($_REQUEST['postType'])) { ?> |
|
1006 | 1006 | function aui_fse_set_data_scroll() { |
1007 | 1007 | console.log('init scroll'); |
1008 | 1008 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Bail if we are not in WP. |
14 | 14 | */ |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if (!defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Only add if the class does not already exist. |
21 | 21 | */ |
22 | -if ( ! class_exists( 'AyeCode_UI_Settings' ) ) { |
|
22 | +if (!class_exists('AyeCode_UI_Settings')) { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * A Class to be able to change settings for Font Awesome. |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | * @return AyeCode_UI_Settings - Main instance. |
100 | 100 | */ |
101 | 101 | public static function instance() { |
102 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) { |
|
102 | + if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) { |
|
103 | 103 | |
104 | 104 | self::$instance = new AyeCode_UI_Settings; |
105 | 105 | |
106 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
106 | + add_action('init', array(self::$instance, 'init')); // set settings |
|
107 | 107 | |
108 | - if ( is_admin() ) { |
|
109 | - add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
110 | - add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
108 | + if (is_admin()) { |
|
109 | + add_action('admin_menu', array(self::$instance, 'menu_item')); |
|
110 | + add_action('admin_init', array(self::$instance, 'register_settings')); |
|
111 | 111 | |
112 | 112 | // Maybe show example page |
113 | - add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) ); |
|
113 | + add_action('template_redirect', array(self::$instance, 'maybe_show_examples')); |
|
114 | 114 | |
115 | - if ( defined( 'BLOCKSTRAP_VERSION' ) ) { |
|
116 | - add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 ); |
|
115 | + if (defined('BLOCKSTRAP_VERSION')) { |
|
116 | + add_filter('sd_aui_colors', array(self::$instance, 'sd_aui_colors'), 10, 3); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - add_action( 'customize_register', array( self::$instance, 'customizer_settings' )); |
|
120 | + add_action('customize_register', array(self::$instance, 'customizer_settings')); |
|
121 | 121 | |
122 | - do_action( 'ayecode_ui_settings_loaded' ); |
|
122 | + do_action('ayecode_ui_settings_loaded'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return self::$instance; |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){ |
|
137 | + public function sd_aui_colors($theme_colors, $include_outlines, $include_branding) { |
|
138 | 138 | |
139 | 139 | |
140 | 140 | $setting = wp_get_global_settings(); |
141 | 141 | |
142 | - if(!empty($setting['color']['palette']['custom'])){ |
|
143 | - foreach($setting['color']['palette']['custom'] as $color){ |
|
142 | + if (!empty($setting['color']['palette']['custom'])) { |
|
143 | + foreach ($setting['color']['palette']['custom'] as $color) { |
|
144 | 144 | $theme_colors[$color['slug']] = esc_attr($color['name']); |
145 | 145 | } |
146 | 146 | } |
@@ -151,81 +151,81 @@ discard block |
||
151 | 151 | /** |
152 | 152 | * Setup some constants. |
153 | 153 | */ |
154 | - public function constants(){ |
|
155 | - define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" ); |
|
156 | - define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' ); |
|
157 | - define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' ); |
|
158 | - define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' ); |
|
159 | - define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' ); |
|
160 | - define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' ); |
|
161 | - define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' ); |
|
162 | - define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' ); |
|
163 | - define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' ); |
|
164 | - define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' ); |
|
165 | - define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' ); |
|
166 | - define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' ); |
|
167 | - define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' ); |
|
168 | - define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' ); |
|
169 | - define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' ); |
|
170 | - define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' ); |
|
154 | + public function constants() { |
|
155 | + define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be"); |
|
156 | + define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d'); |
|
157 | + define('AUI_INFO_COLOR_ORIGINAL', '#17a2b8'); |
|
158 | + define('AUI_WARNING_COLOR_ORIGINAL', '#ffc107'); |
|
159 | + define('AUI_DANGER_COLOR_ORIGINAL', '#dc3545'); |
|
160 | + define('AUI_SUCCESS_COLOR_ORIGINAL', '#44c553'); |
|
161 | + define('AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa'); |
|
162 | + define('AUI_DARK_COLOR_ORIGINAL', '#343a40'); |
|
163 | + define('AUI_WHITE_COLOR_ORIGINAL', '#fff'); |
|
164 | + define('AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd'); |
|
165 | + define('AUI_SALMON_COLOR_ORIGINAL', '#ff977a'); |
|
166 | + define('AUI_CYAN_COLOR_ORIGINAL', '#35bdff'); |
|
167 | + define('AUI_GRAY_COLOR_ORIGINAL', '#ced4da'); |
|
168 | + define('AUI_INDIGO_COLOR_ORIGINAL', '#502c6c'); |
|
169 | + define('AUI_ORANGE_COLOR_ORIGINAL', '#orange'); |
|
170 | + define('AUI_BLACK_COLOR_ORIGINAL', '#000'); |
|
171 | 171 | |
172 | - if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) { |
|
173 | - define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL ); |
|
172 | + if (!defined('AUI_PRIMARY_COLOR')) { |
|
173 | + define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL); |
|
174 | 174 | } |
175 | - if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) { |
|
176 | - define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL ); |
|
175 | + if (!defined('AUI_SECONDARY_COLOR')) { |
|
176 | + define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL); |
|
177 | 177 | } |
178 | - if ( ! defined( 'AUI_INFO_COLOR' ) ) { |
|
179 | - define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL ); |
|
178 | + if (!defined('AUI_INFO_COLOR')) { |
|
179 | + define('AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL); |
|
180 | 180 | } |
181 | - if ( ! defined( 'AUI_WARNING_COLOR' ) ) { |
|
182 | - define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL ); |
|
181 | + if (!defined('AUI_WARNING_COLOR')) { |
|
182 | + define('AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL); |
|
183 | 183 | } |
184 | - if ( ! defined( 'AUI_DANGER_COLOR' ) ) { |
|
185 | - define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL ); |
|
184 | + if (!defined('AUI_DANGER_COLOR')) { |
|
185 | + define('AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL); |
|
186 | 186 | } |
187 | - if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) { |
|
188 | - define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL ); |
|
187 | + if (!defined('AUI_SUCCESS_COLOR')) { |
|
188 | + define('AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL); |
|
189 | 189 | } |
190 | - if ( ! defined( 'AUI_LIGHT_COLOR' ) ) { |
|
191 | - define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL ); |
|
190 | + if (!defined('AUI_LIGHT_COLOR')) { |
|
191 | + define('AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL); |
|
192 | 192 | } |
193 | - if ( ! defined( 'AUI_DARK_COLOR' ) ) { |
|
194 | - define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL ); |
|
193 | + if (!defined('AUI_DARK_COLOR')) { |
|
194 | + define('AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL); |
|
195 | 195 | } |
196 | - if ( ! defined( 'AUI_WHITE_COLOR' ) ) { |
|
197 | - define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL ); |
|
196 | + if (!defined('AUI_WHITE_COLOR')) { |
|
197 | + define('AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL); |
|
198 | 198 | } |
199 | - if ( ! defined( 'AUI_PURPLE_COLOR' ) ) { |
|
200 | - define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL ); |
|
199 | + if (!defined('AUI_PURPLE_COLOR')) { |
|
200 | + define('AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL); |
|
201 | 201 | } |
202 | - if ( ! defined( 'AUI_SALMON_COLOR' ) ) { |
|
203 | - define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL ); |
|
202 | + if (!defined('AUI_SALMON_COLOR')) { |
|
203 | + define('AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL); |
|
204 | 204 | } |
205 | - if ( ! defined( 'AUI_CYAN_COLOR' ) ) { |
|
206 | - define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL ); |
|
205 | + if (!defined('AUI_CYAN_COLOR')) { |
|
206 | + define('AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL); |
|
207 | 207 | } |
208 | - if ( ! defined( 'AUI_GRAY_COLOR' ) ) { |
|
209 | - define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL ); |
|
208 | + if (!defined('AUI_GRAY_COLOR')) { |
|
209 | + define('AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL); |
|
210 | 210 | } |
211 | - if ( ! defined( 'AUI_INDIGO_COLOR' ) ) { |
|
212 | - define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL ); |
|
211 | + if (!defined('AUI_INDIGO_COLOR')) { |
|
212 | + define('AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL); |
|
213 | 213 | } |
214 | - if ( ! defined( 'AUI_ORANGE_COLOR' ) ) { |
|
215 | - define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL ); |
|
214 | + if (!defined('AUI_ORANGE_COLOR')) { |
|
215 | + define('AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL); |
|
216 | 216 | } |
217 | - if ( ! defined( 'AUI_BLACK_COLOR' ) ) { |
|
218 | - define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL ); |
|
217 | + if (!defined('AUI_BLACK_COLOR')) { |
|
218 | + define('AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | } |
222 | 222 | |
223 | - public static function get_colors( $original = false){ |
|
223 | + public static function get_colors($original = false) { |
|
224 | 224 | |
225 | - if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) { |
|
225 | + if (!defined('AUI_PRIMARY_COLOR')) { |
|
226 | 226 | return array(); |
227 | 227 | } |
228 | - if ( $original ) { |
|
228 | + if ($original) { |
|
229 | 229 | return array( |
230 | 230 | 'primary' => AUI_PRIMARY_COLOR_ORIGINAL, |
231 | 231 | 'secondary' => AUI_SECONDARY_COLOR_ORIGINAL, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return mixed |
275 | 275 | */ |
276 | - public function add_bs5_admin_body_class( $classes = '' ) { |
|
276 | + public function add_bs5_admin_body_class($classes = '') { |
|
277 | 277 | $classes .= ' aui_bs5'; |
278 | 278 | |
279 | 279 | return $classes; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @return mixed |
288 | 288 | */ |
289 | - public function add_bs5_body_class( $classes ) { |
|
289 | + public function add_bs5_body_class($classes) { |
|
290 | 290 | $classes[] = 'aui_bs5'; |
291 | 291 | |
292 | 292 | return $classes; |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | global $aui_bs5; |
300 | 300 | |
301 | 301 | // Maybe fix settings |
302 | - if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) { |
|
303 | - $db_settings = get_option( 'ayecode-ui-settings' ); |
|
304 | - if ( ! empty( $db_settings ) ) { |
|
302 | + if (!empty($_REQUEST['aui-fix-admin']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], "aui-fix-admin")) { |
|
303 | + $db_settings = get_option('ayecode-ui-settings'); |
|
304 | + if (!empty($db_settings)) { |
|
305 | 305 | $db_settings['css_backend'] = 'compatibility'; |
306 | 306 | $db_settings['js_backend'] = 'core-popper'; |
307 | - update_option( 'ayecode-ui-settings', $db_settings ); |
|
307 | + update_option('ayecode-ui-settings', $db_settings); |
|
308 | 308 | wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true")); |
309 | 309 | } |
310 | 310 | } |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | // define the version |
317 | 317 | $aui_bs5 = $this->settings['bs_ver'] === '5'; |
318 | 318 | |
319 | - if ( $aui_bs5 ) { |
|
320 | - include_once( dirname( __FILE__ ) . '/inc/bs-conversion.php' ); |
|
321 | - add_filter( 'admin_body_class', array( $this, 'add_bs5_admin_body_class' ), 99, 1 ); |
|
322 | - add_filter( 'body_class', array( $this, 'add_bs5_body_class' ) ); |
|
319 | + if ($aui_bs5) { |
|
320 | + include_once(dirname(__FILE__) . '/inc/bs-conversion.php'); |
|
321 | + add_filter('admin_body_class', array($this, 'add_bs5_admin_body_class'), 99, 1); |
|
322 | + add_filter('body_class', array($this, 'add_bs5_body_class')); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -327,32 +327,32 @@ discard block |
||
327 | 327 | * |
328 | 328 | * We load super early in case there is a theme version that might change the colors |
329 | 329 | */ |
330 | - if ( $this->settings['css'] ) { |
|
330 | + if ($this->settings['css']) { |
|
331 | 331 | $priority = $this->is_bs3_compat() ? 100 : 1; |
332 | 332 | $priority = $aui_bs5 ? 10 : $priority; |
333 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority ); |
|
333 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), $priority); |
|
334 | 334 | } |
335 | - if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) { |
|
336 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 ); |
|
335 | + if ($this->settings['css_backend'] && $this->load_admin_scripts()) { |
|
336 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | // maybe load JS |
340 | - if ( $this->settings['js'] ) { |
|
340 | + if ($this->settings['js']) { |
|
341 | 341 | $priority = $this->is_bs3_compat() ? 100 : 1; |
342 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority ); |
|
342 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority); |
|
343 | 343 | } |
344 | - if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) { |
|
345 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 ); |
|
344 | + if ($this->settings['js_backend'] && $this->load_admin_scripts()) { |
|
345 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | // Maybe set the HTML font size |
349 | - if ( $this->settings['html_font_size'] ) { |
|
350 | - add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 ); |
|
349 | + if ($this->settings['html_font_size']) { |
|
350 | + add_action('wp_footer', array($this, 'html_font_size'), 10); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | // Maybe show backend style error |
354 | - if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){ |
|
355 | - add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) ); |
|
354 | + if ($this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper') { |
|
355 | + add_action('admin_notices', array($this, 'show_admin_style_notice')); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | } |
@@ -360,11 +360,11 @@ discard block |
||
360 | 360 | /** |
361 | 361 | * Show admin notice if backend scripts not loaded. |
362 | 362 | */ |
363 | - public function show_admin_style_notice(){ |
|
364 | - $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin')); |
|
365 | - $button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>'; |
|
366 | - $message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button; |
|
367 | - echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$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>' . $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', |
@@ -798,24 +798,24 @@ discard block |
||
798 | 798 | */ |
799 | 799 | public function get_settings() { |
800 | 800 | |
801 | - $db_settings = get_option( 'ayecode-ui-settings' ); |
|
801 | + $db_settings = get_option('ayecode-ui-settings'); |
|
802 | 802 | $js_default = 'core-popper'; |
803 | 803 | $js_default_backend = $js_default; |
804 | 804 | |
805 | 805 | // maybe set defaults (if no settings set) |
806 | - if(empty($db_settings)){ |
|
807 | - $active_theme = strtolower( get_template() ); // active parent theme. |
|
806 | + if (empty($db_settings)) { |
|
807 | + $active_theme = strtolower(get_template()); // active parent theme. |
|
808 | 808 | $theme_js_settings = self::theme_js_settings(); |
809 | - if(isset($theme_js_settings[$active_theme])){ |
|
809 | + if (isset($theme_js_settings[$active_theme])) { |
|
810 | 810 | $js_default = $theme_js_settings[$active_theme]; |
811 | - $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default; |
|
811 | + $js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default; |
|
812 | 812 | } |
813 | 813 | } |
814 | 814 | |
815 | 815 | /** |
816 | 816 | * Filter the default settings. |
817 | 817 | */ |
818 | - $defaults = apply_filters( 'ayecode-ui-default-settings', array( |
|
818 | + $defaults = apply_filters('ayecode-ui-default-settings', array( |
|
819 | 819 | 'css' => 'compatibility', // core, compatibility |
820 | 820 | 'js' => $js_default, // js to load, core-popper, popper |
821 | 821 | 'html_font_size' => '16', // js to load, core-popper, popper |
@@ -823,16 +823,16 @@ discard block |
||
823 | 823 | 'js_backend' => $js_default_backend, // js to load, core-popper, popper |
824 | 824 | 'disable_admin' => '', // URL snippets to disable loading on admin |
825 | 825 | 'bs_ver' => '4', // The default bootstrap version to sue by default |
826 | - ), $db_settings ); |
|
826 | + ), $db_settings); |
|
827 | 827 | |
828 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
828 | + $settings = wp_parse_args($db_settings, $defaults); |
|
829 | 829 | |
830 | 830 | /** |
831 | 831 | * Filter the Bootstrap settings. |
832 | 832 | * |
833 | 833 | * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
834 | 834 | */ |
835 | - return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults ); |
|
835 | + return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | |
@@ -840,109 +840,109 @@ discard block |
||
840 | 840 | * The settings page html output. |
841 | 841 | */ |
842 | 842 | public function settings_page() { |
843 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
844 | - wp_die( __( 'You do not have sufficient permissions to access this page.', 'ayecode-connect' ) ); |
|
843 | + if (!current_user_can('manage_options')) { |
|
844 | + wp_die(__('You do not have sufficient permissions to access this page.', 'ayecode-connect')); |
|
845 | 845 | } |
846 | - $overrides = apply_filters( 'ayecode-ui-settings', array(), array(), array() ); |
|
846 | + $overrides = apply_filters('ayecode-ui-settings', array(), array(), array()); |
|
847 | 847 | |
848 | 848 | ?> |
849 | 849 | <div class="wrap"> |
850 | 850 | <h1><?php echo $this->name; ?></h1> |
851 | - <p><?php echo apply_filters( 'ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.", 'ayecode-connect' ) );?></p> |
|
851 | + <p><?php echo apply_filters('ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.", 'ayecode-connect')); ?></p> |
|
852 | 852 | <form method="post" action="options.php"> |
853 | 853 | <?php |
854 | - settings_fields( 'ayecode-ui-settings' ); |
|
855 | - do_settings_sections( 'ayecode-ui-settings' ); |
|
854 | + settings_fields('ayecode-ui-settings'); |
|
855 | + do_settings_sections('ayecode-ui-settings'); |
|
856 | 856 | ?> |
857 | 857 | |
858 | - <h2><?php _e( 'BootStrap Version', 'ayecode-connect' ); ?></h2> |
|
859 | - <p><?php echo 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> |
|
858 | + <h2><?php _e('BootStrap Version', 'ayecode-connect'); ?></h2> |
|
859 | + <p><?php echo 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> |
|
860 | 860 | <div class="bsui"><?php |
861 | - if ( ! empty( $overrides ) ) { |
|
861 | + if (!empty($overrides)) { |
|
862 | 862 | echo aui()->alert(array( |
863 | 863 | 'type'=> 'info', |
864 | - 'content'=> __("Some options are disabled as your current theme is overriding them.", 'ayecode-connect' ) |
|
864 | + 'content'=> __("Some options are disabled as your current theme is overriding them.", 'ayecode-connect') |
|
865 | 865 | )); |
866 | 866 | } |
867 | 867 | ?> |
868 | 868 | </div> |
869 | 869 | <table class="form-table wpbs-table-version-settings"> |
870 | 870 | <tr valign="top"> |
871 | - <th scope="row"><label for="wpbs-css"><?php _e( 'Version', 'ayecode-connect' ); ?></label></th> |
|
871 | + <th scope="row"><label for="wpbs-css"><?php _e('Version', 'ayecode-connect'); ?></label></th> |
|
872 | 872 | <td> |
873 | 873 | <select name="ayecode-ui-settings[bs_ver]" id="wpbs-css" <?php echo !empty($overrides['bs_ver']) ? 'disabled' : ''; ?>> |
874 | - <option value="5" <?php selected( $this->settings['bs_ver'], '5' ); ?>><?php _e( 'v5 (recommended)', 'ayecode-connect' ); ?></option> |
|
875 | - <option value="4" <?php selected( $this->settings['bs_ver'], '4' ); ?>><?php _e( 'v4 (legacy)', 'ayecode-connect' ); ?></option> |
|
874 | + <option value="5" <?php selected($this->settings['bs_ver'], '5'); ?>><?php _e('v5 (recommended)', 'ayecode-connect'); ?></option> |
|
875 | + <option value="4" <?php selected($this->settings['bs_ver'], '4'); ?>><?php _e('v4 (legacy)', 'ayecode-connect'); ?></option> |
|
876 | 876 | </select> |
877 | 877 | </td> |
878 | 878 | </tr> |
879 | 879 | </table> |
880 | 880 | |
881 | - <h2><?php _e( 'Frontend', 'ayecode-connect' ); ?></h2> |
|
881 | + <h2><?php _e('Frontend', 'ayecode-connect'); ?></h2> |
|
882 | 882 | <table class="form-table wpbs-table-settings"> |
883 | 883 | <tr valign="top"> |
884 | - <th scope="row"><label for="wpbs-css"><?php _e( 'Load CSS', 'ayecode-connect' ); ?></label></th> |
|
884 | + <th scope="row"><label for="wpbs-css"><?php _e('Load CSS', 'ayecode-connect'); ?></label></th> |
|
885 | 885 | <td> |
886 | 886 | <select name="ayecode-ui-settings[css]" id="wpbs-css" <?php echo !empty($overrides['css']) ? 'disabled' : ''; ?>> |
887 | - <option value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option> |
|
888 | - <option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'ayecode-connect' ); ?></option> |
|
889 | - <option value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'ayecode-connect' ); ?></option> |
|
887 | + <option value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'ayecode-connect'); ?></option> |
|
888 | + <option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'ayecode-connect'); ?></option> |
|
889 | + <option value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'ayecode-connect'); ?></option> |
|
890 | 890 | </select> |
891 | 891 | </td> |
892 | 892 | </tr> |
893 | 893 | |
894 | 894 | <tr valign="top"> |
895 | - <th scope="row"><label for="wpbs-js"><?php _e( 'Load JS', 'ayecode-connect' ); ?></label></th> |
|
895 | + <th scope="row"><label for="wpbs-js"><?php _e('Load JS', 'ayecode-connect'); ?></label></th> |
|
896 | 896 | <td> |
897 | 897 | <select name="ayecode-ui-settings[js]" id="wpbs-js" <?php echo !empty($overrides['js']) ? 'disabled' : ''; ?>> |
898 | - <option value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option> |
|
899 | - <option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'ayecode-connect' ); ?></option> |
|
900 | - <option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'ayecode-connect' ); ?></option> |
|
901 | - <option value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option> |
|
898 | + <option value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'ayecode-connect'); ?></option> |
|
899 | + <option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'ayecode-connect'); ?></option> |
|
900 | + <option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'ayecode-connect'); ?></option> |
|
901 | + <option value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'ayecode-connect'); ?></option> |
|
902 | 902 | </select> |
903 | 903 | </td> |
904 | 904 | </tr> |
905 | 905 | |
906 | 906 | <tr valign="top"> |
907 | - <th scope="row"><label for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'ayecode-connect' ); ?></label></th> |
|
907 | + <th scope="row"><label for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'ayecode-connect'); ?></label></th> |
|
908 | 908 | <td> |
909 | - <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' : ''; ?> /> |
|
910 | - <p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'ayecode-connect' );?></p> |
|
909 | + <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' : ''; ?> /> |
|
910 | + <p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'ayecode-connect'); ?></p> |
|
911 | 911 | </td> |
912 | 912 | </tr> |
913 | 913 | |
914 | 914 | </table> |
915 | 915 | |
916 | - <h2><?php _e( 'Backend', 'ayecode-connect' ); ?> (wp-admin)</h2> |
|
916 | + <h2><?php _e('Backend', 'ayecode-connect'); ?> (wp-admin)</h2> |
|
917 | 917 | <table class="form-table wpbs-table-settings"> |
918 | 918 | <tr valign="top"> |
919 | - <th scope="row"><label for="wpbs-css-admin"><?php _e( 'Load CSS', 'ayecode-connect' ); ?></label></th> |
|
919 | + <th scope="row"><label for="wpbs-css-admin"><?php _e('Load CSS', 'ayecode-connect'); ?></label></th> |
|
920 | 920 | <td> |
921 | 921 | <select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin" <?php echo !empty($overrides['css_backend']) ? 'disabled' : ''; ?>> |
922 | - <option value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option> |
|
923 | - <option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode (will cause style issues)', 'ayecode-connect' ); ?></option> |
|
924 | - <option value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'ayecode-connect' ); ?></option> |
|
922 | + <option value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'ayecode-connect'); ?></option> |
|
923 | + <option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode (will cause style issues)', 'ayecode-connect'); ?></option> |
|
924 | + <option value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _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-admin"><?php _e( 'Load JS', 'ayecode-connect' ); ?></label></th> |
|
930 | + <th scope="row"><label for="wpbs-js-admin"><?php _e('Load JS', 'ayecode-connect'); ?></label></th> |
|
931 | 931 | <td> |
932 | 932 | <select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin" <?php echo !empty($overrides['js_backend']) ? 'disabled' : ''; ?>> |
933 | - <option value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option> |
|
934 | - <option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'ayecode-connect' ); ?></option> |
|
935 | - <option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'ayecode-connect' ); ?></option> |
|
936 | - <option value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option> |
|
933 | + <option value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'ayecode-connect'); ?></option> |
|
934 | + <option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'ayecode-connect'); ?></option> |
|
935 | + <option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'ayecode-connect'); ?></option> |
|
936 | + <option value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _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-disable-admin"><?php _e( 'Disable load on URL', 'ayecode-connect' ); ?></label></th> |
|
942 | + <th scope="row"><label for="wpbs-disable-admin"><?php _e('Disable load on URL', 'ayecode-connect'); ?></label></th> |
|
943 | 943 | <td> |
944 | - <p><?php _e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'ayecode-connect' ); ?></p> |
|
945 | - <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php action=go"><?php echo $this->settings['disable_admin'];?></textarea> |
|
944 | + <p><?php _e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'ayecode-connect'); ?></p> |
|
945 | + <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php action=go"><?php echo $this->settings['disable_admin']; ?></textarea> |
|
946 | 946 | </td> |
947 | 947 | </tr> |
948 | 948 | </table> |
@@ -951,33 +951,33 @@ discard block |
||
951 | 951 | submit_button(); |
952 | 952 | ?> |
953 | 953 | </form> |
954 | - <div id="wpbs-version" data-aui-source="<?php echo esc_attr( $this->get_load_source() ); ?>"><?php echo $this->version; ?></div> |
|
954 | + <div id="wpbs-version" data-aui-source="<?php echo esc_attr($this->get_load_source()); ?>"><?php echo $this->version; ?></div> |
|
955 | 955 | </div> |
956 | 956 | <?php |
957 | 957 | } |
958 | 958 | |
959 | - public function get_load_source(){ |
|
960 | - $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) ); |
|
961 | - $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) ); |
|
959 | + public function get_load_source() { |
|
960 | + $file = str_replace(array("/", "\\"), "/", realpath(__FILE__)); |
|
961 | + $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR)); |
|
962 | 962 | |
963 | 963 | // Find source plugin/theme of SD |
964 | 964 | $source = array(); |
965 | - if ( strpos( $file, $plugins_dir ) !== false ) { |
|
966 | - $source = explode( "/", plugin_basename( $file ) ); |
|
967 | - } else if ( function_exists( 'get_theme_root' ) ) { |
|
968 | - $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) ); |
|
965 | + if (strpos($file, $plugins_dir) !== false) { |
|
966 | + $source = explode("/", plugin_basename($file)); |
|
967 | + } else if (function_exists('get_theme_root')) { |
|
968 | + $themes_dir = str_replace(array("/", "\\"), "/", realpath(get_theme_root())); |
|
969 | 969 | |
970 | - if ( strpos( $file, $themes_dir ) !== false ) { |
|
971 | - $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) ); |
|
970 | + if (strpos($file, $themes_dir) !== false) { |
|
971 | + $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/")); |
|
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | 975 | return isset($source[0]) ? esc_attr($source[0]) : ''; |
976 | 976 | } |
977 | 977 | |
978 | - public function customizer_settings($wp_customize){ |
|
978 | + public function customizer_settings($wp_customize) { |
|
979 | 979 | $wp_customize->add_section('aui_settings', array( |
980 | - 'title' => __('AyeCode UI', 'ayecode-connect' ), |
|
980 | + 'title' => __('AyeCode UI', 'ayecode-connect'), |
|
981 | 981 | 'priority' => 120, |
982 | 982 | )); |
983 | 983 | |
@@ -991,8 +991,8 @@ discard block |
||
991 | 991 | 'type' => 'option', |
992 | 992 | 'transport' => 'refresh', |
993 | 993 | )); |
994 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
995 | - 'label' => __('Primary Color', 'ayecode-connect' ), |
|
994 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
995 | + 'label' => __('Primary Color', 'ayecode-connect'), |
|
996 | 996 | 'section' => 'aui_settings', |
997 | 997 | 'settings' => 'aui_options[color_primary]', |
998 | 998 | ))); |
@@ -1004,8 +1004,8 @@ discard block |
||
1004 | 1004 | 'type' => 'option', |
1005 | 1005 | 'transport' => 'refresh', |
1006 | 1006 | )); |
1007 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1008 | - 'label' => __('Secondary Color', 'ayecode-connect' ), |
|
1007 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1008 | + 'label' => __('Secondary Color', 'ayecode-connect'), |
|
1009 | 1009 | 'section' => 'aui_settings', |
1010 | 1010 | 'settings' => 'aui_options[color_secondary]', |
1011 | 1011 | ))); |
@@ -1031,12 +1031,12 @@ discard block |
||
1031 | 1031 | .collapse.show:not(.in){display: inherit;} |
1032 | 1032 | .fade.show{opacity: 1;} |
1033 | 1033 | |
1034 | - <?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?> |
|
1034 | + <?php if (defined('SVQ_THEME_VERSION')) { ?> |
|
1035 | 1035 | /* KLEO theme specific */ |
1036 | 1036 | .kleo-main-header .navbar-collapse.collapse.show:not(.in){display: block !important;} |
1037 | 1037 | <?php } ?> |
1038 | 1038 | |
1039 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
1039 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
1040 | 1040 | /* With Avada builder */ |
1041 | 1041 | body.modal-open .modal.in {opacity:1;z-index: 99999} |
1042 | 1042 | body.modal-open .modal.bsui.in .modal-content {box-shadow: none;} |
@@ -1047,10 +1047,10 @@ discard block |
||
1047 | 1047 | <?php } ?> |
1048 | 1048 | </style> |
1049 | 1049 | <?php |
1050 | - return str_replace( array( |
|
1050 | + return str_replace(array( |
|
1051 | 1051 | '<style>', |
1052 | 1052 | '</style>' |
1053 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
1053 | + ), '', self::minify_css(ob_get_clean())); |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | global $aui_bs5; |
1059 | 1059 | |
1060 | 1060 | $colors = array(); |
1061 | - if ( defined( 'BLOCKSTRAP_VERSION' ) ) { |
|
1061 | + if (defined('BLOCKSTRAP_VERSION')) { |
|
1062 | 1062 | |
1063 | 1063 | |
1064 | 1064 | $setting = wp_get_global_settings(); |
@@ -1067,22 +1067,22 @@ discard block |
||
1067 | 1067 | // print_r(get_default_block_editor_settings());exit; |
1068 | 1068 | |
1069 | 1069 | // print_r($setting);echo '###';exit; |
1070 | - if(!empty($setting['color']['palette']['theme'])){ |
|
1071 | - foreach($setting['color']['palette']['theme'] as $color){ |
|
1070 | + if (!empty($setting['color']['palette']['theme'])) { |
|
1071 | + foreach ($setting['color']['palette']['theme'] as $color) { |
|
1072 | 1072 | $colors[$color['slug']] = esc_attr($color['color']); |
1073 | 1073 | } |
1074 | 1074 | } |
1075 | 1075 | |
1076 | - if(!empty($setting['color']['palette']['custom'])){ |
|
1077 | - foreach($setting['color']['palette']['custom'] as $color){ |
|
1076 | + if (!empty($setting['color']['palette']['custom'])) { |
|
1077 | + foreach ($setting['color']['palette']['custom'] as $color) { |
|
1078 | 1078 | $colors[$color['slug']] = esc_attr($color['color']); |
1079 | 1079 | } |
1080 | 1080 | } |
1081 | - }else{ |
|
1081 | + } else { |
|
1082 | 1082 | $settings = get_option('aui_options'); |
1083 | 1083 | $colors = array( |
1084 | - 'primary' => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR, |
|
1085 | - 'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR |
|
1084 | + 'primary' => !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR, |
|
1085 | + 'secondary' => !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR |
|
1086 | 1086 | ); |
1087 | 1087 | } |
1088 | 1088 | |
@@ -1093,25 +1093,25 @@ discard block |
||
1093 | 1093 | <?php |
1094 | 1094 | |
1095 | 1095 | // BS v3 compat |
1096 | - if( self::is_bs3_compat() ){ |
|
1096 | + if (self::is_bs3_compat()) { |
|
1097 | 1097 | echo self::bs3_compat_css(); |
1098 | 1098 | } |
1099 | 1099 | |
1100 | - $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : ''; |
|
1100 | + $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
|
1101 | 1101 | $is_fse = false; |
1102 | - if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) ) ) { |
|
1102 | + if (is_admin() && (!empty($_REQUEST['postType']) || $current_screen->is_block_editor()) && (defined('BLOCKSTRAP_VERSION') || defined('AUI_FSE'))) { |
|
1103 | 1103 | $is_fse = true; |
1104 | 1104 | } |
1105 | 1105 | |
1106 | - if(!empty($colors)){ |
|
1106 | + if (!empty($colors)) { |
|
1107 | 1107 | $d_colors = self::get_colors(true); |
1108 | 1108 | |
1109 | 1109 | // $is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'; |
1110 | - foreach($colors as $key => $color ){ |
|
1111 | - if((empty( $d_colors[$key]) || $d_colors[$key] != $color) || $is_fse ) { |
|
1110 | + foreach ($colors as $key => $color) { |
|
1111 | + if ((empty($d_colors[$key]) || $d_colors[$key] != $color) || $is_fse) { |
|
1112 | 1112 | $var = $is_fse ? "var(--wp--preset--color--$key)" : $color; |
1113 | 1113 | $compat = $is_fse ? '.editor-styles-wrapper' : $compatibility; |
1114 | - echo $aui_bs5 ? self::css_overwrite_bs5($key,$var,$compat,$color) : self::css_overwrite($key,$var,$compat,$color); |
|
1114 | + echo $aui_bs5 ? self::css_overwrite_bs5($key, $var, $compat, $color) : self::css_overwrite($key, $var, $compat, $color); |
|
1115 | 1115 | } |
1116 | 1116 | } |
1117 | 1117 | // exit; |
@@ -1120,70 +1120,70 @@ discard block |
||
1120 | 1120 | // Set admin bar z-index lower when modal is open. |
1121 | 1121 | echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}'; |
1122 | 1122 | |
1123 | - if(is_admin()){ |
|
1123 | + if (is_admin()) { |
|
1124 | 1124 | echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}'; |
1125 | 1125 | } |
1126 | 1126 | |
1127 | - if( $aui_bs5 && defined( 'BLOCKSTRAP_VERSION' ) ){ |
|
1127 | + if ($aui_bs5 && defined('BLOCKSTRAP_VERSION')) { |
|
1128 | 1128 | $css = ''; |
1129 | 1129 | $theme_settings = wp_get_global_styles(); |
1130 | 1130 | |
1131 | 1131 | // print_r( $theme_settings);exit; |
1132 | 1132 | |
1133 | 1133 | // font face |
1134 | - if( !empty( $theme_settings['typography']['fontFamily'] ) ){ |
|
1135 | - $t_fontface = str_replace( array('var:preset|','font-family|'), array('--wp--preset--','font-family--'), $theme_settings['typography']['fontFamily'] ); //var(--wp--preset--font-family--poppins) |
|
1134 | + if (!empty($theme_settings['typography']['fontFamily'])) { |
|
1135 | + $t_fontface = str_replace(array('var:preset|', 'font-family|'), array('--wp--preset--', 'font-family--'), $theme_settings['typography']['fontFamily']); //var(--wp--preset--font-family--poppins) |
|
1136 | 1136 | $css .= '--bs-body-font-family: ' . esc_attr($t_fontface) . ';'; |
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | // font size |
1140 | - if( !empty( $theme_settings['typography']['fontSize'] ) ){ |
|
1141 | - $css .= '--bs-body-font-size: ' . esc_attr( $theme_settings['typography']['fontSize'] ) . ' ;'; |
|
1140 | + if (!empty($theme_settings['typography']['fontSize'])) { |
|
1141 | + $css .= '--bs-body-font-size: ' . esc_attr($theme_settings['typography']['fontSize']) . ' ;'; |
|
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | // line height |
1145 | - if( !empty( $theme_settings['typography']['lineHeight'] ) ){ |
|
1146 | - $css .= '--bs-body-line-height: ' . esc_attr( $theme_settings['typography']['lineHeight'] ) . ';'; |
|
1145 | + if (!empty($theme_settings['typography']['lineHeight'])) { |
|
1146 | + $css .= '--bs-body-line-height: ' . esc_attr($theme_settings['typography']['lineHeight']) . ';'; |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | |
1150 | 1150 | // font weight |
1151 | - if( !empty( $theme_settings['typography']['fontWeight'] ) ){ |
|
1152 | - $css .= '--bs-body-font-weight: ' . esc_attr( $theme_settings['typography']['fontWeight'] ) . ';'; |
|
1151 | + if (!empty($theme_settings['typography']['fontWeight'])) { |
|
1152 | + $css .= '--bs-body-font-weight: ' . esc_attr($theme_settings['typography']['fontWeight']) . ';'; |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | // Background |
1156 | - if( !empty( $theme_settings['color']['background'] ) ){ |
|
1157 | - $css .= '--bs-body-bg: ' . esc_attr( $theme_settings['color']['background'] ) . ';'; |
|
1156 | + if (!empty($theme_settings['color']['background'])) { |
|
1157 | + $css .= '--bs-body-bg: ' . esc_attr($theme_settings['color']['background']) . ';'; |
|
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | // Background Gradient |
1161 | - if( !empty( $theme_settings['color']['gradient'] ) ){ |
|
1162 | - $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';'; |
|
1161 | + if (!empty($theme_settings['color']['gradient'])) { |
|
1162 | + $css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';'; |
|
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | // Background Gradient |
1166 | - if( !empty( $theme_settings['color']['gradient'] ) ){ |
|
1167 | - $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';'; |
|
1166 | + if (!empty($theme_settings['color']['gradient'])) { |
|
1167 | + $css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';'; |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | // text color |
1171 | - if( !empty( $theme_settings['color']['text'] ) ){ |
|
1172 | - $css .= '--bs-body-color: ' . esc_attr( $theme_settings['color']['text'] ) . ';'; |
|
1171 | + if (!empty($theme_settings['color']['text'])) { |
|
1172 | + $css .= '--bs-body-color: ' . esc_attr($theme_settings['color']['text']) . ';'; |
|
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | |
1176 | 1176 | // link colors |
1177 | - if( !empty( $theme_settings['elements']['link']['color']['text'] ) ){ |
|
1178 | - $css .= '--bs-link-color: ' . esc_attr( $theme_settings['elements']['link']['color']['text'] ) . ';'; |
|
1177 | + if (!empty($theme_settings['elements']['link']['color']['text'])) { |
|
1178 | + $css .= '--bs-link-color: ' . esc_attr($theme_settings['elements']['link']['color']['text']) . ';'; |
|
1179 | 1179 | } |
1180 | - if( !empty( $theme_settings['elements']['link'][':hover']['color']['text'] ) ){ |
|
1181 | - $css .= '--bs-link-hover-color: ' . esc_attr( $theme_settings['elements']['link'][':hover']['color']['text'] ) . ';'; |
|
1180 | + if (!empty($theme_settings['elements']['link'][':hover']['color']['text'])) { |
|
1181 | + $css .= '--bs-link-hover-color: ' . esc_attr($theme_settings['elements']['link'][':hover']['color']['text']) . ';'; |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | |
1185 | 1185 | |
1186 | - if($css){ |
|
1186 | + if ($css) { |
|
1187 | 1187 | echo $is_fse ? 'body.editor-styles-wrapper{' . $css . '}' : 'body{' . $css . '}'; |
1188 | 1188 | } |
1189 | 1189 | |
@@ -1192,42 +1192,42 @@ discard block |
||
1192 | 1192 | |
1193 | 1193 | // Headings |
1194 | 1194 | $headings_css = ''; |
1195 | - if( !empty( $theme_settings['elements']['heading']['color']['text'] ) ){ |
|
1196 | - $headings_css .= "color: " . esc_attr( $theme_settings['elements']['heading']['color']['text'] ) . ";"; |
|
1195 | + if (!empty($theme_settings['elements']['heading']['color']['text'])) { |
|
1196 | + $headings_css .= "color: " . esc_attr($theme_settings['elements']['heading']['color']['text']) . ";"; |
|
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | // heading background |
1200 | - if( !empty( $theme_settings['elements']['heading']['color']['background'] ) ){ |
|
1201 | - $headings_css .= 'background: ' . esc_attr( $theme_settings['elements']['heading']['color']['background'] ) . ';'; |
|
1200 | + if (!empty($theme_settings['elements']['heading']['color']['background'])) { |
|
1201 | + $headings_css .= 'background: ' . esc_attr($theme_settings['elements']['heading']['color']['background']) . ';'; |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | // heading font family |
1205 | - if( !empty( $theme_settings['elements']['heading']['typography']['fontFamily'] ) ){ |
|
1206 | - $headings_css .= 'font-family: ' . esc_attr( $theme_settings['elements']['heading']['typography']['fontFamily'] ) . ';'; |
|
1205 | + if (!empty($theme_settings['elements']['heading']['typography']['fontFamily'])) { |
|
1206 | + $headings_css .= 'font-family: ' . esc_attr($theme_settings['elements']['heading']['typography']['fontFamily']) . ';'; |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | - if( $headings_css ){ |
|
1209 | + if ($headings_css) { |
|
1210 | 1210 | echo "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . $headings_css . "}"; |
1211 | 1211 | } |
1212 | 1212 | |
1213 | - $hs = array('h1','h2','h3','h4','h5','h6'); |
|
1213 | + $hs = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'); |
|
1214 | 1214 | |
1215 | - foreach($hs as $hn){ |
|
1215 | + foreach ($hs as $hn) { |
|
1216 | 1216 | $h_css = ''; |
1217 | - if( !empty( $theme_settings['elements'][$hn]['color']['text'] ) ){ |
|
1218 | - $h_css .= 'color: ' . esc_attr( $theme_settings['elements'][$hn]['color']['text'] ) . ';'; |
|
1217 | + if (!empty($theme_settings['elements'][$hn]['color']['text'])) { |
|
1218 | + $h_css .= 'color: ' . esc_attr($theme_settings['elements'][$hn]['color']['text']) . ';'; |
|
1219 | 1219 | } |
1220 | 1220 | |
1221 | - if( !empty( $theme_settings['elements'][$hn]['typography']['fontSize'] ) ){ |
|
1222 | - $h_css .= 'font-size: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontSize'] ) . ';'; |
|
1221 | + if (!empty($theme_settings['elements'][$hn]['typography']['fontSize'])) { |
|
1222 | + $h_css .= 'font-size: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontSize']) . ';'; |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | - if( !empty( $theme_settings['elements'][$hn]['typography']['fontFamily'] ) ){ |
|
1226 | - $h_css .= 'font-family: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontFamily'] ) . ';'; |
|
1225 | + if (!empty($theme_settings['elements'][$hn]['typography']['fontFamily'])) { |
|
1226 | + $h_css .= 'font-family: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontFamily']) . ';'; |
|
1227 | 1227 | } |
1228 | 1228 | |
1229 | - if($h_css){ |
|
1230 | - echo $bep . $hn . '{'.$h_css.'}'; |
|
1229 | + if ($h_css) { |
|
1230 | + echo $bep . $hn . '{' . $h_css . '}'; |
|
1231 | 1231 | } |
1232 | 1232 | } |
1233 | 1233 | |
@@ -1246,10 +1246,10 @@ discard block |
||
1246 | 1246 | /* |
1247 | 1247 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1248 | 1248 | */ |
1249 | - return str_replace( array( |
|
1249 | + return str_replace(array( |
|
1250 | 1250 | '<style>', |
1251 | 1251 | '</style>' |
1252 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
1252 | + ), '', self::minify_css(ob_get_clean())); |
|
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | * |
1260 | 1260 | * @return bool |
1261 | 1261 | */ |
1262 | - public static function is_bs3_compat(){ |
|
1262 | + public static function is_bs3_compat() { |
|
1263 | 1263 | return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION'); |
1264 | 1264 | } |
1265 | 1265 | |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | $hex = str_replace('#', '', $hex); |
1269 | 1269 | |
1270 | 1270 | // Convert 3-digit hex to 6-digit hex |
1271 | - if(strlen($hex) == 3) { |
|
1271 | + if (strlen($hex) == 3) { |
|
1272 | 1272 | $hex = str_repeat(substr($hex, 0, 1), 2) . str_repeat(substr($hex, 1, 1), 2) . str_repeat(substr($hex, 2, 1), 2); |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1290,13 +1290,13 @@ discard block |
||
1290 | 1290 | * |
1291 | 1291 | * @return string |
1292 | 1292 | */ |
1293 | - public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex = '' ){ |
|
1293 | + public static function css_overwrite_bs5($type, $color_code, $compatibility, $hex = '') { |
|
1294 | 1294 | global $aui_bs5; |
1295 | 1295 | |
1296 | 1296 | $is_var = false; |
1297 | 1297 | $is_custom = strpos($type, 'custom-') !== false ? true : false; |
1298 | - if(!$color_code){return '';} |
|
1299 | - if(strpos($color_code, 'var') !== false){ |
|
1298 | + if (!$color_code) {return ''; } |
|
1299 | + if (strpos($color_code, 'var') !== false) { |
|
1300 | 1300 | //if(!sanitize_hex_color($color_code)){ |
1301 | 1301 | $color_code = esc_attr($color_code); |
1302 | 1302 | $is_var = true; |
@@ -1306,15 +1306,15 @@ discard block |
||
1306 | 1306 | |
1307 | 1307 | // echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit; |
1308 | 1308 | |
1309 | - if(!$color_code){return '';} |
|
1309 | + if (!$color_code) {return ''; } |
|
1310 | 1310 | |
1311 | 1311 | $rgb = self::hex_to_rgb($hex); |
1312 | 1312 | |
1313 | - if($compatibility===true || $compatibility===1){ |
|
1313 | + if ($compatibility === true || $compatibility === 1) { |
|
1314 | 1314 | $compatibility = '.bsui'; |
1315 | - }elseif(!$compatibility){ |
|
1315 | + }elseif (!$compatibility) { |
|
1316 | 1316 | $compatibility = ''; |
1317 | - }else{ |
|
1317 | + } else { |
|
1318 | 1318 | $compatibility = esc_attr($compatibility); |
1319 | 1319 | } |
1320 | 1320 | |
@@ -1331,30 +1331,30 @@ discard block |
||
1331 | 1331 | * c = color, b = background color, o = border-color, f = fill |
1332 | 1332 | */ |
1333 | 1333 | $selectors = array( |
1334 | - ".btn-{$type}" => array( 'b', 'o' ), |
|
1335 | - ".btn-{$type}.disabled" => array( 'b', 'o' ), |
|
1336 | - ".btn-{$type}:disabled" => array( 'b', 'o' ), |
|
1337 | - ".btn-outline-{$type}" => array( 'c', 'o' ), |
|
1338 | - ".btn-outline-{$type}:hover" => array( 'b', 'o' ), |
|
1339 | - ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ), |
|
1340 | - ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ), |
|
1341 | - ".show>.btn-outline-{$type}.dropdown-toggle" => array( 'b', 'o' ), |
|
1342 | - ".badge-{$type}" => array( 'b' ), |
|
1343 | - ".alert-{$type}" => array( 'b', 'o' ), |
|
1344 | - ".bg-{$type}" => array( 'b', 'f' ), |
|
1345 | - ".btn-link.btn-{$type}" => array( 'c' ), |
|
1346 | - ".text-{$type}" => array( 'c' ), |
|
1334 | + ".btn-{$type}" => array('b', 'o'), |
|
1335 | + ".btn-{$type}.disabled" => array('b', 'o'), |
|
1336 | + ".btn-{$type}:disabled" => array('b', 'o'), |
|
1337 | + ".btn-outline-{$type}" => array('c', 'o'), |
|
1338 | + ".btn-outline-{$type}:hover" => array('b', 'o'), |
|
1339 | + ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'), |
|
1340 | + ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'), |
|
1341 | + ".show>.btn-outline-{$type}.dropdown-toggle" => array('b', 'o'), |
|
1342 | + ".badge-{$type}" => array('b'), |
|
1343 | + ".alert-{$type}" => array('b', 'o'), |
|
1344 | + ".bg-{$type}" => array('b', 'f'), |
|
1345 | + ".btn-link.btn-{$type}" => array('c'), |
|
1346 | + ".text-{$type}" => array('c'), |
|
1347 | 1347 | ); |
1348 | 1348 | |
1349 | - if ( $aui_bs5 ) { |
|
1350 | - unset($selectors[".alert-{$type}" ]); |
|
1349 | + if ($aui_bs5) { |
|
1350 | + unset($selectors[".alert-{$type}"]); |
|
1351 | 1351 | } |
1352 | 1352 | |
1353 | - if ( $type == 'primary' ) { |
|
1353 | + if ($type == 'primary') { |
|
1354 | 1354 | $selectors = $selectors + array( |
1355 | - 'a' => array( 'c' ), |
|
1356 | - '.btn-link' => array( 'c' ), |
|
1357 | - '.dropdown-item.active' => array( 'b' ), |
|
1355 | + 'a' => array('c'), |
|
1356 | + '.btn-link' => array('c'), |
|
1357 | + '.dropdown-item.active' => array('b'), |
|
1358 | 1358 | '.custom-control-input:checked~.custom-control-label::before' => array( |
1359 | 1359 | 'b', |
1360 | 1360 | 'o' |
@@ -1363,56 +1363,56 @@ discard block |
||
1363 | 1363 | 'b', |
1364 | 1364 | 'o' |
1365 | 1365 | ), |
1366 | - '.nav-pills .nav-link.active' => array( 'b' ), |
|
1367 | - '.nav-pills .show>.nav-link' => array( 'b' ), |
|
1368 | - '.page-link' => array( 'c' ), |
|
1366 | + '.nav-pills .nav-link.active' => array('b'), |
|
1367 | + '.nav-pills .show>.nav-link' => array('b'), |
|
1368 | + '.page-link' => array('c'), |
|
1369 | 1369 | '.page-item.active .page-link' => array( |
1370 | 1370 | 'b', |
1371 | 1371 | 'o' |
1372 | 1372 | ), |
1373 | - '.progress-bar' => array( 'b' ), |
|
1373 | + '.progress-bar' => array('b'), |
|
1374 | 1374 | '.list-group-item.active' => array( |
1375 | 1375 | 'b', |
1376 | 1376 | 'o' |
1377 | 1377 | ), |
1378 | - '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ), |
|
1378 | + '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
|
1379 | 1379 | ); |
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | |
1383 | 1383 | |
1384 | 1384 | // link |
1385 | - if ( $type === 'primary' ) { |
|
1386 | - $output .= 'html body {--bs-link-hover-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .75); --bs-link-color: var(--bs-'.esc_attr($type).'); }'; |
|
1387 | - $output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: '.esc_attr($color_code).'; }'; |
|
1388 | - $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).'; }'; |
|
1385 | + if ($type === 'primary') { |
|
1386 | + $output .= 'html body {--bs-link-hover-color: rgba(var(--bs-' . esc_attr($type) . '-rgb), .75); --bs-link-color: var(--bs-' . esc_attr($type) . '); }'; |
|
1387 | + $output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: ' . esc_attr($color_code) . '; }'; |
|
1388 | + $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) . '; }'; |
|
1389 | 1389 | |
1390 | - $output .= $prefix . ' a{color: var(--bs-'.esc_attr($type).');}'; |
|
1391 | - $output .= $prefix . ' .text-primary{color: var(--bs-'.esc_attr($type).') !important;}'; |
|
1390 | + $output .= $prefix . ' a{color: var(--bs-' . esc_attr($type) . ');}'; |
|
1391 | + $output .= $prefix . ' .text-primary{color: var(--bs-' . esc_attr($type) . ') !important;}'; |
|
1392 | 1392 | |
1393 | 1393 | // dropdown |
1394 | - $output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-'.esc_attr($type).'); --bs-dropdown-link-active-color: var(--bs-'.esc_attr($type).');}'; |
|
1394 | + $output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-' . esc_attr($type) . '); --bs-dropdown-link-active-color: var(--bs-' . esc_attr($type) . ');}'; |
|
1395 | 1395 | |
1396 | 1396 | // pagination |
1397 | - $output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-'.esc_attr($type).'); --bs-pagination-active-bg: var(--bs-'.esc_attr($type).');}'; |
|
1397 | + $output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-' . esc_attr($type) . '); --bs-pagination-active-bg: var(--bs-' . esc_attr($type) . ');}'; |
|
1398 | 1398 | |
1399 | 1399 | } |
1400 | 1400 | |
1401 | - $output .= $prefix . ' .link-'.esc_attr($type).':hover {color: rgba(var(--bs-'.esc_attr($type).'-rgb), .8) !important;}'; |
|
1401 | + $output .= $prefix . ' .link-' . esc_attr($type) . ':hover {color: rgba(var(--bs-' . esc_attr($type) . '-rgb), .8) !important;}'; |
|
1402 | 1402 | |
1403 | 1403 | // buttons |
1404 | - $output .= $prefix . ' .btn-'.esc_attr($type).'{'; |
|
1404 | + $output .= $prefix . ' .btn-' . esc_attr($type) . '{'; |
|
1405 | 1405 | $output .= ' |
1406 | - --bs-btn-bg: '.esc_attr($color_code).'; |
|
1407 | - --bs-btn-border-color: '.esc_attr($color_code).'; |
|
1408 | - --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1409 | - --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1410 | - --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb; |
|
1411 | - --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1412 | - --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1406 | + --bs-btn-bg: '.esc_attr($color_code) . '; |
|
1407 | + --bs-btn-border-color: '.esc_attr($color_code) . '; |
|
1408 | + --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1409 | + --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1410 | + --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type) . '-rgb; |
|
1411 | + --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1412 | + --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1413 | 1413 | --bs-btn-active-shadow: unset; |
1414 | - --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5); |
|
1415 | - --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1); |
|
1414 | + --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .5); |
|
1415 | + --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .1); |
|
1416 | 1416 | '; |
1417 | 1417 | // $output .= ' |
1418 | 1418 | // --bs-btn-color: #fff; |
@@ -1423,17 +1423,17 @@ discard block |
||
1423 | 1423 | $output .= '}'; |
1424 | 1424 | |
1425 | 1425 | // buttons outline |
1426 | - $output .= $prefix . ' .btn-outline-'.esc_attr($type).'{'; |
|
1426 | + $output .= $prefix . ' .btn-outline-' . esc_attr($type) . '{'; |
|
1427 | 1427 | $output .= ' |
1428 | - --bs-btn-border-color: '.esc_attr($color_code).'; |
|
1429 | - --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1430 | - --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1431 | - --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb; |
|
1432 | - --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1433 | - --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1428 | + --bs-btn-border-color: '.esc_attr($color_code) . '; |
|
1429 | + --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1430 | + --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1431 | + --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type) . '-rgb; |
|
1432 | + --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1433 | + --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1434 | 1434 | --bs-btn-active-shadow: unset; |
1435 | - --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5); |
|
1436 | - --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1); |
|
1435 | + --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .5); |
|
1436 | + --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .1); |
|
1437 | 1437 | '; |
1438 | 1438 | // $output .= ' |
1439 | 1439 | // --bs-btn-color: #fff; |
@@ -1445,32 +1445,32 @@ discard block |
||
1445 | 1445 | |
1446 | 1446 | |
1447 | 1447 | // button hover |
1448 | - $output .= $prefix . ' .btn-'.esc_attr($type).':hover{'; |
|
1448 | + $output .= $prefix . ' .btn-' . esc_attr($type) . ':hover{'; |
|
1449 | 1449 | $output .= ' |
1450 | - 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); |
|
1450 | + 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); |
|
1451 | 1451 | } |
1452 | 1452 | '; |
1453 | 1453 | |
1454 | 1454 | |
1455 | - if ( $aui_bs5 ) { |
|
1455 | + if ($aui_bs5) { |
|
1456 | 1456 | // $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).'; }'; |
1457 | - $output .= 'html body {--bs-'.esc_attr($type).': '.esc_attr($color_code).'; }'; |
|
1458 | - $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }'; |
|
1457 | + $output .= 'html body {--bs-' . esc_attr($type) . ': ' . esc_attr($color_code) . '; }'; |
|
1458 | + $output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }'; |
|
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | |
1462 | - if ( $is_custom ) { |
|
1462 | + if ($is_custom) { |
|
1463 | 1463 | |
1464 | 1464 | // echo '###'.$type;exit; |
1465 | 1465 | |
1466 | 1466 | // build rules into each type |
1467 | - foreach($selectors as $selector => $types){ |
|
1468 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
1469 | - $types = array_combine($types,$types); |
|
1470 | - if(isset($types['c'])){$color[] = $selector;} |
|
1471 | - if(isset($types['b'])){$background[] = $selector;} |
|
1472 | - if(isset($types['o'])){$border[] = $selector;} |
|
1473 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1467 | + foreach ($selectors as $selector => $types) { |
|
1468 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
1469 | + $types = array_combine($types, $types); |
|
1470 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1471 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1472 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1473 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1474 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | // // build rules into each type |
@@ -1484,36 +1484,36 @@ discard block |
||
1484 | 1484 | // } |
1485 | 1485 | |
1486 | 1486 | // add any color rules |
1487 | - if(!empty($color)){ |
|
1488 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1487 | + if (!empty($color)) { |
|
1488 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1489 | 1489 | } |
1490 | - if(!empty($color_i)){ |
|
1491 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1490 | + if (!empty($color_i)) { |
|
1491 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1492 | 1492 | } |
1493 | 1493 | |
1494 | 1494 | // add any background color rules |
1495 | - if(!empty($background)){ |
|
1496 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1495 | + if (!empty($background)) { |
|
1496 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1497 | 1497 | } |
1498 | - if(!empty($background_i)){ |
|
1499 | - $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1498 | + if (!empty($background_i)) { |
|
1499 | + $output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1500 | 1500 | // $output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} "; |
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | // add any border color rules |
1504 | - if(!empty($border)){ |
|
1505 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1504 | + if (!empty($border)) { |
|
1505 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1506 | 1506 | } |
1507 | - if(!empty($border_i)){ |
|
1508 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1507 | + if (!empty($border_i)) { |
|
1508 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | // add any fill color rules |
1512 | - if(!empty($fill)){ |
|
1513 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1512 | + if (!empty($fill)) { |
|
1513 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1514 | 1514 | } |
1515 | - if(!empty($fill_i)){ |
|
1516 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1515 | + if (!empty($fill_i)) { |
|
1516 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | } |
@@ -1523,25 +1523,25 @@ discard block |
||
1523 | 1523 | |
1524 | 1524 | $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;' : ''; |
1525 | 1525 | // darken |
1526 | - $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075"); |
|
1527 | - $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10"); |
|
1528 | - $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125"); |
|
1529 | - $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4"); |
|
1526 | + $darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075"); |
|
1527 | + $darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10"); |
|
1528 | + $darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125"); |
|
1529 | + $darker_40 = $is_var ? $color_code . ';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code, "-0.4"); |
|
1530 | 1530 | |
1531 | 1531 | // lighten |
1532 | - $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25"); |
|
1532 | + $lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25"); |
|
1533 | 1533 | |
1534 | 1534 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1535 | - $op_25 = $color_code."40"; // 25% opacity |
|
1535 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1536 | 1536 | |
1537 | 1537 | |
1538 | 1538 | // button states |
1539 | - $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : ''; |
|
1540 | - $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
1539 | + $output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : ''; |
|
1540 | + $output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
1541 | 1541 | // $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000; border-color: #000;} "; |
1542 | - $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;} "; |
|
1543 | - $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.";} "; |
|
1544 | - $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;} "; |
|
1542 | + $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;} "; |
|
1543 | + $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 . ";} "; |
|
1544 | + $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;} "; |
|
1545 | 1545 | |
1546 | 1546 | // text |
1547 | 1547 | // $output .= $prefix .".xxx, .text-{$type} {color: var(--bs-".esc_attr($type).");} "; |
@@ -1559,9 +1559,9 @@ discard block |
||
1559 | 1559 | // } |
1560 | 1560 | |
1561 | 1561 | // alerts |
1562 | - if ( $aui_bs5 ) { |
|
1562 | + if ($aui_bs5) { |
|
1563 | 1563 | // $output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20; border-color: ".$color_code."30;color:$darker_40} "; |
1564 | - $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;} "; |
|
1564 | + $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;} "; |
|
1565 | 1565 | } |
1566 | 1566 | |
1567 | 1567 | return $output; |
@@ -1576,12 +1576,12 @@ discard block |
||
1576 | 1576 | * |
1577 | 1577 | * @return string |
1578 | 1578 | */ |
1579 | - public static function css_overwrite($type,$color_code,$compatibility, $hex = '' ){ |
|
1579 | + public static function css_overwrite($type, $color_code, $compatibility, $hex = '') { |
|
1580 | 1580 | global $aui_bs5; |
1581 | 1581 | |
1582 | 1582 | $is_var = false; |
1583 | - if(!$color_code){return '';} |
|
1584 | - if(strpos($color_code, 'var') !== false){ |
|
1583 | + if (!$color_code) {return ''; } |
|
1584 | + if (strpos($color_code, 'var') !== false) { |
|
1585 | 1585 | //if(!sanitize_hex_color($color_code)){ |
1586 | 1586 | $color_code = esc_attr($color_code); |
1587 | 1587 | $is_var = true; |
@@ -1591,15 +1591,15 @@ discard block |
||
1591 | 1591 | |
1592 | 1592 | // echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit; |
1593 | 1593 | |
1594 | - if(!$color_code){return '';} |
|
1594 | + if (!$color_code) {return ''; } |
|
1595 | 1595 | |
1596 | 1596 | $rgb = self::hex_to_rgb($hex); |
1597 | 1597 | |
1598 | - if($compatibility===true || $compatibility===1){ |
|
1598 | + if ($compatibility === true || $compatibility === 1) { |
|
1599 | 1599 | $compatibility = '.bsui'; |
1600 | - }elseif(!$compatibility){ |
|
1600 | + }elseif (!$compatibility) { |
|
1601 | 1601 | $compatibility = ''; |
1602 | - }else{ |
|
1602 | + } else { |
|
1603 | 1603 | $compatibility = esc_attr($compatibility); |
1604 | 1604 | } |
1605 | 1605 | |
@@ -1613,29 +1613,29 @@ discard block |
||
1613 | 1613 | * c = color, b = background color, o = border-color, f = fill |
1614 | 1614 | */ |
1615 | 1615 | $selectors = array( |
1616 | - ".btn-{$type}" => array( 'b', 'o' ), |
|
1617 | - ".btn-{$type}.disabled" => array( 'b', 'o' ), |
|
1618 | - ".btn-{$type}:disabled" => array( 'b', 'o' ), |
|
1619 | - ".btn-outline-{$type}" => array( 'c', 'o' ), |
|
1620 | - ".btn-outline-{$type}:hover" => array( 'b', 'o' ), |
|
1621 | - ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ), |
|
1622 | - ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ), |
|
1623 | - ".show>.btn-outline-{$type}.dropdown-toggle" => array( 'b', 'o' ), |
|
1624 | - ".badge-{$type}" => array( 'b' ), |
|
1625 | - ".alert-{$type}" => array( 'b', 'o' ), |
|
1626 | - ".bg-{$type}" => array( 'b', 'f' ), |
|
1627 | - ".btn-link.btn-{$type}" => array( 'c' ), |
|
1616 | + ".btn-{$type}" => array('b', 'o'), |
|
1617 | + ".btn-{$type}.disabled" => array('b', 'o'), |
|
1618 | + ".btn-{$type}:disabled" => array('b', 'o'), |
|
1619 | + ".btn-outline-{$type}" => array('c', 'o'), |
|
1620 | + ".btn-outline-{$type}:hover" => array('b', 'o'), |
|
1621 | + ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'), |
|
1622 | + ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'), |
|
1623 | + ".show>.btn-outline-{$type}.dropdown-toggle" => array('b', 'o'), |
|
1624 | + ".badge-{$type}" => array('b'), |
|
1625 | + ".alert-{$type}" => array('b', 'o'), |
|
1626 | + ".bg-{$type}" => array('b', 'f'), |
|
1627 | + ".btn-link.btn-{$type}" => array('c'), |
|
1628 | 1628 | ); |
1629 | 1629 | |
1630 | - if ( $aui_bs5 ) { |
|
1631 | - unset($selectors[".alert-{$type}" ]); |
|
1630 | + if ($aui_bs5) { |
|
1631 | + unset($selectors[".alert-{$type}"]); |
|
1632 | 1632 | } |
1633 | 1633 | |
1634 | - if ( $type == 'primary' ) { |
|
1634 | + if ($type == 'primary') { |
|
1635 | 1635 | $selectors = $selectors + array( |
1636 | - 'a' => array( 'c' ), |
|
1637 | - '.btn-link' => array( 'c' ), |
|
1638 | - '.dropdown-item.active' => array( 'b' ), |
|
1636 | + 'a' => array('c'), |
|
1637 | + '.btn-link' => array('c'), |
|
1638 | + '.dropdown-item.active' => array('b'), |
|
1639 | 1639 | '.custom-control-input:checked~.custom-control-label::before' => array( |
1640 | 1640 | 'b', |
1641 | 1641 | 'o' |
@@ -1644,19 +1644,19 @@ discard block |
||
1644 | 1644 | 'b', |
1645 | 1645 | 'o' |
1646 | 1646 | ), |
1647 | - '.nav-pills .nav-link.active' => array( 'b' ), |
|
1648 | - '.nav-pills .show>.nav-link' => array( 'b' ), |
|
1649 | - '.page-link' => array( 'c' ), |
|
1647 | + '.nav-pills .nav-link.active' => array('b'), |
|
1648 | + '.nav-pills .show>.nav-link' => array('b'), |
|
1649 | + '.page-link' => array('c'), |
|
1650 | 1650 | '.page-item.active .page-link' => array( |
1651 | 1651 | 'b', |
1652 | 1652 | 'o' |
1653 | 1653 | ), |
1654 | - '.progress-bar' => array( 'b' ), |
|
1654 | + '.progress-bar' => array('b'), |
|
1655 | 1655 | '.list-group-item.active' => array( |
1656 | 1656 | 'b', |
1657 | 1657 | 'o' |
1658 | 1658 | ), |
1659 | - '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ), |
|
1659 | + '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
|
1660 | 1660 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
1661 | 1661 | // '.custom-range::-moz-range-thumb' => array('b'), |
1662 | 1662 | // '.custom-range::-ms-thumb' => array('b'), |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | } |
1665 | 1665 | |
1666 | 1666 | $important_selectors = array( |
1667 | - ".bg-{$type}" => array('b','f'), |
|
1667 | + ".bg-{$type}" => array('b', 'f'), |
|
1668 | 1668 | ".border-{$type}" => array('o'), |
1669 | 1669 | ".text-{$type}" => array('c'), |
1670 | 1670 | ); |
@@ -1680,62 +1680,62 @@ discard block |
||
1680 | 1680 | |
1681 | 1681 | $output = ''; |
1682 | 1682 | |
1683 | - if ( $aui_bs5 ) { |
|
1683 | + if ($aui_bs5) { |
|
1684 | 1684 | // $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).'; }'; |
1685 | - $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }'; |
|
1685 | + $output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }'; |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | // build rules into each type |
1689 | - foreach($selectors as $selector => $types){ |
|
1690 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
1691 | - $types = array_combine($types,$types); |
|
1692 | - if(isset($types['c'])){$color[] = $selector;} |
|
1693 | - if(isset($types['b'])){$background[] = $selector;} |
|
1694 | - if(isset($types['o'])){$border[] = $selector;} |
|
1695 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1689 | + foreach ($selectors as $selector => $types) { |
|
1690 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
1691 | + $types = array_combine($types, $types); |
|
1692 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1693 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1694 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1695 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | // build rules into each type |
1699 | - foreach($important_selectors as $selector => $types){ |
|
1700 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
1701 | - $types = array_combine($types,$types); |
|
1702 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
1703 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
1704 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
1705 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
1699 | + foreach ($important_selectors as $selector => $types) { |
|
1700 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
1701 | + $types = array_combine($types, $types); |
|
1702 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
1703 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
1704 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
1705 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
1706 | 1706 | } |
1707 | 1707 | |
1708 | 1708 | // add any color rules |
1709 | - if(!empty($color)){ |
|
1710 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1709 | + if (!empty($color)) { |
|
1710 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1711 | 1711 | } |
1712 | - if(!empty($color_i)){ |
|
1713 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1712 | + if (!empty($color_i)) { |
|
1713 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1714 | 1714 | } |
1715 | 1715 | |
1716 | 1716 | // add any background color rules |
1717 | - if(!empty($background)){ |
|
1718 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1717 | + if (!empty($background)) { |
|
1718 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1719 | 1719 | } |
1720 | - if(!empty($background_i)){ |
|
1721 | - $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1720 | + if (!empty($background_i)) { |
|
1721 | + $output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1722 | 1722 | // $output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} "; |
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | // add any border color rules |
1726 | - if(!empty($border)){ |
|
1727 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1726 | + if (!empty($border)) { |
|
1727 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1728 | 1728 | } |
1729 | - if(!empty($border_i)){ |
|
1730 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1729 | + if (!empty($border_i)) { |
|
1730 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1731 | 1731 | } |
1732 | 1732 | |
1733 | 1733 | // add any fill color rules |
1734 | - if(!empty($fill)){ |
|
1735 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1734 | + if (!empty($fill)) { |
|
1735 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1736 | 1736 | } |
1737 | - if(!empty($fill_i)){ |
|
1738 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1737 | + if (!empty($fill_i)) { |
|
1738 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1739 | 1739 | } |
1740 | 1740 | |
1741 | 1741 | |
@@ -1743,27 +1743,27 @@ discard block |
||
1743 | 1743 | |
1744 | 1744 | $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;' : ''; |
1745 | 1745 | // darken |
1746 | - $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075"); |
|
1747 | - $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10"); |
|
1748 | - $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125"); |
|
1749 | - $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4"); |
|
1746 | + $darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075"); |
|
1747 | + $darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10"); |
|
1748 | + $darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125"); |
|
1749 | + $darker_40 = $is_var ? $color_code . ';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code, "-0.4"); |
|
1750 | 1750 | |
1751 | 1751 | // lighten |
1752 | - $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25"); |
|
1752 | + $lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25"); |
|
1753 | 1753 | |
1754 | 1754 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1755 | - $op_25 = $color_code."40"; // 25% opacity |
|
1755 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1756 | 1756 | |
1757 | 1757 | |
1758 | 1758 | // button states |
1759 | - $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : ''; |
|
1760 | - $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
1759 | + $output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : ''; |
|
1760 | + $output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
1761 | 1761 | // $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000; border-color: #000;} "; |
1762 | - $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;} "; |
|
1763 | - $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.";} "; |
|
1764 | - $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;} "; |
|
1762 | + $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;} "; |
|
1763 | + $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 . ";} "; |
|
1764 | + $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;} "; |
|
1765 | 1765 | |
1766 | - if ( $type == 'primary' ) { |
|
1766 | + if ($type == 'primary') { |
|
1767 | 1767 | // dropdown's |
1768 | 1768 | $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
1769 | 1769 | |
@@ -1775,9 +1775,9 @@ discard block |
||
1775 | 1775 | } |
1776 | 1776 | |
1777 | 1777 | // alerts |
1778 | - if ( $aui_bs5 ) { |
|
1778 | + if ($aui_bs5) { |
|
1779 | 1779 | // $output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20; border-color: ".$color_code."30;color:$darker_40} "; |
1780 | - $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;} "; |
|
1780 | + $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;} "; |
|
1781 | 1781 | } |
1782 | 1782 | |
1783 | 1783 | return $output; |
@@ -1793,11 +1793,11 @@ discard block |
||
1793 | 1793 | * |
1794 | 1794 | * @return string |
1795 | 1795 | */ |
1796 | - public static function css_primary($color_code,$compatibility, $use_variable = false){ |
|
1796 | + public static function css_primary($color_code, $compatibility, $use_variable = false) { |
|
1797 | 1797 | |
1798 | - if(!$use_variable){ |
|
1798 | + if (!$use_variable) { |
|
1799 | 1799 | $color_code = sanitize_hex_color($color_code); |
1800 | - if(!$color_code){return '';} |
|
1800 | + if (!$color_code) {return ''; } |
|
1801 | 1801 | } |
1802 | 1802 | |
1803 | 1803 | /** |
@@ -1805,36 +1805,36 @@ discard block |
||
1805 | 1805 | */ |
1806 | 1806 | $selectors = array( |
1807 | 1807 | 'a' => array('c'), |
1808 | - '.btn-primary' => array('b','o'), |
|
1809 | - '.btn-primary.disabled' => array('b','o'), |
|
1810 | - '.btn-primary:disabled' => array('b','o'), |
|
1811 | - '.btn-outline-primary' => array('c','o'), |
|
1812 | - '.btn-outline-primary:hover' => array('b','o'), |
|
1813 | - '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
1814 | - '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
1815 | - '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'), |
|
1808 | + '.btn-primary' => array('b', 'o'), |
|
1809 | + '.btn-primary.disabled' => array('b', 'o'), |
|
1810 | + '.btn-primary:disabled' => array('b', 'o'), |
|
1811 | + '.btn-outline-primary' => array('c', 'o'), |
|
1812 | + '.btn-outline-primary:hover' => array('b', 'o'), |
|
1813 | + '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
1814 | + '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
1815 | + '.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'), |
|
1816 | 1816 | '.btn-link' => array('c'), |
1817 | 1817 | '.dropdown-item.active' => array('b'), |
1818 | - '.custom-control-input:checked~.custom-control-label::before' => array('b','o'), |
|
1819 | - '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'), |
|
1818 | + '.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'), |
|
1819 | + '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'), |
|
1820 | 1820 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
1821 | 1821 | // '.custom-range::-moz-range-thumb' => array('b'), |
1822 | 1822 | // '.custom-range::-ms-thumb' => array('b'), |
1823 | 1823 | '.nav-pills .nav-link.active' => array('b'), |
1824 | 1824 | '.nav-pills .show>.nav-link' => array('b'), |
1825 | 1825 | '.page-link' => array('c'), |
1826 | - '.page-item.active .page-link' => array('b','o'), |
|
1826 | + '.page-item.active .page-link' => array('b', 'o'), |
|
1827 | 1827 | '.badge-primary' => array('b'), |
1828 | - '.alert-primary' => array('b','o'), |
|
1828 | + '.alert-primary' => array('b', 'o'), |
|
1829 | 1829 | '.progress-bar' => array('b'), |
1830 | - '.list-group-item.active' => array('b','o'), |
|
1831 | - '.bg-primary' => array('b','f'), |
|
1830 | + '.list-group-item.active' => array('b', 'o'), |
|
1831 | + '.bg-primary' => array('b', 'f'), |
|
1832 | 1832 | '.btn-link.btn-primary' => array('c'), |
1833 | 1833 | '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
1834 | 1834 | ); |
1835 | 1835 | |
1836 | 1836 | $important_selectors = array( |
1837 | - '.bg-primary' => array('b','f'), |
|
1837 | + '.bg-primary' => array('b', 'f'), |
|
1838 | 1838 | '.border-primary' => array('o'), |
1839 | 1839 | '.text-primary' => array('c'), |
1840 | 1840 | ); |
@@ -1851,88 +1851,88 @@ discard block |
||
1851 | 1851 | $output = ''; |
1852 | 1852 | |
1853 | 1853 | // build rules into each type |
1854 | - foreach($selectors as $selector => $types){ |
|
1855 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
1856 | - $types = array_combine($types,$types); |
|
1857 | - if(isset($types['c'])){$color[] = $selector;} |
|
1858 | - if(isset($types['b'])){$background[] = $selector;} |
|
1859 | - if(isset($types['o'])){$border[] = $selector;} |
|
1860 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1854 | + foreach ($selectors as $selector => $types) { |
|
1855 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
1856 | + $types = array_combine($types, $types); |
|
1857 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1858 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1859 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1860 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1861 | 1861 | } |
1862 | 1862 | |
1863 | 1863 | // build rules into each type |
1864 | - foreach($important_selectors as $selector => $types){ |
|
1865 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
1866 | - $types = array_combine($types,$types); |
|
1867 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
1868 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
1869 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
1870 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
1864 | + foreach ($important_selectors as $selector => $types) { |
|
1865 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
1866 | + $types = array_combine($types, $types); |
|
1867 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
1868 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
1869 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
1870 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
1871 | 1871 | } |
1872 | 1872 | |
1873 | 1873 | // add any color rules |
1874 | - if(!empty($color)){ |
|
1875 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1874 | + if (!empty($color)) { |
|
1875 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1876 | 1876 | } |
1877 | - if(!empty($color_i)){ |
|
1878 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1877 | + if (!empty($color_i)) { |
|
1878 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | // add any background color rules |
1882 | - if(!empty($background)){ |
|
1883 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1882 | + if (!empty($background)) { |
|
1883 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1884 | 1884 | } |
1885 | - if(!empty($background_i)){ |
|
1886 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1885 | + if (!empty($background_i)) { |
|
1886 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1887 | 1887 | } |
1888 | 1888 | |
1889 | 1889 | // add any border color rules |
1890 | - if(!empty($border)){ |
|
1891 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1890 | + if (!empty($border)) { |
|
1891 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1892 | 1892 | } |
1893 | - if(!empty($border_i)){ |
|
1894 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1893 | + if (!empty($border_i)) { |
|
1894 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1895 | 1895 | } |
1896 | 1896 | |
1897 | 1897 | // add any fill color rules |
1898 | - if(!empty($fill)){ |
|
1899 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1898 | + if (!empty($fill)) { |
|
1899 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1900 | 1900 | } |
1901 | - if(!empty($fill_i)){ |
|
1902 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1901 | + if (!empty($fill_i)) { |
|
1902 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1903 | 1903 | } |
1904 | 1904 | |
1905 | 1905 | |
1906 | 1906 | $prefix = $compatibility ? ".bsui " : ""; |
1907 | 1907 | |
1908 | 1908 | // darken |
1909 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
1910 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
1911 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
1909 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
1910 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
1911 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
1912 | 1912 | |
1913 | 1913 | // lighten |
1914 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
1914 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
1915 | 1915 | |
1916 | 1916 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1917 | - $op_25 = $color_code."40"; // 25% opacity |
|
1917 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1918 | 1918 | |
1919 | 1919 | |
1920 | 1920 | // button states |
1921 | - $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
1922 | - $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;} "; |
|
1923 | - $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.";} "; |
|
1924 | - $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;} "; |
|
1921 | + $output .= $prefix . " .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
1922 | + $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;} "; |
|
1923 | + $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 . ";} "; |
|
1924 | + $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;} "; |
|
1925 | 1925 | |
1926 | 1926 | |
1927 | 1927 | // dropdown's |
1928 | - $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
1928 | + $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
1929 | 1929 | |
1930 | 1930 | |
1931 | 1931 | // input states |
1932 | - $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1932 | + $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1933 | 1933 | |
1934 | 1934 | // page link |
1935 | - $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1935 | + $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1936 | 1936 | |
1937 | 1937 | return $output; |
1938 | 1938 | } |
@@ -1946,30 +1946,30 @@ discard block |
||
1946 | 1946 | * |
1947 | 1947 | * @return string |
1948 | 1948 | */ |
1949 | - public static function css_secondary($color_code,$compatibility){; |
|
1949 | + public static function css_secondary($color_code, $compatibility) {; |
|
1950 | 1950 | $color_code = sanitize_hex_color($color_code); |
1951 | - if(!$color_code){return '';} |
|
1951 | + if (!$color_code) {return ''; } |
|
1952 | 1952 | /** |
1953 | 1953 | * c = color, b = background color, o = border-color, f = fill |
1954 | 1954 | */ |
1955 | 1955 | $selectors = array( |
1956 | - '.btn-secondary' => array('b','o'), |
|
1957 | - '.btn-secondary.disabled' => array('b','o'), |
|
1958 | - '.btn-secondary:disabled' => array('b','o'), |
|
1959 | - '.btn-outline-secondary' => array('c','o'), |
|
1960 | - '.btn-outline-secondary:hover' => array('b','o'), |
|
1956 | + '.btn-secondary' => array('b', 'o'), |
|
1957 | + '.btn-secondary.disabled' => array('b', 'o'), |
|
1958 | + '.btn-secondary:disabled' => array('b', 'o'), |
|
1959 | + '.btn-outline-secondary' => array('c', 'o'), |
|
1960 | + '.btn-outline-secondary:hover' => array('b', 'o'), |
|
1961 | 1961 | '.btn-outline-secondary.disabled' => array('c'), |
1962 | 1962 | '.btn-outline-secondary:disabled' => array('c'), |
1963 | - '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
1964 | - '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
1965 | - '.btn-outline-secondary.dropdown-toggle' => array('b','o'), |
|
1963 | + '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
1964 | + '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
1965 | + '.btn-outline-secondary.dropdown-toggle' => array('b', 'o'), |
|
1966 | 1966 | '.badge-secondary' => array('b'), |
1967 | - '.alert-secondary' => array('b','o'), |
|
1967 | + '.alert-secondary' => array('b', 'o'), |
|
1968 | 1968 | '.btn-link.btn-secondary' => array('c'), |
1969 | 1969 | ); |
1970 | 1970 | |
1971 | 1971 | $important_selectors = array( |
1972 | - '.bg-secondary' => array('b','f'), |
|
1972 | + '.bg-secondary' => array('b', 'f'), |
|
1973 | 1973 | '.border-secondary' => array('o'), |
1974 | 1974 | '.text-secondary' => array('c'), |
1975 | 1975 | ); |
@@ -1986,77 +1986,77 @@ discard block |
||
1986 | 1986 | $output = ''; |
1987 | 1987 | |
1988 | 1988 | // build rules into each type |
1989 | - foreach($selectors as $selector => $types){ |
|
1990 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
1991 | - $types = array_combine($types,$types); |
|
1992 | - if(isset($types['c'])){$color[] = $selector;} |
|
1993 | - if(isset($types['b'])){$background[] = $selector;} |
|
1994 | - if(isset($types['o'])){$border[] = $selector;} |
|
1995 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1989 | + foreach ($selectors as $selector => $types) { |
|
1990 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
1991 | + $types = array_combine($types, $types); |
|
1992 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1993 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1994 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1995 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1996 | 1996 | } |
1997 | 1997 | |
1998 | 1998 | // build rules into each type |
1999 | - foreach($important_selectors as $selector => $types){ |
|
2000 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
2001 | - $types = array_combine($types,$types); |
|
2002 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
2003 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
2004 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
2005 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
1999 | + foreach ($important_selectors as $selector => $types) { |
|
2000 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
2001 | + $types = array_combine($types, $types); |
|
2002 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
2003 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
2004 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
2005 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
2006 | 2006 | } |
2007 | 2007 | |
2008 | 2008 | // add any color rules |
2009 | - if(!empty($color)){ |
|
2010 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
2009 | + if (!empty($color)) { |
|
2010 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
2011 | 2011 | } |
2012 | - if(!empty($color_i)){ |
|
2013 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
2012 | + if (!empty($color_i)) { |
|
2013 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
2014 | 2014 | } |
2015 | 2015 | |
2016 | 2016 | // add any background color rules |
2017 | - if(!empty($background)){ |
|
2018 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
2017 | + if (!empty($background)) { |
|
2018 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
2019 | 2019 | } |
2020 | - if(!empty($background_i)){ |
|
2021 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
2020 | + if (!empty($background_i)) { |
|
2021 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
2022 | 2022 | } |
2023 | 2023 | |
2024 | 2024 | // add any border color rules |
2025 | - if(!empty($border)){ |
|
2026 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
2025 | + if (!empty($border)) { |
|
2026 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
2027 | 2027 | } |
2028 | - if(!empty($border_i)){ |
|
2029 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
2028 | + if (!empty($border_i)) { |
|
2029 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
2030 | 2030 | } |
2031 | 2031 | |
2032 | 2032 | // add any fill color rules |
2033 | - if(!empty($fill)){ |
|
2034 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
2033 | + if (!empty($fill)) { |
|
2034 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
2035 | 2035 | } |
2036 | - if(!empty($fill_i)){ |
|
2037 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
2036 | + if (!empty($fill_i)) { |
|
2037 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
2038 | 2038 | } |
2039 | 2039 | |
2040 | 2040 | |
2041 | 2041 | $prefix = $compatibility ? ".bsui " : ""; |
2042 | 2042 | |
2043 | 2043 | // darken |
2044 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
2045 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
2046 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
2044 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
2045 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
2046 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
2047 | 2047 | |
2048 | 2048 | // lighten |
2049 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
2049 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
2050 | 2050 | |
2051 | 2051 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
2052 | - $op_25 = $color_code."40"; // 25% opacity |
|
2052 | + $op_25 = $color_code . "40"; // 25% opacity |
|
2053 | 2053 | |
2054 | 2054 | |
2055 | 2055 | // button states |
2056 | - $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
2057 | - $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;} "; |
|
2058 | - $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.";} "; |
|
2059 | - $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;} "; |
|
2056 | + $output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
2057 | + $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;} "; |
|
2058 | + $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 . ";} "; |
|
2059 | + $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;} "; |
|
2060 | 2060 | |
2061 | 2061 | |
2062 | 2062 | return $output; |
@@ -2092,8 +2092,8 @@ discard block |
||
2092 | 2092 | /** |
2093 | 2093 | * Check if we should display examples. |
2094 | 2094 | */ |
2095 | - public function maybe_show_examples(){ |
|
2096 | - if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){ |
|
2095 | + public function maybe_show_examples() { |
|
2096 | + if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) { |
|
2097 | 2097 | echo "<head>"; |
2098 | 2098 | wp_head(); |
2099 | 2099 | echo "</head>"; |
@@ -2109,7 +2109,7 @@ discard block |
||
2109 | 2109 | * |
2110 | 2110 | * @return string |
2111 | 2111 | */ |
2112 | - public function get_examples(){ |
|
2112 | + public function get_examples() { |
|
2113 | 2113 | $output = ''; |
2114 | 2114 | |
2115 | 2115 | |
@@ -2215,74 +2215,74 @@ discard block |
||
2215 | 2215 | */ |
2216 | 2216 | public static function calendar_params() { |
2217 | 2217 | $params = array( |
2218 | - 'month_long_1' => __( 'January', 'ayecode-connect' ), |
|
2219 | - 'month_long_2' => __( 'February', 'ayecode-connect' ), |
|
2220 | - 'month_long_3' => __( 'March', 'ayecode-connect' ), |
|
2221 | - 'month_long_4' => __( 'April', 'ayecode-connect' ), |
|
2222 | - 'month_long_5' => __( 'May', 'ayecode-connect' ), |
|
2223 | - 'month_long_6' => __( 'June', 'ayecode-connect' ), |
|
2224 | - 'month_long_7' => __( 'July', 'ayecode-connect' ), |
|
2225 | - 'month_long_8' => __( 'August', 'ayecode-connect' ), |
|
2226 | - 'month_long_9' => __( 'September', 'ayecode-connect' ), |
|
2227 | - 'month_long_10' => __( 'October', 'ayecode-connect' ), |
|
2228 | - 'month_long_11' => __( 'November', 'ayecode-connect' ), |
|
2229 | - 'month_long_12' => __( 'December', 'ayecode-connect' ), |
|
2230 | - 'month_s_1' => _x( 'Jan', 'January abbreviation', 'ayecode-connect' ), |
|
2231 | - 'month_s_2' => _x( 'Feb', 'February abbreviation', 'ayecode-connect' ), |
|
2232 | - 'month_s_3' => _x( 'Mar', 'March abbreviation', 'ayecode-connect' ), |
|
2233 | - 'month_s_4' => _x( 'Apr', 'April abbreviation', 'ayecode-connect' ), |
|
2234 | - 'month_s_5' => _x( 'May', 'May abbreviation', 'ayecode-connect' ), |
|
2235 | - 'month_s_6' => _x( 'Jun', 'June abbreviation', 'ayecode-connect' ), |
|
2236 | - 'month_s_7' => _x( 'Jul', 'July abbreviation', 'ayecode-connect' ), |
|
2237 | - 'month_s_8' => _x( 'Aug', 'August abbreviation', 'ayecode-connect' ), |
|
2238 | - 'month_s_9' => _x( 'Sep', 'September abbreviation', 'ayecode-connect' ), |
|
2239 | - 'month_s_10' => _x( 'Oct', 'October abbreviation', 'ayecode-connect' ), |
|
2240 | - 'month_s_11' => _x( 'Nov', 'November abbreviation', 'ayecode-connect' ), |
|
2241 | - 'month_s_12' => _x( 'Dec', 'December abbreviation', 'ayecode-connect' ), |
|
2242 | - 'day_s1_1' => _x( 'S', 'Sunday initial', 'ayecode-connect' ), |
|
2243 | - 'day_s1_2' => _x( 'M', 'Monday initial', 'ayecode-connect' ), |
|
2244 | - 'day_s1_3' => _x( 'T', 'Tuesday initial', 'ayecode-connect' ), |
|
2245 | - 'day_s1_4' => _x( 'W', 'Wednesday initial', 'ayecode-connect' ), |
|
2246 | - 'day_s1_5' => _x( 'T', 'Friday initial', 'ayecode-connect' ), |
|
2247 | - 'day_s1_6' => _x( 'F', 'Thursday initial', 'ayecode-connect' ), |
|
2248 | - 'day_s1_7' => _x( 'S', 'Saturday initial', 'ayecode-connect' ), |
|
2249 | - 'day_s2_1' => __( 'Su', 'ayecode-connect' ), |
|
2250 | - 'day_s2_2' => __( 'Mo', 'ayecode-connect' ), |
|
2251 | - 'day_s2_3' => __( 'Tu', 'ayecode-connect' ), |
|
2252 | - 'day_s2_4' => __( 'We', 'ayecode-connect' ), |
|
2253 | - 'day_s2_5' => __( 'Th', 'ayecode-connect' ), |
|
2254 | - 'day_s2_6' => __( 'Fr', 'ayecode-connect' ), |
|
2255 | - 'day_s2_7' => __( 'Sa', 'ayecode-connect' ), |
|
2256 | - 'day_s3_1' => __( 'Sun', 'ayecode-connect' ), |
|
2257 | - 'day_s3_2' => __( 'Mon', 'ayecode-connect' ), |
|
2258 | - 'day_s3_3' => __( 'Tue', 'ayecode-connect' ), |
|
2259 | - 'day_s3_4' => __( 'Wed', 'ayecode-connect' ), |
|
2260 | - 'day_s3_5' => __( 'Thu', 'ayecode-connect' ), |
|
2261 | - 'day_s3_6' => __( 'Fri', 'ayecode-connect' ), |
|
2262 | - 'day_s3_7' => __( 'Sat', 'ayecode-connect' ), |
|
2263 | - 'day_s5_1' => __( 'Sunday', 'ayecode-connect' ), |
|
2264 | - 'day_s5_2' => __( 'Monday', 'ayecode-connect' ), |
|
2265 | - 'day_s5_3' => __( 'Tuesday', 'ayecode-connect' ), |
|
2266 | - 'day_s5_4' => __( 'Wednesday', 'ayecode-connect' ), |
|
2267 | - 'day_s5_5' => __( 'Thursday', 'ayecode-connect' ), |
|
2268 | - 'day_s5_6' => __( 'Friday', 'ayecode-connect' ), |
|
2269 | - 'day_s5_7' => __( 'Saturday', 'ayecode-connect' ), |
|
2270 | - 'am_lower' => __( 'am', 'ayecode-connect' ), |
|
2271 | - 'pm_lower' => __( 'pm', 'ayecode-connect' ), |
|
2272 | - 'am_upper' => __( 'AM', 'ayecode-connect' ), |
|
2273 | - 'pm_upper' => __( 'PM', 'ayecode-connect' ), |
|
2274 | - 'firstDayOfWeek' => (int) get_option( 'start_of_week' ), |
|
2218 | + 'month_long_1' => __('January', 'ayecode-connect'), |
|
2219 | + 'month_long_2' => __('February', 'ayecode-connect'), |
|
2220 | + 'month_long_3' => __('March', 'ayecode-connect'), |
|
2221 | + 'month_long_4' => __('April', 'ayecode-connect'), |
|
2222 | + 'month_long_5' => __('May', 'ayecode-connect'), |
|
2223 | + 'month_long_6' => __('June', 'ayecode-connect'), |
|
2224 | + 'month_long_7' => __('July', 'ayecode-connect'), |
|
2225 | + 'month_long_8' => __('August', 'ayecode-connect'), |
|
2226 | + 'month_long_9' => __('September', 'ayecode-connect'), |
|
2227 | + 'month_long_10' => __('October', 'ayecode-connect'), |
|
2228 | + 'month_long_11' => __('November', 'ayecode-connect'), |
|
2229 | + 'month_long_12' => __('December', 'ayecode-connect'), |
|
2230 | + 'month_s_1' => _x('Jan', 'January abbreviation', 'ayecode-connect'), |
|
2231 | + 'month_s_2' => _x('Feb', 'February abbreviation', 'ayecode-connect'), |
|
2232 | + 'month_s_3' => _x('Mar', 'March abbreviation', 'ayecode-connect'), |
|
2233 | + 'month_s_4' => _x('Apr', 'April abbreviation', 'ayecode-connect'), |
|
2234 | + 'month_s_5' => _x('May', 'May abbreviation', 'ayecode-connect'), |
|
2235 | + 'month_s_6' => _x('Jun', 'June abbreviation', 'ayecode-connect'), |
|
2236 | + 'month_s_7' => _x('Jul', 'July abbreviation', 'ayecode-connect'), |
|
2237 | + 'month_s_8' => _x('Aug', 'August abbreviation', 'ayecode-connect'), |
|
2238 | + 'month_s_9' => _x('Sep', 'September abbreviation', 'ayecode-connect'), |
|
2239 | + 'month_s_10' => _x('Oct', 'October abbreviation', 'ayecode-connect'), |
|
2240 | + 'month_s_11' => _x('Nov', 'November abbreviation', 'ayecode-connect'), |
|
2241 | + 'month_s_12' => _x('Dec', 'December abbreviation', 'ayecode-connect'), |
|
2242 | + 'day_s1_1' => _x('S', 'Sunday initial', 'ayecode-connect'), |
|
2243 | + 'day_s1_2' => _x('M', 'Monday initial', 'ayecode-connect'), |
|
2244 | + 'day_s1_3' => _x('T', 'Tuesday initial', 'ayecode-connect'), |
|
2245 | + 'day_s1_4' => _x('W', 'Wednesday initial', 'ayecode-connect'), |
|
2246 | + 'day_s1_5' => _x('T', 'Friday initial', 'ayecode-connect'), |
|
2247 | + 'day_s1_6' => _x('F', 'Thursday initial', 'ayecode-connect'), |
|
2248 | + 'day_s1_7' => _x('S', 'Saturday initial', 'ayecode-connect'), |
|
2249 | + 'day_s2_1' => __('Su', 'ayecode-connect'), |
|
2250 | + 'day_s2_2' => __('Mo', 'ayecode-connect'), |
|
2251 | + 'day_s2_3' => __('Tu', 'ayecode-connect'), |
|
2252 | + 'day_s2_4' => __('We', 'ayecode-connect'), |
|
2253 | + 'day_s2_5' => __('Th', 'ayecode-connect'), |
|
2254 | + 'day_s2_6' => __('Fr', 'ayecode-connect'), |
|
2255 | + 'day_s2_7' => __('Sa', 'ayecode-connect'), |
|
2256 | + 'day_s3_1' => __('Sun', 'ayecode-connect'), |
|
2257 | + 'day_s3_2' => __('Mon', 'ayecode-connect'), |
|
2258 | + 'day_s3_3' => __('Tue', 'ayecode-connect'), |
|
2259 | + 'day_s3_4' => __('Wed', 'ayecode-connect'), |
|
2260 | + 'day_s3_5' => __('Thu', 'ayecode-connect'), |
|
2261 | + 'day_s3_6' => __('Fri', 'ayecode-connect'), |
|
2262 | + 'day_s3_7' => __('Sat', 'ayecode-connect'), |
|
2263 | + 'day_s5_1' => __('Sunday', 'ayecode-connect'), |
|
2264 | + 'day_s5_2' => __('Monday', 'ayecode-connect'), |
|
2265 | + 'day_s5_3' => __('Tuesday', 'ayecode-connect'), |
|
2266 | + 'day_s5_4' => __('Wednesday', 'ayecode-connect'), |
|
2267 | + 'day_s5_5' => __('Thursday', 'ayecode-connect'), |
|
2268 | + 'day_s5_6' => __('Friday', 'ayecode-connect'), |
|
2269 | + 'day_s5_7' => __('Saturday', 'ayecode-connect'), |
|
2270 | + 'am_lower' => __('am', 'ayecode-connect'), |
|
2271 | + 'pm_lower' => __('pm', 'ayecode-connect'), |
|
2272 | + 'am_upper' => __('AM', 'ayecode-connect'), |
|
2273 | + 'pm_upper' => __('PM', 'ayecode-connect'), |
|
2274 | + 'firstDayOfWeek' => (int) get_option('start_of_week'), |
|
2275 | 2275 | 'time_24hr' => false, |
2276 | - 'year' => __( 'Year', 'ayecode-connect' ), |
|
2277 | - 'hour' => __( 'Hour', 'ayecode-connect' ), |
|
2278 | - 'minute' => __( 'Minute', 'ayecode-connect' ), |
|
2279 | - 'weekAbbreviation' => __( 'Wk', 'ayecode-connect' ), |
|
2280 | - 'rangeSeparator' => __( ' to ', 'ayecode-connect' ), |
|
2281 | - 'scrollTitle' => __( 'Scroll to increment', 'ayecode-connect' ), |
|
2282 | - 'toggleTitle' => __( 'Click to toggle', 'ayecode-connect' ) |
|
2276 | + 'year' => __('Year', 'ayecode-connect'), |
|
2277 | + 'hour' => __('Hour', 'ayecode-connect'), |
|
2278 | + 'minute' => __('Minute', 'ayecode-connect'), |
|
2279 | + 'weekAbbreviation' => __('Wk', 'ayecode-connect'), |
|
2280 | + 'rangeSeparator' => __(' to ', 'ayecode-connect'), |
|
2281 | + 'scrollTitle' => __('Scroll to increment', 'ayecode-connect'), |
|
2282 | + 'toggleTitle' => __('Click to toggle', 'ayecode-connect') |
|
2283 | 2283 | ); |
2284 | 2284 | |
2285 | - return apply_filters( 'ayecode_ui_calendar_params', $params ); |
|
2285 | + return apply_filters('ayecode_ui_calendar_params', $params); |
|
2286 | 2286 | } |
2287 | 2287 | |
2288 | 2288 | /** |
@@ -2295,47 +2295,47 @@ discard block |
||
2295 | 2295 | public static function flatpickr_locale() { |
2296 | 2296 | $params = self::calendar_params(); |
2297 | 2297 | |
2298 | - if ( is_string( $params ) ) { |
|
2299 | - $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' ); |
|
2298 | + if (is_string($params)) { |
|
2299 | + $params = html_entity_decode($params, ENT_QUOTES, 'UTF-8'); |
|
2300 | 2300 | } else { |
2301 | - foreach ( (array) $params as $key => $value ) { |
|
2302 | - if ( ! is_scalar( $value ) ) { |
|
2301 | + foreach ((array) $params as $key => $value) { |
|
2302 | + if (!is_scalar($value)) { |
|
2303 | 2303 | continue; |
2304 | 2304 | } |
2305 | 2305 | |
2306 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2306 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2307 | 2307 | } |
2308 | 2308 | } |
2309 | 2309 | |
2310 | 2310 | $day_s3 = array(); |
2311 | 2311 | $day_s5 = array(); |
2312 | 2312 | |
2313 | - for ( $i = 1; $i <= 7; $i ++ ) { |
|
2314 | - $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] ); |
|
2315 | - $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] ); |
|
2313 | + for ($i = 1; $i <= 7; $i++) { |
|
2314 | + $day_s3[] = addslashes($params['day_s3_' . $i]); |
|
2315 | + $day_s5[] = addslashes($params['day_s3_' . $i]); |
|
2316 | 2316 | } |
2317 | 2317 | |
2318 | 2318 | $month_s = array(); |
2319 | 2319 | $month_long = array(); |
2320 | 2320 | |
2321 | - for ( $i = 1; $i <= 12; $i ++ ) { |
|
2322 | - $month_s[] = addslashes( $params[ 'month_s_' . $i ] ); |
|
2323 | - $month_long[] = addslashes( $params[ 'month_long_' . $i ] ); |
|
2321 | + for ($i = 1; $i <= 12; $i++) { |
|
2322 | + $month_s[] = addslashes($params['month_s_' . $i]); |
|
2323 | + $month_long[] = addslashes($params['month_long_' . $i]); |
|
2324 | 2324 | } |
2325 | 2325 | |
2326 | 2326 | ob_start(); |
2327 | - if ( 0 ) { ?><script><?php } ?> |
|
2327 | + if (0) { ?><script><?php } ?> |
|
2328 | 2328 | { |
2329 | 2329 | weekdays: { |
2330 | - shorthand: ['<?php echo implode( "','", $day_s3 ); ?>'], |
|
2331 | - longhand: ['<?php echo implode( "','", $day_s5 ); ?>'], |
|
2330 | + shorthand: ['<?php echo implode("','", $day_s3); ?>'], |
|
2331 | + longhand: ['<?php echo implode("','", $day_s5); ?>'], |
|
2332 | 2332 | }, |
2333 | 2333 | months: { |
2334 | - shorthand: ['<?php echo implode( "','", $month_s ); ?>'], |
|
2335 | - longhand: ['<?php echo implode( "','", $month_long ); ?>'], |
|
2334 | + shorthand: ['<?php echo implode("','", $month_s); ?>'], |
|
2335 | + longhand: ['<?php echo implode("','", $month_long); ?>'], |
|
2336 | 2336 | }, |
2337 | 2337 | daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31], |
2338 | - firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>, |
|
2338 | + firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>, |
|
2339 | 2339 | ordinal: function (nth) { |
2340 | 2340 | var s = nth % 100; |
2341 | 2341 | if (s > 3 && s < 21) |
@@ -2351,21 +2351,21 @@ discard block |
||
2351 | 2351 | return "th"; |
2352 | 2352 | } |
2353 | 2353 | }, |
2354 | - rangeSeparator: '<?php echo addslashes( $params[ 'rangeSeparator' ] ); ?>', |
|
2355 | - weekAbbreviation: '<?php echo addslashes( $params[ 'weekAbbreviation' ] ); ?>', |
|
2356 | - scrollTitle: '<?php echo addslashes( $params[ 'scrollTitle' ] ); ?>', |
|
2357 | - toggleTitle: '<?php echo addslashes( $params[ 'toggleTitle' ] ); ?>', |
|
2358 | - amPM: ['<?php echo addslashes( $params[ 'am_upper' ] ); ?>','<?php echo addslashes( $params[ 'pm_upper' ] ); ?>'], |
|
2359 | - yearAriaLabel: '<?php echo addslashes( $params[ 'year' ] ); ?>', |
|
2360 | - hourAriaLabel: '<?php echo addslashes( $params[ 'hour' ] ); ?>', |
|
2361 | - minuteAriaLabel: '<?php echo addslashes( $params[ 'minute' ] ); ?>', |
|
2362 | - time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?> |
|
2354 | + rangeSeparator: '<?php echo addslashes($params['rangeSeparator']); ?>', |
|
2355 | + weekAbbreviation: '<?php echo addslashes($params['weekAbbreviation']); ?>', |
|
2356 | + scrollTitle: '<?php echo addslashes($params['scrollTitle']); ?>', |
|
2357 | + toggleTitle: '<?php echo addslashes($params['toggleTitle']); ?>', |
|
2358 | + amPM: ['<?php echo addslashes($params['am_upper']); ?>','<?php echo addslashes($params['pm_upper']); ?>'], |
|
2359 | + yearAriaLabel: '<?php echo addslashes($params['year']); ?>', |
|
2360 | + hourAriaLabel: '<?php echo addslashes($params['hour']); ?>', |
|
2361 | + minuteAriaLabel: '<?php echo addslashes($params['minute']); ?>', |
|
2362 | + time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?> |
|
2363 | 2363 | } |
2364 | - <?php if ( 0 ) { ?></script><?php } ?> |
|
2364 | + <?php if (0) { ?></script><?php } ?> |
|
2365 | 2365 | <?php |
2366 | 2366 | $locale = ob_get_clean(); |
2367 | 2367 | |
2368 | - return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) ); |
|
2368 | + return apply_filters('ayecode_ui_flatpickr_locale', trim($locale)); |
|
2369 | 2369 | } |
2370 | 2370 | |
2371 | 2371 | /** |
@@ -2377,20 +2377,20 @@ discard block |
||
2377 | 2377 | */ |
2378 | 2378 | public static function select2_params() { |
2379 | 2379 | $params = array( |
2380 | - 'i18n_select_state_text' => esc_attr__( 'Select an option…', 'ayecode-connect' ), |
|
2381 | - 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'ayecode-connect' ), |
|
2382 | - 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'ayecode-connect' ), |
|
2383 | - 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'ayecode-connect' ), |
|
2384 | - 'i18n_input_too_short_n' => _x( 'Please enter %item% or more characters', 'enhanced select', 'ayecode-connect' ), |
|
2385 | - 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'ayecode-connect' ), |
|
2386 | - 'i18n_input_too_long_n' => _x( 'Please delete %item% characters', 'enhanced select', 'ayecode-connect' ), |
|
2387 | - 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'ayecode-connect' ), |
|
2388 | - 'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'ayecode-connect' ), |
|
2389 | - 'i18n_load_more' => _x( 'Loading more results…', 'enhanced select', 'ayecode-connect' ), |
|
2390 | - 'i18n_searching' => _x( 'Searching…', 'enhanced select', 'ayecode-connect' ) |
|
2380 | + 'i18n_select_state_text' => esc_attr__('Select an option…', 'ayecode-connect'), |
|
2381 | + 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'ayecode-connect'), |
|
2382 | + 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'ayecode-connect'), |
|
2383 | + 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'ayecode-connect'), |
|
2384 | + 'i18n_input_too_short_n' => _x('Please enter %item% or more characters', 'enhanced select', 'ayecode-connect'), |
|
2385 | + 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'ayecode-connect'), |
|
2386 | + 'i18n_input_too_long_n' => _x('Please delete %item% characters', 'enhanced select', 'ayecode-connect'), |
|
2387 | + 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'ayecode-connect'), |
|
2388 | + 'i18n_selection_too_long_n' => _x('You can only select %item% items', 'enhanced select', 'ayecode-connect'), |
|
2389 | + 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'ayecode-connect'), |
|
2390 | + 'i18n_searching' => _x('Searching…', 'enhanced select', 'ayecode-connect') |
|
2391 | 2391 | ); |
2392 | 2392 | |
2393 | - return apply_filters( 'ayecode_ui_select2_params', $params ); |
|
2393 | + return apply_filters('ayecode_ui_select2_params', $params); |
|
2394 | 2394 | } |
2395 | 2395 | |
2396 | 2396 | /** |
@@ -2403,17 +2403,17 @@ discard block |
||
2403 | 2403 | public static function select2_locale() { |
2404 | 2404 | $params = self::select2_params(); |
2405 | 2405 | |
2406 | - foreach ( (array) $params as $key => $value ) { |
|
2407 | - if ( ! is_scalar( $value ) ) { |
|
2406 | + foreach ((array) $params as $key => $value) { |
|
2407 | + if (!is_scalar($value)) { |
|
2408 | 2408 | continue; |
2409 | 2409 | } |
2410 | 2410 | |
2411 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2411 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2412 | 2412 | } |
2413 | 2413 | |
2414 | - $locale = json_encode( $params ); |
|
2414 | + $locale = json_encode($params); |
|
2415 | 2415 | |
2416 | - return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) ); |
|
2416 | + return apply_filters('ayecode_ui_select2_locale', trim($locale)); |
|
2417 | 2417 | } |
2418 | 2418 | |
2419 | 2419 | /** |
@@ -2426,35 +2426,35 @@ discard block |
||
2426 | 2426 | public static function timeago_locale() { |
2427 | 2427 | $params = array( |
2428 | 2428 | 'prefix_ago' => '', |
2429 | - 'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'ayecode-connect' ), |
|
2430 | - 'prefix_after' => _x( 'after', 'time ago', 'ayecode-connect' ) . ' ', |
|
2429 | + 'suffix_ago' => ' ' . _x('ago', 'time ago', 'ayecode-connect'), |
|
2430 | + 'prefix_after' => _x('after', 'time ago', 'ayecode-connect') . ' ', |
|
2431 | 2431 | 'suffix_after' => '', |
2432 | - 'seconds' => _x( 'less than a minute', 'time ago', 'ayecode-connect' ), |
|
2433 | - 'minute' => _x( 'about a minute', 'time ago', 'ayecode-connect' ), |
|
2434 | - 'minutes' => _x( '%d minutes', 'time ago', 'ayecode-connect' ), |
|
2435 | - 'hour' => _x( 'about an hour', 'time ago', 'ayecode-connect' ), |
|
2436 | - 'hours' => _x( 'about %d hours', 'time ago', 'ayecode-connect' ), |
|
2437 | - 'day' => _x( 'a day', 'time ago', 'ayecode-connect' ), |
|
2438 | - 'days' => _x( '%d days', 'time ago', 'ayecode-connect' ), |
|
2439 | - 'month' => _x( 'about a month', 'time ago', 'ayecode-connect' ), |
|
2440 | - 'months' => _x( '%d months', 'time ago', 'ayecode-connect' ), |
|
2441 | - 'year' => _x( 'about a year', 'time ago', 'ayecode-connect' ), |
|
2442 | - 'years' => _x( '%d years', 'time ago', 'ayecode-connect' ), |
|
2432 | + 'seconds' => _x('less than a minute', 'time ago', 'ayecode-connect'), |
|
2433 | + 'minute' => _x('about a minute', 'time ago', 'ayecode-connect'), |
|
2434 | + 'minutes' => _x('%d minutes', 'time ago', 'ayecode-connect'), |
|
2435 | + 'hour' => _x('about an hour', 'time ago', 'ayecode-connect'), |
|
2436 | + 'hours' => _x('about %d hours', 'time ago', 'ayecode-connect'), |
|
2437 | + 'day' => _x('a day', 'time ago', 'ayecode-connect'), |
|
2438 | + 'days' => _x('%d days', 'time ago', 'ayecode-connect'), |
|
2439 | + 'month' => _x('about a month', 'time ago', 'ayecode-connect'), |
|
2440 | + 'months' => _x('%d months', 'time ago', 'ayecode-connect'), |
|
2441 | + 'year' => _x('about a year', 'time ago', 'ayecode-connect'), |
|
2442 | + 'years' => _x('%d years', 'time ago', 'ayecode-connect'), |
|
2443 | 2443 | ); |
2444 | 2444 | |
2445 | - $params = apply_filters( 'ayecode_ui_timeago_params', $params ); |
|
2445 | + $params = apply_filters('ayecode_ui_timeago_params', $params); |
|
2446 | 2446 | |
2447 | - foreach ( (array) $params as $key => $value ) { |
|
2448 | - if ( ! is_scalar( $value ) ) { |
|
2447 | + foreach ((array) $params as $key => $value) { |
|
2448 | + if (!is_scalar($value)) { |
|
2449 | 2449 | continue; |
2450 | 2450 | } |
2451 | 2451 | |
2452 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2452 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2453 | 2453 | } |
2454 | 2454 | |
2455 | - $locale = json_encode( $params ); |
|
2455 | + $locale = json_encode($params); |
|
2456 | 2456 | |
2457 | - return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) ); |
|
2457 | + return apply_filters('ayecode_ui_timeago_locale', trim($locale)); |
|
2458 | 2458 | } |
2459 | 2459 | |
2460 | 2460 | /** |
@@ -2465,7 +2465,7 @@ discard block |
||
2465 | 2465 | * @return mixed |
2466 | 2466 | */ |
2467 | 2467 | public static function minify_js($input) { |
2468 | - if(trim($input) === "") return $input; |
|
2468 | + if (trim($input) === "") return $input; |
|
2469 | 2469 | return preg_replace( |
2470 | 2470 | array( |
2471 | 2471 | // Remove comment(s) |
@@ -2497,7 +2497,7 @@ discard block |
||
2497 | 2497 | * @return mixed |
2498 | 2498 | */ |
2499 | 2499 | public static function minify_css($input) { |
2500 | - if(trim($input) === "") return $input; |
|
2500 | + if (trim($input) === "") return $input; |
|
2501 | 2501 | return preg_replace( |
2502 | 2502 | array( |
2503 | 2503 | // Remove comment(s) |
@@ -3063,12 +3063,12 @@ discard block |
||
3063 | 3063 | }); |
3064 | 3064 | } |
3065 | 3065 | } |
3066 | - <?php do_action( 'aui_conditional_fields_js', $this ); ?> |
|
3066 | + <?php do_action('aui_conditional_fields_js', $this); ?> |
|
3067 | 3067 | </script> |
3068 | 3068 | <?php |
3069 | 3069 | $output = ob_get_clean(); |
3070 | 3070 | |
3071 | - return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) ); |
|
3071 | + return str_replace(array('<script>', '</script>'), '', self::minify_js($output)); |
|
3072 | 3072 | } |
3073 | 3073 | } |
3074 | 3074 |
@@ -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.6"; |
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,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | -if ( ! class_exists( "AyeCode_Connect_Helper" ) ) { |
|
6 | +if (!class_exists("AyeCode_Connect_Helper")) { |
|
7 | 7 | /** |
8 | 8 | * Allow the quick setup and connection of our AyeCode Connect plugin. |
9 | 9 | * |
@@ -28,50 +28,50 @@ discard block |
||
28 | 28 | * @param array $strings |
29 | 29 | * @param array $pages |
30 | 30 | */ |
31 | - public function __construct( $strings = array(), $pages = array() ) { |
|
31 | + public function __construct($strings = array(), $pages = array()) { |
|
32 | 32 | // Only fire if not localhost and the current user has the right permissions. |
33 | - if ( ! $this->is_localhost() && current_user_can( 'manage_options' ) ) { |
|
33 | + if (!$this->is_localhost() && current_user_can('manage_options')) { |
|
34 | 34 | // set default strings |
35 | 35 | $default_strings = array( |
36 | - 'connect_title' => __( "Thanks for choosing an AyeCode Product!", 'ayecode-connect' ), |
|
37 | - 'connect_external' => __( "Please confirm you wish to connect your site?", 'ayecode-connect' ), |
|
38 | - 'connect' => wp_sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", 'ayecode-connect' ), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>" ), |
|
39 | - 'connect_button' => __( "Connect Site", 'ayecode-connect' ), |
|
40 | - 'connecting_button' => __( "Connecting...", 'ayecode-connect' ), |
|
41 | - 'error_localhost' => __( "This service will only work with a live domain, not a localhost.", 'ayecode-connect' ), |
|
42 | - 'error' => __( "Something went wrong, please refresh and try again.", 'ayecode-connect' ), |
|
36 | + 'connect_title' => __("Thanks for choosing an AyeCode Product!", 'ayecode-connect'), |
|
37 | + 'connect_external' => __("Please confirm you wish to connect your site?", 'ayecode-connect'), |
|
38 | + 'connect' => wp_sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", 'ayecode-connect'), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"), |
|
39 | + 'connect_button' => __("Connect Site", 'ayecode-connect'), |
|
40 | + 'connecting_button' => __("Connecting...", 'ayecode-connect'), |
|
41 | + 'error_localhost' => __("This service will only work with a live domain, not a localhost.", 'ayecode-connect'), |
|
42 | + 'error' => __("Something went wrong, please refresh and try again.", 'ayecode-connect'), |
|
43 | 43 | ); |
44 | - $this->strings = array_merge( $default_strings, $strings ); |
|
44 | + $this->strings = array_merge($default_strings, $strings); |
|
45 | 45 | |
46 | 46 | // set default pages |
47 | 47 | $default_pages = array(); |
48 | - $this->pages = array_merge( $default_pages, $pages ); |
|
48 | + $this->pages = array_merge($default_pages, $pages); |
|
49 | 49 | |
50 | 50 | // maybe show connect site notice |
51 | - add_action( 'admin_notices', array( $this, 'ayecode_connect_install_notice' ) ); |
|
51 | + add_action('admin_notices', array($this, 'ayecode_connect_install_notice')); |
|
52 | 52 | |
53 | 53 | // add ajax action if not already added |
54 | - if ( ! has_action( 'wp_ajax_ayecode_connect_helper' ) ) { |
|
55 | - add_action( 'wp_ajax_ayecode_connect_helper', array( $this, 'ayecode_connect_install' ) ); |
|
54 | + if (!has_action('wp_ajax_ayecode_connect_helper')) { |
|
55 | + add_action('wp_ajax_ayecode_connect_helper', array($this, 'ayecode_connect_install')); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | 59 | // add ajax action if not already added |
60 | - if ( ! has_action( 'wp_ajax_nopriv_ayecode_connect_helper_installed' ) ) { |
|
61 | - add_action( 'wp_ajax_nopriv_ayecode_connect_helper_installed', array( $this, 'ayecode_connect_helper_installed' ) ); |
|
60 | + if (!has_action('wp_ajax_nopriv_ayecode_connect_helper_installed')) { |
|
61 | + add_action('wp_ajax_nopriv_ayecode_connect_helper_installed', array($this, 'ayecode_connect_helper_installed')); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Give a way to check we can connect via a external redirect. |
67 | 67 | */ |
68 | - public function ayecode_connect_helper_installed(){ |
|
68 | + public function ayecode_connect_helper_installed() { |
|
69 | 69 | $active = array( |
70 | - 'gd' => defined('GEODIRECTORY_VERSION') && version_compare(GEODIRECTORY_VERSION,'2.0.0.79','>') ? 1 : 0, |
|
71 | - 'uwp' => defined('USERSWP_VERSION') && version_compare(USERSWP_VERSION,'1.2.1.5','>') ? 1 : 0, |
|
72 | - 'wpi' => defined('WPINV_VERSION') && version_compare(WPINV_VERSION,'1.0.14','>') ? 1 : 0, |
|
70 | + 'gd' => defined('GEODIRECTORY_VERSION') && version_compare(GEODIRECTORY_VERSION, '2.0.0.79', '>') ? 1 : 0, |
|
71 | + 'uwp' => defined('USERSWP_VERSION') && version_compare(USERSWP_VERSION, '1.2.1.5', '>') ? 1 : 0, |
|
72 | + 'wpi' => defined('WPINV_VERSION') && version_compare(WPINV_VERSION, '1.0.14', '>') ? 1 : 0, |
|
73 | 73 | ); |
74 | - wp_send_json_success( $active ); |
|
74 | + wp_send_json_success($active); |
|
75 | 75 | wp_die(); |
76 | 76 | } |
77 | 77 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - private function format_plugin_slug( $key ) { |
|
86 | - $slug = explode( '/', $key ); |
|
87 | - $slug = explode( '.', end( $slug ) ); |
|
85 | + private function format_plugin_slug($key) { |
|
86 | + $slug = explode('/', $key); |
|
87 | + $slug = explode('.', end($slug)); |
|
88 | 88 | |
89 | 89 | return $slug[0]; |
90 | 90 | } |
@@ -94,45 +94,45 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function ayecode_connect_install() { |
96 | 96 | // bail if localhost |
97 | - if ( $this->is_localhost() ) { |
|
98 | - wp_send_json_error( $this->strings['error_localhost'] ); |
|
97 | + if ($this->is_localhost()) { |
|
98 | + wp_send_json_error($this->strings['error_localhost']); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // Explicitly clear the event. |
102 | - wp_clear_scheduled_hook( 'geodir_plugin_background_installer', func_get_args() ); |
|
102 | + wp_clear_scheduled_hook('geodir_plugin_background_installer', func_get_args()); |
|
103 | 103 | |
104 | 104 | $success = true; |
105 | 105 | $plugin_slug = "ayecode-connect"; |
106 | - if ( ! empty( $plugin_slug ) ) { |
|
107 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
108 | - require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
109 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
110 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
106 | + if (!empty($plugin_slug)) { |
|
107 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
108 | + require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); |
|
109 | + require_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'); |
|
110 | + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
111 | 111 | |
112 | 112 | WP_Filesystem(); |
113 | 113 | |
114 | 114 | $skin = new Automatic_Upgrader_Skin; |
115 | - $upgrader = new WP_Upgrader( $skin ); |
|
116 | - $installed_plugins = array_map( array( $this, 'format_plugin_slug' ), array_keys( get_plugins() ) ); |
|
115 | + $upgrader = new WP_Upgrader($skin); |
|
116 | + $installed_plugins = array_map(array($this, 'format_plugin_slug'), array_keys(get_plugins())); |
|
117 | 117 | $plugin_slug = $plugin_slug; |
118 | 118 | $plugin = $plugin_slug . '/' . $plugin_slug . '.php'; |
119 | 119 | $installed = false; |
120 | 120 | $activate = false; |
121 | 121 | |
122 | 122 | // See if the plugin is installed already |
123 | - if ( in_array( $plugin_slug, $installed_plugins ) ) { |
|
123 | + if (in_array($plugin_slug, $installed_plugins)) { |
|
124 | 124 | $installed = true; |
125 | - $activate = ! is_plugin_active( $plugin ); |
|
125 | + $activate = !is_plugin_active($plugin); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // Install this thing! |
129 | - if ( ! $installed ) { |
|
129 | + if (!$installed) { |
|
130 | 130 | |
131 | 131 | // Suppress feedback |
132 | 132 | ob_start(); |
133 | 133 | |
134 | 134 | try { |
135 | - $plugin_information = plugins_api( 'plugin_information', array( |
|
135 | + $plugin_information = plugins_api('plugin_information', array( |
|
136 | 136 | 'slug' => $plugin_slug, |
137 | 137 | 'fields' => array( |
138 | 138 | 'short_description' => false, |
@@ -149,26 +149,26 @@ discard block |
||
149 | 149 | 'author_profile' => false, |
150 | 150 | 'author' => false, |
151 | 151 | ), |
152 | - ) ); |
|
152 | + )); |
|
153 | 153 | |
154 | - if ( is_wp_error( $plugin_information ) ) { |
|
155 | - throw new Exception( $plugin_information->get_error_message() ); |
|
154 | + if (is_wp_error($plugin_information)) { |
|
155 | + throw new Exception($plugin_information->get_error_message()); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | $package = $plugin_information->download_link; |
159 | - $download = $upgrader->download_package( $package ); |
|
159 | + $download = $upgrader->download_package($package); |
|
160 | 160 | |
161 | - if ( is_wp_error( $download ) ) { |
|
162 | - throw new Exception( $download->get_error_message() ); |
|
161 | + if (is_wp_error($download)) { |
|
162 | + throw new Exception($download->get_error_message()); |
|
163 | 163 | } |
164 | 164 | |
165 | - $working_dir = $upgrader->unpack_package( $download, true ); |
|
165 | + $working_dir = $upgrader->unpack_package($download, true); |
|
166 | 166 | |
167 | - if ( is_wp_error( $working_dir ) ) { |
|
168 | - throw new Exception( $working_dir->get_error_message() ); |
|
167 | + if (is_wp_error($working_dir)) { |
|
168 | + throw new Exception($working_dir->get_error_message()); |
|
169 | 169 | } |
170 | 170 | |
171 | - $result = $upgrader->install_package( array( |
|
171 | + $result = $upgrader->install_package(array( |
|
172 | 172 | 'source' => $working_dir, |
173 | 173 | 'destination' => WP_PLUGIN_DIR, |
174 | 174 | 'clear_destination' => false, |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | 'type' => 'plugin', |
179 | 179 | 'action' => 'install', |
180 | 180 | ), |
181 | - ) ); |
|
181 | + )); |
|
182 | 182 | |
183 | - if ( is_wp_error( $result ) ) { |
|
184 | - throw new Exception( $result->get_error_message() ); |
|
183 | + if (is_wp_error($result)) { |
|
184 | + throw new Exception($result->get_error_message()); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | $activate = true; |
188 | 188 | |
189 | - } catch ( Exception $e ) { |
|
189 | + } catch (Exception $e) { |
|
190 | 190 | $success = false; |
191 | 191 | } |
192 | 192 | |
@@ -197,30 +197,30 @@ discard block |
||
197 | 197 | wp_clean_plugins_cache(); |
198 | 198 | |
199 | 199 | // Activate this thing |
200 | - if ( $activate ) { |
|
200 | + if ($activate) { |
|
201 | 201 | try { |
202 | - $result = activate_plugin( $plugin ); |
|
202 | + $result = activate_plugin($plugin); |
|
203 | 203 | |
204 | - if ( is_wp_error( $result ) ) { |
|
204 | + if (is_wp_error($result)) { |
|
205 | 205 | $success = false; |
206 | 206 | } else { |
207 | 207 | $success = true; |
208 | 208 | } |
209 | - } catch ( Exception $e ) { |
|
209 | + } catch (Exception $e) { |
|
210 | 210 | $success = false; |
211 | 211 | } |
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - if ( $success && function_exists( 'ayecode_connect_args' ) ) { |
|
216 | - ayecode_connect();// init |
|
215 | + if ($success && function_exists('ayecode_connect_args')) { |
|
216 | + ayecode_connect(); // init |
|
217 | 217 | $args = ayecode_connect_args(); |
218 | - $client = new AyeCode_Connect( $args ); |
|
219 | - $redirect_to = ! empty( $_POST['redirect_to'] ) ? esc_url_raw( $_POST['redirect_to'] ) : ''; |
|
220 | - $redirect = $client->build_connect_url( $redirect_to ); |
|
221 | - wp_send_json_success( array( 'connect_url' => $redirect ) ); |
|
218 | + $client = new AyeCode_Connect($args); |
|
219 | + $redirect_to = !empty($_POST['redirect_to']) ? esc_url_raw($_POST['redirect_to']) : ''; |
|
220 | + $redirect = $client->build_connect_url($redirect_to); |
|
221 | + wp_send_json_success(array('connect_url' => $redirect)); |
|
222 | 222 | } else { |
223 | - wp_send_json_error( $this->strings['error_localhost'] ); |
|
223 | + wp_send_json_error($this->strings['error_localhost']); |
|
224 | 224 | } |
225 | 225 | wp_die(); |
226 | 226 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | public function is_localhost() { |
234 | 234 | $localhost = false; |
235 | 235 | |
236 | - $host = isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : ''; |
|
236 | + $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; |
|
237 | 237 | $localhost_domains = array( |
238 | 238 | 'localhost', |
239 | 239 | 'localhost.localdomain', |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | '::1' |
242 | 242 | ); |
243 | 243 | |
244 | - if ( in_array( $host, $localhost_domains ) ) { |
|
244 | + if (in_array($host, $localhost_domains)) { |
|
245 | 245 | $localhost = true; |
246 | 246 | } |
247 | 247 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * Show notice to connect site. |
253 | 253 | */ |
254 | 254 | public function ayecode_connect_install_notice() { |
255 | - if ( $this->maybe_show() ) { |
|
255 | + if ($this->maybe_show()) { |
|
256 | 256 | $connect_title_string = $this->strings['connect_title']; |
257 | 257 | $connect_external_string = $this->strings['connect_external']; |
258 | 258 | $connect_string = $this->strings['connect']; |
@@ -294,19 +294,19 @@ discard block |
||
294 | 294 | </svg> |
295 | 295 | </span> |
296 | 296 | <span class="acch-float-left acch-text"> |
297 | - <h3 class="acch-title"><?php echo esc_attr( $connect_title_string ); ?></h3> |
|
297 | + <h3 class="acch-title"><?php echo esc_attr($connect_title_string); ?></h3> |
|
298 | 298 | <p><?php echo $connect_string; ?> |
299 | 299 | </p> |
300 | 300 | </span> |
301 | 301 | |
302 | 302 | <span class="acch-float-left acch-button"> |
303 | - <button onclick="ayecode_connect_helper(this);" id="gd-connect-site" class="button button-primary" data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button> |
|
303 | + <button onclick="ayecode_connect_helper(this);" id="gd-connect-site" class="button button-primary" data-connecting="<?php echo esc_attr($connecting_button_string); ?>"><?php echo esc_attr($connect_button_string) ?></button> |
|
304 | 304 | </span> |
305 | 305 | </div> |
306 | 306 | |
307 | 307 | <?php |
308 | 308 | // only include the popup HTML if needed. |
309 | - if ( ! empty( $_REQUEST['external-connect-request'] ) ) { |
|
309 | + if (!empty($_REQUEST['external-connect-request'])) { |
|
310 | 310 | ?> |
311 | 311 | <div id="ayecode-connect-helper-external-confirm" style="display:none;"> |
312 | 312 | <div class="noticex notice-info acch-notice" style="border: none;"> |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | </svg> |
345 | 345 | </span> |
346 | 346 | <span class="acch-float-left acch-text"> |
347 | - <h3 class="acch-title"><?php echo esc_attr( $connect_external_string ); ?></h3> |
|
347 | + <h3 class="acch-title"><?php echo esc_attr($connect_external_string); ?></h3> |
|
348 | 348 | </span> |
349 | 349 | |
350 | 350 | <span class="acch-float-left acch-button"> |
351 | - <button onclick="ayecode_connect_helper(this);" id="gd-connect-site" class="button button-primary" data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button> |
|
351 | + <button onclick="ayecode_connect_helper(this);" id="gd-connect-site" class="button button-primary" data-connecting="<?php echo esc_attr($connecting_button_string); ?>"><?php echo esc_attr($connect_button_string) ?></button> |
|
352 | 352 | </span> |
353 | 353 | </div> |
354 | 354 | </div> |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | public function script() { |
367 | 367 | |
368 | 368 | // add thickbox if external request is requested |
369 | - if ( ! empty( $_REQUEST['external-connect-request'] ) ) { |
|
369 | + if (!empty($_REQUEST['external-connect-request'])) { |
|
370 | 370 | add_thickbox(); |
371 | 371 | } |
372 | 372 | ?> |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | url: ajaxurl, |
418 | 418 | data: { |
419 | 419 | action: 'ayecode_connect_helper', |
420 | - security: '<?php echo wp_create_nonce( 'ayecode-connect-helper' );?>', |
|
420 | + security: '<?php echo wp_create_nonce('ayecode-connect-helper'); ?>', |
|
421 | 421 | redirect_to: $current_url |
422 | 422 | }, |
423 | 423 | beforeSend: function () { |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | } |
437 | 437 | <?php |
438 | 438 | // add thickbox if external request is requested |
439 | - if(! empty( $_REQUEST['external-connect-request'] )) { |
|
439 | + if (!empty($_REQUEST['external-connect-request'])) { |
|
440 | 440 | ?> |
441 | 441 | jQuery(function () { |
442 | 442 | setTimeout(function () { |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | $show = false; |
460 | 460 | |
461 | 461 | // check if on a page set to show |
462 | - if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], $this->pages ) ) { |
|
462 | + if (isset($_REQUEST['page']) && in_array($_REQUEST['page'], $this->pages)) { |
|
463 | 463 | // check if not active and connected |
464 | - if ( ! defined( 'AYECODE_CONNECT_VERSION' ) || ! get_option( 'ayecode_connect_blog_token' ) ) { |
|
464 | + if (!defined('AYECODE_CONNECT_VERSION') || !get_option('ayecode_connect_blog_token')) { |
|
465 | 465 | $show = true; |
466 | 466 | } |
467 | 467 | } |
@@ -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( 'WP_Font_Awesome_Settings' ) ) { |
|
22 | +if (!class_exists('WP_Font_Awesome_Settings')) { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * A Class to be able to change settings for Font Awesome. |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | * @return WP_Font_Awesome_Settings - Main instance. |
83 | 83 | */ |
84 | 84 | public static function instance() { |
85 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) { |
|
85 | + if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) { |
|
86 | 86 | self::$instance = new WP_Font_Awesome_Settings; |
87 | 87 | |
88 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
88 | + add_action('init', array(self::$instance, 'init')); // set settings |
|
89 | 89 | |
90 | - if ( is_admin() ) { |
|
91 | - add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
92 | - add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
93 | - add_action( 'admin_init', array( self::$instance, 'constants' ) ); |
|
94 | - add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) ); |
|
90 | + if (is_admin()) { |
|
91 | + add_action('admin_menu', array(self::$instance, 'menu_item')); |
|
92 | + add_action('admin_init', array(self::$instance, 'register_settings')); |
|
93 | + add_action('admin_init', array(self::$instance, 'constants')); |
|
94 | + add_action('admin_notices', array(self::$instance, 'admin_notices')); |
|
95 | 95 | } |
96 | 96 | |
97 | - do_action( 'wp_font_awesome_settings_loaded' ); |
|
97 | + do_action('wp_font_awesome_settings_loaded'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | return self::$instance; |
@@ -105,26 +105,26 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return void |
107 | 107 | */ |
108 | - public function constants(){ |
|
108 | + public function constants() { |
|
109 | 109 | |
110 | 110 | // register iconpicker constant |
111 | - if ( ! defined( 'FAS_ICONPICKER_JS_URL' ) ) { |
|
111 | + if (!defined('FAS_ICONPICKER_JS_URL')) { |
|
112 | 112 | $url = $this->get_path_url(); |
113 | 113 | $version = $this->settings['version']; |
114 | 114 | |
115 | - if( !$version || version_compare($version,'5.999','>')){ |
|
115 | + if (!$version || version_compare($version, '5.999', '>')) { |
|
116 | 116 | $url .= 'assets/js/fa-iconpicker-v6.min.js'; |
117 | - }else{ |
|
117 | + } else { |
|
118 | 118 | $url .= 'assets/js/fa-iconpicker-v5.min.js'; |
119 | 119 | } |
120 | 120 | |
121 | - define( 'FAS_ICONPICKER_JS_URL', $url ); |
|
121 | + define('FAS_ICONPICKER_JS_URL', $url); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | 125 | // Set a constant if pro enbaled |
126 | - if ( ! defined( 'FAS_PRO' ) && $this->settings['pro'] ) { |
|
127 | - define( 'FAS_PRO', true ); |
|
126 | + if (!defined('FAS_PRO') && $this->settings['pro']) { |
|
127 | + define('FAS_PRO', true); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -134,19 +134,19 @@ discard block |
||
134 | 134 | * @return string |
135 | 135 | */ |
136 | 136 | public function get_path_url() { |
137 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
138 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
137 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
138 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
139 | 139 | |
140 | 140 | // Replace http:// to https://. |
141 | - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { |
|
142 | - $content_url = str_replace( 'http://', 'https://', $content_url ); |
|
141 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
142 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | // Check if we are inside a plugin |
146 | - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
147 | - $url = str_replace( $content_dir, $content_url, $file_dir ); |
|
146 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
147 | + $url = str_replace($content_dir, $content_url, $file_dir); |
|
148 | 148 | |
149 | - return trailingslashit( $url ); |
|
149 | + return trailingslashit($url); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -156,45 +156,45 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function init() { |
158 | 158 | // Download fontawesome locally. |
159 | - add_action( 'add_option_wp-font-awesome-settings', array( $this, 'add_option_wp_font_awesome_settings' ), 10, 2 ); |
|
160 | - add_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 ); |
|
159 | + add_action('add_option_wp-font-awesome-settings', array($this, 'add_option_wp_font_awesome_settings'), 10, 2); |
|
160 | + add_action('update_option_wp-font-awesome-settings', array($this, 'update_option_wp_font_awesome_settings'), 10, 2); |
|
161 | 161 | |
162 | 162 | $this->settings = $this->get_settings(); |
163 | 163 | |
164 | 164 | // Check if the official plugin is active and use that instead if so. |
165 | - if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
166 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
167 | - add_action( 'admin_head', array( $this, 'add_generator' ), 99 ); |
|
165 | + if (!defined('FONTAWESOME_PLUGIN_FILE')) { |
|
166 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
167 | + add_action('admin_head', array($this, 'add_generator'), 99); |
|
168 | 168 | } |
169 | 169 | |
170 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
171 | - add_action( 'wp_head', array( $this, 'add_generator' ), 99 ); |
|
170 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
171 | + add_action('wp_head', array($this, 'add_generator'), 99); |
|
172 | 172 | } |
173 | 173 | |
174 | - if ( $this->settings['type'] == 'CSS' ) { |
|
175 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
176 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
174 | + if ($this->settings['type'] == 'CSS') { |
|
175 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
176 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000); |
|
177 | 177 | //add_action( 'wp_footer', array( $this, 'enqueue_style' ), 5000 ); // not sure why this was added, seems to break frontend |
178 | 178 | } |
179 | 179 | |
180 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
181 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
182 | - add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_styles' ), 10, 2 ); |
|
180 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
181 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000); |
|
182 | + add_filter('block_editor_settings_all', array($this, 'enqueue_editor_styles'), 10, 2); |
|
183 | 183 | } |
184 | 184 | } else { |
185 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
186 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
185 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
186 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); |
|
187 | 187 | } |
188 | 188 | |
189 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
190 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
191 | - add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_scripts' ), 10, 2 ); |
|
189 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
190 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); |
|
191 | + add_filter('block_editor_settings_all', array($this, 'enqueue_editor_scripts'), 10, 2); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | 195 | // remove font awesome if set to do so |
196 | - if ( $this->settings['dequeue'] == '1' ) { |
|
197 | - add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 ); |
|
196 | + if ($this->settings['dequeue'] == '1') { |
|
197 | + add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return array |
210 | 210 | */ |
211 | - public function enqueue_editor_styles( $editor_settings, $block_editor_context ){ |
|
211 | + public function enqueue_editor_styles($editor_settings, $block_editor_context) { |
|
212 | 212 | |
213 | - if ( ! empty( $editor_settings['__unstableResolvedAssets']['styles'] ) ) { |
|
213 | + if (!empty($editor_settings['__unstableResolvedAssets']['styles'])) { |
|
214 | 214 | $url = $this->get_url(); |
215 | 215 | $editor_settings['__unstableResolvedAssets']['styles'] .= "<link rel='stylesheet' id='font-awesome-css' href='$url' media='all' />"; |
216 | 216 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return array |
228 | 228 | */ |
229 | - public function enqueue_editor_scripts( $editor_settings, $block_editor_context ){ |
|
229 | + public function enqueue_editor_scripts($editor_settings, $block_editor_context) { |
|
230 | 230 | |
231 | 231 | $url = $this->get_url(); |
232 | 232 | $editor_settings['__unstableResolvedAssets']['scripts'] .= "<script src='$url' id='font-awesome-js'></script>"; |
@@ -240,22 +240,22 @@ discard block |
||
240 | 240 | public function enqueue_style() { |
241 | 241 | // build url |
242 | 242 | $url = $this->get_url(); |
243 | - $version = ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ? strip_tags( $this->settings['local_version'] ) : null; |
|
243 | + $version = !empty($this->settings['local']) && empty($this->settings['pro']) ? strip_tags($this->settings['local_version']) : null; |
|
244 | 244 | |
245 | - wp_deregister_style( 'font-awesome' ); // deregister in case its already there |
|
246 | - wp_register_style( 'font-awesome', $url, array(), $version ); |
|
247 | - wp_enqueue_style( 'font-awesome' ); |
|
245 | + wp_deregister_style('font-awesome'); // deregister in case its already there |
|
246 | + wp_register_style('font-awesome', $url, array(), $version); |
|
247 | + wp_enqueue_style('font-awesome'); |
|
248 | 248 | |
249 | 249 | // RTL language support CSS. |
250 | - if ( is_rtl() ) { |
|
251 | - wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() ); |
|
250 | + if (is_rtl()) { |
|
251 | + wp_add_inline_style('font-awesome', $this->rtl_inline_css()); |
|
252 | 252 | } |
253 | 253 | |
254 | - if ( $this->settings['shims'] ) { |
|
255 | - $url = $this->get_url( true ); |
|
256 | - wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there |
|
257 | - wp_register_style( 'font-awesome-shims', $url, array(), $version ); |
|
258 | - wp_enqueue_style( 'font-awesome-shims' ); |
|
254 | + if ($this->settings['shims']) { |
|
255 | + $url = $this->get_url(true); |
|
256 | + wp_deregister_style('font-awesome-shims'); // deregister in case its already there |
|
257 | + wp_register_style('font-awesome-shims', $url, array(), $version); |
|
258 | + wp_enqueue_style('font-awesome-shims'); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
@@ -267,15 +267,15 @@ discard block |
||
267 | 267 | $url = $this->get_url(); |
268 | 268 | |
269 | 269 | $deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script'; |
270 | - call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there |
|
271 | - wp_register_script( 'font-awesome', $url, array(), null ); |
|
272 | - wp_enqueue_script( 'font-awesome' ); |
|
270 | + call_user_func($deregister_function, 'font-awesome'); // deregister in case its already there |
|
271 | + wp_register_script('font-awesome', $url, array(), null); |
|
272 | + wp_enqueue_script('font-awesome'); |
|
273 | 273 | |
274 | - if ( $this->settings['shims'] ) { |
|
275 | - $url = $this->get_url( true ); |
|
276 | - call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there |
|
277 | - wp_register_script( 'font-awesome-shims', $url, array(), null ); |
|
278 | - wp_enqueue_script( 'font-awesome-shims' ); |
|
274 | + if ($this->settings['shims']) { |
|
275 | + $url = $this->get_url(true); |
|
276 | + call_user_func($deregister_function, 'font-awesome-shims'); // deregister in case its already there |
|
277 | + wp_register_script('font-awesome-shims', $url, array(), null); |
|
278 | + wp_enqueue_script('font-awesome-shims'); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
@@ -287,16 +287,16 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @return string The url to the file. |
289 | 289 | */ |
290 | - public function get_url( $shims = false, $local = true ) { |
|
290 | + public function get_url($shims = false, $local = true) { |
|
291 | 291 | $script = $shims ? 'v4-shims' : 'all'; |
292 | 292 | $sub = $this->settings['pro'] ? 'pro' : 'use'; |
293 | 293 | $type = $this->settings['type']; |
294 | 294 | $version = $this->settings['version']; |
295 | - $kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : ''; |
|
295 | + $kit_url = $this->settings['kit-url'] ? esc_url($this->settings['kit-url']) : ''; |
|
296 | 296 | $url = ''; |
297 | 297 | |
298 | - if ( $type == 'KIT' && $kit_url ) { |
|
299 | - if ( $shims ) { |
|
298 | + if ($type == 'KIT' && $kit_url) { |
|
299 | + if ($shims) { |
|
300 | 300 | // if its a kit then we don't add shims here |
301 | 301 | return ''; |
302 | 302 | } |
@@ -305,13 +305,13 @@ discard block |
||
305 | 305 | } else { |
306 | 306 | $v = ''; |
307 | 307 | // Check and load locally. |
308 | - if ( $local && $this->has_local() ) { |
|
308 | + if ($local && $this->has_local()) { |
|
309 | 309 | $script .= ".min"; |
310 | - $v .= '&ver=' . strip_tags( $this->settings['local_version'] ); |
|
310 | + $v .= '&ver=' . strip_tags($this->settings['local_version']); |
|
311 | 311 | $url .= $this->get_fonts_url(); // Local fonts url. |
312 | 312 | } else { |
313 | 313 | $url .= "https://$sub.fontawesome.com/releases/"; // CDN |
314 | - $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
314 | + $url .= !empty($version) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
315 | 315 | } |
316 | 316 | $url .= $type == 'CSS' ? 'css/' : 'js/'; // type |
317 | 317 | $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @return string The filtered url. |
334 | 334 | */ |
335 | - public function remove_font_awesome( $url, $original_url, $_context ) { |
|
335 | + public function remove_font_awesome($url, $original_url, $_context) { |
|
336 | 336 | |
337 | - if ( $_context == 'display' |
|
338 | - && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false ) |
|
339 | - && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false ) |
|
337 | + if ($_context == 'display' |
|
338 | + && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false) |
|
339 | + && (strstr($url, ".js") !== false || strstr($url, ".css") !== false) |
|
340 | 340 | ) {// it's a font-awesome-url (probably) |
341 | 341 | |
342 | - if ( strstr( $url, "wpfas=true" ) !== false ) { |
|
343 | - if ( $this->settings['type'] == 'JS' ) { |
|
344 | - if ( $this->settings['js-pseudo'] ) { |
|
342 | + if (strstr($url, "wpfas=true") !== false) { |
|
343 | + if ($this->settings['type'] == 'JS') { |
|
344 | + if ($this->settings['js-pseudo']) { |
|
345 | 345 | $url .= "' data-search-pseudo-elements defer='defer"; |
346 | 346 | } else { |
347 | 347 | $url .= "' defer='defer"; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * Register the database settings with WordPress. |
361 | 361 | */ |
362 | 362 | public function register_settings() { |
363 | - register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' ); |
|
363 | + register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings'); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -369,10 +369,10 @@ discard block |
||
369 | 369 | */ |
370 | 370 | public function menu_item() { |
371 | 371 | $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
372 | - call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
372 | + call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
373 | 373 | $this, |
374 | 374 | 'settings_page' |
375 | - ) ); |
|
375 | + )); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @return array The array of settings. |
382 | 382 | */ |
383 | 383 | public function get_settings() { |
384 | - $db_settings = get_option( 'wp-font-awesome-settings' ); |
|
384 | + $db_settings = get_option('wp-font-awesome-settings'); |
|
385 | 385 | |
386 | 386 | $defaults = array( |
387 | 387 | 'type' => 'CSS', // type to use, CSS or JS or KIT |
@@ -396,30 +396,30 @@ discard block |
||
396 | 396 | 'kit-url' => '', // the kit url |
397 | 397 | ); |
398 | 398 | |
399 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
399 | + $settings = wp_parse_args($db_settings, $defaults); |
|
400 | 400 | |
401 | 401 | /** |
402 | 402 | * Filter the Font Awesome settings. |
403 | 403 | * |
404 | 404 | * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
405 | 405 | */ |
406 | - return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults ); |
|
406 | + return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
410 | 410 | * The settings page html output. |
411 | 411 | */ |
412 | 412 | public function settings_page() { |
413 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
414 | - wp_die( __( 'You do not have sufficient permissions to access this page.', 'ayecode-connect' ) ); |
|
413 | + if (!current_user_can('manage_options')) { |
|
414 | + wp_die(__('You do not have sufficient permissions to access this page.', 'ayecode-connect')); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | // a hidden way to force the update of the version number via api instead of waiting the 48 hours |
418 | - if ( isset( $_REQUEST['force-version-check'] ) ) { |
|
419 | - $this->get_latest_version( $force_api = true ); |
|
418 | + if (isset($_REQUEST['force-version-check'])) { |
|
419 | + $this->get_latest_version($force_api = true); |
|
420 | 420 | } |
421 | 421 | |
422 | - if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
422 | + if (!defined('FONTAWESOME_PLUGIN_FILE')) { |
|
423 | 423 | ?> |
424 | 424 | <style> |
425 | 425 | .wpfas-kit-show { |
@@ -446,42 +446,42 @@ discard block |
||
446 | 446 | <h1><?php echo $this->name; ?></h1> |
447 | 447 | <form method="post" action="options.php" class="fas-settings-form"> |
448 | 448 | <?php |
449 | - settings_fields( 'wp-font-awesome-settings' ); |
|
450 | - do_settings_sections( 'wp-font-awesome-settings' ); |
|
449 | + settings_fields('wp-font-awesome-settings'); |
|
450 | + do_settings_sections('wp-font-awesome-settings'); |
|
451 | 451 | $table_class = ''; |
452 | - if ( $this->settings['type'] ) { |
|
453 | - $table_class .= 'wpfas-' . sanitize_html_class( strtolower( $this->settings['type'] ) ) . '-set'; |
|
452 | + if ($this->settings['type']) { |
|
453 | + $table_class .= 'wpfas-' . sanitize_html_class(strtolower($this->settings['type'])) . '-set'; |
|
454 | 454 | } |
455 | - if ( ! empty( $this->settings['pro'] ) ) { |
|
455 | + if (!empty($this->settings['pro'])) { |
|
456 | 456 | $table_class .= ' wpfas-has-pro'; |
457 | 457 | } |
458 | 458 | ?> |
459 | - <?php if ( $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ) { ?> |
|
460 | - <?php if ( $this->has_local() ) { ?> |
|
461 | - <div class="notice notice-info"><p><strong><?php _e( 'Font Awesome fonts are loading locally.', 'ayecode-connect' ); ?></strong></p></div> |
|
459 | + <?php if ($this->settings['type'] != 'KIT' && !empty($this->settings['local']) && empty($this->settings['pro'])) { ?> |
|
460 | + <?php if ($this->has_local()) { ?> |
|
461 | + <div class="notice notice-info"><p><strong><?php _e('Font Awesome fonts are loading locally.', 'ayecode-connect'); ?></strong></p></div> |
|
462 | 462 | <?php } else { ?> |
463 | - <div class="notice notice-error"><p><strong><?php _e( 'Font Awesome fonts are not loading locally!', 'ayecode-connect' ); ?></strong></p></div> |
|
463 | + <div class="notice notice-error"><p><strong><?php _e('Font Awesome fonts are not loading locally!', 'ayecode-connect'); ?></strong></p></div> |
|
464 | 464 | <?php } ?> |
465 | 465 | <?php } ?> |
466 | - <table class="form-table wpfas-table-settings <?php echo esc_attr( $table_class ); ?>"> |
|
466 | + <table class="form-table wpfas-table-settings <?php echo esc_attr($table_class); ?>"> |
|
467 | 467 | <tr valign="top"> |
468 | - <th scope="row"><label for="wpfas-type"><?php _e( 'Type', 'ayecode-connect' ); ?></label></th> |
|
468 | + <th scope="row"><label for="wpfas-type"><?php _e('Type', 'ayecode-connect'); ?></label></th> |
|
469 | 469 | <td> |
470 | 470 | <select name="wp-font-awesome-settings[type]" id="wpfas-type" onchange="if(this.value=='KIT'){jQuery('.wpfas-table-settings').addClass('wpfas-kit-set');}else{jQuery('.wpfas-table-settings').removeClass('wpfas-kit-set');}"> |
471 | - <option value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)', 'ayecode-connect' ); ?></option> |
|
472 | - <option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option> |
|
473 | - <option value="KIT" <?php selected( $this->settings['type'], 'KIT' ); ?>><?php _e( 'Kits (settings managed on fontawesome.com)', 'ayecode-connect' ); ?></option> |
|
471 | + <option value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)', 'ayecode-connect'); ?></option> |
|
472 | + <option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option> |
|
473 | + <option value="KIT" <?php selected($this->settings['type'], 'KIT'); ?>><?php _e('Kits (settings managed on fontawesome.com)', 'ayecode-connect'); ?></option> |
|
474 | 474 | </select> |
475 | 475 | </td> |
476 | 476 | </tr> |
477 | 477 | |
478 | 478 | <tr valign="top" class="wpfas-kit-show"> |
479 | - <th scope="row"><label for="wpfas-kit-url"><?php _e( 'Kit URL', 'ayecode-connect' ); ?></label></th> |
|
479 | + <th scope="row"><label for="wpfas-kit-url"><?php _e('Kit URL', 'ayecode-connect'); ?></label></th> |
|
480 | 480 | <td> |
481 | - <input class="regular-text" id="wpfas-kit-url" type="url" name="wp-font-awesome-settings[kit-url]" value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>" placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/> |
|
481 | + <input class="regular-text" id="wpfas-kit-url" type="url" name="wp-font-awesome-settings[kit-url]" value="<?php echo esc_attr($this->settings['kit-url']); ?>" placeholder="<?php echo 'https://kit.font'; echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/> |
|
482 | 482 | <span><?php |
483 | 483 | echo wp_sprintf( |
484 | - __( 'Requires a free account with Font Awesome. %sGet kit url%s', 'ayecode-connect' ), |
|
484 | + __('Requires a free account with Font Awesome. %sGet kit url%s', 'ayecode-connect'), |
|
485 | 485 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>', |
486 | 486 | '</a>' |
487 | 487 | ); |
@@ -490,44 +490,44 @@ discard block |
||
490 | 490 | </tr> |
491 | 491 | |
492 | 492 | <tr valign="top" class="wpfas-kit-hide"> |
493 | - <th scope="row"><label for="wpfas-version"><?php _e( 'Version', 'ayecode-connect' ); ?></label></th> |
|
493 | + <th scope="row"><label for="wpfas-version"><?php _e('Version', 'ayecode-connect'); ?></label></th> |
|
494 | 494 | <td> |
495 | 495 | <select name="wp-font-awesome-settings[version]" id="wpfas-version"> |
496 | - <option value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo wp_sprintf( __( 'Latest - %s (default)', 'ayecode-connect' ), $this->get_latest_version() ); ?></option> |
|
497 | - <option value="6.1.0" <?php selected( $this->settings['version'], '6.1.0' ); ?>>6.1.0</option> |
|
498 | - <option value="6.0.0" <?php selected( $this->settings['version'], '6.0.0' ); ?>>6.0.0</option> |
|
499 | - <option value="5.15.4" <?php selected( $this->settings['version'], '5.15.4' ); ?>>5.15.4</option> |
|
500 | - <option value="5.6.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>>5.6.0</option> |
|
501 | - <option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>>5.5.0</option> |
|
502 | - <option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>>5.4.0</option> |
|
503 | - <option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>>5.3.0</option> |
|
504 | - <option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>>5.2.0</option> |
|
505 | - <option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>>5.1.0</option> |
|
506 | - <option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>>4.7.1 (CSS only)</option> |
|
496 | + <option value="" <?php selected($this->settings['version'], ''); ?>><?php echo wp_sprintf(__('Latest - %s (default)', 'ayecode-connect'), $this->get_latest_version()); ?></option> |
|
497 | + <option value="6.1.0" <?php selected($this->settings['version'], '6.1.0'); ?>>6.1.0</option> |
|
498 | + <option value="6.0.0" <?php selected($this->settings['version'], '6.0.0'); ?>>6.0.0</option> |
|
499 | + <option value="5.15.4" <?php selected($this->settings['version'], '5.15.4'); ?>>5.15.4</option> |
|
500 | + <option value="5.6.0" <?php selected($this->settings['version'], '5.6.0'); ?>>5.6.0</option> |
|
501 | + <option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>>5.5.0</option> |
|
502 | + <option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>>5.4.0</option> |
|
503 | + <option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>>5.3.0</option> |
|
504 | + <option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>>5.2.0</option> |
|
505 | + <option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>>5.1.0</option> |
|
506 | + <option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>>4.7.1 (CSS only)</option> |
|
507 | 507 | </select> |
508 | 508 | </td> |
509 | 509 | </tr> |
510 | 510 | |
511 | 511 | <tr valign="top"> |
512 | - <th scope="row"><label for="wpfas-enqueue"><?php _e( 'Enqueue', 'ayecode-connect' ); ?></label></th> |
|
512 | + <th scope="row"><label for="wpfas-enqueue"><?php _e('Enqueue', 'ayecode-connect'); ?></label></th> |
|
513 | 513 | <td> |
514 | 514 | <select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue"> |
515 | - <option value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)', 'ayecode-connect' ); ?></option> |
|
516 | - <option value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend', 'ayecode-connect' ); ?></option> |
|
517 | - <option value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend', 'ayecode-connect' ); ?></option> |
|
515 | + <option value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)', 'ayecode-connect'); ?></option> |
|
516 | + <option value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend', 'ayecode-connect'); ?></option> |
|
517 | + <option value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend', 'ayecode-connect'); ?></option> |
|
518 | 518 | </select> |
519 | 519 | </td> |
520 | 520 | </tr> |
521 | 521 | |
522 | 522 | <tr valign="top" class="wpfas-kit-hide"> |
523 | 523 | <th scope="row"><label |
524 | - for="wpfas-pro"><?php _e( 'Enable pro', 'ayecode-connect' ); ?></label></th> |
|
524 | + for="wpfas-pro"><?php _e('Enable pro', 'ayecode-connect'); ?></label></th> |
|
525 | 525 | <td> |
526 | 526 | <input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/> |
527 | - <input type="checkbox" name="wp-font-awesome-settings[pro]" value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro" onchange="if(jQuery(this).is(':checked')){jQuery('.wpfas-table-settings').addClass('wpfas-has-pro')}else{jQuery('.wpfas-table-settings').removeClass('wpfas-has-pro')}"/> |
|
527 | + <input type="checkbox" name="wp-font-awesome-settings[pro]" value="1" <?php checked($this->settings['pro'], '1'); ?> id="wpfas-pro" onchange="if(jQuery(this).is(':checked')){jQuery('.wpfas-table-settings').addClass('wpfas-has-pro')}else{jQuery('.wpfas-table-settings').removeClass('wpfas-has-pro')}"/> |
|
528 | 528 | <span><?php |
529 | 529 | echo wp_sprintf( |
530 | - __( 'Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'ayecode-connect' ), |
|
530 | + __('Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'ayecode-connect'), |
|
531 | 531 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">', |
532 | 532 | ' <i class="fas fa-external-link-alt"></i></a>', |
533 | 533 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">', |
@@ -538,49 +538,49 @@ discard block |
||
538 | 538 | </tr> |
539 | 539 | |
540 | 540 | <tr valign="top" class="wpfas-kit-hide wpfas-hide-pro"> |
541 | - <th scope="row"><label for="wpfas-local"><?php _e( 'Load Fonts Locally', 'ayecode-connect' ); ?></label></th> |
|
541 | + <th scope="row"><label for="wpfas-local"><?php _e('Load Fonts Locally', 'ayecode-connect'); ?></label></th> |
|
542 | 542 | <td> |
543 | 543 | <input type="hidden" name="wp-font-awesome-settings[local]" value="0"/> |
544 | - <input type="hidden" name="wp-font-awesome-settings[local_version]" value="<?php echo esc_attr( $this->settings['local_version'] ); ?>"/> |
|
545 | - <input type="checkbox" name="wp-font-awesome-settings[local]" value="1" <?php checked( $this->settings['local'], '1' ); ?> id="wpfas-local"/> |
|
546 | - <span><?php _e( '(For free version only) Load FontAwesome fonts from locally. This downloads FontAwesome fonts from fontawesome.com & stores at the local site.', 'ayecode-connect' ); ?></span> |
|
544 | + <input type="hidden" name="wp-font-awesome-settings[local_version]" value="<?php echo esc_attr($this->settings['local_version']); ?>"/> |
|
545 | + <input type="checkbox" name="wp-font-awesome-settings[local]" value="1" <?php checked($this->settings['local'], '1'); ?> id="wpfas-local"/> |
|
546 | + <span><?php _e('(For free version only) Load FontAwesome fonts from locally. This downloads FontAwesome fonts from fontawesome.com & stores at the local site.', 'ayecode-connect'); ?></span> |
|
547 | 547 | </td> |
548 | 548 | </tr> |
549 | 549 | |
550 | 550 | <tr valign="top" class="wpfas-kit-hide"> |
551 | 551 | <th scope="row"><label |
552 | - for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility', 'ayecode-connect' ); ?></label> |
|
552 | + for="wpfas-shims"><?php _e('Enable v4 shims compatibility', 'ayecode-connect'); ?></label> |
|
553 | 553 | </th> |
554 | 554 | <td> |
555 | 555 | <input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/> |
556 | 556 | <input type="checkbox" name="wp-font-awesome-settings[shims]" |
557 | - value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/> |
|
558 | - <span><?php _e( 'This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'ayecode-connect' ); ?></span> |
|
557 | + value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/> |
|
558 | + <span><?php _e('This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'ayecode-connect'); ?></span> |
|
559 | 559 | </td> |
560 | 560 | </tr> |
561 | 561 | |
562 | 562 | <tr valign="top" class="wpfas-kit-hide"> |
563 | 563 | <th scope="row"><label |
564 | - for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)', 'ayecode-connect' ); ?></label> |
|
564 | + for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)', 'ayecode-connect'); ?></label> |
|
565 | 565 | </th> |
566 | 566 | <td> |
567 | 567 | <input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/> |
568 | 568 | <input type="checkbox" name="wp-font-awesome-settings[js-pseudo]" |
569 | - value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?> |
|
569 | + value="1" <?php checked($this->settings['js-pseudo'], '1'); ?> |
|
570 | 570 | id="wpfas-js-pseudo"/> |
571 | - <span><?php _e( 'Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'ayecode-connect' ); ?></span> |
|
571 | + <span><?php _e('Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'ayecode-connect'); ?></span> |
|
572 | 572 | </td> |
573 | 573 | </tr> |
574 | 574 | |
575 | 575 | <tr valign="top"> |
576 | 576 | <th scope="row"><label |
577 | - for="wpfas-dequeue"><?php _e( 'Dequeue', 'ayecode-connect' ); ?></label></th> |
|
577 | + for="wpfas-dequeue"><?php _e('Dequeue', 'ayecode-connect'); ?></label></th> |
|
578 | 578 | <td> |
579 | 579 | <input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/> |
580 | 580 | <input type="checkbox" name="wp-font-awesome-settings[dequeue]" |
581 | - value="1" <?php checked( $this->settings['dequeue'], '1' ); ?> |
|
581 | + value="1" <?php checked($this->settings['dequeue'], '1'); ?> |
|
582 | 582 | id="wpfas-dequeue"/> |
583 | - <span><?php _e( 'This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'ayecode-connect' ); ?></span> |
|
583 | + <span><?php _e('This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'ayecode-connect'); ?></span> |
|
584 | 584 | </td> |
585 | 585 | </tr> |
586 | 586 | |
@@ -589,12 +589,12 @@ discard block |
||
589 | 589 | <?php |
590 | 590 | submit_button(); |
591 | 591 | ?> |
592 | - <p class="submit"><a href="https://fontawesome.com/referral?a=c9b89e1418" class="button button-secondary"><?php _e('Get 24,000+ more icons with Font Awesome Pro','ayecode-connect'); ?> <i class="fas fa-external-link-alt"></i></a></p> |
|
592 | + <p class="submit"><a href="https://fontawesome.com/referral?a=c9b89e1418" class="button button-secondary"><?php _e('Get 24,000+ more icons with Font Awesome Pro', 'ayecode-connect'); ?> <i class="fas fa-external-link-alt"></i></a></p> |
|
593 | 593 | |
594 | 594 | </div> |
595 | 595 | </form> |
596 | 596 | |
597 | - <div id="wpfas-version"><?php echo wp_sprintf(__( 'Version: %s (affiliate links provided)', 'ayecode-connect' ), $this->version ); ?></div> |
|
597 | + <div id="wpfas-version"><?php echo wp_sprintf(__('Version: %s (affiliate links provided)', 'ayecode-connect'), $this->version); ?></div> |
|
598 | 598 | </div> |
599 | 599 | <?php |
600 | 600 | } |
@@ -609,12 +609,12 @@ discard block |
||
609 | 609 | * |
610 | 610 | * @return string Either a valid version number or an empty string. |
611 | 611 | */ |
612 | - public function validate_version_number( $version ) { |
|
612 | + public function validate_version_number($version) { |
|
613 | 613 | |
614 | - if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) { |
|
614 | + if (version_compare($version, '0.0.1', '>=') >= 0) { |
|
615 | 615 | // valid |
616 | 616 | } else { |
617 | - $version = '';// not validated |
|
617 | + $version = ''; // not validated |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | return $version; |
@@ -629,27 +629,27 @@ discard block |
||
629 | 629 | * @since 1.0.7 |
630 | 630 | * @return mixed|string The latest version number found. |
631 | 631 | */ |
632 | - public function get_latest_version( $force_api = false ) { |
|
632 | + public function get_latest_version($force_api = false) { |
|
633 | 633 | $latest_version = $this->latest; |
634 | 634 | |
635 | - $cache = get_transient( 'wp-font-awesome-settings-version' ); |
|
635 | + $cache = get_transient('wp-font-awesome-settings-version'); |
|
636 | 636 | |
637 | - if ( $cache === false || $force_api ) { // its not set |
|
637 | + if ($cache === false || $force_api) { // its not set |
|
638 | 638 | $api_ver = $this->get_latest_version_from_api(); |
639 | - if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) { |
|
639 | + if (version_compare($api_ver, $this->latest, '>=') >= 0) { |
|
640 | 640 | $latest_version = $api_ver; |
641 | - set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS ); |
|
641 | + set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS); |
|
642 | 642 | } |
643 | - } elseif ( $this->validate_version_number( $cache ) ) { |
|
644 | - if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) { |
|
643 | + } elseif ($this->validate_version_number($cache)) { |
|
644 | + if (version_compare($cache, $this->latest, '>=') >= 0) { |
|
645 | 645 | $latest_version = $cache; |
646 | 646 | } |
647 | 647 | } |
648 | 648 | |
649 | 649 | // Check and auto download fonts locally. |
650 | - if ( empty( $this->settings['pro'] ) && empty( $this->settings['version'] ) && $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && ! empty( $this->settings['local_version'] ) && ! empty( $latest_version ) ) { |
|
651 | - if ( version_compare( $latest_version, $this->settings['local_version'], '>' ) && is_admin() && ! wp_doing_ajax() ) { |
|
652 | - $this->download_package( $latest_version ); |
|
650 | + if (empty($this->settings['pro']) && empty($this->settings['version']) && $this->settings['type'] != 'KIT' && !empty($this->settings['local']) && !empty($this->settings['local_version']) && !empty($latest_version)) { |
|
651 | + if (version_compare($latest_version, $this->settings['local_version'], '>') && is_admin() && !wp_doing_ajax()) { |
|
652 | + $this->download_package($latest_version); |
|
653 | 653 | } |
654 | 654 | } |
655 | 655 | |
@@ -664,10 +664,10 @@ discard block |
||
664 | 664 | */ |
665 | 665 | public function get_latest_version_from_api() { |
666 | 666 | $version = "0"; |
667 | - $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" ); |
|
668 | - if ( ! is_wp_error( $response ) && is_array( $response ) ) { |
|
669 | - $api_response = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
670 | - if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) { |
|
667 | + $response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest"); |
|
668 | + if (!is_wp_error($response) && is_array($response)) { |
|
669 | + $api_response = json_decode(wp_remote_retrieve_body($response), true); |
|
670 | + if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) { |
|
671 | 671 | $version = $api_response['tag_name']; |
672 | 672 | } |
673 | 673 | } |
@@ -695,21 +695,21 @@ discard block |
||
695 | 695 | public function admin_notices() { |
696 | 696 | $settings = $this->settings; |
697 | 697 | |
698 | - if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
699 | - if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) { |
|
698 | + if (defined('FONTAWESOME_PLUGIN_FILE')) { |
|
699 | + if (!empty($_REQUEST['page']) && $_REQUEST['page'] == 'wp-font-awesome-settings') { |
|
700 | 700 | ?> |
701 | 701 | <div class="notice notice-error is-dismissible"> |
702 | - <p><?php _e( 'The Official Font Awesome Plugin is active, please adjust your settings there.', 'ayecode-connect' ); ?></p> |
|
702 | + <p><?php _e('The Official Font Awesome Plugin is active, please adjust your settings there.', 'ayecode-connect'); ?></p> |
|
703 | 703 | </div> |
704 | 704 | <?php |
705 | 705 | } |
706 | 706 | } else { |
707 | - if ( ! empty( $settings ) ) { |
|
708 | - if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) { |
|
707 | + if (!empty($settings)) { |
|
708 | + if ($settings['type'] != 'KIT' && $settings['pro'] && ($settings['version'] == '' || version_compare($settings['version'], '6', '>='))) { |
|
709 | 709 | $link = admin_url('options-general.php?page=wp-font-awesome-settings'); |
710 | 710 | ?> |
711 | 711 | <div class="notice notice-error is-dismissible"> |
712 | - <p><?php echo wp_sprintf( __( 'Font Awesome Pro v6 requires the use of a kit, please setup your kit in %ssettings.%s', 'ayecode-connect' ),"<a href='". esc_url_raw( $link )."'>","</a>" ); ?></p> |
|
712 | + <p><?php echo wp_sprintf(__('Font Awesome Pro v6 requires the use of a kit, please setup your kit in %ssettings.%s', 'ayecode-connect'), "<a href='" . esc_url_raw($link) . "'>", "</a>"); ?></p> |
|
713 | 713 | </div> |
714 | 714 | <?php |
715 | 715 | } |
@@ -725,20 +725,20 @@ discard block |
||
725 | 725 | * @param string $option The option name. |
726 | 726 | * @param mixed $value The option value. |
727 | 727 | */ |
728 | - public function add_option_wp_font_awesome_settings( $option, $value ) { |
|
728 | + public function add_option_wp_font_awesome_settings($option, $value) { |
|
729 | 729 | // Do nothing if WordPress is being installed. |
730 | - if ( wp_installing() ) { |
|
730 | + if (wp_installing()) { |
|
731 | 731 | return; |
732 | 732 | } |
733 | 733 | |
734 | - if ( ! empty( $value['local'] ) && empty( $value['pro'] ) && ! ( ! empty( $value['type'] ) && $value['type'] == 'KIT' ) ) { |
|
735 | - $version = isset( $value['version'] ) && $value['version'] ? $value['version'] : $this->get_latest_version(); |
|
734 | + if (!empty($value['local']) && empty($value['pro']) && !(!empty($value['type']) && $value['type'] == 'KIT')) { |
|
735 | + $version = isset($value['version']) && $value['version'] ? $value['version'] : $this->get_latest_version(); |
|
736 | 736 | |
737 | - if ( ! empty( $version ) ) { |
|
738 | - $response = $this->download_package( $version, $value ); |
|
737 | + if (!empty($version)) { |
|
738 | + $response = $this->download_package($version, $value); |
|
739 | 739 | |
740 | - if ( is_wp_error( $response ) ) { |
|
741 | - add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'ayecode-connect' ) . ' ' . $response->get_error_message(), 'error' ); |
|
740 | + if (is_wp_error($response)) { |
|
741 | + add_settings_error('general', 'fontawesome_download', __('ERROR:', 'ayecode-connect') . ' ' . $response->get_error_message(), 'error'); |
|
742 | 742 | } |
743 | 743 | } |
744 | 744 | } |
@@ -752,25 +752,25 @@ discard block |
||
752 | 752 | * @param mixed $old_value The old option value. |
753 | 753 | * @param mixed $value The new option value. |
754 | 754 | */ |
755 | - public function update_option_wp_font_awesome_settings( $old_value, $new_value ) { |
|
755 | + public function update_option_wp_font_awesome_settings($old_value, $new_value) { |
|
756 | 756 | // Do nothing if WordPress is being installed. |
757 | - if ( wp_installing() ) { |
|
757 | + if (wp_installing()) { |
|
758 | 758 | return; |
759 | 759 | } |
760 | 760 | |
761 | - if ( ! empty( $new_value['local'] ) && empty( $new_value['pro'] ) && ! ( ! empty( $new_value['type'] ) && $new_value['type'] == 'KIT' ) ) { |
|
761 | + if (!empty($new_value['local']) && empty($new_value['pro']) && !(!empty($new_value['type']) && $new_value['type'] == 'KIT')) { |
|
762 | 762 | // Old values |
763 | - $old_version = isset( $old_value['version'] ) && $old_value['version'] ? $old_value['version'] : ( isset( $old_value['local_version'] ) ? $old_value['local_version'] : '' ); |
|
764 | - $old_local = isset( $old_value['local'] ) ? (int) $old_value['local'] : 0; |
|
763 | + $old_version = isset($old_value['version']) && $old_value['version'] ? $old_value['version'] : (isset($old_value['local_version']) ? $old_value['local_version'] : ''); |
|
764 | + $old_local = isset($old_value['local']) ? (int) $old_value['local'] : 0; |
|
765 | 765 | |
766 | 766 | // New values |
767 | - $new_version = isset( $new_value['version'] ) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version(); |
|
767 | + $new_version = isset($new_value['version']) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version(); |
|
768 | 768 | |
769 | - if ( empty( $old_local ) || $old_version !== $new_version || ! file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) { |
|
770 | - $response = $this->download_package( $new_version, $new_value ); |
|
769 | + if (empty($old_local) || $old_version !== $new_version || !file_exists($this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css')) { |
|
770 | + $response = $this->download_package($new_version, $new_value); |
|
771 | 771 | |
772 | - if ( is_wp_error( $response ) ) { |
|
773 | - add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'ayecode-connect' ) . ' ' . $response->get_error_message(), 'error' ); |
|
772 | + if (is_wp_error($response)) { |
|
773 | + add_settings_error('general', 'fontawesome_download', __('ERROR:', 'ayecode-connect') . ' ' . $response->get_error_message(), 'error'); |
|
774 | 774 | } |
775 | 775 | } |
776 | 776 | } |
@@ -784,9 +784,9 @@ discard block |
||
784 | 784 | * @param string Fonts directory local path. |
785 | 785 | */ |
786 | 786 | public function get_fonts_dir() { |
787 | - $upload_dir = wp_upload_dir( null, false ); |
|
787 | + $upload_dir = wp_upload_dir(null, false); |
|
788 | 788 | |
789 | - return $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR; |
|
789 | + return $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | /** |
@@ -797,9 +797,9 @@ discard block |
||
797 | 797 | * @param string Fonts directory local url. |
798 | 798 | */ |
799 | 799 | public function get_fonts_url() { |
800 | - $upload_dir = wp_upload_dir( null, false ); |
|
800 | + $upload_dir = wp_upload_dir(null, false); |
|
801 | 801 | |
802 | - return $upload_dir['baseurl'] . '/ayefonts/fa/'; |
|
802 | + return $upload_dir['baseurl'] . '/ayefonts/fa/'; |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | /** |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | * @return bool True if active else false. |
811 | 811 | */ |
812 | 812 | public function has_local() { |
813 | - if ( ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) && file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) { |
|
813 | + if (!empty($this->settings['local']) && empty($this->settings['pro']) && file_exists($this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css')) { |
|
814 | 814 | return true; |
815 | 815 | } |
816 | 816 | |
@@ -825,18 +825,18 @@ discard block |
||
825 | 825 | * @return object The WP Filesystem. |
826 | 826 | */ |
827 | 827 | public function get_wp_filesystem() { |
828 | - if ( ! function_exists( 'get_filesystem_method' ) ) { |
|
829 | - require_once( ABSPATH . "/wp-admin/includes/file.php" ); |
|
828 | + if (!function_exists('get_filesystem_method')) { |
|
829 | + require_once(ABSPATH . "/wp-admin/includes/file.php"); |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | $access_type = get_filesystem_method(); |
833 | 833 | |
834 | - if ( $access_type === 'direct' ) { |
|
834 | + if ($access_type === 'direct') { |
|
835 | 835 | /* You can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */ |
836 | - $creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() ); |
|
836 | + $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
837 | 837 | |
838 | 838 | /* Initialize the API */ |
839 | - if ( ! WP_Filesystem( $creds ) ) { |
|
839 | + if (!WP_Filesystem($creds)) { |
|
840 | 840 | /* Any problems and we exit */ |
841 | 841 | return false; |
842 | 842 | } |
@@ -845,11 +845,11 @@ discard block |
||
845 | 845 | |
846 | 846 | return $wp_filesystem; |
847 | 847 | /* Do our file manipulations below */ |
848 | - } else if ( defined( 'FTP_USER' ) ) { |
|
849 | - $creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() ); |
|
848 | + } else if (defined('FTP_USER')) { |
|
849 | + $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array()); |
|
850 | 850 | |
851 | 851 | /* Initialize the API */ |
852 | - if ( ! WP_Filesystem( $creds ) ) { |
|
852 | + if (!WP_Filesystem($creds)) { |
|
853 | 853 | /* Any problems and we exit */ |
854 | 854 | return false; |
855 | 855 | } |
@@ -872,38 +872,38 @@ discard block |
||
872 | 872 | * @param array $option Fontawesome settings. |
873 | 873 | * @return WP_ERROR|bool Error on fail and true on success. |
874 | 874 | */ |
875 | - public function download_package( $version, $option = array() ) { |
|
875 | + public function download_package($version, $option = array()) { |
|
876 | 876 | $filename = 'fontawesome-free-' . $version . '-web'; |
877 | 877 | $url = 'https://use.fontawesome.com/releases/v' . $version . '/' . $filename . '.zip'; |
878 | 878 | |
879 | - if ( ! function_exists( 'wp_handle_upload' ) ) { |
|
879 | + if (!function_exists('wp_handle_upload')) { |
|
880 | 880 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
881 | 881 | } |
882 | 882 | |
883 | - $download_file = download_url( esc_url_raw( $url ) ); |
|
883 | + $download_file = download_url(esc_url_raw($url)); |
|
884 | 884 | |
885 | - if ( is_wp_error( $download_file ) ) { |
|
886 | - return new WP_Error( 'fontawesome_download_failed', __( $download_file->get_error_message(), 'ayecode-connect' ) ); |
|
887 | - } else if ( empty( $download_file ) ) { |
|
888 | - return new WP_Error( 'fontawesome_download_failed', __( 'Something went wrong in downloading the font awesome to store locally.', 'ayecode-connect' ) ); |
|
885 | + if (is_wp_error($download_file)) { |
|
886 | + return new WP_Error('fontawesome_download_failed', __($download_file->get_error_message(), 'ayecode-connect')); |
|
887 | + } else if (empty($download_file)) { |
|
888 | + return new WP_Error('fontawesome_download_failed', __('Something went wrong in downloading the font awesome to store locally.', 'ayecode-connect')); |
|
889 | 889 | } |
890 | 890 | |
891 | - $response = $this->extract_package( $download_file, $filename, true ); |
|
891 | + $response = $this->extract_package($download_file, $filename, true); |
|
892 | 892 | |
893 | 893 | // Update local version. |
894 | - if ( is_wp_error( $response ) ) { |
|
894 | + if (is_wp_error($response)) { |
|
895 | 895 | return $response; |
896 | - } else if ( $response ) { |
|
897 | - if ( empty( $option ) ) { |
|
898 | - $option = get_option( 'wp-font-awesome-settings' ); |
|
896 | + } else if ($response) { |
|
897 | + if (empty($option)) { |
|
898 | + $option = get_option('wp-font-awesome-settings'); |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | $option['local_version'] = $version; |
902 | 902 | |
903 | 903 | // Remove action to prevent looping. |
904 | - remove_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 ); |
|
904 | + remove_action('update_option_wp-font-awesome-settings', array($this, 'update_option_wp_font_awesome_settings'), 10, 2); |
|
905 | 905 | |
906 | - update_option( 'wp-font-awesome-settings', $option ); |
|
906 | + update_option('wp-font-awesome-settings', $option); |
|
907 | 907 | |
908 | 908 | return true; |
909 | 909 | } |
@@ -921,60 +921,60 @@ discard block |
||
921 | 921 | * @param bool $delete_package Delete temp file or not. |
922 | 922 | * @return WP_Error|bool True on success WP_Error on fail. |
923 | 923 | */ |
924 | - public function extract_package( $package, $dirname = '', $delete_package = false ) { |
|
924 | + public function extract_package($package, $dirname = '', $delete_package = false) { |
|
925 | 925 | global $wp_filesystem; |
926 | 926 | |
927 | 927 | $wp_filesystem = $this->get_wp_filesystem(); |
928 | 928 | |
929 | - if ( empty( $wp_filesystem ) && isset( $wp_filesystem->errors ) && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) { |
|
930 | - return new WP_Error( 'fontawesome_filesystem_error', __( $wp_filesystem->errors->get_error_message(), 'ayecode-connect' ) ); |
|
931 | - } else if ( empty( $wp_filesystem ) ) { |
|
932 | - return new WP_Error( 'fontawesome_filesystem_error', __( 'Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'ayecode-connect' ) ); |
|
929 | + if (empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) { |
|
930 | + return new WP_Error('fontawesome_filesystem_error', __($wp_filesystem->errors->get_error_message(), 'ayecode-connect')); |
|
931 | + } else if (empty($wp_filesystem)) { |
|
932 | + return new WP_Error('fontawesome_filesystem_error', __('Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'ayecode-connect')); |
|
933 | 933 | } |
934 | 934 | |
935 | 935 | $fonts_dir = $this->get_fonts_dir(); |
936 | - $fonts_tmp_dir = dirname( $fonts_dir ) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR; |
|
936 | + $fonts_tmp_dir = dirname($fonts_dir) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR; |
|
937 | 937 | |
938 | - if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) { |
|
939 | - $wp_filesystem->delete( $fonts_tmp_dir, true ); |
|
938 | + if ($wp_filesystem->is_dir($fonts_tmp_dir)) { |
|
939 | + $wp_filesystem->delete($fonts_tmp_dir, true); |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | // Unzip package to working directory. |
943 | - $result = unzip_file( $package, $fonts_tmp_dir ); |
|
943 | + $result = unzip_file($package, $fonts_tmp_dir); |
|
944 | 944 | |
945 | - if ( is_wp_error( $result ) ) { |
|
946 | - $wp_filesystem->delete( $fonts_tmp_dir, true ); |
|
945 | + if (is_wp_error($result)) { |
|
946 | + $wp_filesystem->delete($fonts_tmp_dir, true); |
|
947 | 947 | |
948 | - if ( 'incompatible_archive' === $result->get_error_code() ) { |
|
949 | - return new WP_Error( 'fontawesome_incompatible_archive', __( $result->get_error_message(), 'ayecode-connect' ) ); |
|
948 | + if ('incompatible_archive' === $result->get_error_code()) { |
|
949 | + return new WP_Error('fontawesome_incompatible_archive', __($result->get_error_message(), 'ayecode-connect')); |
|
950 | 950 | } |
951 | 951 | |
952 | 952 | return $result; |
953 | 953 | } |
954 | 954 | |
955 | - if ( $wp_filesystem->is_dir( $fonts_dir ) ) { |
|
956 | - $wp_filesystem->delete( $fonts_dir, true ); |
|
955 | + if ($wp_filesystem->is_dir($fonts_dir)) { |
|
956 | + $wp_filesystem->delete($fonts_dir, true); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | $extract_dir = $fonts_tmp_dir; |
960 | 960 | |
961 | - if ( $dirname && $wp_filesystem->is_dir( $extract_dir . $dirname . DIRECTORY_SEPARATOR ) ) { |
|
961 | + if ($dirname && $wp_filesystem->is_dir($extract_dir . $dirname . DIRECTORY_SEPARATOR)) { |
|
962 | 962 | $extract_dir .= $dirname . DIRECTORY_SEPARATOR; |
963 | 963 | } |
964 | 964 | |
965 | 965 | try { |
966 | - $return = $wp_filesystem->move( $extract_dir, $fonts_dir, true ); |
|
967 | - } catch ( Exception $e ) { |
|
968 | - $return = new WP_Error( 'fontawesome_move_package', __( 'Fail to move font awesome package!', 'ayecode-connect' ) ); |
|
966 | + $return = $wp_filesystem->move($extract_dir, $fonts_dir, true); |
|
967 | + } catch (Exception $e) { |
|
968 | + $return = new WP_Error('fontawesome_move_package', __('Fail to move font awesome package!', 'ayecode-connect')); |
|
969 | 969 | } |
970 | 970 | |
971 | - if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) { |
|
972 | - $wp_filesystem->delete( $fonts_tmp_dir, true ); |
|
971 | + if ($wp_filesystem->is_dir($fonts_tmp_dir)) { |
|
972 | + $wp_filesystem->delete($fonts_tmp_dir, true); |
|
973 | 973 | } |
974 | 974 | |
975 | 975 | // Once extracted, delete the package if required. |
976 | - if ( $delete_package ) { |
|
977 | - unlink( $package ); |
|
976 | + if ($delete_package) { |
|
977 | + unlink($package); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | return $return; |
@@ -984,22 +984,22 @@ discard block |
||
984 | 984 | * Output the version in the header. |
985 | 985 | */ |
986 | 986 | public function add_generator() { |
987 | - $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) ); |
|
988 | - $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) ); |
|
987 | + $file = str_replace(array("/", "\\"), "/", realpath(__FILE__)); |
|
988 | + $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR)); |
|
989 | 989 | |
990 | 990 | // Find source plugin/theme. |
991 | 991 | $source = array(); |
992 | - if ( strpos( $file, $plugins_dir ) !== false ) { |
|
993 | - $source = explode( "/", plugin_basename( $file ) ); |
|
994 | - } else if ( function_exists( 'get_theme_root' ) ) { |
|
995 | - $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) ); |
|
992 | + if (strpos($file, $plugins_dir) !== false) { |
|
993 | + $source = explode("/", plugin_basename($file)); |
|
994 | + } else if (function_exists('get_theme_root')) { |
|
995 | + $themes_dir = str_replace(array("/", "\\"), "/", realpath(get_theme_root())); |
|
996 | 996 | |
997 | - if ( strpos( $file, $themes_dir ) !== false ) { |
|
998 | - $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) ); |
|
997 | + if (strpos($file, $themes_dir) !== false) { |
|
998 | + $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/")); |
|
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | |
1002 | - echo '<meta name="generator" content="WP Font Awesome Settings v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-ac-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />'; |
|
1002 | + echo '<meta name="generator" content="WP Font Awesome Settings v' . esc_attr($this->version) . '"' . (!empty($source[0]) ? ' data-ac-source="' . esc_attr($source[0]) . '"' : '') . ' />'; |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; |
5 | 5 | } |
6 | 6 | |
7 | -if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) { |
|
7 | +if (!class_exists('AyeCode_Deactivation_Survey')) { |
|
8 | 8 | |
9 | 9 | class AyeCode_Deactivation_Survey { |
10 | 10 | |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | |
22 | 22 | public $version = "1.0.7"; |
23 | 23 | |
24 | - public static function instance( $plugin = array() ) { |
|
25 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_Deactivation_Survey ) ) { |
|
24 | + public static function instance($plugin = array()) { |
|
25 | + if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_Deactivation_Survey)) { |
|
26 | 26 | self::$instance = new AyeCode_Deactivation_Survey; |
27 | 27 | self::$plugins = array(); |
28 | 28 | |
29 | - add_action( 'admin_enqueue_scripts', array( self::$instance, 'scripts' ) ); |
|
29 | + add_action('admin_enqueue_scripts', array(self::$instance, 'scripts')); |
|
30 | 30 | |
31 | - do_action( 'ayecode_deactivation_survey_loaded' ); |
|
31 | + do_action('ayecode_deactivation_survey_loaded'); |
|
32 | 32 | } |
33 | 33 | |
34 | - if(!empty($plugin)){ |
|
35 | - self::$plugins[] = (object)$plugin; |
|
34 | + if (!empty($plugin)) { |
|
35 | + self::$plugins[] = (object) $plugin; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | return self::$instance; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | global $pagenow; |
43 | 43 | |
44 | 44 | // Bail if we are not on the plugins page |
45 | - if ( $pagenow != "plugins.php" ) { |
|
45 | + if ($pagenow != "plugins.php") { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
@@ -55,19 +55,19 @@ discard block |
||
55 | 55 | * We deliberately don't add textdomains here so that double textdomain warning is not given in theme review. |
56 | 56 | */ |
57 | 57 | wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_strings', array( |
58 | - 'quick_feedback' => __( 'Quick Feedback', 'ayecode-connect' ), |
|
59 | - 'foreword' => __( 'If you would be kind enough, please tell us why you\'re deactivating?', 'ayecode-connect' ), |
|
60 | - 'better_plugins_name' => __( 'Please tell us which plugin?', 'ayecode-connect' ), |
|
61 | - 'please_tell_us' => __( 'Please tell us the reason so we can improve the plugin', 'ayecode-connect' ), |
|
62 | - 'do_not_attach_email' => __( 'Do not send my e-mail address with this feedback', 'ayecode-connect' ), |
|
63 | - 'brief_description' => __( 'Please give us any feedback that could help us improve', 'ayecode-connect' ), |
|
64 | - 'cancel' => __( 'Cancel', 'ayecode-connect' ), |
|
65 | - 'skip_and_deactivate' => __( 'Skip & Deactivate', 'ayecode-connect' ), |
|
66 | - 'submit_and_deactivate' => __( 'Submit & Deactivate', 'ayecode-connect' ), |
|
67 | - 'please_wait' => __( 'Please wait', 'ayecode-connect' ), |
|
68 | - 'get_support' => __( 'Get Support', 'ayecode-connect' ), |
|
69 | - 'documentation' => __( 'Documentation', 'ayecode-connect' ), |
|
70 | - 'thank_you' => __( 'Thank you!', 'ayecode-connect' ), |
|
58 | + 'quick_feedback' => __('Quick Feedback', 'ayecode-connect'), |
|
59 | + 'foreword' => __('If you would be kind enough, please tell us why you\'re deactivating?', 'ayecode-connect'), |
|
60 | + 'better_plugins_name' => __('Please tell us which plugin?', 'ayecode-connect'), |
|
61 | + 'please_tell_us' => __('Please tell us the reason so we can improve the plugin', 'ayecode-connect'), |
|
62 | + 'do_not_attach_email' => __('Do not send my e-mail address with this feedback', 'ayecode-connect'), |
|
63 | + 'brief_description' => __('Please give us any feedback that could help us improve', 'ayecode-connect'), |
|
64 | + 'cancel' => __('Cancel', 'ayecode-connect'), |
|
65 | + 'skip_and_deactivate' => __('Skip & Deactivate', 'ayecode-connect'), |
|
66 | + 'submit_and_deactivate' => __('Submit & Deactivate', 'ayecode-connect'), |
|
67 | + 'please_wait' => __('Please wait', 'ayecode-connect'), |
|
68 | + 'get_support' => __('Get Support', 'ayecode-connect'), |
|
69 | + 'documentation' => __('Documentation', 'ayecode-connect'), |
|
70 | + 'thank_you' => __('Thank you!', 'ayecode-connect'), |
|
71 | 71 | )); |
72 | 72 | |
73 | 73 | // Plugins |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | // Reasons |
77 | 77 | $defaultReasons = array( |
78 | - 'suddenly-stopped-working' => __( 'The plugin suddenly stopped working', 'ayecode-connect' ), |
|
79 | - 'plugin-broke-site' => __( 'The plugin broke my site', 'ayecode-connect' ), |
|
80 | - 'plugin-setup-difficult' => __( 'Too difficult to setup', 'ayecode-connect' ), |
|
81 | - 'plugin-design-difficult' => __( 'Too difficult to get the design i want', 'ayecode-connect' ), |
|
82 | - 'no-longer-needed' => __( 'I don\'t need this plugin any more', 'ayecode-connect' ), |
|
83 | - 'found-better-plugin' => __( 'I found a better plugin', 'ayecode-connect' ), |
|
84 | - 'temporary-deactivation' => __( 'It\'s a temporary deactivation, I\'m troubleshooting', 'ayecode-connect' ), |
|
85 | - 'other' => __( 'Other', 'ayecode-connect' ), |
|
78 | + 'suddenly-stopped-working' => __('The plugin suddenly stopped working', 'ayecode-connect'), |
|
79 | + 'plugin-broke-site' => __('The plugin broke my site', 'ayecode-connect'), |
|
80 | + 'plugin-setup-difficult' => __('Too difficult to setup', 'ayecode-connect'), |
|
81 | + 'plugin-design-difficult' => __('Too difficult to get the design i want', 'ayecode-connect'), |
|
82 | + 'no-longer-needed' => __('I don\'t need this plugin any more', 'ayecode-connect'), |
|
83 | + 'found-better-plugin' => __('I found a better plugin', 'ayecode-connect'), |
|
84 | + 'temporary-deactivation' => __('It\'s a temporary deactivation, I\'m troubleshooting', 'ayecode-connect'), |
|
85 | + 'other' => __('Other', 'ayecode-connect'), |
|
86 | 86 | ); |
87 | 87 | |
88 | - foreach( $plugins as $plugin ) { |
|
89 | - $plugin->reasons = apply_filters( 'ayecode_deactivation_survey_reasons', $defaultReasons, $plugin ); |
|
88 | + foreach ($plugins as $plugin) { |
|
89 | + $plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin); |
|
90 | 90 | $plugin->url = home_url(); |
91 | 91 | $plugin->activated = 0; |
92 | 92 | } |