@@ -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 | $defaults = array( |
| 23 | 23 | 'type' => 'text', |
| 24 | 24 | 'name' => '', |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * Parse incoming $args into an array and merge it with $defaults |
| 54 | 54 | */ |
| 55 | - $args = wp_parse_args( $args, $defaults ); |
|
| 55 | + $args = wp_parse_args($args, $defaults); |
|
| 56 | 56 | $output = ''; |
| 57 | - if ( ! empty( $args['type'] ) ) { |
|
| 57 | + if (!empty($args['type'])) { |
|
| 58 | 58 | // hidden label option needs to be empty |
| 59 | 59 | $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type']; |
| 60 | 60 | |
| 61 | - $type = sanitize_html_class( $args['type'] ); |
|
| 61 | + $type = sanitize_html_class($args['type']); |
|
| 62 | 62 | |
| 63 | 63 | $help_text = ''; |
| 64 | 64 | $label = ''; |
@@ -66,24 +66,24 @@ discard block |
||
| 66 | 66 | $label_args = array( |
| 67 | 67 | 'title'=> $args['label'], |
| 68 | 68 | 'for'=> $args['id'], |
| 69 | - 'class' => $args['label_class']." ", |
|
| 69 | + 'class' => $args['label_class'] . " ", |
|
| 70 | 70 | 'label_type' => $args['label_type'] |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | // floating labels need label after |
| 74 | - if( $args['label_type'] == 'floating' && $type != 'checkbox' ){ |
|
| 74 | + if ($args['label_type'] == 'floating' && $type != 'checkbox') { |
|
| 75 | 75 | $label_after = true; |
| 76 | 76 | $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works. |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // Some special sauce for files |
| 80 | - if($type=='file' ){ |
|
| 80 | + if ($type == 'file') { |
|
| 81 | 81 | $label_after = true; // if type file we need the label after |
| 82 | 82 | $args['class'] .= ' custom-file-input '; |
| 83 | - }elseif($type=='checkbox'){ |
|
| 83 | + }elseif ($type == 'checkbox') { |
|
| 84 | 84 | $label_after = true; // if type file we need the label after |
| 85 | 85 | $args['class'] .= ' custom-control-input '; |
| 86 | - }elseif($type=='datepicker' || $type=='timepicker'){ |
|
| 86 | + }elseif ($type == 'datepicker' || $type == 'timepicker') { |
|
| 87 | 87 | $type = 'text'; |
| 88 | 88 | //$args['class'] .= ' aui-flatpickr bg-initial '; |
| 89 | 89 | $args['class'] .= ' bg-initial '; |
@@ -99,65 +99,65 @@ discard block |
||
| 99 | 99 | $output .= '<input type="' . $type . '" '; |
| 100 | 100 | |
| 101 | 101 | // name |
| 102 | - if(!empty($args['name'])){ |
|
| 103 | - $output .= ' name="'.esc_attr($args['name']).'" '; |
|
| 102 | + if (!empty($args['name'])) { |
|
| 103 | + $output .= ' name="' . esc_attr($args['name']) . '" '; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // id |
| 107 | - if(!empty($args['id'])){ |
|
| 108 | - $output .= ' id="'.sanitize_html_class($args['id']).'" '; |
|
| 107 | + if (!empty($args['id'])) { |
|
| 108 | + $output .= ' id="' . sanitize_html_class($args['id']) . '" '; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // placeholder |
| 112 | - if(isset($args['placeholder']) && '' != $args['placeholder'] ){ |
|
| 113 | - $output .= ' placeholder="'.esc_attr($args['placeholder']).'" '; |
|
| 112 | + if (isset($args['placeholder']) && '' != $args['placeholder']) { |
|
| 113 | + $output .= ' placeholder="' . esc_attr($args['placeholder']) . '" '; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // title |
| 117 | - if(!empty($args['title'])){ |
|
| 118 | - $output .= ' title="'.esc_attr($args['title']).'" '; |
|
| 117 | + if (!empty($args['title'])) { |
|
| 118 | + $output .= ' title="' . esc_attr($args['title']) . '" '; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // value |
| 122 | - if(!empty($args['value'])){ |
|
| 122 | + if (!empty($args['value'])) { |
|
| 123 | 123 | $output .= AUI_Component_Helper::value($args['value']); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // checked, for radio and checkboxes |
| 127 | - if( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ){ |
|
| 127 | + if (($type == 'checkbox' || $type == 'radio') && $args['checked']) { |
|
| 128 | 128 | $output .= ' checked '; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // validation text |
| 132 | - if(!empty($args['validation_text'])){ |
|
| 133 | - $output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" '; |
|
| 132 | + if (!empty($args['validation_text'])) { |
|
| 133 | + $output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" '; |
|
| 134 | 134 | $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" '; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // validation_pattern |
| 138 | - if(!empty($args['validation_pattern'])){ |
|
| 139 | - $output .= ' pattern="'.$args['validation_pattern'].'" '; |
|
| 138 | + if (!empty($args['validation_pattern'])) { |
|
| 139 | + $output .= ' pattern="' . $args['validation_pattern'] . '" '; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // step (for numbers) |
| 143 | - if(!empty($args['step'])){ |
|
| 144 | - $output .= ' step="'.$args['step'].'" '; |
|
| 143 | + if (!empty($args['step'])) { |
|
| 144 | + $output .= ' step="' . $args['step'] . '" '; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // required |
| 148 | - if(!empty($args['required'])){ |
|
| 148 | + if (!empty($args['required'])) { |
|
| 149 | 149 | $output .= ' required '; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // class |
| 153 | - $class = !empty($args['class']) ? AUI_Component_Helper::esc_classes( $args['class'] ) : ''; |
|
| 154 | - $output .= ' class="form-control '.$class.'" '; |
|
| 153 | + $class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : ''; |
|
| 154 | + $output .= ' class="form-control ' . $class . '" '; |
|
| 155 | 155 | |
| 156 | 156 | // data-attributes |
| 157 | 157 | $output .= AUI_Component_Helper::data_attributes($args); |
| 158 | 158 | |
| 159 | 159 | // extra attributes |
| 160 | - if(!empty($args['extra_attributes'])){ |
|
| 160 | + if (!empty($args['extra_attributes'])) { |
|
| 161 | 161 | $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -166,40 +166,40 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | |
| 168 | 168 | // label |
| 169 | - if(!empty($args['label'])){ |
|
| 170 | - if($type == 'file'){$label_args['class'] .= 'custom-file-label';} |
|
| 171 | - elseif($type == 'checkbox'){$label_args['class'] .= 'custom-control-label';} |
|
| 172 | - $label = self::label( $label_args, $type ); |
|
| 169 | + if (!empty($args['label'])) { |
|
| 170 | + if ($type == 'file') {$label_args['class'] .= 'custom-file-label'; } |
|
| 171 | + elseif ($type == 'checkbox') {$label_args['class'] .= 'custom-control-label'; } |
|
| 172 | + $label = self::label($label_args, $type); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // help text |
| 176 | - if(!empty($args['help_text'])){ |
|
| 176 | + if (!empty($args['help_text'])) { |
|
| 177 | 177 | $help_text = AUI_Component_Helper::help_text($args['help_text']); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | // set help text in the correct possition |
| 182 | - if($label_after){ |
|
| 182 | + if ($label_after) { |
|
| 183 | 183 | $output .= $label . $help_text; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // some input types need a separate wrap |
| 187 | - if($type == 'file') { |
|
| 188 | - $output = self::wrap( array( |
|
| 187 | + if ($type == 'file') { |
|
| 188 | + $output = self::wrap(array( |
|
| 189 | 189 | 'content' => $output, |
| 190 | 190 | 'class' => 'form-group custom-file' |
| 191 | - ) ); |
|
| 192 | - }elseif($type == 'checkbox'){ |
|
| 191 | + )); |
|
| 192 | + }elseif ($type == 'checkbox') { |
|
| 193 | 193 | $wrap_class = $args['switch'] ? 'custom-switch' : 'custom-checkbox'; |
| 194 | - $output = self::wrap( array( |
|
| 194 | + $output = self::wrap(array( |
|
| 195 | 195 | 'content' => $output, |
| 196 | - 'class' => 'custom-control '.$wrap_class |
|
| 197 | - ) ); |
|
| 196 | + 'class' => 'custom-control ' . $wrap_class |
|
| 197 | + )); |
|
| 198 | 198 | |
| 199 | - if($args['label_type']=='horizontal'){ |
|
| 199 | + if ($args['label_type'] == 'horizontal') { |
|
| 200 | 200 | $output = '<div class="col-sm-2 col-form-label"></div><div class="col-sm-10">' . $output . '</div>'; |
| 201 | 201 | } |
| 202 | - }elseif($type == 'password' && $args['password_toggle'] && !$args['input_group_right']){ |
|
| 202 | + }elseif ($type == 'password' && $args['password_toggle'] && !$args['input_group_right']) { |
|
| 203 | 203 | |
| 204 | 204 | |
| 205 | 205 | // allow password field to toggle view |
@@ -213,49 +213,49 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | // input group wraps |
| 216 | - if($args['input_group_left'] || $args['input_group_right']){ |
|
| 216 | + if ($args['input_group_left'] || $args['input_group_right']) { |
|
| 217 | 217 | $w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : ''; |
| 218 | - if($args['input_group_left']){ |
|
| 219 | - $output = self::wrap( array( |
|
| 218 | + if ($args['input_group_left']) { |
|
| 219 | + $output = self::wrap(array( |
|
| 220 | 220 | 'content' => $output, |
| 221 | - 'class' => $args['input_group_left_inside'] ? 'input-group-inside position-relative'.$w100 : 'input-group', |
|
| 221 | + 'class' => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group', |
|
| 222 | 222 | 'input_group_left' => $args['input_group_left'], |
| 223 | 223 | 'input_group_left_inside' => $args['input_group_left_inside'] |
| 224 | - ) ); |
|
| 224 | + )); |
|
| 225 | 225 | } |
| 226 | - if($args['input_group_right']){ |
|
| 227 | - $output = self::wrap( array( |
|
| 226 | + if ($args['input_group_right']) { |
|
| 227 | + $output = self::wrap(array( |
|
| 228 | 228 | 'content' => $output, |
| 229 | - 'class' => $args['input_group_right_inside'] ? 'input-group-inside position-relative'.$w100 : 'input-group', |
|
| 229 | + 'class' => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group', |
|
| 230 | 230 | 'input_group_right' => $args['input_group_right'], |
| 231 | 231 | 'input_group_right_inside' => $args['input_group_right_inside'] |
| 232 | - ) ); |
|
| 232 | + )); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - if(!$label_after){ |
|
| 237 | + if (!$label_after) { |
|
| 238 | 238 | $output .= $help_text; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
| 242 | - if($args['label_type']=='horizontal' && $type != 'checkbox'){ |
|
| 243 | - $output = self::wrap( array( |
|
| 242 | + if ($args['label_type'] == 'horizontal' && $type != 'checkbox') { |
|
| 243 | + $output = self::wrap(array( |
|
| 244 | 244 | 'content' => $output, |
| 245 | 245 | 'class' => 'col-sm-10', |
| 246 | - ) ); |
|
| 246 | + )); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if(!$label_after){ |
|
| 249 | + if (!$label_after) { |
|
| 250 | 250 | $output = $label . $output; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // wrap |
| 254 | - if(!$args['no_wrap']){ |
|
| 254 | + if (!$args['no_wrap']) { |
|
| 255 | 255 | |
| 256 | - $form_group_class = $args['label_type']=='floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group'; |
|
| 257 | - $wrap_class = $args['label_type']=='horizontal' ? $form_group_class . ' row' : $form_group_class; |
|
| 258 | - $wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class; |
|
| 256 | + $form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group'; |
|
| 257 | + $wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class; |
|
| 258 | + $wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
| 259 | 259 | $output = self::wrap(array( |
| 260 | 260 | 'content' => $output, |
| 261 | 261 | 'class' => $wrap_class, |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @return string The rendered component. |
| 280 | 280 | */ |
| 281 | - public static function textarea($args = array()){ |
|
| 281 | + public static function textarea($args = array()) { |
|
| 282 | 282 | $defaults = array( |
| 283 | 283 | 'name' => '', |
| 284 | 284 | 'class' => '', |
@@ -306,43 +306,43 @@ discard block |
||
| 306 | 306 | /** |
| 307 | 307 | * Parse incoming $args into an array and merge it with $defaults |
| 308 | 308 | */ |
| 309 | - $args = wp_parse_args( $args, $defaults ); |
|
| 309 | + $args = wp_parse_args($args, $defaults); |
|
| 310 | 310 | $output = ''; |
| 311 | 311 | |
| 312 | 312 | // hidden label option needs to be empty |
| 313 | 313 | $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type']; |
| 314 | 314 | |
| 315 | 315 | // floating labels don't work with wysiwyg so set it as top |
| 316 | - if($args['label_type'] == 'floating' && !empty($args['wysiwyg'])){ |
|
| 316 | + if ($args['label_type'] == 'floating' && !empty($args['wysiwyg'])) { |
|
| 317 | 317 | $args['label_type'] = 'top'; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | $label_after = $args['label_after']; |
| 321 | 321 | |
| 322 | 322 | // floating labels need label after |
| 323 | - if( $args['label_type'] == 'floating' && empty($args['wysiwyg']) ){ |
|
| 323 | + if ($args['label_type'] == 'floating' && empty($args['wysiwyg'])) { |
|
| 324 | 324 | $label_after = true; |
| 325 | 325 | $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works. |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | // label |
| 329 | - if(!empty($args['label']) && is_array($args['label'])){ |
|
| 330 | - }elseif(!empty($args['label']) && !$label_after){ |
|
| 329 | + if (!empty($args['label']) && is_array($args['label'])) { |
|
| 330 | + }elseif (!empty($args['label']) && !$label_after) { |
|
| 331 | 331 | $label_args = array( |
| 332 | 332 | 'title'=> $args['label'], |
| 333 | 333 | 'for'=> $args['id'], |
| 334 | - 'class' => $args['label_class']." ", |
|
| 334 | + 'class' => $args['label_class'] . " ", |
|
| 335 | 335 | 'label_type' => $args['label_type'] |
| 336 | 336 | ); |
| 337 | - $output .= self::label( $label_args ); |
|
| 337 | + $output .= self::label($label_args); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | // maybe horizontal label |
| 341 | - if($args['label_type']=='horizontal'){ |
|
| 341 | + if ($args['label_type'] == 'horizontal') { |
|
| 342 | 342 | $output .= '<div class="col-sm-10">'; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if(!empty($args['wysiwyg'])){ |
|
| 345 | + if (!empty($args['wysiwyg'])) { |
|
| 346 | 346 | ob_start(); |
| 347 | 347 | $content = $args['value']; |
| 348 | 348 | $editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor'; |
@@ -356,65 +356,65 @@ discard block |
||
| 356 | 356 | ); |
| 357 | 357 | |
| 358 | 358 | // maybe set settings if array |
| 359 | - if(is_array($args['wysiwyg'])){ |
|
| 360 | - $settings = wp_parse_args( $args['wysiwyg'], $settings ); |
|
| 359 | + if (is_array($args['wysiwyg'])) { |
|
| 360 | + $settings = wp_parse_args($args['wysiwyg'], $settings); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - wp_editor( $content, $editor_id, $settings ); |
|
| 363 | + wp_editor($content, $editor_id, $settings); |
|
| 364 | 364 | $output .= ob_get_clean(); |
| 365 | - }else{ |
|
| 365 | + } else { |
|
| 366 | 366 | |
| 367 | 367 | // open |
| 368 | 368 | $output .= '<textarea '; |
| 369 | 369 | |
| 370 | 370 | // name |
| 371 | - if(!empty($args['name'])){ |
|
| 372 | - $output .= ' name="'.esc_attr($args['name']).'" '; |
|
| 371 | + if (!empty($args['name'])) { |
|
| 372 | + $output .= ' name="' . esc_attr($args['name']) . '" '; |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | // id |
| 376 | - if(!empty($args['id'])){ |
|
| 377 | - $output .= ' id="'.sanitize_html_class($args['id']).'" '; |
|
| 376 | + if (!empty($args['id'])) { |
|
| 377 | + $output .= ' id="' . sanitize_html_class($args['id']) . '" '; |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | // placeholder |
| 381 | - if(isset($args['placeholder']) && '' != $args['placeholder']){ |
|
| 382 | - $output .= ' placeholder="'.esc_attr($args['placeholder']).'" '; |
|
| 381 | + if (isset($args['placeholder']) && '' != $args['placeholder']) { |
|
| 382 | + $output .= ' placeholder="' . esc_attr($args['placeholder']) . '" '; |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | // title |
| 386 | - if(!empty($args['title'])){ |
|
| 387 | - $output .= ' title="'.esc_attr($args['title']).'" '; |
|
| 386 | + if (!empty($args['title'])) { |
|
| 387 | + $output .= ' title="' . esc_attr($args['title']) . '" '; |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // validation text |
| 391 | - if(!empty($args['validation_text'])){ |
|
| 392 | - $output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" '; |
|
| 391 | + if (!empty($args['validation_text'])) { |
|
| 392 | + $output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" '; |
|
| 393 | 393 | $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" '; |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // validation_pattern |
| 397 | - if(!empty($args['validation_pattern'])){ |
|
| 398 | - $output .= ' pattern="'.$args['validation_pattern'].'" '; |
|
| 397 | + if (!empty($args['validation_pattern'])) { |
|
| 398 | + $output .= ' pattern="' . $args['validation_pattern'] . '" '; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | // required |
| 402 | - if(!empty($args['required'])){ |
|
| 402 | + if (!empty($args['required'])) { |
|
| 403 | 403 | $output .= ' required '; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | // rows |
| 407 | - if(!empty($args['rows'])){ |
|
| 408 | - $output .= ' rows="'.absint($args['rows']).'" '; |
|
| 407 | + if (!empty($args['rows'])) { |
|
| 408 | + $output .= ' rows="' . absint($args['rows']) . '" '; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | |
| 412 | 412 | // class |
| 413 | 413 | $class = !empty($args['class']) ? $args['class'] : ''; |
| 414 | - $output .= ' class="form-control '.$class.'" '; |
|
| 414 | + $output .= ' class="form-control ' . $class . '" '; |
|
| 415 | 415 | |
| 416 | 416 | // extra attributes |
| 417 | - if(!empty($args['extra_attributes'])){ |
|
| 417 | + if (!empty($args['extra_attributes'])) { |
|
| 418 | 418 | $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
| 419 | 419 | } |
| 420 | 420 | |
@@ -422,11 +422,11 @@ discard block |
||
| 422 | 422 | $output .= ' >'; |
| 423 | 423 | |
| 424 | 424 | // value |
| 425 | - if ( ! empty( $args['value'] ) ) { |
|
| 426 | - if ( ! empty( $args['allow_tags'] ) ) { |
|
| 427 | - $output .= AUI_Component_Helper::sanitize_html_field( $args['value'], $args ); // Sanitize HTML. |
|
| 425 | + if (!empty($args['value'])) { |
|
| 426 | + if (!empty($args['allow_tags'])) { |
|
| 427 | + $output .= AUI_Component_Helper::sanitize_html_field($args['value'], $args); // Sanitize HTML. |
|
| 428 | 428 | } else { |
| 429 | - $output .= sanitize_textarea_field( $args['value'] ); |
|
| 429 | + $output .= sanitize_textarea_field($args['value']); |
|
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | |
@@ -435,32 +435,32 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - if(!empty($args['label']) && $label_after){ |
|
| 438 | + if (!empty($args['label']) && $label_after) { |
|
| 439 | 439 | $label_args = array( |
| 440 | 440 | 'title'=> $args['label'], |
| 441 | 441 | 'for'=> $args['id'], |
| 442 | - 'class' => $args['label_class']." ", |
|
| 442 | + 'class' => $args['label_class'] . " ", |
|
| 443 | 443 | 'label_type' => $args['label_type'] |
| 444 | 444 | ); |
| 445 | - $output .= self::label( $label_args ); |
|
| 445 | + $output .= self::label($label_args); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | // help text |
| 449 | - if(!empty($args['help_text'])){ |
|
| 449 | + if (!empty($args['help_text'])) { |
|
| 450 | 450 | $output .= AUI_Component_Helper::help_text($args['help_text']); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | // maybe horizontal label |
| 454 | - if($args['label_type']=='horizontal'){ |
|
| 454 | + if ($args['label_type'] == 'horizontal') { |
|
| 455 | 455 | $output .= '</div>'; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | |
| 459 | 459 | // wrap |
| 460 | - if(!$args['no_wrap']){ |
|
| 461 | - $form_group_class = $args['label_type']=='floating' ? 'form-label-group' : 'form-group'; |
|
| 462 | - $wrap_class = $args['label_type']=='horizontal' ? $form_group_class . ' row' : $form_group_class; |
|
| 463 | - $wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class; |
|
| 460 | + if (!$args['no_wrap']) { |
|
| 461 | + $form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : 'form-group'; |
|
| 462 | + $wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class; |
|
| 463 | + $wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
| 464 | 464 | $output = self::wrap(array( |
| 465 | 465 | 'content' => $output, |
| 466 | 466 | 'class' => $wrap_class, |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | return $output; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - public static function label($args = array(), $type = ''){ |
|
| 476 | + public static function label($args = array(), $type = '') { |
|
| 477 | 477 | //<label for="exampleInputEmail1">Email address</label> |
| 478 | 478 | $defaults = array( |
| 479 | 479 | 'title' => 'div', |
@@ -485,20 +485,20 @@ discard block |
||
| 485 | 485 | /** |
| 486 | 486 | * Parse incoming $args into an array and merge it with $defaults |
| 487 | 487 | */ |
| 488 | - $args = wp_parse_args( $args, $defaults ); |
|
| 488 | + $args = wp_parse_args($args, $defaults); |
|
| 489 | 489 | $output = ''; |
| 490 | 490 | |
| 491 | - if($args['title']){ |
|
| 491 | + if ($args['title']) { |
|
| 492 | 492 | |
| 493 | 493 | // maybe hide labels //@todo set a global option for visibility class |
| 494 | - if($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type']) ){ |
|
| 494 | + if ($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type'])) { |
|
| 495 | 495 | $class = $args['class']; |
| 496 | - }else{ |
|
| 497 | - $class = 'sr-only '.$args['class']; |
|
| 496 | + } else { |
|
| 497 | + $class = 'sr-only ' . $args['class']; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | // maybe horizontal |
| 501 | - if($args['label_type']=='horizontal' && $type != 'checkbox'){ |
|
| 501 | + if ($args['label_type'] == 'horizontal' && $type != 'checkbox') { |
|
| 502 | 502 | $class .= ' col-sm-2 col-form-label'; |
| 503 | 503 | } |
| 504 | 504 | |
@@ -506,20 +506,20 @@ discard block |
||
| 506 | 506 | $output .= '<label '; |
| 507 | 507 | |
| 508 | 508 | // for |
| 509 | - if(!empty($args['for'])){ |
|
| 510 | - $output .= ' for="'.esc_attr($args['for']).'" '; |
|
| 509 | + if (!empty($args['for'])) { |
|
| 510 | + $output .= ' for="' . esc_attr($args['for']) . '" '; |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | // class |
| 514 | - $class = $class ? AUI_Component_Helper::esc_classes( $class ) : ''; |
|
| 515 | - $output .= ' class="'.$class.'" '; |
|
| 514 | + $class = $class ? AUI_Component_Helper::esc_classes($class) : ''; |
|
| 515 | + $output .= ' class="' . $class . '" '; |
|
| 516 | 516 | |
| 517 | 517 | // close |
| 518 | 518 | $output .= '>'; |
| 519 | 519 | |
| 520 | 520 | |
| 521 | 521 | // title, don't escape fully as can contain html |
| 522 | - if(!empty($args['title'])){ |
|
| 522 | + if (!empty($args['title'])) { |
|
| 523 | 523 | $output .= wp_kses_post($args['title']); |
| 524 | 524 | } |
| 525 | 525 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | * |
| 541 | 541 | * @return string |
| 542 | 542 | */ |
| 543 | - public static function wrap($args = array()){ |
|
| 543 | + public static function wrap($args = array()) { |
|
| 544 | 544 | $defaults = array( |
| 545 | 545 | 'type' => 'div', |
| 546 | 546 | 'class' => 'form-group', |
@@ -556,55 +556,55 @@ discard block |
||
| 556 | 556 | /** |
| 557 | 557 | * Parse incoming $args into an array and merge it with $defaults |
| 558 | 558 | */ |
| 559 | - $args = wp_parse_args( $args, $defaults ); |
|
| 559 | + $args = wp_parse_args($args, $defaults); |
|
| 560 | 560 | $output = ''; |
| 561 | - if($args['type']){ |
|
| 561 | + if ($args['type']) { |
|
| 562 | 562 | |
| 563 | 563 | // open |
| 564 | - $output .= '<'.sanitize_html_class($args['type']); |
|
| 564 | + $output .= '<' . sanitize_html_class($args['type']); |
|
| 565 | 565 | |
| 566 | 566 | // element require |
| 567 | - if(!empty($args['element_require'])){ |
|
| 567 | + if (!empty($args['element_require'])) { |
|
| 568 | 568 | $output .= AUI_Component_Helper::element_require($args['element_require']); |
| 569 | 569 | $args['class'] .= " aui-conditional-field"; |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | // argument_id |
| 573 | - if( !empty($args['argument_id']) ){ |
|
| 574 | - $output .= ' data-argument="'.esc_attr($args['argument_id']).'"'; |
|
| 573 | + if (!empty($args['argument_id'])) { |
|
| 574 | + $output .= ' data-argument="' . esc_attr($args['argument_id']) . '"'; |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | // class |
| 578 | - $class = !empty($args['class']) ? AUI_Component_Helper::esc_classes( $args['class'] ) : ''; |
|
| 579 | - $output .= ' class="'.$class.'" '; |
|
| 578 | + $class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : ''; |
|
| 579 | + $output .= ' class="' . $class . '" '; |
|
| 580 | 580 | |
| 581 | 581 | // close wrap |
| 582 | 582 | $output .= ' >'; |
| 583 | 583 | |
| 584 | 584 | |
| 585 | 585 | // Input group left |
| 586 | - if(!empty($args['input_group_left'])){ |
|
| 586 | + if (!empty($args['input_group_left'])) { |
|
| 587 | 587 | $position_class = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : ''; |
| 588 | - $input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">'.$args['input_group_left'].'</span>'; |
|
| 589 | - $output .= '<div class="input-group-prepend '.$position_class.'">'.$input_group_left.'</div>'; |
|
| 588 | + $input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>'; |
|
| 589 | + $output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>'; |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | // content |
| 593 | 593 | $output .= $args['content']; |
| 594 | 594 | |
| 595 | 595 | // Input group right |
| 596 | - if(!empty($args['input_group_right'])){ |
|
| 596 | + if (!empty($args['input_group_right'])) { |
|
| 597 | 597 | $position_class = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : ''; |
| 598 | - $input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">'.$args['input_group_right'].'</span>'; |
|
| 599 | - $output .= '<div class="input-group-append '.$position_class.'">'.$input_group_right.'</div>'; |
|
| 598 | + $input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>'; |
|
| 599 | + $output .= '<div class="input-group-append ' . $position_class . '">' . $input_group_right . '</div>'; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | |
| 603 | 603 | // close wrap |
| 604 | - $output .= '</'.sanitize_html_class($args['type']).'>'; |
|
| 604 | + $output .= '</' . sanitize_html_class($args['type']) . '>'; |
|
| 605 | 605 | |
| 606 | 606 | |
| 607 | - }else{ |
|
| 607 | + } else { |
|
| 608 | 608 | $output = $args['content']; |
| 609 | 609 | } |
| 610 | 610 | |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | * |
| 619 | 619 | * @return string The rendered component. |
| 620 | 620 | */ |
| 621 | - public static function select($args = array()){ |
|
| 621 | + public static function select($args = array()) { |
|
| 622 | 622 | $defaults = array( |
| 623 | 623 | 'class' => '', |
| 624 | 624 | 'wrap_class' => '', |
@@ -644,11 +644,11 @@ discard block |
||
| 644 | 644 | /** |
| 645 | 645 | * Parse incoming $args into an array and merge it with $defaults |
| 646 | 646 | */ |
| 647 | - $args = wp_parse_args( $args, $defaults ); |
|
| 647 | + $args = wp_parse_args($args, $defaults); |
|
| 648 | 648 | $output = ''; |
| 649 | 649 | |
| 650 | 650 | // for now lets hide floating labels |
| 651 | - if( $args['label_type'] == 'floating' ){$args['label_type'] = 'hidden';} |
|
| 651 | + if ($args['label_type'] == 'floating') {$args['label_type'] = 'hidden'; } |
|
| 652 | 652 | |
| 653 | 653 | // hidden label option needs to be empty |
| 654 | 654 | $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type']; |
@@ -657,85 +657,85 @@ discard block |
||
| 657 | 657 | $label_after = $args['label_after']; |
| 658 | 658 | |
| 659 | 659 | // floating labels need label after |
| 660 | - if( $args['label_type'] == 'floating' ){ |
|
| 660 | + if ($args['label_type'] == 'floating') { |
|
| 661 | 661 | $label_after = true; |
| 662 | 662 | $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works. |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | // Maybe setup select2 |
| 666 | 666 | $is_select2 = false; |
| 667 | - if(!empty($args['select2'])){ |
|
| 667 | + if (!empty($args['select2'])) { |
|
| 668 | 668 | $args['class'] .= ' aui-select2'; |
| 669 | 669 | $is_select2 = true; |
| 670 | - }elseif( strpos($args['class'], 'aui-select2') !== false){ |
|
| 670 | + }elseif (strpos($args['class'], 'aui-select2') !== false) { |
|
| 671 | 671 | $is_select2 = true; |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | // select2 tags |
| 675 | - if( !empty($args['select2']) && $args['select2'] === 'tags'){ // triple equals needed here for some reason |
|
| 675 | + if (!empty($args['select2']) && $args['select2'] === 'tags') { // triple equals needed here for some reason |
|
| 676 | 676 | $args['data-tags'] = 'true'; |
| 677 | 677 | $args['data-token-separators'] = "[',']"; |
| 678 | 678 | $args['multiple'] = true; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | // select2 placeholder |
| 682 | - if($is_select2 && isset($args['placeholder']) && '' != $args['placeholder'] && empty($args['data-placeholder'])){ |
|
| 682 | + if ($is_select2 && isset($args['placeholder']) && '' != $args['placeholder'] && empty($args['data-placeholder'])) { |
|
| 683 | 683 | $args['data-placeholder'] = esc_attr($args['placeholder']); |
| 684 | 684 | $args['data-allow-clear'] = isset($args['data-allow-clear']) ? (bool) $args['data-allow-clear'] : true; |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | // label |
| 688 | - if(!empty($args['label']) && is_array($args['label'])){ |
|
| 689 | - }elseif(!empty($args['label']) && !$label_after){ |
|
| 688 | + if (!empty($args['label']) && is_array($args['label'])) { |
|
| 689 | + }elseif (!empty($args['label']) && !$label_after) { |
|
| 690 | 690 | $label_args = array( |
| 691 | 691 | 'title'=> $args['label'], |
| 692 | 692 | 'for'=> $args['id'], |
| 693 | - 'class' => $args['label_class']." ", |
|
| 693 | + 'class' => $args['label_class'] . " ", |
|
| 694 | 694 | 'label_type' => $args['label_type'] |
| 695 | 695 | ); |
| 696 | 696 | $output .= self::label($label_args); |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | // maybe horizontal label |
| 700 | - if($args['label_type']=='horizontal'){ |
|
| 700 | + if ($args['label_type'] == 'horizontal') { |
|
| 701 | 701 | $output .= '<div class="col-sm-10">'; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | // Set hidden input to save empty value for multiselect. |
| 705 | - if ( ! empty( $args['multiple'] ) && ! empty( $args['name'] ) ) { |
|
| 706 | - $output .= '<input type="hidden" ' . AUI_Component_Helper::name( $args['name'] ) . ' value=""/>'; |
|
| 705 | + if (!empty($args['multiple']) && !empty($args['name'])) { |
|
| 706 | + $output .= '<input type="hidden" ' . AUI_Component_Helper::name($args['name']) . ' value=""/>'; |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | // open/type |
| 710 | 710 | $output .= '<select '; |
| 711 | 711 | |
| 712 | 712 | // style |
| 713 | - if($is_select2){ |
|
| 713 | + if ($is_select2) { |
|
| 714 | 714 | $output .= " style='width:100%;' "; |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | // element require |
| 718 | - if(!empty($args['element_require'])){ |
|
| 718 | + if (!empty($args['element_require'])) { |
|
| 719 | 719 | $output .= AUI_Component_Helper::element_require($args['element_require']); |
| 720 | 720 | $args['class'] .= " aui-conditional-field"; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | // class |
| 724 | 724 | $class = !empty($args['class']) ? $args['class'] : ''; |
| 725 | - $output .= AUI_Component_Helper::class_attr('custom-select '.$class); |
|
| 725 | + $output .= AUI_Component_Helper::class_attr('custom-select ' . $class); |
|
| 726 | 726 | |
| 727 | 727 | // name |
| 728 | - if(!empty($args['name'])){ |
|
| 729 | - $output .= AUI_Component_Helper::name($args['name'],$args['multiple']); |
|
| 728 | + if (!empty($args['name'])) { |
|
| 729 | + $output .= AUI_Component_Helper::name($args['name'], $args['multiple']); |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | // id |
| 733 | - if(!empty($args['id'])){ |
|
| 733 | + if (!empty($args['id'])) { |
|
| 734 | 734 | $output .= AUI_Component_Helper::id($args['id']); |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | // title |
| 738 | - if(!empty($args['title'])){ |
|
| 738 | + if (!empty($args['title'])) { |
|
| 739 | 739 | $output .= AUI_Component_Helper::title($args['title']); |
| 740 | 740 | } |
| 741 | 741 | |
@@ -746,17 +746,17 @@ discard block |
||
| 746 | 746 | $output .= AUI_Component_Helper::aria_attributes($args); |
| 747 | 747 | |
| 748 | 748 | // extra attributes |
| 749 | - if(!empty($args['extra_attributes'])){ |
|
| 749 | + if (!empty($args['extra_attributes'])) { |
|
| 750 | 750 | $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | // required |
| 754 | - if(!empty($args['required'])){ |
|
| 754 | + if (!empty($args['required'])) { |
|
| 755 | 755 | $output .= ' required '; |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | // multiple |
| 759 | - if(!empty($args['multiple'])){ |
|
| 759 | + if (!empty($args['multiple'])) { |
|
| 760 | 760 | $output .= ' multiple '; |
| 761 | 761 | } |
| 762 | 762 | |
@@ -764,21 +764,21 @@ discard block |
||
| 764 | 764 | $output .= ' >'; |
| 765 | 765 | |
| 766 | 766 | // placeholder |
| 767 | - if(isset($args['placeholder']) && '' != $args['placeholder'] && !$is_select2){ |
|
| 768 | - $output .= '<option value="" disabled selected hidden>'.esc_attr($args['placeholder']).'</option>'; |
|
| 769 | - }elseif($is_select2 && !empty($args['placeholder'])){ |
|
| 767 | + if (isset($args['placeholder']) && '' != $args['placeholder'] && !$is_select2) { |
|
| 768 | + $output .= '<option value="" disabled selected hidden>' . esc_attr($args['placeholder']) . '</option>'; |
|
| 769 | + }elseif ($is_select2 && !empty($args['placeholder'])) { |
|
| 770 | 770 | $output .= "<option></option>"; // select2 needs an empty select to fill the placeholder |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | // Options |
| 774 | - if(!empty($args['options'])){ |
|
| 774 | + if (!empty($args['options'])) { |
|
| 775 | 775 | |
| 776 | - if(!is_array($args['options'])){ |
|
| 776 | + if (!is_array($args['options'])) { |
|
| 777 | 777 | $output .= $args['options']; // not the preferred way but an option |
| 778 | - }else{ |
|
| 779 | - foreach($args['options'] as $val => $name){ |
|
| 778 | + } else { |
|
| 779 | + foreach ($args['options'] as $val => $name) { |
|
| 780 | 780 | $selected = ''; |
| 781 | - if(is_array($name)){ |
|
| 781 | + if (is_array($name)) { |
|
| 782 | 782 | if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) { |
| 783 | 783 | $option_label = isset($name['label']) ? $name['label'] : ''; |
| 784 | 784 | |
@@ -786,23 +786,23 @@ discard block |
||
| 786 | 786 | } else { |
| 787 | 787 | $option_label = isset($name['label']) ? $name['label'] : ''; |
| 788 | 788 | $option_value = isset($name['value']) ? $name['value'] : ''; |
| 789 | - if(!empty($args['multiple']) && !empty($args['value']) && is_array($args['value']) ){ |
|
| 789 | + if (!empty($args['multiple']) && !empty($args['value']) && is_array($args['value'])) { |
|
| 790 | 790 | $selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : ""; |
| 791 | - } elseif(!empty($args['value'])) { |
|
| 792 | - $selected = selected($option_value,stripslashes_deep($args['value']), false); |
|
| 791 | + } elseif (!empty($args['value'])) { |
|
| 792 | + $selected = selected($option_value, stripslashes_deep($args['value']), false); |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | $output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
| 796 | 796 | } |
| 797 | - }else{ |
|
| 798 | - if(!empty($args['value'])){ |
|
| 799 | - if(is_array($args['value'])){ |
|
| 800 | - $selected = in_array($val,$args['value']) ? 'selected="selected"' : ''; |
|
| 801 | - } elseif(!empty($args['value'])) { |
|
| 802 | - $selected = selected( $args['value'], $val, false); |
|
| 797 | + } else { |
|
| 798 | + if (!empty($args['value'])) { |
|
| 799 | + if (is_array($args['value'])) { |
|
| 800 | + $selected = in_array($val, $args['value']) ? 'selected="selected"' : ''; |
|
| 801 | + } elseif (!empty($args['value'])) { |
|
| 802 | + $selected = selected($args['value'], $val, false); |
|
| 803 | 803 | } |
| 804 | 804 | } |
| 805 | - $output .= '<option value="'.esc_attr($val).'" '.$selected.'>'.esc_attr($name).'</option>'; |
|
| 805 | + $output .= '<option value="' . esc_attr($val) . '" ' . $selected . '>' . esc_attr($name) . '</option>'; |
|
| 806 | 806 | } |
| 807 | 807 | } |
| 808 | 808 | } |
@@ -812,31 +812,31 @@ discard block |
||
| 812 | 812 | // closing tag |
| 813 | 813 | $output .= '</select>'; |
| 814 | 814 | |
| 815 | - if(!empty($args['label']) && $label_after){ |
|
| 815 | + if (!empty($args['label']) && $label_after) { |
|
| 816 | 816 | $label_args = array( |
| 817 | 817 | 'title'=> $args['label'], |
| 818 | 818 | 'for'=> $args['id'], |
| 819 | - 'class' => $args['label_class']." ", |
|
| 819 | + 'class' => $args['label_class'] . " ", |
|
| 820 | 820 | 'label_type' => $args['label_type'] |
| 821 | 821 | ); |
| 822 | 822 | $output .= self::label($label_args); |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | // help text |
| 826 | - if(!empty($args['help_text'])){ |
|
| 826 | + if (!empty($args['help_text'])) { |
|
| 827 | 827 | $output .= AUI_Component_Helper::help_text($args['help_text']); |
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | // maybe horizontal label |
| 831 | - if($args['label_type']=='horizontal'){ |
|
| 831 | + if ($args['label_type'] == 'horizontal') { |
|
| 832 | 832 | $output .= '</div>'; |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | |
| 836 | 836 | // wrap |
| 837 | - if(!$args['no_wrap']){ |
|
| 838 | - $wrap_class = $args['label_type']=='horizontal' ? 'form-group row' : 'form-group'; |
|
| 839 | - $wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class; |
|
| 837 | + if (!$args['no_wrap']) { |
|
| 838 | + $wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group'; |
|
| 839 | + $wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
| 840 | 840 | $output = self::wrap(array( |
| 841 | 841 | 'content' => $output, |
| 842 | 842 | 'class' => $wrap_class, |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | * |
| 857 | 857 | * @return string The rendered component. |
| 858 | 858 | */ |
| 859 | - public static function radio($args = array()){ |
|
| 859 | + public static function radio($args = array()) { |
|
| 860 | 860 | $defaults = array( |
| 861 | 861 | 'class' => '', |
| 862 | 862 | 'wrap_class' => '', |
@@ -880,14 +880,14 @@ discard block |
||
| 880 | 880 | /** |
| 881 | 881 | * Parse incoming $args into an array and merge it with $defaults |
| 882 | 882 | */ |
| 883 | - $args = wp_parse_args( $args, $defaults ); |
|
| 883 | + $args = wp_parse_args($args, $defaults); |
|
| 884 | 884 | |
| 885 | 885 | // for now lets use horizontal for floating |
| 886 | - if( $args['label_type'] == 'floating' ){$args['label_type'] = 'horizontal';} |
|
| 886 | + if ($args['label_type'] == 'floating') {$args['label_type'] = 'horizontal'; } |
|
| 887 | 887 | |
| 888 | 888 | $label_args = array( |
| 889 | 889 | 'title'=> $args['label'], |
| 890 | - 'class' => $args['label_class']." pt-0 ", |
|
| 890 | + 'class' => $args['label_class'] . " pt-0 ", |
|
| 891 | 891 | 'label_type' => $args['label_type'] |
| 892 | 892 | ); |
| 893 | 893 | |
@@ -896,39 +896,39 @@ discard block |
||
| 896 | 896 | |
| 897 | 897 | |
| 898 | 898 | // label before |
| 899 | - if(!empty($args['label'])){ |
|
| 900 | - $output .= self::label( $label_args, 'radio' ); |
|
| 899 | + if (!empty($args['label'])) { |
|
| 900 | + $output .= self::label($label_args, 'radio'); |
|
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | // maybe horizontal label |
| 904 | - if($args['label_type']=='horizontal'){ |
|
| 904 | + if ($args['label_type'] == 'horizontal') { |
|
| 905 | 905 | $output .= '<div class="col-sm-10">'; |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | - if(!empty($args['options'])){ |
|
| 908 | + if (!empty($args['options'])) { |
|
| 909 | 909 | $count = 0; |
| 910 | - foreach($args['options'] as $value => $label){ |
|
| 910 | + foreach ($args['options'] as $value => $label) { |
|
| 911 | 911 | $option_args = $args; |
| 912 | 912 | $option_args['value'] = $value; |
| 913 | 913 | $option_args['label'] = $label; |
| 914 | 914 | $option_args['checked'] = $value == $args['value'] ? true : false; |
| 915 | - $output .= self::radio_option($option_args,$count); |
|
| 915 | + $output .= self::radio_option($option_args, $count); |
|
| 916 | 916 | $count++; |
| 917 | 917 | } |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | // help text |
| 921 | - $help_text = ! empty( $args['help_text'] ) ? AUI_Component_Helper::help_text( $args['help_text'] ) : ''; |
|
| 921 | + $help_text = !empty($args['help_text']) ? AUI_Component_Helper::help_text($args['help_text']) : ''; |
|
| 922 | 922 | $output .= $help_text; |
| 923 | 923 | |
| 924 | 924 | // maybe horizontal label |
| 925 | - if($args['label_type']=='horizontal'){ |
|
| 925 | + if ($args['label_type'] == 'horizontal') { |
|
| 926 | 926 | $output .= '</div>'; |
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | // wrap |
| 930 | - $wrap_class = $args['label_type']=='horizontal' ? 'form-group row' : 'form-group'; |
|
| 931 | - $wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class; |
|
| 930 | + $wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group'; |
|
| 931 | + $wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class; |
|
| 932 | 932 | $output = self::wrap(array( |
| 933 | 933 | 'content' => $output, |
| 934 | 934 | 'class' => $wrap_class, |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | * |
| 948 | 948 | * @return string The rendered component. |
| 949 | 949 | */ |
| 950 | - public static function radio_option($args = array(),$count = ''){ |
|
| 950 | + public static function radio_option($args = array(), $count = '') { |
|
| 951 | 951 | $defaults = array( |
| 952 | 952 | 'class' => '', |
| 953 | 953 | 'id' => '', |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | /** |
| 966 | 966 | * Parse incoming $args into an array and merge it with $defaults |
| 967 | 967 | */ |
| 968 | - $args = wp_parse_args( $args, $defaults ); |
|
| 968 | + $args = wp_parse_args($args, $defaults); |
|
| 969 | 969 | |
| 970 | 970 | $output = ''; |
| 971 | 971 | |
@@ -976,27 +976,27 @@ discard block |
||
| 976 | 976 | $output .= ' class="form-check-input" '; |
| 977 | 977 | |
| 978 | 978 | // name |
| 979 | - if(!empty($args['name'])){ |
|
| 979 | + if (!empty($args['name'])) { |
|
| 980 | 980 | $output .= AUI_Component_Helper::name($args['name']); |
| 981 | 981 | } |
| 982 | 982 | |
| 983 | 983 | // id |
| 984 | - if(!empty($args['id'])){ |
|
| 985 | - $output .= AUI_Component_Helper::id($args['id'].$count); |
|
| 984 | + if (!empty($args['id'])) { |
|
| 985 | + $output .= AUI_Component_Helper::id($args['id'] . $count); |
|
| 986 | 986 | } |
| 987 | 987 | |
| 988 | 988 | // title |
| 989 | - if(!empty($args['title'])){ |
|
| 989 | + if (!empty($args['title'])) { |
|
| 990 | 990 | $output .= AUI_Component_Helper::title($args['title']); |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | // value |
| 994 | - if(isset($args['value'])){ |
|
| 994 | + if (isset($args['value'])) { |
|
| 995 | 995 | $output .= AUI_Component_Helper::value($args['value']); |
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | // checked, for radio and checkboxes |
| 999 | - if( $args['checked'] ){ |
|
| 999 | + if ($args['checked']) { |
|
| 1000 | 1000 | $output .= ' checked '; |
| 1001 | 1001 | } |
| 1002 | 1002 | |
@@ -1007,12 +1007,12 @@ discard block |
||
| 1007 | 1007 | $output .= AUI_Component_Helper::aria_attributes($args); |
| 1008 | 1008 | |
| 1009 | 1009 | // extra attributes |
| 1010 | - if(!empty($args['extra_attributes'])){ |
|
| 1010 | + if (!empty($args['extra_attributes'])) { |
|
| 1011 | 1011 | $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | // required |
| 1015 | - if(!empty($args['required'])){ |
|
| 1015 | + if (!empty($args['required'])) { |
|
| 1016 | 1016 | $output .= ' required '; |
| 1017 | 1017 | } |
| 1018 | 1018 | |
@@ -1020,13 +1020,13 @@ discard block |
||
| 1020 | 1020 | $output .= ' >'; |
| 1021 | 1021 | |
| 1022 | 1022 | // label |
| 1023 | - if(!empty($args['label']) && is_array($args['label'])){ |
|
| 1024 | - }elseif(!empty($args['label'])){ |
|
| 1025 | - $output .= self::label(array('title'=>$args['label'],'for'=>$args['id'].$count,'class'=>'form-check-label'),'radio'); |
|
| 1023 | + if (!empty($args['label']) && is_array($args['label'])) { |
|
| 1024 | + }elseif (!empty($args['label'])) { |
|
| 1025 | + $output .= self::label(array('title'=>$args['label'], 'for'=>$args['id'] . $count, 'class'=>'form-check-label'), 'radio'); |
|
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | // wrap |
| 1029 | - if(!$args['no_wrap']){ |
|
| 1029 | + if (!$args['no_wrap']) { |
|
| 1030 | 1030 | $wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check'; |
| 1031 | 1031 | $output = self::wrap(array( |
| 1032 | 1032 | 'content' => $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 | |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @return string |
| 21 | 21 | */ |
| 22 | - public static function name($text,$multiple = false){ |
|
| 22 | + public static function name($text, $multiple = false) { |
|
| 23 | 23 | $output = ''; |
| 24 | 24 | |
| 25 | - if($text){ |
|
| 26 | - $is_multiple = strpos($text, '[') === false && $multiple ? '[]' : ''; |
|
| 27 | - $output = ' name="'.esc_attr($text).$is_multiple.'" '; |
|
| 25 | + if ($text) { |
|
| 26 | + $is_multiple = strpos($text, '[') === false && $multiple ? '[]' : ''; |
|
| 27 | + $output = ' name="' . esc_attr($text) . $is_multiple . '" '; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | return $output; |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return string The sanitized item. |
| 39 | 39 | */ |
| 40 | - public static function id($text){ |
|
| 40 | + public static function id($text) { |
|
| 41 | 41 | $output = ''; |
| 42 | 42 | |
| 43 | - if($text){ |
|
| 44 | - $output = ' id="'.sanitize_html_class($text).'" '; |
|
| 43 | + if ($text) { |
|
| 44 | + $output = ' id="' . sanitize_html_class($text) . '" '; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return $output; |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return string The sanitized item. |
| 56 | 56 | */ |
| 57 | - public static function title($text){ |
|
| 57 | + public static function title($text) { |
|
| 58 | 58 | $output = ''; |
| 59 | 59 | |
| 60 | - if($text){ |
|
| 61 | - $output = ' title="'.esc_attr($text).'" '; |
|
| 60 | + if ($text) { |
|
| 61 | + $output = ' title="' . esc_attr($text) . '" '; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | return $output; |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @return string The sanitized item. |
| 73 | 73 | */ |
| 74 | - public static function value($text){ |
|
| 74 | + public static function value($text) { |
|
| 75 | 75 | $output = ''; |
| 76 | 76 | |
| 77 | - if($text){ |
|
| 78 | - $output = ' value="'.esc_attr($text).'" '; |
|
| 77 | + if ($text) { |
|
| 78 | + $output = ' value="' . esc_attr($text) . '" '; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | return $output; |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return string The sanitized item. |
| 90 | 90 | */ |
| 91 | - public static function class_attr($text){ |
|
| 91 | + public static function class_attr($text) { |
|
| 92 | 92 | $output = ''; |
| 93 | 93 | |
| 94 | - if($text){ |
|
| 94 | + if ($text) { |
|
| 95 | 95 | $classes = self::esc_classes($text); |
| 96 | - if(!empty($classes)){ |
|
| 97 | - $output = ' class="'.$classes.'" '; |
|
| 96 | + if (!empty($classes)) { |
|
| 97 | + $output = ' class="' . $classes . '" '; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -108,15 +108,15 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public static function esc_classes($text){ |
|
| 111 | + public static function esc_classes($text) { |
|
| 112 | 112 | $output = ''; |
| 113 | 113 | |
| 114 | - if($text){ |
|
| 115 | - $classes = explode(" ",$text); |
|
| 116 | - $classes = array_map("trim",$classes); |
|
| 117 | - $classes = array_map("sanitize_html_class",$classes); |
|
| 118 | - if(!empty($classes)){ |
|
| 119 | - $output = implode(" ",$classes); |
|
| 114 | + if ($text) { |
|
| 115 | + $classes = explode(" ", $text); |
|
| 116 | + $classes = array_map("trim", $classes); |
|
| 117 | + $classes = array_map("sanitize_html_class", $classes); |
|
| 118 | + if (!empty($classes)) { |
|
| 119 | + $output = implode(" ", $classes); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return string |
| 131 | 131 | */ |
| 132 | - public static function data_attributes($args){ |
|
| 132 | + public static function data_attributes($args) { |
|
| 133 | 133 | $output = ''; |
| 134 | 134 | |
| 135 | - if(!empty($args)){ |
|
| 135 | + if (!empty($args)) { |
|
| 136 | 136 | |
| 137 | - foreach($args as $key => $val){ |
|
| 138 | - if(substr( $key, 0, 5 ) === "data-"){ |
|
| 139 | - $output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" '; |
|
| 137 | + foreach ($args as $key => $val) { |
|
| 138 | + if (substr($key, 0, 5) === "data-") { |
|
| 139 | + $output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" '; |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | * |
| 150 | 150 | * @return string |
| 151 | 151 | */ |
| 152 | - public static function aria_attributes($args){ |
|
| 152 | + public static function aria_attributes($args) { |
|
| 153 | 153 | $output = ''; |
| 154 | 154 | |
| 155 | - if(!empty($args)){ |
|
| 155 | + if (!empty($args)) { |
|
| 156 | 156 | |
| 157 | - foreach($args as $key => $val){ |
|
| 158 | - if(substr( $key, 0, 5 ) === "aria-"){ |
|
| 159 | - $output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" '; |
|
| 157 | + foreach ($args as $key => $val) { |
|
| 158 | + if (substr($key, 0, 5) === "aria-") { |
|
| 159 | + $output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" '; |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -173,19 +173,19 @@ discard block |
||
| 173 | 173 | * |
| 174 | 174 | * @return string |
| 175 | 175 | */ |
| 176 | - public static function icon($class,$space_after = false, $extra_attributes = array()){ |
|
| 176 | + public static function icon($class, $space_after = false, $extra_attributes = array()) { |
|
| 177 | 177 | $output = ''; |
| 178 | 178 | |
| 179 | - if($class){ |
|
| 179 | + if ($class) { |
|
| 180 | 180 | $classes = self::esc_classes($class); |
| 181 | - if(!empty($classes)){ |
|
| 182 | - $output = '<i class="'.$classes.'" '; |
|
| 181 | + if (!empty($classes)) { |
|
| 182 | + $output = '<i class="' . $classes . '" '; |
|
| 183 | 183 | // extra attributes |
| 184 | - if(!empty($extra_attributes)){ |
|
| 184 | + if (!empty($extra_attributes)) { |
|
| 185 | 185 | $output .= AUI_Component_Helper::extra_attributes($extra_attributes); |
| 186 | 186 | } |
| 187 | 187 | $output .= '></i>'; |
| 188 | - if($space_after){ |
|
| 188 | + if ($space_after) { |
|
| 189 | 189 | $output .= " "; |
| 190 | 190 | } |
| 191 | 191 | } |
@@ -199,17 +199,17 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @return string |
| 201 | 201 | */ |
| 202 | - public static function extra_attributes($args){ |
|
| 202 | + public static function extra_attributes($args) { |
|
| 203 | 203 | $output = ''; |
| 204 | 204 | |
| 205 | - if(!empty($args)){ |
|
| 205 | + if (!empty($args)) { |
|
| 206 | 206 | |
| 207 | - if( is_array($args) ){ |
|
| 208 | - foreach($args as $key => $val){ |
|
| 209 | - $output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" '; |
|
| 207 | + if (is_array($args)) { |
|
| 208 | + foreach ($args as $key => $val) { |
|
| 209 | + $output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" '; |
|
| 210 | 210 | } |
| 211 | - }else{ |
|
| 212 | - $output .= ' '.$args.' '; |
|
| 211 | + } else { |
|
| 212 | + $output .= ' ' . $args . ' '; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | } |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @return string |
| 224 | 224 | */ |
| 225 | - public static function help_text($text){ |
|
| 225 | + public static function help_text($text) { |
|
| 226 | 226 | $output = ''; |
| 227 | 227 | |
| 228 | - if($text){ |
|
| 229 | - $output .= '<small class="form-text text-muted">'.wp_kses_post($text).'</small>'; |
|
| 228 | + if ($text) { |
|
| 229 | + $output .= '<small class="form-text text-muted">' . wp_kses_post($text) . '</small>'; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | |
@@ -240,18 +240,18 @@ discard block |
||
| 240 | 240 | * |
| 241 | 241 | * @return string|void |
| 242 | 242 | */ |
| 243 | - public static function element_require( $input ) { |
|
| 243 | + public static function element_require($input) { |
|
| 244 | 244 | |
| 245 | - $input = str_replace( "'", '"', $input );// we only want double quotes |
|
| 245 | + $input = str_replace("'", '"', $input); // we only want double quotes |
|
| 246 | 246 | |
| 247 | - $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array( |
|
| 247 | + $output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array( |
|
| 248 | 248 | "jQuery(form).find('[data-argument=\"", |
| 249 | 249 | "\"]').find('input,select,textarea').val()", |
| 250 | 250 | "\"]').find('input:checked').val()", |
| 251 | - ), $input ) ); |
|
| 251 | + ), $input)); |
|
| 252 | 252 | |
| 253 | - if($output){ |
|
| 254 | - $output = ' data-element-require="'.$output.'" '; |
|
| 253 | + if ($output) { |
|
| 254 | + $output = ' data-element-require="' . $output . '" '; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | return $output; |
@@ -268,13 +268,13 @@ discard block |
||
| 268 | 268 | * @param array $input Input. |
| 269 | 269 | * @return array Array of allowed HTML tags and their allowed attributes. |
| 270 | 270 | */ |
| 271 | - public static function kses_allowed_html( $context = 'post', $input = array() ) { |
|
| 272 | - $allowed_html = wp_kses_allowed_html( $context ); |
|
| 271 | + public static function kses_allowed_html($context = 'post', $input = array()) { |
|
| 272 | + $allowed_html = wp_kses_allowed_html($context); |
|
| 273 | 273 | |
| 274 | - if ( is_array( $allowed_html ) ) { |
|
| 274 | + if (is_array($allowed_html)) { |
|
| 275 | 275 | // <iframe> |
| 276 | - if ( ! isset( $allowed_html['iframe'] ) && $context == 'post' ) { |
|
| 277 | - $allowed_html['iframe'] = array( |
|
| 276 | + if (!isset($allowed_html['iframe']) && $context == 'post') { |
|
| 277 | + $allowed_html['iframe'] = array( |
|
| 278 | 278 | 'class' => true, |
| 279 | 279 | 'id' => true, |
| 280 | 280 | 'src' => true, |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * @param @param string|array $context The context for which to retrieve tags. |
| 303 | 303 | * @param array $input Input field. |
| 304 | 304 | */ |
| 305 | - return apply_filters( 'ayecode_ui_kses_allowed_html', $allowed_html, $context, $input ); |
|
| 305 | + return apply_filters('ayecode_ui_kses_allowed_html', $allowed_html, $context, $input); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -324,20 +324,20 @@ discard block |
||
| 324 | 324 | * @param array $input Input Field. |
| 325 | 325 | * @return string Filtered content with only allowed HTML elements. |
| 326 | 326 | */ |
| 327 | - public static function _sanitize_html_field( $value, $input = array() ) { |
|
| 328 | - if ( $value === '' ) { |
|
| 327 | + public static function _sanitize_html_field($value, $input = array()) { |
|
| 328 | + if ($value === '') { |
|
| 329 | 329 | return $value; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - $allowed_html = self::kses_allowed_html( 'post', $input ); |
|
| 332 | + $allowed_html = self::kses_allowed_html('post', $input); |
|
| 333 | 333 | |
| 334 | - if ( ! is_array( $allowed_html ) ) { |
|
| 335 | - $allowed_html = wp_kses_allowed_html( 'post' ); |
|
| 334 | + if (!is_array($allowed_html)) { |
|
| 335 | + $allowed_html = wp_kses_allowed_html('post'); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - $filtered = trim( wp_unslash( $value ) ); |
|
| 339 | - $filtered = wp_kses( $filtered, $allowed_html ); |
|
| 340 | - $filtered = balanceTags( $filtered ); // Balances tags |
|
| 338 | + $filtered = trim(wp_unslash($value)); |
|
| 339 | + $filtered = wp_kses($filtered, $allowed_html); |
|
| 340 | + $filtered = balanceTags($filtered); // Balances tags |
|
| 341 | 341 | |
| 342 | 342 | return $filtered; |
| 343 | 343 | } |
@@ -351,21 +351,21 @@ discard block |
||
| 351 | 351 | * @param array $input Input Field. |
| 352 | 352 | * @return mixed Stripped value. |
| 353 | 353 | */ |
| 354 | - public static function sanitize_html_field( $value, $input = array() ) { |
|
| 354 | + public static function sanitize_html_field($value, $input = array()) { |
|
| 355 | 355 | $original = $value; |
| 356 | 356 | |
| 357 | - if ( is_array( $value ) ) { |
|
| 358 | - foreach ( $value as $index => $item ) { |
|
| 359 | - $value[ $index ] = self::_sanitize_html_field( $value, $input ); |
|
| 357 | + if (is_array($value)) { |
|
| 358 | + foreach ($value as $index => $item) { |
|
| 359 | + $value[$index] = self::_sanitize_html_field($value, $input); |
|
| 360 | 360 | } |
| 361 | - } elseif ( is_object( $value ) ) { |
|
| 362 | - $object_vars = get_object_vars( $value ); |
|
| 361 | + } elseif (is_object($value)) { |
|
| 362 | + $object_vars = get_object_vars($value); |
|
| 363 | 363 | |
| 364 | - foreach ( $object_vars as $property_name => $property_value ) { |
|
| 365 | - $value->$property_name = self::_sanitize_html_field( $property_value, $input ); |
|
| 364 | + foreach ($object_vars as $property_name => $property_value) { |
|
| 365 | + $value->$property_name = self::_sanitize_html_field($property_value, $input); |
|
| 366 | 366 | } |
| 367 | 367 | } else { |
| 368 | - $value = self::_sanitize_html_field( $value, $input ); |
|
| 368 | + $value = self::_sanitize_html_field($value, $input); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
@@ -377,6 +377,6 @@ discard block |
||
| 377 | 377 | * @param string|array $value Original content without filter. |
| 378 | 378 | * @param array $input Input Field. |
| 379 | 379 | */ |
| 380 | - return apply_filters( 'ayecode_ui_sanitize_html_field', $value, $original, $input ); |
|
| 380 | + return apply_filters('ayecode_ui_sanitize_html_field', $value, $original, $input); |
|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | \ No newline at end of file |
@@ -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. |
@@ -98,23 +98,23 @@ discard block |
||
| 98 | 98 | * @return AyeCode_UI_Settings - Main instance. |
| 99 | 99 | */ |
| 100 | 100 | public static function instance() { |
| 101 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) { |
|
| 101 | + if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) { |
|
| 102 | 102 | |
| 103 | 103 | self::$instance = new AyeCode_UI_Settings; |
| 104 | 104 | |
| 105 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
| 105 | + add_action('init', array(self::$instance, 'init')); // set settings |
|
| 106 | 106 | |
| 107 | - if ( is_admin() ) { |
|
| 108 | - add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
| 109 | - add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
| 107 | + if (is_admin()) { |
|
| 108 | + add_action('admin_menu', array(self::$instance, 'menu_item')); |
|
| 109 | + add_action('admin_init', array(self::$instance, 'register_settings')); |
|
| 110 | 110 | |
| 111 | 111 | // Maybe show example page |
| 112 | - add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) ); |
|
| 112 | + add_action('template_redirect', array(self::$instance, 'maybe_show_examples')); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - add_action( 'customize_register', array( self::$instance, 'customizer_settings' )); |
|
| 115 | + add_action('customize_register', array(self::$instance, 'customizer_settings')); |
|
| 116 | 116 | |
| 117 | - do_action( 'ayecode_ui_settings_loaded' ); |
|
| 117 | + do_action('ayecode_ui_settings_loaded'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return self::$instance; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | /** |
| 124 | 124 | * Setup some constants. |
| 125 | 125 | */ |
| 126 | - public function constants(){ |
|
| 126 | + public function constants() { |
|
| 127 | 127 | define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be"); |
| 128 | 128 | define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d'); |
| 129 | 129 | if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL); |
@@ -143,25 +143,25 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * We load super early in case there is a theme version that might change the colors |
| 145 | 145 | */ |
| 146 | - if ( $this->settings['css'] ) { |
|
| 147 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 ); |
|
| 146 | + if ($this->settings['css']) { |
|
| 147 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 1); |
|
| 148 | 148 | } |
| 149 | - if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) { |
|
| 150 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 ); |
|
| 149 | + if ($this->settings['css_backend'] && $this->load_admin_scripts()) { |
|
| 150 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // maybe load JS |
| 154 | - if ( $this->settings['js'] ) { |
|
| 154 | + if ($this->settings['js']) { |
|
| 155 | 155 | $priority = $this->is_bs3_compat() ? 100 : 1; |
| 156 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority ); |
|
| 156 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority); |
|
| 157 | 157 | } |
| 158 | - if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) { |
|
| 159 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 ); |
|
| 158 | + if ($this->settings['js_backend'] && $this->load_admin_scripts()) { |
|
| 159 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // Maybe set the HTML font size |
| 163 | - if ( $this->settings['html_font_size'] ) { |
|
| 164 | - add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 ); |
|
| 163 | + if ($this->settings['html_font_size']) { |
|
| 164 | + add_action('wp_footer', array($this, 'html_font_size'), 10); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -172,14 +172,14 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return bool |
| 174 | 174 | */ |
| 175 | - public function load_admin_scripts(){ |
|
| 175 | + public function load_admin_scripts() { |
|
| 176 | 176 | $result = true; |
| 177 | 177 | |
| 178 | 178 | // check if specifically disabled |
| 179 | - if(!empty($this->settings['disable_admin'])){ |
|
| 180 | - $url_parts = explode("\n",$this->settings['disable_admin']); |
|
| 181 | - foreach($url_parts as $part){ |
|
| 182 | - if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){ |
|
| 179 | + if (!empty($this->settings['disable_admin'])) { |
|
| 180 | + $url_parts = explode("\n", $this->settings['disable_admin']); |
|
| 181 | + foreach ($url_parts as $part) { |
|
| 182 | + if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) { |
|
| 183 | 183 | return false; // return early, no point checking further |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * Add a html font size to the footer. |
| 193 | 193 | */ |
| 194 | - public function html_font_size(){ |
|
| 194 | + public function html_font_size() { |
|
| 195 | 195 | $this->settings = $this->get_settings(); |
| 196 | - echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>"; |
|
| 196 | + echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>"; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @return bool |
| 203 | 203 | */ |
| 204 | - public function is_aui_screen(){ |
|
| 204 | + public function is_aui_screen() { |
|
| 205 | 205 | $load = false; |
| 206 | 206 | // check if we should load or not |
| 207 | - if ( is_admin() ) { |
|
| 207 | + if (is_admin()) { |
|
| 208 | 208 | // Only enable on set pages |
| 209 | 209 | $aui_screens = array( |
| 210 | 210 | 'page', |
@@ -213,19 +213,19 @@ discard block |
||
| 213 | 213 | 'appearance_page_gutenberg-widgets', |
| 214 | 214 | 'widgets' |
| 215 | 215 | ); |
| 216 | - $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens ); |
|
| 216 | + $screen_ids = apply_filters('aui_screen_ids', $aui_screens); |
|
| 217 | 217 | |
| 218 | 218 | $screen = get_current_screen(); |
| 219 | 219 | |
| 220 | 220 | // echo '###'.$screen->id; |
| 221 | 221 | |
| 222 | 222 | // check if we are on a AUI screen |
| 223 | - if ( $screen && in_array( $screen->id, $screen_ids ) ) { |
|
| 223 | + if ($screen && in_array($screen->id, $screen_ids)) { |
|
| 224 | 224 | $load = true; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | //load for widget previews in WP 5.8 |
| 228 | - if( !empty($_REQUEST['legacy-widget-preview'])){ |
|
| 228 | + if (!empty($_REQUEST['legacy-widget-preview'])) { |
|
| 229 | 229 | $load = true; |
| 230 | 230 | } |
| 231 | 231 | } |
@@ -238,25 +238,25 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function enqueue_style() { |
| 240 | 240 | |
| 241 | - if( is_admin() && !$this->is_aui_screen()){ |
|
| 241 | + if (is_admin() && !$this->is_aui_screen()) { |
|
| 242 | 242 | // don't add wp-admin scripts if not requested to |
| 243 | - }else{ |
|
| 243 | + } else { |
|
| 244 | 244 | $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend'; |
| 245 | 245 | |
| 246 | 246 | $rtl = is_rtl() ? '-rtl' : ''; |
| 247 | 247 | |
| 248 | - if($this->settings[$css_setting]){ |
|
| 249 | - $compatibility = $this->settings[$css_setting]=='core' ? false : true; |
|
| 250 | - $url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css'; |
|
| 251 | - wp_register_style( 'ayecode-ui', $url, array(), $this->latest ); |
|
| 252 | - wp_enqueue_style( 'ayecode-ui' ); |
|
| 248 | + if ($this->settings[$css_setting]) { |
|
| 249 | + $compatibility = $this->settings[$css_setting] == 'core' ? false : true; |
|
| 250 | + $url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets/css/ayecode-ui' . $rtl . '.css' : $this->url . 'assets/css/ayecode-ui-compatibility' . $rtl . '.css'; |
|
| 251 | + wp_register_style('ayecode-ui', $url, array(), $this->latest); |
|
| 252 | + wp_enqueue_style('ayecode-ui'); |
|
| 253 | 253 | |
| 254 | 254 | // flatpickr |
| 255 | - wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest ); |
|
| 255 | + wp_register_style('flatpickr', $this->url . 'assets/css/flatpickr.min.css', array(), $this->latest); |
|
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | // fix some wp-admin issues |
| 259 | - if(is_admin()){ |
|
| 259 | + if (is_admin()) { |
|
| 260 | 260 | $custom_css = " |
| 261 | 261 | body{ |
| 262 | 262 | background-color: #f1f1f1; |
@@ -305,11 +305,11 @@ discard block |
||
| 305 | 305 | padding: 0; |
| 306 | 306 | } |
| 307 | 307 | "; |
| 308 | - wp_add_inline_style( 'ayecode-ui', $custom_css ); |
|
| 308 | + wp_add_inline_style('ayecode-ui', $custom_css); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | // custom changes |
| 312 | - wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) ); |
|
| 312 | + wp_add_inline_style('ayecode-ui', self::custom_css($compatibility)); |
|
| 313 | 313 | |
| 314 | 314 | } |
| 315 | 315 | } |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | function aui_init_flatpickr(){ |
| 570 | 570 | if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) { |
| 571 | 571 | $aui_doing_init_flatpickr = true; |
| 572 | - <?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
| 572 | + <?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
| 573 | 573 | jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr(); |
| 574 | 574 | } |
| 575 | 575 | $aui_doing_init_flatpickr = false; |
@@ -1023,10 +1023,10 @@ discard block |
||
| 1023 | 1023 | /* |
| 1024 | 1024 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 1025 | 1025 | */ |
| 1026 | - return str_replace( array( |
|
| 1026 | + return str_replace(array( |
|
| 1027 | 1027 | '<script>', |
| 1028 | 1028 | '</script>' |
| 1029 | - ), '', self::minify_js($output) ); |
|
| 1029 | + ), '', self::minify_js($output)); |
|
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | 1032 | |
@@ -1040,13 +1040,13 @@ discard block |
||
| 1040 | 1040 | ob_start(); |
| 1041 | 1041 | ?> |
| 1042 | 1042 | <script> |
| 1043 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
| 1043 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
| 1044 | 1044 | /* With Avada builder */ |
| 1045 | 1045 | |
| 1046 | 1046 | <?php } ?> |
| 1047 | 1047 | </script> |
| 1048 | 1048 | <?php |
| 1049 | - return str_replace( array( |
|
| 1049 | + return str_replace(array( |
|
| 1050 | 1050 | '<script>', |
| 1051 | 1051 | '</script>' |
| 1052 | 1052 | ), '', ob_get_clean()); |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | * |
| 1058 | 1058 | * If this remains small then its best to use this than to add another JS file. |
| 1059 | 1059 | */ |
| 1060 | - public function inline_script_file_browser(){ |
|
| 1060 | + public function inline_script_file_browser() { |
|
| 1061 | 1061 | ob_start(); |
| 1062 | 1062 | ?> |
| 1063 | 1063 | <script> |
@@ -1072,10 +1072,10 @@ discard block |
||
| 1072 | 1072 | /* |
| 1073 | 1073 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 1074 | 1074 | */ |
| 1075 | - return str_replace( array( |
|
| 1075 | + return str_replace(array( |
|
| 1076 | 1076 | '<script>', |
| 1077 | 1077 | '</script>' |
| 1078 | - ), '', $output ); |
|
| 1078 | + ), '', $output); |
|
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | /** |
@@ -1083,50 +1083,50 @@ discard block |
||
| 1083 | 1083 | */ |
| 1084 | 1084 | public function enqueue_scripts() { |
| 1085 | 1085 | |
| 1086 | - if( is_admin() && !$this->is_aui_screen()){ |
|
| 1086 | + if (is_admin() && !$this->is_aui_screen()) { |
|
| 1087 | 1087 | // don't add wp-admin scripts if not requested to |
| 1088 | - }else { |
|
| 1088 | + } else { |
|
| 1089 | 1089 | |
| 1090 | 1090 | $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend'; |
| 1091 | 1091 | |
| 1092 | 1092 | // select2 |
| 1093 | - wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version ); |
|
| 1093 | + wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version); |
|
| 1094 | 1094 | |
| 1095 | 1095 | // flatpickr |
| 1096 | - wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest ); |
|
| 1096 | + wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest); |
|
| 1097 | 1097 | |
| 1098 | 1098 | // Bootstrap file browser |
| 1099 | - wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version ); |
|
| 1100 | - wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() ); |
|
| 1099 | + wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version); |
|
| 1100 | + wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser()); |
|
| 1101 | 1101 | |
| 1102 | 1102 | $load_inline = false; |
| 1103 | 1103 | |
| 1104 | - if ( $this->settings[ $js_setting ] == 'core-popper' ) { |
|
| 1104 | + if ($this->settings[$js_setting] == 'core-popper') { |
|
| 1105 | 1105 | // Bootstrap bundle |
| 1106 | 1106 | $url = $this->url . 'assets/js/bootstrap.bundle.min.js'; |
| 1107 | - wp_register_script( 'bootstrap-js-bundle', $url, array( |
|
| 1107 | + wp_register_script('bootstrap-js-bundle', $url, array( |
|
| 1108 | 1108 | 'select2', |
| 1109 | 1109 | 'jquery' |
| 1110 | - ), $this->latest, $this->is_bs3_compat() ); |
|
| 1110 | + ), $this->latest, $this->is_bs3_compat()); |
|
| 1111 | 1111 | // if in admin then add to footer for compatibility. |
| 1112 | - is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' ); |
|
| 1112 | + is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle'); |
|
| 1113 | 1113 | $script = $this->inline_script(); |
| 1114 | - wp_add_inline_script( 'bootstrap-js-bundle', $script ); |
|
| 1115 | - } elseif ( $this->settings[ $js_setting ] == 'popper' ) { |
|
| 1114 | + wp_add_inline_script('bootstrap-js-bundle', $script); |
|
| 1115 | + } elseif ($this->settings[$js_setting] == 'popper') { |
|
| 1116 | 1116 | $url = $this->url . 'assets/js/popper.min.js'; |
| 1117 | - wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->latest ); |
|
| 1118 | - wp_enqueue_script( 'bootstrap-js-popper' ); |
|
| 1117 | + wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->latest); |
|
| 1118 | + wp_enqueue_script('bootstrap-js-popper'); |
|
| 1119 | 1119 | $load_inline = true; |
| 1120 | 1120 | } else { |
| 1121 | 1121 | $load_inline = true; |
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | 1124 | // Load needed inline scripts by faking the loading of a script if the main script is not being loaded |
| 1125 | - if ( $load_inline ) { |
|
| 1126 | - wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) ); |
|
| 1127 | - wp_enqueue_script( 'bootstrap-dummy' ); |
|
| 1125 | + if ($load_inline) { |
|
| 1126 | + wp_register_script('bootstrap-dummy', '', array('select2', 'jquery')); |
|
| 1127 | + wp_enqueue_script('bootstrap-dummy'); |
|
| 1128 | 1128 | $script = $this->inline_script(); |
| 1129 | - wp_add_inline_script( 'bootstrap-dummy', $script ); |
|
| 1129 | + wp_add_inline_script('bootstrap-dummy', $script); |
|
| 1130 | 1130 | } |
| 1131 | 1131 | } |
| 1132 | 1132 | |
@@ -1135,9 +1135,9 @@ discard block |
||
| 1135 | 1135 | /** |
| 1136 | 1136 | * Enqueue flatpickr if called. |
| 1137 | 1137 | */ |
| 1138 | - public function enqueue_flatpickr(){ |
|
| 1139 | - wp_enqueue_style( 'flatpickr' ); |
|
| 1140 | - wp_enqueue_script( 'flatpickr' ); |
|
| 1138 | + public function enqueue_flatpickr() { |
|
| 1139 | + wp_enqueue_style('flatpickr'); |
|
| 1140 | + wp_enqueue_script('flatpickr'); |
|
| 1141 | 1141 | } |
| 1142 | 1142 | |
| 1143 | 1143 | /** |
@@ -1149,15 +1149,15 @@ discard block |
||
| 1149 | 1149 | |
| 1150 | 1150 | $url = ''; |
| 1151 | 1151 | // check if we are inside a plugin |
| 1152 | - $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
| 1152 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
| 1153 | 1153 | |
| 1154 | 1154 | // add check in-case user has changed wp-content dir name. |
| 1155 | 1155 | $wp_content_folder_name = basename(WP_CONTENT_DIR); |
| 1156 | - $dir_parts = explode("/$wp_content_folder_name/",$file_dir); |
|
| 1157 | - $url_parts = explode("/$wp_content_folder_name/",plugins_url()); |
|
| 1156 | + $dir_parts = explode("/$wp_content_folder_name/", $file_dir); |
|
| 1157 | + $url_parts = explode("/$wp_content_folder_name/", plugins_url()); |
|
| 1158 | 1158 | |
| 1159 | - if(!empty($url_parts[0]) && !empty($dir_parts[1])){ |
|
| 1160 | - $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] ); |
|
| 1159 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
| 1160 | + $url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]); |
|
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | 1163 | return $url; |
@@ -1167,7 +1167,7 @@ discard block |
||
| 1167 | 1167 | * Register the database settings with WordPress. |
| 1168 | 1168 | */ |
| 1169 | 1169 | public function register_settings() { |
| 1170 | - register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' ); |
|
| 1170 | + register_setting('ayecode-ui-settings', 'ayecode-ui-settings'); |
|
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | 1173 | /** |
@@ -1176,10 +1176,10 @@ discard block |
||
| 1176 | 1176 | */ |
| 1177 | 1177 | public function menu_item() { |
| 1178 | 1178 | $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
| 1179 | - call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array( |
|
| 1179 | + call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array( |
|
| 1180 | 1180 | $this, |
| 1181 | 1181 | 'settings_page' |
| 1182 | - ) ); |
|
| 1182 | + )); |
|
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | /** |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | * |
| 1188 | 1188 | * @return array |
| 1189 | 1189 | */ |
| 1190 | - public function theme_js_settings(){ |
|
| 1190 | + public function theme_js_settings() { |
|
| 1191 | 1191 | return array( |
| 1192 | 1192 | 'ayetheme' => 'popper', |
| 1193 | 1193 | 'listimia' => 'required', |
@@ -1203,17 +1203,17 @@ discard block |
||
| 1203 | 1203 | */ |
| 1204 | 1204 | public function get_settings() { |
| 1205 | 1205 | |
| 1206 | - $db_settings = get_option( 'ayecode-ui-settings' ); |
|
| 1206 | + $db_settings = get_option('ayecode-ui-settings'); |
|
| 1207 | 1207 | $js_default = 'core-popper'; |
| 1208 | 1208 | $js_default_backend = $js_default; |
| 1209 | 1209 | |
| 1210 | 1210 | // maybe set defaults (if no settings set) |
| 1211 | - if(empty($db_settings)){ |
|
| 1212 | - $active_theme = strtolower( get_template() ); // active parent theme. |
|
| 1211 | + if (empty($db_settings)) { |
|
| 1212 | + $active_theme = strtolower(get_template()); // active parent theme. |
|
| 1213 | 1213 | $theme_js_settings = self::theme_js_settings(); |
| 1214 | - if(isset($theme_js_settings[$active_theme])){ |
|
| 1214 | + if (isset($theme_js_settings[$active_theme])) { |
|
| 1215 | 1215 | $js_default = $theme_js_settings[$active_theme]; |
| 1216 | - $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default; |
|
| 1216 | + $js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default; |
|
| 1217 | 1217 | } |
| 1218 | 1218 | } |
| 1219 | 1219 | |
@@ -1226,14 +1226,14 @@ discard block |
||
| 1226 | 1226 | 'disable_admin' => '', // URL snippets to disable loading on admin |
| 1227 | 1227 | ); |
| 1228 | 1228 | |
| 1229 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
| 1229 | + $settings = wp_parse_args($db_settings, $defaults); |
|
| 1230 | 1230 | |
| 1231 | 1231 | /** |
| 1232 | 1232 | * Filter the Bootstrap settings. |
| 1233 | 1233 | * |
| 1234 | 1234 | * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
| 1235 | 1235 | */ |
| 1236 | - return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults ); |
|
| 1236 | + return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults); |
|
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | |
@@ -1241,90 +1241,90 @@ discard block |
||
| 1241 | 1241 | * The settings page html output. |
| 1242 | 1242 | */ |
| 1243 | 1243 | public function settings_page() { |
| 1244 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 1245 | - wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) ); |
|
| 1244 | + if (!current_user_can('manage_options')) { |
|
| 1245 | + wp_die(__('You do not have sufficient permissions to access this page.', 'aui')); |
|
| 1246 | 1246 | } |
| 1247 | 1247 | ?> |
| 1248 | 1248 | <div class="wrap"> |
| 1249 | 1249 | <h1><?php echo $this->name; ?></h1> |
| 1250 | - <p><?php _e("Here you can adjust settings if you are having compatibility issues.",'aui');?></p> |
|
| 1250 | + <p><?php _e("Here you can adjust settings if you are having compatibility issues.", 'aui'); ?></p> |
|
| 1251 | 1251 | <form method="post" action="options.php"> |
| 1252 | 1252 | <?php |
| 1253 | - settings_fields( 'ayecode-ui-settings' ); |
|
| 1254 | - do_settings_sections( 'ayecode-ui-settings' ); |
|
| 1253 | + settings_fields('ayecode-ui-settings'); |
|
| 1254 | + do_settings_sections('ayecode-ui-settings'); |
|
| 1255 | 1255 | ?> |
| 1256 | 1256 | |
| 1257 | - <h2><?php _e( 'Frontend', 'aui' ); ?></h2> |
|
| 1257 | + <h2><?php _e('Frontend', 'aui'); ?></h2> |
|
| 1258 | 1258 | <table class="form-table wpbs-table-settings"> |
| 1259 | 1259 | <tr valign="top"> |
| 1260 | 1260 | <th scope="row"><label |
| 1261 | - for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th> |
|
| 1261 | + for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th> |
|
| 1262 | 1262 | <td> |
| 1263 | 1263 | <select name="ayecode-ui-settings[css]" id="wpbs-css"> |
| 1264 | - <option value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option> |
|
| 1265 | - <option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option> |
|
| 1266 | - <option value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option> |
|
| 1264 | + <option value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option> |
|
| 1265 | + <option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option> |
|
| 1266 | + <option value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'aui'); ?></option> |
|
| 1267 | 1267 | </select> |
| 1268 | 1268 | </td> |
| 1269 | 1269 | </tr> |
| 1270 | 1270 | |
| 1271 | 1271 | <tr valign="top"> |
| 1272 | 1272 | <th scope="row"><label |
| 1273 | - for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th> |
|
| 1273 | + for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th> |
|
| 1274 | 1274 | <td> |
| 1275 | 1275 | <select name="ayecode-ui-settings[js]" id="wpbs-js"> |
| 1276 | - <option value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option> |
|
| 1277 | - <option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option> |
|
| 1278 | - <option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option> |
|
| 1279 | - <option value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option> |
|
| 1276 | + <option value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option> |
|
| 1277 | + <option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option> |
|
| 1278 | + <option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option> |
|
| 1279 | + <option value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option> |
|
| 1280 | 1280 | </select> |
| 1281 | 1281 | </td> |
| 1282 | 1282 | </tr> |
| 1283 | 1283 | |
| 1284 | 1284 | <tr valign="top"> |
| 1285 | 1285 | <th scope="row"><label |
| 1286 | - for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'aui' ); ?></label></th> |
|
| 1286 | + for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'aui'); ?></label></th> |
|
| 1287 | 1287 | <td> |
| 1288 | - <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" /> |
|
| 1289 | - <p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.",'aui');?></p> |
|
| 1288 | + <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" /> |
|
| 1289 | + <p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'aui'); ?></p> |
|
| 1290 | 1290 | </td> |
| 1291 | 1291 | </tr> |
| 1292 | 1292 | |
| 1293 | 1293 | </table> |
| 1294 | 1294 | |
| 1295 | - <h2><?php _e( 'Backend', 'aui' ); ?> (wp-admin)</h2> |
|
| 1295 | + <h2><?php _e('Backend', 'aui'); ?> (wp-admin)</h2> |
|
| 1296 | 1296 | <table class="form-table wpbs-table-settings"> |
| 1297 | 1297 | <tr valign="top"> |
| 1298 | 1298 | <th scope="row"><label |
| 1299 | - for="wpbs-css-admin"><?php _e( 'Load CSS', 'aui' ); ?></label></th> |
|
| 1299 | + for="wpbs-css-admin"><?php _e('Load CSS', 'aui'); ?></label></th> |
|
| 1300 | 1300 | <td> |
| 1301 | 1301 | <select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin"> |
| 1302 | - <option value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option> |
|
| 1303 | - <option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode (will cause style issues)', 'aui' ); ?></option> |
|
| 1304 | - <option value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option> |
|
| 1302 | + <option value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option> |
|
| 1303 | + <option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode (will cause style issues)', 'aui'); ?></option> |
|
| 1304 | + <option value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _e('Disabled', 'aui'); ?></option> |
|
| 1305 | 1305 | </select> |
| 1306 | 1306 | </td> |
| 1307 | 1307 | </tr> |
| 1308 | 1308 | |
| 1309 | 1309 | <tr valign="top"> |
| 1310 | 1310 | <th scope="row"><label |
| 1311 | - for="wpbs-js-admin"><?php _e( 'Load JS', 'aui' ); ?></label></th> |
|
| 1311 | + for="wpbs-js-admin"><?php _e('Load JS', 'aui'); ?></label></th> |
|
| 1312 | 1312 | <td> |
| 1313 | 1313 | <select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin"> |
| 1314 | - <option value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option> |
|
| 1315 | - <option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option> |
|
| 1316 | - <option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option> |
|
| 1317 | - <option value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option> |
|
| 1314 | + <option value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option> |
|
| 1315 | + <option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option> |
|
| 1316 | + <option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option> |
|
| 1317 | + <option value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option> |
|
| 1318 | 1318 | </select> |
| 1319 | 1319 | </td> |
| 1320 | 1320 | </tr> |
| 1321 | 1321 | |
| 1322 | 1322 | <tr valign="top"> |
| 1323 | 1323 | <th scope="row"><label |
| 1324 | - for="wpbs-disable-admin"><?php _e( 'Disable load on URL', 'aui' ); ?></label></th> |
|
| 1324 | + for="wpbs-disable-admin"><?php _e('Disable load on URL', 'aui'); ?></label></th> |
|
| 1325 | 1325 | <td> |
| 1326 | - <p><?php _e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui' ); ?></p> |
|
| 1327 | - <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> |
|
| 1326 | + <p><?php _e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui'); ?></p> |
|
| 1327 | + <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> |
|
| 1328 | 1328 | |
| 1329 | 1329 | </td> |
| 1330 | 1330 | </tr> |
@@ -1342,9 +1342,9 @@ discard block |
||
| 1342 | 1342 | <?php |
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | - public function customizer_settings($wp_customize){ |
|
| 1345 | + public function customizer_settings($wp_customize) { |
|
| 1346 | 1346 | $wp_customize->add_section('aui_settings', array( |
| 1347 | - 'title' => __('AyeCode UI','aui'), |
|
| 1347 | + 'title' => __('AyeCode UI', 'aui'), |
|
| 1348 | 1348 | 'priority' => 120, |
| 1349 | 1349 | )); |
| 1350 | 1350 | |
@@ -1358,8 +1358,8 @@ discard block |
||
| 1358 | 1358 | 'type' => 'option', |
| 1359 | 1359 | 'transport' => 'refresh', |
| 1360 | 1360 | )); |
| 1361 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
| 1362 | - 'label' => __('Primary Color','aui'), |
|
| 1361 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
| 1362 | + 'label' => __('Primary Color', 'aui'), |
|
| 1363 | 1363 | 'section' => 'aui_settings', |
| 1364 | 1364 | 'settings' => 'aui_options[color_primary]', |
| 1365 | 1365 | ))); |
@@ -1371,8 +1371,8 @@ discard block |
||
| 1371 | 1371 | 'type' => 'option', |
| 1372 | 1372 | 'transport' => 'refresh', |
| 1373 | 1373 | )); |
| 1374 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
| 1375 | - 'label' => __('Secondary Color','aui'), |
|
| 1374 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
| 1375 | + 'label' => __('Secondary Color', 'aui'), |
|
| 1376 | 1376 | 'section' => 'aui_settings', |
| 1377 | 1377 | 'settings' => 'aui_options[color_secondary]', |
| 1378 | 1378 | ))); |
@@ -1398,12 +1398,12 @@ discard block |
||
| 1398 | 1398 | .collapse.show:not(.in){display: inherit;} |
| 1399 | 1399 | .fade.show{opacity: 1;} |
| 1400 | 1400 | |
| 1401 | - <?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?> |
|
| 1401 | + <?php if (defined('SVQ_THEME_VERSION')) { ?> |
|
| 1402 | 1402 | /* KLEO theme specific */ |
| 1403 | 1403 | .kleo-main-header .navbar-collapse.collapse.show:not(.in){display: block !important;} |
| 1404 | 1404 | <?php } ?> |
| 1405 | 1405 | |
| 1406 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
| 1406 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
| 1407 | 1407 | /* With Avada builder */ |
| 1408 | 1408 | body.modal-open .modal.in {opacity:1;z-index: 99999} |
| 1409 | 1409 | body.modal-open .modal.bsui.in .modal-content {box-shadow: none;} |
@@ -1411,10 +1411,10 @@ discard block |
||
| 1411 | 1411 | <?php } ?> |
| 1412 | 1412 | </style> |
| 1413 | 1413 | <?php |
| 1414 | - return str_replace( array( |
|
| 1414 | + return str_replace(array( |
|
| 1415 | 1415 | '<style>', |
| 1416 | 1416 | '</style>' |
| 1417 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
| 1417 | + ), '', self::minify_css(ob_get_clean())); |
|
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | |
@@ -1431,16 +1431,16 @@ discard block |
||
| 1431 | 1431 | <?php |
| 1432 | 1432 | |
| 1433 | 1433 | // BS v3 compat |
| 1434 | - if( self::is_bs3_compat() ){ |
|
| 1434 | + if (self::is_bs3_compat()) { |
|
| 1435 | 1435 | echo self::bs3_compat_css(); |
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | - if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){ |
|
| 1439 | - echo self::css_primary($primary_color,$compatibility); |
|
| 1438 | + if (!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL) { |
|
| 1439 | + echo self::css_primary($primary_color, $compatibility); |
|
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | - if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){ |
|
| 1443 | - echo self::css_secondary($settings['color_secondary'],$compatibility); |
|
| 1442 | + if (!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL) { |
|
| 1443 | + echo self::css_secondary($settings['color_secondary'], $compatibility); |
|
| 1444 | 1444 | } |
| 1445 | 1445 | |
| 1446 | 1446 | // Set admin bar z-index lower when modal is open. |
@@ -1453,10 +1453,10 @@ discard block |
||
| 1453 | 1453 | /* |
| 1454 | 1454 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 1455 | 1455 | */ |
| 1456 | - return str_replace( array( |
|
| 1456 | + return str_replace(array( |
|
| 1457 | 1457 | '<style>', |
| 1458 | 1458 | '</style>' |
| 1459 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
| 1459 | + ), '', self::minify_css(ob_get_clean())); |
|
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | 1462 | /** |
@@ -1464,48 +1464,48 @@ discard block |
||
| 1464 | 1464 | * |
| 1465 | 1465 | * @return bool |
| 1466 | 1466 | */ |
| 1467 | - public static function is_bs3_compat(){ |
|
| 1467 | + public static function is_bs3_compat() { |
|
| 1468 | 1468 | return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION'); |
| 1469 | 1469 | } |
| 1470 | 1470 | |
| 1471 | - public static function css_primary($color_code,$compatibility){; |
|
| 1471 | + public static function css_primary($color_code, $compatibility) {; |
|
| 1472 | 1472 | $color_code = sanitize_hex_color($color_code); |
| 1473 | - if(!$color_code){return '';} |
|
| 1473 | + if (!$color_code) {return ''; } |
|
| 1474 | 1474 | /** |
| 1475 | 1475 | * c = color, b = background color, o = border-color, f = fill |
| 1476 | 1476 | */ |
| 1477 | 1477 | $selectors = array( |
| 1478 | 1478 | 'a' => array('c'), |
| 1479 | - '.btn-primary' => array('b','o'), |
|
| 1480 | - '.btn-primary.disabled' => array('b','o'), |
|
| 1481 | - '.btn-primary:disabled' => array('b','o'), |
|
| 1482 | - '.btn-outline-primary' => array('c','o'), |
|
| 1483 | - '.btn-outline-primary:hover' => array('b','o'), |
|
| 1484 | - '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
| 1485 | - '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
| 1486 | - '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'), |
|
| 1479 | + '.btn-primary' => array('b', 'o'), |
|
| 1480 | + '.btn-primary.disabled' => array('b', 'o'), |
|
| 1481 | + '.btn-primary:disabled' => array('b', 'o'), |
|
| 1482 | + '.btn-outline-primary' => array('c', 'o'), |
|
| 1483 | + '.btn-outline-primary:hover' => array('b', 'o'), |
|
| 1484 | + '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
| 1485 | + '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
| 1486 | + '.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'), |
|
| 1487 | 1487 | '.btn-link' => array('c'), |
| 1488 | 1488 | '.dropdown-item.active' => array('b'), |
| 1489 | - '.custom-control-input:checked~.custom-control-label::before' => array('b','o'), |
|
| 1490 | - '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'), |
|
| 1489 | + '.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'), |
|
| 1490 | + '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'), |
|
| 1491 | 1491 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
| 1492 | 1492 | // '.custom-range::-moz-range-thumb' => array('b'), |
| 1493 | 1493 | // '.custom-range::-ms-thumb' => array('b'), |
| 1494 | 1494 | '.nav-pills .nav-link.active' => array('b'), |
| 1495 | 1495 | '.nav-pills .show>.nav-link' => array('b'), |
| 1496 | 1496 | '.page-link' => array('c'), |
| 1497 | - '.page-item.active .page-link' => array('b','o'), |
|
| 1497 | + '.page-item.active .page-link' => array('b', 'o'), |
|
| 1498 | 1498 | '.badge-primary' => array('b'), |
| 1499 | - '.alert-primary' => array('b','o'), |
|
| 1499 | + '.alert-primary' => array('b', 'o'), |
|
| 1500 | 1500 | '.progress-bar' => array('b'), |
| 1501 | - '.list-group-item.active' => array('b','o'), |
|
| 1502 | - '.bg-primary' => array('b','f'), |
|
| 1501 | + '.list-group-item.active' => array('b', 'o'), |
|
| 1502 | + '.bg-primary' => array('b', 'f'), |
|
| 1503 | 1503 | '.btn-link.btn-primary' => array('c'), |
| 1504 | 1504 | '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
| 1505 | 1505 | ); |
| 1506 | 1506 | |
| 1507 | 1507 | $important_selectors = array( |
| 1508 | - '.bg-primary' => array('b','f'), |
|
| 1508 | + '.bg-primary' => array('b', 'f'), |
|
| 1509 | 1509 | '.border-primary' => array('o'), |
| 1510 | 1510 | '.text-primary' => array('c'), |
| 1511 | 1511 | ); |
@@ -1522,116 +1522,116 @@ discard block |
||
| 1522 | 1522 | $output = ''; |
| 1523 | 1523 | |
| 1524 | 1524 | // build rules into each type |
| 1525 | - foreach($selectors as $selector => $types){ |
|
| 1526 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
| 1527 | - $types = array_combine($types,$types); |
|
| 1528 | - if(isset($types['c'])){$color[] = $selector;} |
|
| 1529 | - if(isset($types['b'])){$background[] = $selector;} |
|
| 1530 | - if(isset($types['o'])){$border[] = $selector;} |
|
| 1531 | - if(isset($types['f'])){$fill[] = $selector;} |
|
| 1525 | + foreach ($selectors as $selector => $types) { |
|
| 1526 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
| 1527 | + $types = array_combine($types, $types); |
|
| 1528 | + if (isset($types['c'])) {$color[] = $selector; } |
|
| 1529 | + if (isset($types['b'])) {$background[] = $selector; } |
|
| 1530 | + if (isset($types['o'])) {$border[] = $selector; } |
|
| 1531 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | 1534 | // build rules into each type |
| 1535 | - foreach($important_selectors as $selector => $types){ |
|
| 1536 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
| 1537 | - $types = array_combine($types,$types); |
|
| 1538 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
| 1539 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
| 1540 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
| 1541 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
| 1535 | + foreach ($important_selectors as $selector => $types) { |
|
| 1536 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
| 1537 | + $types = array_combine($types, $types); |
|
| 1538 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
| 1539 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
| 1540 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
| 1541 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | 1544 | // add any color rules |
| 1545 | - if(!empty($color)){ |
|
| 1546 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
| 1545 | + if (!empty($color)) { |
|
| 1546 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
| 1547 | 1547 | } |
| 1548 | - if(!empty($color_i)){ |
|
| 1549 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
| 1548 | + if (!empty($color_i)) { |
|
| 1549 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
| 1550 | 1550 | } |
| 1551 | 1551 | |
| 1552 | 1552 | // add any background color rules |
| 1553 | - if(!empty($background)){ |
|
| 1554 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
| 1553 | + if (!empty($background)) { |
|
| 1554 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
| 1555 | 1555 | } |
| 1556 | - if(!empty($background_i)){ |
|
| 1557 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
| 1556 | + if (!empty($background_i)) { |
|
| 1557 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | // add any border color rules |
| 1561 | - if(!empty($border)){ |
|
| 1562 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
| 1561 | + if (!empty($border)) { |
|
| 1562 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
| 1563 | 1563 | } |
| 1564 | - if(!empty($border_i)){ |
|
| 1565 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
| 1564 | + if (!empty($border_i)) { |
|
| 1565 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | // add any fill color rules |
| 1569 | - if(!empty($fill)){ |
|
| 1570 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
| 1569 | + if (!empty($fill)) { |
|
| 1570 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
| 1571 | 1571 | } |
| 1572 | - if(!empty($fill_i)){ |
|
| 1573 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
| 1572 | + if (!empty($fill_i)) { |
|
| 1573 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | 1576 | |
| 1577 | 1577 | $prefix = $compatibility ? ".bsui " : ""; |
| 1578 | 1578 | |
| 1579 | 1579 | // darken |
| 1580 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
| 1581 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
| 1582 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
| 1580 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
| 1581 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
| 1582 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
| 1583 | 1583 | |
| 1584 | 1584 | // lighten |
| 1585 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
| 1585 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
| 1586 | 1586 | |
| 1587 | 1587 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
| 1588 | - $op_25 = $color_code."40"; // 25% opacity |
|
| 1588 | + $op_25 = $color_code . "40"; // 25% opacity |
|
| 1589 | 1589 | |
| 1590 | 1590 | |
| 1591 | 1591 | // button states |
| 1592 | - $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
| 1593 | - $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;} "; |
|
| 1594 | - $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.";} "; |
|
| 1595 | - $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;} "; |
|
| 1592 | + $output .= $prefix . " .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
| 1593 | + $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;} "; |
|
| 1594 | + $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 . ";} "; |
|
| 1595 | + $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;} "; |
|
| 1596 | 1596 | |
| 1597 | 1597 | |
| 1598 | 1598 | // dropdown's |
| 1599 | - $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
| 1599 | + $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
| 1600 | 1600 | |
| 1601 | 1601 | |
| 1602 | 1602 | // input states |
| 1603 | - $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
| 1603 | + $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
| 1604 | 1604 | |
| 1605 | 1605 | // page link |
| 1606 | - $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
| 1606 | + $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
| 1607 | 1607 | |
| 1608 | 1608 | return $output; |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| 1611 | - public static function css_secondary($color_code,$compatibility){; |
|
| 1611 | + public static function css_secondary($color_code, $compatibility) {; |
|
| 1612 | 1612 | $color_code = sanitize_hex_color($color_code); |
| 1613 | - if(!$color_code){return '';} |
|
| 1613 | + if (!$color_code) {return ''; } |
|
| 1614 | 1614 | /** |
| 1615 | 1615 | * c = color, b = background color, o = border-color, f = fill |
| 1616 | 1616 | */ |
| 1617 | 1617 | $selectors = array( |
| 1618 | - '.btn-secondary' => array('b','o'), |
|
| 1619 | - '.btn-secondary.disabled' => array('b','o'), |
|
| 1620 | - '.btn-secondary:disabled' => array('b','o'), |
|
| 1621 | - '.btn-outline-secondary' => array('c','o'), |
|
| 1622 | - '.btn-outline-secondary:hover' => array('b','o'), |
|
| 1618 | + '.btn-secondary' => array('b', 'o'), |
|
| 1619 | + '.btn-secondary.disabled' => array('b', 'o'), |
|
| 1620 | + '.btn-secondary:disabled' => array('b', 'o'), |
|
| 1621 | + '.btn-outline-secondary' => array('c', 'o'), |
|
| 1622 | + '.btn-outline-secondary:hover' => array('b', 'o'), |
|
| 1623 | 1623 | '.btn-outline-secondary.disabled' => array('c'), |
| 1624 | 1624 | '.btn-outline-secondary:disabled' => array('c'), |
| 1625 | - '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
| 1626 | - '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
| 1627 | - '.btn-outline-secondary.dropdown-toggle' => array('b','o'), |
|
| 1625 | + '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
| 1626 | + '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
| 1627 | + '.btn-outline-secondary.dropdown-toggle' => array('b', 'o'), |
|
| 1628 | 1628 | '.badge-secondary' => array('b'), |
| 1629 | - '.alert-secondary' => array('b','o'), |
|
| 1629 | + '.alert-secondary' => array('b', 'o'), |
|
| 1630 | 1630 | '.btn-link.btn-secondary' => array('c'), |
| 1631 | 1631 | ); |
| 1632 | 1632 | |
| 1633 | 1633 | $important_selectors = array( |
| 1634 | - '.bg-secondary' => array('b','f'), |
|
| 1634 | + '.bg-secondary' => array('b', 'f'), |
|
| 1635 | 1635 | '.border-secondary' => array('o'), |
| 1636 | 1636 | '.text-secondary' => array('c'), |
| 1637 | 1637 | ); |
@@ -1648,77 +1648,77 @@ discard block |
||
| 1648 | 1648 | $output = ''; |
| 1649 | 1649 | |
| 1650 | 1650 | // build rules into each type |
| 1651 | - foreach($selectors as $selector => $types){ |
|
| 1652 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
| 1653 | - $types = array_combine($types,$types); |
|
| 1654 | - if(isset($types['c'])){$color[] = $selector;} |
|
| 1655 | - if(isset($types['b'])){$background[] = $selector;} |
|
| 1656 | - if(isset($types['o'])){$border[] = $selector;} |
|
| 1657 | - if(isset($types['f'])){$fill[] = $selector;} |
|
| 1651 | + foreach ($selectors as $selector => $types) { |
|
| 1652 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
| 1653 | + $types = array_combine($types, $types); |
|
| 1654 | + if (isset($types['c'])) {$color[] = $selector; } |
|
| 1655 | + if (isset($types['b'])) {$background[] = $selector; } |
|
| 1656 | + if (isset($types['o'])) {$border[] = $selector; } |
|
| 1657 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | // build rules into each type |
| 1661 | - foreach($important_selectors as $selector => $types){ |
|
| 1662 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
| 1663 | - $types = array_combine($types,$types); |
|
| 1664 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
| 1665 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
| 1666 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
| 1667 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
| 1661 | + foreach ($important_selectors as $selector => $types) { |
|
| 1662 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
| 1663 | + $types = array_combine($types, $types); |
|
| 1664 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
| 1665 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
| 1666 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
| 1667 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | 1670 | // add any color rules |
| 1671 | - if(!empty($color)){ |
|
| 1672 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
| 1671 | + if (!empty($color)) { |
|
| 1672 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
| 1673 | 1673 | } |
| 1674 | - if(!empty($color_i)){ |
|
| 1675 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
| 1674 | + if (!empty($color_i)) { |
|
| 1675 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
| 1676 | 1676 | } |
| 1677 | 1677 | |
| 1678 | 1678 | // add any background color rules |
| 1679 | - if(!empty($background)){ |
|
| 1680 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
| 1679 | + if (!empty($background)) { |
|
| 1680 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
| 1681 | 1681 | } |
| 1682 | - if(!empty($background_i)){ |
|
| 1683 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
| 1682 | + if (!empty($background_i)) { |
|
| 1683 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | 1686 | // add any border color rules |
| 1687 | - if(!empty($border)){ |
|
| 1688 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
| 1687 | + if (!empty($border)) { |
|
| 1688 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
| 1689 | 1689 | } |
| 1690 | - if(!empty($border_i)){ |
|
| 1691 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
| 1690 | + if (!empty($border_i)) { |
|
| 1691 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | 1694 | // add any fill color rules |
| 1695 | - if(!empty($fill)){ |
|
| 1696 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
| 1695 | + if (!empty($fill)) { |
|
| 1696 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
| 1697 | 1697 | } |
| 1698 | - if(!empty($fill_i)){ |
|
| 1699 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
| 1698 | + if (!empty($fill_i)) { |
|
| 1699 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
| 1700 | 1700 | } |
| 1701 | 1701 | |
| 1702 | 1702 | |
| 1703 | 1703 | $prefix = $compatibility ? ".bsui " : ""; |
| 1704 | 1704 | |
| 1705 | 1705 | // darken |
| 1706 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
| 1707 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
| 1708 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
| 1706 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
| 1707 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
| 1708 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
| 1709 | 1709 | |
| 1710 | 1710 | // lighten |
| 1711 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
| 1711 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
| 1712 | 1712 | |
| 1713 | 1713 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
| 1714 | - $op_25 = $color_code."40"; // 25% opacity |
|
| 1714 | + $op_25 = $color_code . "40"; // 25% opacity |
|
| 1715 | 1715 | |
| 1716 | 1716 | |
| 1717 | 1717 | // button states |
| 1718 | - $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
| 1719 | - $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;} "; |
|
| 1720 | - $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.";} "; |
|
| 1721 | - $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;} "; |
|
| 1718 | + $output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
| 1719 | + $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;} "; |
|
| 1720 | + $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 . ";} "; |
|
| 1721 | + $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;} "; |
|
| 1722 | 1722 | |
| 1723 | 1723 | |
| 1724 | 1724 | return $output; |
@@ -1754,8 +1754,8 @@ discard block |
||
| 1754 | 1754 | /** |
| 1755 | 1755 | * Check if we should display examples. |
| 1756 | 1756 | */ |
| 1757 | - public function maybe_show_examples(){ |
|
| 1758 | - if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){ |
|
| 1757 | + public function maybe_show_examples() { |
|
| 1758 | + if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) { |
|
| 1759 | 1759 | echo "<head>"; |
| 1760 | 1760 | wp_head(); |
| 1761 | 1761 | echo "</head>"; |
@@ -1771,7 +1771,7 @@ discard block |
||
| 1771 | 1771 | * |
| 1772 | 1772 | * @return string |
| 1773 | 1773 | */ |
| 1774 | - public function get_examples(){ |
|
| 1774 | + public function get_examples() { |
|
| 1775 | 1775 | $output = ''; |
| 1776 | 1776 | |
| 1777 | 1777 | |
@@ -1877,74 +1877,74 @@ discard block |
||
| 1877 | 1877 | */ |
| 1878 | 1878 | public static function calendar_params() { |
| 1879 | 1879 | $params = array( |
| 1880 | - 'month_long_1' => __( 'January', 'aui' ), |
|
| 1881 | - 'month_long_2' => __( 'February', 'aui' ), |
|
| 1882 | - 'month_long_3' => __( 'March', 'aui' ), |
|
| 1883 | - 'month_long_4' => __( 'April', 'aui' ), |
|
| 1884 | - 'month_long_5' => __( 'May', 'aui' ), |
|
| 1885 | - 'month_long_6' => __( 'June', 'aui' ), |
|
| 1886 | - 'month_long_7' => __( 'July', 'aui' ), |
|
| 1887 | - 'month_long_8' => __( 'August', 'aui' ), |
|
| 1888 | - 'month_long_9' => __( 'September', 'aui' ), |
|
| 1889 | - 'month_long_10' => __( 'October', 'aui' ), |
|
| 1890 | - 'month_long_11' => __( 'November', 'aui' ), |
|
| 1891 | - 'month_long_12' => __( 'December', 'aui' ), |
|
| 1892 | - 'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ), |
|
| 1893 | - 'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ), |
|
| 1894 | - 'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ), |
|
| 1895 | - 'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ), |
|
| 1896 | - 'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ), |
|
| 1897 | - 'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ), |
|
| 1898 | - 'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ), |
|
| 1899 | - 'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ), |
|
| 1900 | - 'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ), |
|
| 1901 | - 'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ), |
|
| 1902 | - 'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ), |
|
| 1903 | - 'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ), |
|
| 1904 | - 'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ), |
|
| 1905 | - 'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ), |
|
| 1906 | - 'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ), |
|
| 1907 | - 'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ), |
|
| 1908 | - 'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ), |
|
| 1909 | - 'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ), |
|
| 1910 | - 'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ), |
|
| 1911 | - 'day_s2_1' => __( 'Su', 'aui' ), |
|
| 1912 | - 'day_s2_2' => __( 'Mo', 'aui' ), |
|
| 1913 | - 'day_s2_3' => __( 'Tu', 'aui' ), |
|
| 1914 | - 'day_s2_4' => __( 'We', 'aui' ), |
|
| 1915 | - 'day_s2_5' => __( 'Th', 'aui' ), |
|
| 1916 | - 'day_s2_6' => __( 'Fr', 'aui' ), |
|
| 1917 | - 'day_s2_7' => __( 'Sa', 'aui' ), |
|
| 1918 | - 'day_s3_1' => __( 'Sun', 'aui' ), |
|
| 1919 | - 'day_s3_2' => __( 'Mon', 'aui' ), |
|
| 1920 | - 'day_s3_3' => __( 'Tue', 'aui' ), |
|
| 1921 | - 'day_s3_4' => __( 'Wed', 'aui' ), |
|
| 1922 | - 'day_s3_5' => __( 'Thu', 'aui' ), |
|
| 1923 | - 'day_s3_6' => __( 'Fri', 'aui' ), |
|
| 1924 | - 'day_s3_7' => __( 'Sat', 'aui' ), |
|
| 1925 | - 'day_s5_1' => __( 'Sunday', 'aui' ), |
|
| 1926 | - 'day_s5_2' => __( 'Monday', 'aui' ), |
|
| 1927 | - 'day_s5_3' => __( 'Tuesday', 'aui' ), |
|
| 1928 | - 'day_s5_4' => __( 'Wednesday', 'aui' ), |
|
| 1929 | - 'day_s5_5' => __( 'Thursday', 'aui' ), |
|
| 1930 | - 'day_s5_6' => __( 'Friday', 'aui' ), |
|
| 1931 | - 'day_s5_7' => __( 'Saturday', 'aui' ), |
|
| 1932 | - 'am_lower' => __( 'am', 'aui' ), |
|
| 1933 | - 'pm_lower' => __( 'pm', 'aui' ), |
|
| 1934 | - 'am_upper' => __( 'AM', 'aui' ), |
|
| 1935 | - 'pm_upper' => __( 'PM', 'aui' ), |
|
| 1936 | - 'firstDayOfWeek' => (int) get_option( 'start_of_week' ), |
|
| 1880 | + 'month_long_1' => __('January', 'aui'), |
|
| 1881 | + 'month_long_2' => __('February', 'aui'), |
|
| 1882 | + 'month_long_3' => __('March', 'aui'), |
|
| 1883 | + 'month_long_4' => __('April', 'aui'), |
|
| 1884 | + 'month_long_5' => __('May', 'aui'), |
|
| 1885 | + 'month_long_6' => __('June', 'aui'), |
|
| 1886 | + 'month_long_7' => __('July', 'aui'), |
|
| 1887 | + 'month_long_8' => __('August', 'aui'), |
|
| 1888 | + 'month_long_9' => __('September', 'aui'), |
|
| 1889 | + 'month_long_10' => __('October', 'aui'), |
|
| 1890 | + 'month_long_11' => __('November', 'aui'), |
|
| 1891 | + 'month_long_12' => __('December', 'aui'), |
|
| 1892 | + 'month_s_1' => _x('Jan', 'January abbreviation', 'aui'), |
|
| 1893 | + 'month_s_2' => _x('Feb', 'February abbreviation', 'aui'), |
|
| 1894 | + 'month_s_3' => _x('Mar', 'March abbreviation', 'aui'), |
|
| 1895 | + 'month_s_4' => _x('Apr', 'April abbreviation', 'aui'), |
|
| 1896 | + 'month_s_5' => _x('May', 'May abbreviation', 'aui'), |
|
| 1897 | + 'month_s_6' => _x('Jun', 'June abbreviation', 'aui'), |
|
| 1898 | + 'month_s_7' => _x('Jul', 'July abbreviation', 'aui'), |
|
| 1899 | + 'month_s_8' => _x('Aug', 'August abbreviation', 'aui'), |
|
| 1900 | + 'month_s_9' => _x('Sep', 'September abbreviation', 'aui'), |
|
| 1901 | + 'month_s_10' => _x('Oct', 'October abbreviation', 'aui'), |
|
| 1902 | + 'month_s_11' => _x('Nov', 'November abbreviation', 'aui'), |
|
| 1903 | + 'month_s_12' => _x('Dec', 'December abbreviation', 'aui'), |
|
| 1904 | + 'day_s1_1' => _x('S', 'Sunday initial', 'aui'), |
|
| 1905 | + 'day_s1_2' => _x('M', 'Monday initial', 'aui'), |
|
| 1906 | + 'day_s1_3' => _x('T', 'Tuesday initial', 'aui'), |
|
| 1907 | + 'day_s1_4' => _x('W', 'Wednesday initial', 'aui'), |
|
| 1908 | + 'day_s1_5' => _x('T', 'Friday initial', 'aui'), |
|
| 1909 | + 'day_s1_6' => _x('F', 'Thursday initial', 'aui'), |
|
| 1910 | + 'day_s1_7' => _x('S', 'Saturday initial', 'aui'), |
|
| 1911 | + 'day_s2_1' => __('Su', 'aui'), |
|
| 1912 | + 'day_s2_2' => __('Mo', 'aui'), |
|
| 1913 | + 'day_s2_3' => __('Tu', 'aui'), |
|
| 1914 | + 'day_s2_4' => __('We', 'aui'), |
|
| 1915 | + 'day_s2_5' => __('Th', 'aui'), |
|
| 1916 | + 'day_s2_6' => __('Fr', 'aui'), |
|
| 1917 | + 'day_s2_7' => __('Sa', 'aui'), |
|
| 1918 | + 'day_s3_1' => __('Sun', 'aui'), |
|
| 1919 | + 'day_s3_2' => __('Mon', 'aui'), |
|
| 1920 | + 'day_s3_3' => __('Tue', 'aui'), |
|
| 1921 | + 'day_s3_4' => __('Wed', 'aui'), |
|
| 1922 | + 'day_s3_5' => __('Thu', 'aui'), |
|
| 1923 | + 'day_s3_6' => __('Fri', 'aui'), |
|
| 1924 | + 'day_s3_7' => __('Sat', 'aui'), |
|
| 1925 | + 'day_s5_1' => __('Sunday', 'aui'), |
|
| 1926 | + 'day_s5_2' => __('Monday', 'aui'), |
|
| 1927 | + 'day_s5_3' => __('Tuesday', 'aui'), |
|
| 1928 | + 'day_s5_4' => __('Wednesday', 'aui'), |
|
| 1929 | + 'day_s5_5' => __('Thursday', 'aui'), |
|
| 1930 | + 'day_s5_6' => __('Friday', 'aui'), |
|
| 1931 | + 'day_s5_7' => __('Saturday', 'aui'), |
|
| 1932 | + 'am_lower' => __('am', 'aui'), |
|
| 1933 | + 'pm_lower' => __('pm', 'aui'), |
|
| 1934 | + 'am_upper' => __('AM', 'aui'), |
|
| 1935 | + 'pm_upper' => __('PM', 'aui'), |
|
| 1936 | + 'firstDayOfWeek' => (int) get_option('start_of_week'), |
|
| 1937 | 1937 | 'time_24hr' => false, |
| 1938 | - 'year' => __( 'Year', 'aui' ), |
|
| 1939 | - 'hour' => __( 'Hour', 'aui' ), |
|
| 1940 | - 'minute' => __( 'Minute', 'aui' ), |
|
| 1941 | - 'weekAbbreviation' => __( 'Wk', 'aui' ), |
|
| 1942 | - 'rangeSeparator' => __( ' to ', 'aui' ), |
|
| 1943 | - 'scrollTitle' => __( 'Scroll to increment', 'aui' ), |
|
| 1944 | - 'toggleTitle' => __( 'Click to toggle', 'aui' ) |
|
| 1938 | + 'year' => __('Year', 'aui'), |
|
| 1939 | + 'hour' => __('Hour', 'aui'), |
|
| 1940 | + 'minute' => __('Minute', 'aui'), |
|
| 1941 | + 'weekAbbreviation' => __('Wk', 'aui'), |
|
| 1942 | + 'rangeSeparator' => __(' to ', 'aui'), |
|
| 1943 | + 'scrollTitle' => __('Scroll to increment', 'aui'), |
|
| 1944 | + 'toggleTitle' => __('Click to toggle', 'aui') |
|
| 1945 | 1945 | ); |
| 1946 | 1946 | |
| 1947 | - return apply_filters( 'ayecode_ui_calendar_params', $params ); |
|
| 1947 | + return apply_filters('ayecode_ui_calendar_params', $params); |
|
| 1948 | 1948 | } |
| 1949 | 1949 | |
| 1950 | 1950 | /** |
@@ -1957,47 +1957,47 @@ discard block |
||
| 1957 | 1957 | public static function flatpickr_locale() { |
| 1958 | 1958 | $params = self::calendar_params(); |
| 1959 | 1959 | |
| 1960 | - if ( is_string( $params ) ) { |
|
| 1961 | - $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' ); |
|
| 1960 | + if (is_string($params)) { |
|
| 1961 | + $params = html_entity_decode($params, ENT_QUOTES, 'UTF-8'); |
|
| 1962 | 1962 | } else { |
| 1963 | - foreach ( (array) $params as $key => $value ) { |
|
| 1964 | - if ( ! is_scalar( $value ) ) { |
|
| 1963 | + foreach ((array) $params as $key => $value) { |
|
| 1964 | + if (!is_scalar($value)) { |
|
| 1965 | 1965 | continue; |
| 1966 | 1966 | } |
| 1967 | 1967 | |
| 1968 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
| 1968 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
| 1969 | 1969 | } |
| 1970 | 1970 | } |
| 1971 | 1971 | |
| 1972 | 1972 | $day_s3 = array(); |
| 1973 | 1973 | $day_s5 = array(); |
| 1974 | 1974 | |
| 1975 | - for ( $i = 1; $i <= 7; $i ++ ) { |
|
| 1976 | - $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] ); |
|
| 1977 | - $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] ); |
|
| 1975 | + for ($i = 1; $i <= 7; $i++) { |
|
| 1976 | + $day_s3[] = addslashes($params['day_s3_' . $i]); |
|
| 1977 | + $day_s5[] = addslashes($params['day_s3_' . $i]); |
|
| 1978 | 1978 | } |
| 1979 | 1979 | |
| 1980 | 1980 | $month_s = array(); |
| 1981 | 1981 | $month_long = array(); |
| 1982 | 1982 | |
| 1983 | - for ( $i = 1; $i <= 12; $i ++ ) { |
|
| 1984 | - $month_s[] = addslashes( $params[ 'month_s_' . $i ] ); |
|
| 1985 | - $month_long[] = addslashes( $params[ 'month_long_' . $i ] ); |
|
| 1983 | + for ($i = 1; $i <= 12; $i++) { |
|
| 1984 | + $month_s[] = addslashes($params['month_s_' . $i]); |
|
| 1985 | + $month_long[] = addslashes($params['month_long_' . $i]); |
|
| 1986 | 1986 | } |
| 1987 | 1987 | |
| 1988 | 1988 | ob_start(); |
| 1989 | -if ( 0 ) { ?><script><?php } ?> |
|
| 1989 | +if (0) { ?><script><?php } ?> |
|
| 1990 | 1990 | { |
| 1991 | 1991 | weekdays: { |
| 1992 | - shorthand: ['<?php echo implode( "','", $day_s3 ); ?>'], |
|
| 1993 | - longhand: ['<?php echo implode( "','", $day_s5 ); ?>'], |
|
| 1992 | + shorthand: ['<?php echo implode("','", $day_s3); ?>'], |
|
| 1993 | + longhand: ['<?php echo implode("','", $day_s5); ?>'], |
|
| 1994 | 1994 | }, |
| 1995 | 1995 | months: { |
| 1996 | - shorthand: ['<?php echo implode( "','", $month_s ); ?>'], |
|
| 1997 | - longhand: ['<?php echo implode( "','", $month_long ); ?>'], |
|
| 1996 | + shorthand: ['<?php echo implode("','", $month_s); ?>'], |
|
| 1997 | + longhand: ['<?php echo implode("','", $month_long); ?>'], |
|
| 1998 | 1998 | }, |
| 1999 | 1999 | daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31], |
| 2000 | - firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>, |
|
| 2000 | + firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>, |
|
| 2001 | 2001 | ordinal: function (nth) { |
| 2002 | 2002 | var s = nth % 100; |
| 2003 | 2003 | if (s > 3 && s < 21) |
@@ -2013,21 +2013,21 @@ discard block |
||
| 2013 | 2013 | return "th"; |
| 2014 | 2014 | } |
| 2015 | 2015 | }, |
| 2016 | - rangeSeparator: '<?php echo addslashes( $params[ 'rangeSeparator' ] ); ?>', |
|
| 2017 | - weekAbbreviation: '<?php echo addslashes( $params[ 'weekAbbreviation' ] ); ?>', |
|
| 2018 | - scrollTitle: '<?php echo addslashes( $params[ 'scrollTitle' ] ); ?>', |
|
| 2019 | - toggleTitle: '<?php echo addslashes( $params[ 'toggleTitle' ] ); ?>', |
|
| 2020 | - amPM: ['<?php echo addslashes( $params[ 'am_upper' ] ); ?>','<?php echo addslashes( $params[ 'pm_upper' ] ); ?>'], |
|
| 2021 | - yearAriaLabel: '<?php echo addslashes( $params[ 'year' ] ); ?>', |
|
| 2022 | - hourAriaLabel: '<?php echo addslashes( $params[ 'hour' ] ); ?>', |
|
| 2023 | - minuteAriaLabel: '<?php echo addslashes( $params[ 'minute' ] ); ?>', |
|
| 2024 | - time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?> |
|
| 2016 | + rangeSeparator: '<?php echo addslashes($params['rangeSeparator']); ?>', |
|
| 2017 | + weekAbbreviation: '<?php echo addslashes($params['weekAbbreviation']); ?>', |
|
| 2018 | + scrollTitle: '<?php echo addslashes($params['scrollTitle']); ?>', |
|
| 2019 | + toggleTitle: '<?php echo addslashes($params['toggleTitle']); ?>', |
|
| 2020 | + amPM: ['<?php echo addslashes($params['am_upper']); ?>','<?php echo addslashes($params['pm_upper']); ?>'], |
|
| 2021 | + yearAriaLabel: '<?php echo addslashes($params['year']); ?>', |
|
| 2022 | + hourAriaLabel: '<?php echo addslashes($params['hour']); ?>', |
|
| 2023 | + minuteAriaLabel: '<?php echo addslashes($params['minute']); ?>', |
|
| 2024 | + time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?> |
|
| 2025 | 2025 | } |
| 2026 | -<?php if ( 0 ) { ?></script><?php } ?> |
|
| 2026 | +<?php if (0) { ?></script><?php } ?> |
|
| 2027 | 2027 | <?php |
| 2028 | 2028 | $locale = ob_get_clean(); |
| 2029 | 2029 | |
| 2030 | - return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) ); |
|
| 2030 | + return apply_filters('ayecode_ui_flatpickr_locale', trim($locale)); |
|
| 2031 | 2031 | } |
| 2032 | 2032 | |
| 2033 | 2033 | /** |
@@ -2039,20 +2039,20 @@ discard block |
||
| 2039 | 2039 | */ |
| 2040 | 2040 | public static function select2_params() { |
| 2041 | 2041 | $params = array( |
| 2042 | - 'i18n_select_state_text' => esc_attr__( 'Select an option…', 'aui' ), |
|
| 2043 | - 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'aui' ), |
|
| 2044 | - 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'aui' ), |
|
| 2045 | - 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ), |
|
| 2046 | - 'i18n_input_too_short_n' => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ), |
|
| 2047 | - 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'aui' ), |
|
| 2048 | - 'i18n_input_too_long_n' => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ), |
|
| 2049 | - 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ), |
|
| 2050 | - 'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ), |
|
| 2051 | - 'i18n_load_more' => _x( 'Loading more results…', 'enhanced select', 'aui' ), |
|
| 2052 | - 'i18n_searching' => _x( 'Searching…', 'enhanced select', 'aui' ) |
|
| 2042 | + 'i18n_select_state_text' => esc_attr__('Select an option…', 'aui'), |
|
| 2043 | + 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'aui'), |
|
| 2044 | + 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'aui'), |
|
| 2045 | + 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'aui'), |
|
| 2046 | + 'i18n_input_too_short_n' => _x('Please enter %item% or more characters', 'enhanced select', 'aui'), |
|
| 2047 | + 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'aui'), |
|
| 2048 | + 'i18n_input_too_long_n' => _x('Please delete %item% characters', 'enhanced select', 'aui'), |
|
| 2049 | + 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'aui'), |
|
| 2050 | + 'i18n_selection_too_long_n' => _x('You can only select %item% items', 'enhanced select', 'aui'), |
|
| 2051 | + 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'aui'), |
|
| 2052 | + 'i18n_searching' => _x('Searching…', 'enhanced select', 'aui') |
|
| 2053 | 2053 | ); |
| 2054 | 2054 | |
| 2055 | - return apply_filters( 'ayecode_ui_select2_params', $params ); |
|
| 2055 | + return apply_filters('ayecode_ui_select2_params', $params); |
|
| 2056 | 2056 | } |
| 2057 | 2057 | |
| 2058 | 2058 | /** |
@@ -2065,17 +2065,17 @@ discard block |
||
| 2065 | 2065 | public static function select2_locale() { |
| 2066 | 2066 | $params = self::select2_params(); |
| 2067 | 2067 | |
| 2068 | - foreach ( (array) $params as $key => $value ) { |
|
| 2069 | - if ( ! is_scalar( $value ) ) { |
|
| 2068 | + foreach ((array) $params as $key => $value) { |
|
| 2069 | + if (!is_scalar($value)) { |
|
| 2070 | 2070 | continue; |
| 2071 | 2071 | } |
| 2072 | 2072 | |
| 2073 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
| 2073 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
| 2074 | 2074 | } |
| 2075 | 2075 | |
| 2076 | - $locale = json_encode( $params ); |
|
| 2076 | + $locale = json_encode($params); |
|
| 2077 | 2077 | |
| 2078 | - return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) ); |
|
| 2078 | + return apply_filters('ayecode_ui_select2_locale', trim($locale)); |
|
| 2079 | 2079 | } |
| 2080 | 2080 | |
| 2081 | 2081 | /** |
@@ -2088,35 +2088,35 @@ discard block |
||
| 2088 | 2088 | public static function timeago_locale() { |
| 2089 | 2089 | $params = array( |
| 2090 | 2090 | 'prefix_ago' => '', |
| 2091 | - 'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ), |
|
| 2092 | - 'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ', |
|
| 2091 | + 'suffix_ago' => ' ' . _x('ago', 'time ago', 'aui'), |
|
| 2092 | + 'prefix_after' => _x('after', 'time ago', 'aui') . ' ', |
|
| 2093 | 2093 | 'suffix_after' => '', |
| 2094 | - 'seconds' => _x( 'less than a minute', 'time ago', 'aui' ), |
|
| 2095 | - 'minute' => _x( 'about a minute', 'time ago', 'aui' ), |
|
| 2096 | - 'minutes' => _x( '%d minutes', 'time ago', 'aui' ), |
|
| 2097 | - 'hour' => _x( 'about an hour', 'time ago', 'aui' ), |
|
| 2098 | - 'hours' => _x( 'about %d hours', 'time ago', 'aui' ), |
|
| 2099 | - 'day' => _x( 'a day', 'time ago', 'aui' ), |
|
| 2100 | - 'days' => _x( '%d days', 'time ago', 'aui' ), |
|
| 2101 | - 'month' => _x( 'about a month', 'time ago', 'aui' ), |
|
| 2102 | - 'months' => _x( '%d months', 'time ago', 'aui' ), |
|
| 2103 | - 'year' => _x( 'about a year', 'time ago', 'aui' ), |
|
| 2104 | - 'years' => _x( '%d years', 'time ago', 'aui' ), |
|
| 2094 | + 'seconds' => _x('less than a minute', 'time ago', 'aui'), |
|
| 2095 | + 'minute' => _x('about a minute', 'time ago', 'aui'), |
|
| 2096 | + 'minutes' => _x('%d minutes', 'time ago', 'aui'), |
|
| 2097 | + 'hour' => _x('about an hour', 'time ago', 'aui'), |
|
| 2098 | + 'hours' => _x('about %d hours', 'time ago', 'aui'), |
|
| 2099 | + 'day' => _x('a day', 'time ago', 'aui'), |
|
| 2100 | + 'days' => _x('%d days', 'time ago', 'aui'), |
|
| 2101 | + 'month' => _x('about a month', 'time ago', 'aui'), |
|
| 2102 | + 'months' => _x('%d months', 'time ago', 'aui'), |
|
| 2103 | + 'year' => _x('about a year', 'time ago', 'aui'), |
|
| 2104 | + 'years' => _x('%d years', 'time ago', 'aui'), |
|
| 2105 | 2105 | ); |
| 2106 | 2106 | |
| 2107 | - $params = apply_filters( 'ayecode_ui_timeago_params', $params ); |
|
| 2107 | + $params = apply_filters('ayecode_ui_timeago_params', $params); |
|
| 2108 | 2108 | |
| 2109 | - foreach ( (array) $params as $key => $value ) { |
|
| 2110 | - if ( ! is_scalar( $value ) ) { |
|
| 2109 | + foreach ((array) $params as $key => $value) { |
|
| 2110 | + if (!is_scalar($value)) { |
|
| 2111 | 2111 | continue; |
| 2112 | 2112 | } |
| 2113 | 2113 | |
| 2114 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
| 2114 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
| 2115 | 2115 | } |
| 2116 | 2116 | |
| 2117 | - $locale = json_encode( $params ); |
|
| 2117 | + $locale = json_encode($params); |
|
| 2118 | 2118 | |
| 2119 | - return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) ); |
|
| 2119 | + return apply_filters('ayecode_ui_timeago_locale', trim($locale)); |
|
| 2120 | 2120 | } |
| 2121 | 2121 | |
| 2122 | 2122 | /** |
@@ -2127,7 +2127,7 @@ discard block |
||
| 2127 | 2127 | * @return mixed |
| 2128 | 2128 | */ |
| 2129 | 2129 | public static function minify_js($input) { |
| 2130 | - if(trim($input) === "") return $input; |
|
| 2130 | + if (trim($input) === "") return $input; |
|
| 2131 | 2131 | return preg_replace( |
| 2132 | 2132 | array( |
| 2133 | 2133 | // Remove comment(s) |
@@ -2159,7 +2159,7 @@ discard block |
||
| 2159 | 2159 | * @return mixed |
| 2160 | 2160 | */ |
| 2161 | 2161 | public static function minify_css($input) { |
| 2162 | - if(trim($input) === "") return $input; |
|
| 2162 | + if (trim($input) === "") return $input; |
|
| 2163 | 2163 | return preg_replace( |
| 2164 | 2164 | array( |
| 2165 | 2165 | // Remove comment(s) |
@@ -6,39 +6,39 @@ |
||
| 6 | 6 | /** |
| 7 | 7 | * Bail if we are not in WP. |
| 8 | 8 | */ |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if (!defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Set the version only if its the current newest while loading. |
| 15 | 15 | */ |
| 16 | -add_action('after_setup_theme', function () { |
|
| 17 | - global $ayecode_ui_version,$ayecode_ui_file_key; |
|
| 16 | +add_action('after_setup_theme', function() { |
|
| 17 | + global $ayecode_ui_version, $ayecode_ui_file_key; |
|
| 18 | 18 | $this_version = "0.1.53"; |
| 19 | - if(version_compare($this_version , $ayecode_ui_version, '>')){ |
|
| 20 | - $ayecode_ui_version = $this_version ; |
|
| 21 | - $ayecode_ui_file_key = wp_hash( __FILE__ ); |
|
| 19 | + if (version_compare($this_version, $ayecode_ui_version, '>')) { |
|
| 20 | + $ayecode_ui_version = $this_version; |
|
| 21 | + $ayecode_ui_file_key = wp_hash(__FILE__); |
|
| 22 | 22 | } |
| 23 | 23 | },0); |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Load this version of WP Bootstrap Settings only if the file hash is the current one. |
| 27 | 27 | */ |
| 28 | -add_action('after_setup_theme', function () { |
|
| 28 | +add_action('after_setup_theme', function() { |
|
| 29 | 29 | global $ayecode_ui_file_key; |
| 30 | - if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){ |
|
| 31 | - include_once( dirname( __FILE__ ) . '/includes/class-aui.php' ); |
|
| 32 | - include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' ); |
|
| 30 | + if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) { |
|
| 31 | + include_once(dirname(__FILE__) . '/includes/class-aui.php'); |
|
| 32 | + include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php'); |
|
| 33 | 33 | } |
| 34 | 34 | },1); |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Add the function that calls the class. |
| 38 | 38 | */ |
| 39 | -if(!function_exists('aui')){ |
|
| 40 | - function aui(){ |
|
| 41 | - if(!class_exists("AUI",false)){ |
|
| 39 | +if (!function_exists('aui')) { |
|
| 40 | + function aui() { |
|
| 41 | + if (!class_exists("AUI", false)) { |
|
| 42 | 42 | return false; |
| 43 | 43 | } |
| 44 | 44 | return AUI::instance(); |
@@ -12,14 +12,14 @@ discard block |
||
| 12 | 12 | /** |
| 13 | 13 | * Bail if we are not in WP. |
| 14 | 14 | */ |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if (!defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Only add if the class does not already exist. |
| 21 | 21 | */ |
| 22 | -if ( ! class_exists( '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. |
@@ -88,17 +88,17 @@ discard block |
||
| 88 | 88 | * @return WP_Font_Awesome_Settings - Main instance. |
| 89 | 89 | */ |
| 90 | 90 | public static function instance() { |
| 91 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) { |
|
| 91 | + if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) { |
|
| 92 | 92 | self::$instance = new WP_Font_Awesome_Settings; |
| 93 | 93 | |
| 94 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
| 94 | + add_action('init', array(self::$instance, 'init')); // set settings |
|
| 95 | 95 | |
| 96 | - if ( is_admin() ) { |
|
| 97 | - add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
| 98 | - add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
| 96 | + if (is_admin()) { |
|
| 97 | + add_action('admin_menu', array(self::$instance, 'menu_item')); |
|
| 98 | + add_action('admin_init', array(self::$instance, 'register_settings')); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - do_action( 'wp_font_awesome_settings_loaded' ); |
|
| 101 | + do_action('wp_font_awesome_settings_loaded'); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | return self::$instance; |
@@ -112,30 +112,30 @@ discard block |
||
| 112 | 112 | public function init() { |
| 113 | 113 | $this->settings = $this->get_settings(); |
| 114 | 114 | |
| 115 | - if ( $this->settings['type'] == 'CSS' ) { |
|
| 115 | + if ($this->settings['type'] == 'CSS') { |
|
| 116 | 116 | |
| 117 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 118 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 117 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
| 118 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 122 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 121 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
| 122 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | } else { |
| 126 | 126 | |
| 127 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 128 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 127 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
| 128 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 132 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 131 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
| 132 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // remove font awesome if set to do so |
| 137 | - if ( $this->settings['dequeue'] == '1' ) { |
|
| 138 | - add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 ); |
|
| 137 | + if ($this->settings['dequeue'] == '1') { |
|
| 138 | + add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | } |
@@ -147,20 +147,20 @@ discard block |
||
| 147 | 147 | // build url |
| 148 | 148 | $url = $this->get_url(); |
| 149 | 149 | |
| 150 | - wp_deregister_style( 'font-awesome' ); // deregister in case its already there |
|
| 151 | - wp_register_style( 'font-awesome', $url, array(), null ); |
|
| 152 | - wp_enqueue_style( 'font-awesome' ); |
|
| 150 | + wp_deregister_style('font-awesome'); // deregister in case its already there |
|
| 151 | + wp_register_style('font-awesome', $url, array(), null); |
|
| 152 | + wp_enqueue_style('font-awesome'); |
|
| 153 | 153 | |
| 154 | 154 | // RTL language support CSS. |
| 155 | - if ( is_rtl() ) { |
|
| 156 | - wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() ); |
|
| 155 | + if (is_rtl()) { |
|
| 156 | + wp_add_inline_style('font-awesome', $this->rtl_inline_css()); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if ( $this->settings['shims'] ) { |
|
| 160 | - $url = $this->get_url( true ); |
|
| 161 | - wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there |
|
| 162 | - wp_register_style( 'font-awesome-shims', $url, array(), null ); |
|
| 163 | - wp_enqueue_style( 'font-awesome-shims' ); |
|
| 159 | + if ($this->settings['shims']) { |
|
| 160 | + $url = $this->get_url(true); |
|
| 161 | + wp_deregister_style('font-awesome-shims'); // deregister in case its already there |
|
| 162 | + wp_register_style('font-awesome-shims', $url, array(), null); |
|
| 163 | + wp_enqueue_style('font-awesome-shims'); |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
@@ -172,15 +172,15 @@ discard block |
||
| 172 | 172 | $url = $this->get_url(); |
| 173 | 173 | |
| 174 | 174 | $deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script'; |
| 175 | - call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there |
|
| 176 | - wp_register_script( 'font-awesome', $url, array(), null ); |
|
| 177 | - wp_enqueue_script( 'font-awesome' ); |
|
| 178 | - |
|
| 179 | - if ( $this->settings['shims'] ) { |
|
| 180 | - $url = $this->get_url( true ); |
|
| 181 | - call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there |
|
| 182 | - wp_register_script( 'font-awesome-shims', $url, array(), null ); |
|
| 183 | - wp_enqueue_script( 'font-awesome-shims' ); |
|
| 175 | + call_user_func($deregister_function, 'font-awesome'); // deregister in case its already there |
|
| 176 | + wp_register_script('font-awesome', $url, array(), null); |
|
| 177 | + wp_enqueue_script('font-awesome'); |
|
| 178 | + |
|
| 179 | + if ($this->settings['shims']) { |
|
| 180 | + $url = $this->get_url(true); |
|
| 181 | + call_user_func($deregister_function, 'font-awesome-shims'); // deregister in case its already there |
|
| 182 | + wp_register_script('font-awesome-shims', $url, array(), null); |
|
| 183 | + wp_enqueue_script('font-awesome-shims'); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -191,16 +191,16 @@ discard block |
||
| 191 | 191 | * |
| 192 | 192 | * @return string The url to the file. |
| 193 | 193 | */ |
| 194 | - public function get_url( $shims = false ) { |
|
| 194 | + public function get_url($shims = false) { |
|
| 195 | 195 | $script = $shims ? 'v4-shims' : 'all'; |
| 196 | 196 | $sub = $this->settings['pro'] ? 'pro' : 'use'; |
| 197 | 197 | $type = $this->settings['type']; |
| 198 | 198 | $version = $this->settings['version']; |
| 199 | - $kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : ''; |
|
| 199 | + $kit_url = $this->settings['kit-url'] ? esc_url($this->settings['kit-url']) : ''; |
|
| 200 | 200 | $url = ''; |
| 201 | 201 | |
| 202 | - if ( $type == 'KIT' && $kit_url ) { |
|
| 203 | - if ( $shims ) { |
|
| 202 | + if ($type == 'KIT' && $kit_url) { |
|
| 203 | + if ($shims) { |
|
| 204 | 204 | // if its a kit then we don't add shims here |
| 205 | 205 | return ''; |
| 206 | 206 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $url .= "?wpfas=true"; // set our var so our version is not removed |
| 209 | 209 | } else { |
| 210 | 210 | $url .= "https://$sub.fontawesome.com/releases/"; // CDN |
| 211 | - $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
| 211 | + $url .= !empty($version) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
| 212 | 212 | $url .= $type == 'CSS' ? 'css/' : 'js/'; // type |
| 213 | 213 | $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type |
| 214 | 214 | $url .= "?wpfas=true"; // set our var so our version is not removed |
@@ -228,16 +228,16 @@ discard block |
||
| 228 | 228 | * |
| 229 | 229 | * @return string The filtered url. |
| 230 | 230 | */ |
| 231 | - public function remove_font_awesome( $url, $original_url, $_context ) { |
|
| 231 | + public function remove_font_awesome($url, $original_url, $_context) { |
|
| 232 | 232 | |
| 233 | - if ( $_context == 'display' |
|
| 234 | - && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false ) |
|
| 235 | - && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false ) |
|
| 233 | + if ($_context == 'display' |
|
| 234 | + && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false) |
|
| 235 | + && (strstr($url, ".js") !== false || strstr($url, ".css") !== false) |
|
| 236 | 236 | ) {// it's a font-awesome-url (probably) |
| 237 | 237 | |
| 238 | - if ( strstr( $url, "wpfas=true" ) !== false ) { |
|
| 239 | - if ( $this->settings['type'] == 'JS' ) { |
|
| 240 | - if ( $this->settings['js-pseudo'] ) { |
|
| 238 | + if (strstr($url, "wpfas=true") !== false) { |
|
| 239 | + if ($this->settings['type'] == 'JS') { |
|
| 240 | + if ($this->settings['js-pseudo']) { |
|
| 241 | 241 | $url .= "' data-search-pseudo-elements defer='defer"; |
| 242 | 242 | } else { |
| 243 | 243 | $url .= "' defer='defer"; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * Register the database settings with WordPress. |
| 257 | 257 | */ |
| 258 | 258 | public function register_settings() { |
| 259 | - register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' ); |
|
| 259 | + register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings'); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function menu_item() { |
| 267 | 267 | $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
| 268 | - call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 268 | + call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 269 | 269 | $this, |
| 270 | 270 | 'settings_page' |
| 271 | - ) ); |
|
| 271 | + )); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | public function get_settings() { |
| 280 | 280 | |
| 281 | - $db_settings = get_option( 'wp-font-awesome-settings' ); |
|
| 281 | + $db_settings = get_option('wp-font-awesome-settings'); |
|
| 282 | 282 | |
| 283 | 283 | $defaults = array( |
| 284 | 284 | 'type' => 'CSS', // type to use, CSS or JS or KIT |
@@ -291,14 +291,14 @@ discard block |
||
| 291 | 291 | 'kit-url' => '', // the kit url |
| 292 | 292 | ); |
| 293 | 293 | |
| 294 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
| 294 | + $settings = wp_parse_args($db_settings, $defaults); |
|
| 295 | 295 | |
| 296 | 296 | /** |
| 297 | 297 | * Filter the Font Awesome settings. |
| 298 | 298 | * |
| 299 | 299 | * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
| 300 | 300 | */ |
| 301 | - return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults ); |
|
| 301 | + return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | |
@@ -306,13 +306,13 @@ discard block |
||
| 306 | 306 | * The settings page html output. |
| 307 | 307 | */ |
| 308 | 308 | public function settings_page() { |
| 309 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 310 | - wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) ); |
|
| 309 | + if (!current_user_can('manage_options')) { |
|
| 310 | + wp_die(__('You do not have sufficient permissions to access this page.', 'font-awesome-settings')); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // a hidden way to force the update of the version number via api instead of waiting the 48 hours |
| 314 | - if ( isset( $_REQUEST['force-version-check'] ) ) { |
|
| 315 | - $this->get_latest_version( $force_api = true ); |
|
| 314 | + if (isset($_REQUEST['force-version-check'])) { |
|
| 315 | + $this->get_latest_version($force_api = true); |
|
| 316 | 316 | } |
| 317 | 317 | ?> |
| 318 | 318 | <style> |
@@ -332,37 +332,37 @@ discard block |
||
| 332 | 332 | <h1><?php echo $this->name; ?></h1> |
| 333 | 333 | <form method="post" action="options.php"> |
| 334 | 334 | <?php |
| 335 | - settings_fields( 'wp-font-awesome-settings' ); |
|
| 336 | - do_settings_sections( 'wp-font-awesome-settings' ); |
|
| 335 | + settings_fields('wp-font-awesome-settings'); |
|
| 336 | + do_settings_sections('wp-font-awesome-settings'); |
|
| 337 | 337 | $kit_set = $this->settings['type'] == 'KIT' ? 'wpfas-kit-set' : ''; |
| 338 | 338 | ?> |
| 339 | - <table class="form-table wpfas-table-settings <?php echo esc_attr( $kit_set ); ?>"> |
|
| 339 | + <table class="form-table wpfas-table-settings <?php echo esc_attr($kit_set); ?>"> |
|
| 340 | 340 | <tr valign="top"> |
| 341 | 341 | <th scope="row"><label |
| 342 | - for="wpfas-type"><?php _e( 'Type', 'font-awesome-settings' ); ?></label></th> |
|
| 342 | + for="wpfas-type"><?php _e('Type', 'font-awesome-settings'); ?></label></th> |
|
| 343 | 343 | <td> |
| 344 | 344 | <select name="wp-font-awesome-settings[type]" id="wpfas-type" |
| 345 | 345 | onchange="if(this.value=='KIT'){jQuery('.wpfas-table-settings').addClass('wpfas-kit-set');}else{jQuery('.wpfas-table-settings').removeClass('wpfas-kit-set');}"> |
| 346 | 346 | <option |
| 347 | - value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)', 'font-awesome-settings' ); ?></option> |
|
| 348 | - <option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option> |
|
| 347 | + value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)', 'font-awesome-settings'); ?></option> |
|
| 348 | + <option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option> |
|
| 349 | 349 | <option |
| 350 | - value="KIT" <?php selected( $this->settings['type'], 'KIT' ); ?>><?php _e( 'Kits (settings managed on fontawesome.com)', 'font-awesome-settings' ); ?></option> |
|
| 350 | + value="KIT" <?php selected($this->settings['type'], 'KIT'); ?>><?php _e('Kits (settings managed on fontawesome.com)', 'font-awesome-settings'); ?></option> |
|
| 351 | 351 | </select> |
| 352 | 352 | </td> |
| 353 | 353 | </tr> |
| 354 | 354 | |
| 355 | 355 | <tr valign="top" class="wpfas-kit-show"> |
| 356 | 356 | <th scope="row"><label |
| 357 | - for="wpfas-kit-url"><?php _e( 'Kit URL', 'font-awesome-settings' ); ?></label></th> |
|
| 357 | + for="wpfas-kit-url"><?php _e('Kit URL', 'font-awesome-settings'); ?></label></th> |
|
| 358 | 358 | <td> |
| 359 | 359 | <input class="regular-text" id="wpfas-kit-url" type="url" |
| 360 | 360 | name="wp-font-awesome-settings[kit-url]" |
| 361 | - value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>" |
|
| 362 | - placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/> |
|
| 361 | + value="<?php echo esc_attr($this->settings['kit-url']); ?>" |
|
| 362 | + placeholder="<?php echo 'https://kit.font'; echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/> |
|
| 363 | 363 | <span><?php |
| 364 | 364 | echo sprintf( |
| 365 | - __( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ), |
|
| 365 | + __('Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings'), |
|
| 366 | 366 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>', |
| 367 | 367 | '</a>' |
| 368 | 368 | ); |
@@ -372,31 +372,31 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | <tr valign="top" class="wpfas-kit-hide"> |
| 374 | 374 | <th scope="row"><label |
| 375 | - for="wpfas-version"><?php _e( 'Version', 'font-awesome-settings' ); ?></label></th> |
|
| 375 | + for="wpfas-version"><?php _e('Version', 'font-awesome-settings'); ?></label></th> |
|
| 376 | 376 | <td> |
| 377 | 377 | <select name="wp-font-awesome-settings[version]" id="wpfas-version"> |
| 378 | 378 | <option |
| 379 | - value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo sprintf( __( 'Latest - %s (default)', 'font-awesome-settings' ), $this->get_latest_version() ); ?> |
|
| 379 | + value="" <?php selected($this->settings['version'], ''); ?>><?php echo sprintf(__('Latest - %s (default)', 'font-awesome-settings'), $this->get_latest_version()); ?> |
|
| 380 | 380 | </option> |
| 381 | - <option value="5.6.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>> |
|
| 381 | + <option value="5.6.0" <?php selected($this->settings['version'], '5.6.0'); ?>> |
|
| 382 | 382 | 5.6.0 |
| 383 | 383 | </option> |
| 384 | - <option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>> |
|
| 384 | + <option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>> |
|
| 385 | 385 | 5.5.0 |
| 386 | 386 | </option> |
| 387 | - <option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>> |
|
| 387 | + <option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>> |
|
| 388 | 388 | 5.4.0 |
| 389 | 389 | </option> |
| 390 | - <option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>> |
|
| 390 | + <option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>> |
|
| 391 | 391 | 5.3.0 |
| 392 | 392 | </option> |
| 393 | - <option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>> |
|
| 393 | + <option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>> |
|
| 394 | 394 | 5.2.0 |
| 395 | 395 | </option> |
| 396 | - <option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>> |
|
| 396 | + <option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>> |
|
| 397 | 397 | 5.1.0 |
| 398 | 398 | </option> |
| 399 | - <option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>> |
|
| 399 | + <option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>> |
|
| 400 | 400 | 4.7.1 (CSS only) |
| 401 | 401 | </option> |
| 402 | 402 | </select> |
@@ -405,29 +405,29 @@ discard block |
||
| 405 | 405 | |
| 406 | 406 | <tr valign="top"> |
| 407 | 407 | <th scope="row"><label |
| 408 | - for="wpfas-enqueue"><?php _e( 'Enqueue', 'font-awesome-settings' ); ?></label></th> |
|
| 408 | + for="wpfas-enqueue"><?php _e('Enqueue', 'font-awesome-settings'); ?></label></th> |
|
| 409 | 409 | <td> |
| 410 | 410 | <select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue"> |
| 411 | 411 | <option |
| 412 | - value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)', 'font-awesome-settings' ); ?></option> |
|
| 412 | + value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)', 'font-awesome-settings'); ?></option> |
|
| 413 | 413 | <option |
| 414 | - value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend', 'font-awesome-settings' ); ?></option> |
|
| 414 | + value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend', 'font-awesome-settings'); ?></option> |
|
| 415 | 415 | <option |
| 416 | - value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend', 'font-awesome-settings' ); ?></option> |
|
| 416 | + value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend', 'font-awesome-settings'); ?></option> |
|
| 417 | 417 | </select> |
| 418 | 418 | </td> |
| 419 | 419 | </tr> |
| 420 | 420 | |
| 421 | 421 | <tr valign="top" class="wpfas-kit-hide"> |
| 422 | 422 | <th scope="row"><label |
| 423 | - for="wpfas-pro"><?php _e( 'Enable pro', 'font-awesome-settings' ); ?></label></th> |
|
| 423 | + for="wpfas-pro"><?php _e('Enable pro', 'font-awesome-settings'); ?></label></th> |
|
| 424 | 424 | <td> |
| 425 | 425 | <input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/> |
| 426 | 426 | <input type="checkbox" name="wp-font-awesome-settings[pro]" |
| 427 | - value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro"/> |
|
| 427 | + value="1" <?php checked($this->settings['pro'], '1'); ?> id="wpfas-pro"/> |
|
| 428 | 428 | <span><?php |
| 429 | 429 | echo sprintf( |
| 430 | - __( 'Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings' ), |
|
| 430 | + __('Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings'), |
|
| 431 | 431 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/pro"><i class="fas fa-external-link-alt"></i>', |
| 432 | 432 | '</a>', |
| 433 | 433 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn"><i class="fas fa-external-link-alt"></i>', |
@@ -439,38 +439,38 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | <tr valign="top" class="wpfas-kit-hide"> |
| 441 | 441 | <th scope="row"><label |
| 442 | - for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility', 'font-awesome-settings' ); ?></label> |
|
| 442 | + for="wpfas-shims"><?php _e('Enable v4 shims compatibility', 'font-awesome-settings'); ?></label> |
|
| 443 | 443 | </th> |
| 444 | 444 | <td> |
| 445 | 445 | <input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/> |
| 446 | 446 | <input type="checkbox" name="wp-font-awesome-settings[shims]" |
| 447 | - value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/> |
|
| 448 | - <span><?php _e( 'This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings' ); ?></span> |
|
| 447 | + value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/> |
|
| 448 | + <span><?php _e('This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings'); ?></span> |
|
| 449 | 449 | </td> |
| 450 | 450 | </tr> |
| 451 | 451 | |
| 452 | 452 | <tr valign="top" class="wpfas-kit-hide"> |
| 453 | 453 | <th scope="row"><label |
| 454 | - for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)', 'font-awesome-settings' ); ?></label> |
|
| 454 | + for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)', 'font-awesome-settings'); ?></label> |
|
| 455 | 455 | </th> |
| 456 | 456 | <td> |
| 457 | 457 | <input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/> |
| 458 | 458 | <input type="checkbox" name="wp-font-awesome-settings[js-pseudo]" |
| 459 | - value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?> |
|
| 459 | + value="1" <?php checked($this->settings['js-pseudo'], '1'); ?> |
|
| 460 | 460 | id="wpfas-js-pseudo"/> |
| 461 | - <span><?php _e( 'Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings' ); ?></span> |
|
| 461 | + <span><?php _e('Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings'); ?></span> |
|
| 462 | 462 | </td> |
| 463 | 463 | </tr> |
| 464 | 464 | |
| 465 | 465 | <tr valign="top"> |
| 466 | 466 | <th scope="row"><label |
| 467 | - for="wpfas-dequeue"><?php _e( 'Dequeue', 'font-awesome-settings' ); ?></label></th> |
|
| 467 | + for="wpfas-dequeue"><?php _e('Dequeue', 'font-awesome-settings'); ?></label></th> |
|
| 468 | 468 | <td> |
| 469 | 469 | <input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/> |
| 470 | 470 | <input type="checkbox" name="wp-font-awesome-settings[dequeue]" |
| 471 | - value="1" <?php checked( $this->settings['dequeue'], '1' ); ?> |
|
| 471 | + value="1" <?php checked($this->settings['dequeue'], '1'); ?> |
|
| 472 | 472 | id="wpfas-dequeue"/> |
| 473 | - <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.', 'font-awesome-settings' ); ?></span> |
|
| 473 | + <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.', 'font-awesome-settings'); ?></span> |
|
| 474 | 474 | </td> |
| 475 | 475 | </tr> |
| 476 | 476 | |
@@ -495,12 +495,12 @@ discard block |
||
| 495 | 495 | * |
| 496 | 496 | * @return string Either a valid version number or an empty string. |
| 497 | 497 | */ |
| 498 | - public function validate_version_number( $version ) { |
|
| 498 | + public function validate_version_number($version) { |
|
| 499 | 499 | |
| 500 | - if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) { |
|
| 500 | + if (version_compare($version, '0.0.1', '>=') >= 0) { |
|
| 501 | 501 | // valid |
| 502 | 502 | } else { |
| 503 | - $version = '';// not validated |
|
| 503 | + $version = ''; // not validated |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | return $version; |
@@ -515,19 +515,19 @@ discard block |
||
| 515 | 515 | * @since 1.0.7 |
| 516 | 516 | * @return mixed|string The latest version number found. |
| 517 | 517 | */ |
| 518 | - public function get_latest_version( $force_api = false ) { |
|
| 518 | + public function get_latest_version($force_api = false) { |
|
| 519 | 519 | $latest_version = $this->latest; |
| 520 | 520 | |
| 521 | - $cache = get_transient( 'wp-font-awesome-settings-version' ); |
|
| 521 | + $cache = get_transient('wp-font-awesome-settings-version'); |
|
| 522 | 522 | |
| 523 | - if ( $cache === false || $force_api ) { // its not set |
|
| 523 | + if ($cache === false || $force_api) { // its not set |
|
| 524 | 524 | $api_ver = $this->get_latest_version_from_api(); |
| 525 | - if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) { |
|
| 525 | + if (version_compare($api_ver, $this->latest, '>=') >= 0) { |
|
| 526 | 526 | $latest_version = $api_ver; |
| 527 | - set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS ); |
|
| 527 | + set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS); |
|
| 528 | 528 | } |
| 529 | - } elseif ( $this->validate_version_number( $cache ) ) { |
|
| 530 | - if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) { |
|
| 529 | + } elseif ($this->validate_version_number($cache)) { |
|
| 530 | + if (version_compare($cache, $this->latest, '>=') >= 0) { |
|
| 531 | 531 | $latest_version = $cache; |
| 532 | 532 | } |
| 533 | 533 | } |
@@ -543,10 +543,10 @@ discard block |
||
| 543 | 543 | */ |
| 544 | 544 | public function get_latest_version_from_api() { |
| 545 | 545 | $version = "0"; |
| 546 | - $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" ); |
|
| 547 | - if ( ! is_wp_error( $response ) && is_array( $response ) ) { |
|
| 548 | - $api_response = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
| 549 | - if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) { |
|
| 546 | + $response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest"); |
|
| 547 | + if (!is_wp_error($response) && is_array($response)) { |
|
| 548 | + $api_response = json_decode(wp_remote_retrieve_body($response), true); |
|
| 549 | + if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) { |
|
| 550 | 550 | $version = $api_response['tag_name']; |
| 551 | 551 | } |
| 552 | 552 | } |
@@ -11,102 +11,102 @@ |
||
| 11 | 11 | |
| 12 | 12 | class InstalledVersions |
| 13 | 13 | { |
| 14 | -private static $installed = array ( |
|
| 14 | +private static $installed = array( |
|
| 15 | 15 | 'root' => |
| 16 | - array ( |
|
| 16 | + array( |
|
| 17 | 17 | 'pretty_version' => 'dev-master', |
| 18 | 18 | 'version' => 'dev-master', |
| 19 | 19 | 'aliases' => |
| 20 | - array ( |
|
| 20 | + array( |
|
| 21 | 21 | ), |
| 22 | 22 | 'reference' => 'e4ac59f9dd63142f0c58042dfd18283fcaf0d7ab', |
| 23 | 23 | 'name' => 'ayecode/invoicing', |
| 24 | 24 | ), |
| 25 | 25 | 'versions' => |
| 26 | - array ( |
|
| 26 | + array( |
|
| 27 | 27 | 'ayecode/ayecode-connect-helper' => |
| 28 | - array ( |
|
| 28 | + array( |
|
| 29 | 29 | 'pretty_version' => '1.0.3', |
| 30 | 30 | 'version' => '1.0.3.0', |
| 31 | 31 | 'aliases' => |
| 32 | - array ( |
|
| 32 | + array( |
|
| 33 | 33 | ), |
| 34 | 34 | 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
| 35 | 35 | ), |
| 36 | 36 | 'ayecode/invoicing' => |
| 37 | - array ( |
|
| 37 | + array( |
|
| 38 | 38 | 'pretty_version' => 'dev-master', |
| 39 | 39 | 'version' => 'dev-master', |
| 40 | 40 | 'aliases' => |
| 41 | - array ( |
|
| 41 | + array( |
|
| 42 | 42 | ), |
| 43 | 43 | 'reference' => 'e4ac59f9dd63142f0c58042dfd18283fcaf0d7ab', |
| 44 | 44 | ), |
| 45 | 45 | 'ayecode/wp-ayecode-ui' => |
| 46 | - array ( |
|
| 46 | + array( |
|
| 47 | 47 | 'pretty_version' => '0.1.53', |
| 48 | 48 | 'version' => '0.1.53.0', |
| 49 | 49 | 'aliases' => |
| 50 | - array ( |
|
| 50 | + array( |
|
| 51 | 51 | ), |
| 52 | 52 | 'reference' => '9b0918600744c2a2e785010460f2c0e5be17fc5a', |
| 53 | 53 | ), |
| 54 | 54 | 'ayecode/wp-deactivation-survey' => |
| 55 | - array ( |
|
| 55 | + array( |
|
| 56 | 56 | 'pretty_version' => '1.0.3', |
| 57 | 57 | 'version' => '1.0.3.0', |
| 58 | 58 | 'aliases' => |
| 59 | - array ( |
|
| 59 | + array( |
|
| 60 | 60 | ), |
| 61 | 61 | 'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667', |
| 62 | 62 | ), |
| 63 | 63 | 'ayecode/wp-font-awesome-settings' => |
| 64 | - array ( |
|
| 64 | + array( |
|
| 65 | 65 | 'pretty_version' => '1.0.13', |
| 66 | 66 | 'version' => '1.0.13.0', |
| 67 | 67 | 'aliases' => |
| 68 | - array ( |
|
| 68 | + array( |
|
| 69 | 69 | ), |
| 70 | 70 | 'reference' => 'a7a11ee4290674ec214d1fe694139af275350402', |
| 71 | 71 | ), |
| 72 | 72 | 'ayecode/wp-super-duper' => |
| 73 | - array ( |
|
| 73 | + array( |
|
| 74 | 74 | 'pretty_version' => '1.0.26', |
| 75 | 75 | 'version' => '1.0.26.0', |
| 76 | 76 | 'aliases' => |
| 77 | - array ( |
|
| 77 | + array( |
|
| 78 | 78 | ), |
| 79 | 79 | 'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131', |
| 80 | 80 | ), |
| 81 | 81 | 'composer/installers' => |
| 82 | - array ( |
|
| 82 | + array( |
|
| 83 | 83 | 'pretty_version' => 'v1.11.0', |
| 84 | 84 | 'version' => '1.11.0.0', |
| 85 | 85 | 'aliases' => |
| 86 | - array ( |
|
| 86 | + array( |
|
| 87 | 87 | ), |
| 88 | 88 | 'reference' => 'ae03311f45dfe194412081526be2e003960df74b', |
| 89 | 89 | ), |
| 90 | 90 | 'maxmind-db/reader' => |
| 91 | - array ( |
|
| 91 | + array( |
|
| 92 | 92 | 'pretty_version' => 'v1.6.0', |
| 93 | 93 | 'version' => '1.6.0.0', |
| 94 | 94 | 'aliases' => |
| 95 | - array ( |
|
| 95 | + array( |
|
| 96 | 96 | ), |
| 97 | 97 | 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
| 98 | 98 | ), |
| 99 | 99 | 'roundcube/plugin-installer' => |
| 100 | - array ( |
|
| 100 | + array( |
|
| 101 | 101 | 'replaced' => |
| 102 | - array ( |
|
| 102 | + array( |
|
| 103 | 103 | 0 => '*', |
| 104 | 104 | ), |
| 105 | 105 | ), |
| 106 | 106 | 'shama/baton' => |
| 107 | - array ( |
|
| 107 | + array( |
|
| 108 | 108 | 'replaced' => |
| 109 | - array ( |
|
| 109 | + array( |
|
| 110 | 110 | 0 => '*', |
| 111 | 111 | ), |
| 112 | 112 | ), |
@@ -1,99 +1,99 @@ |
||
| 1 | -<?php return array ( |
|
| 1 | +<?php return array( |
|
| 2 | 2 | 'root' => |
| 3 | - array ( |
|
| 3 | + array( |
|
| 4 | 4 | 'pretty_version' => 'dev-master', |
| 5 | 5 | 'version' => 'dev-master', |
| 6 | 6 | 'aliases' => |
| 7 | - array ( |
|
| 7 | + array( |
|
| 8 | 8 | ), |
| 9 | 9 | 'reference' => 'e4ac59f9dd63142f0c58042dfd18283fcaf0d7ab', |
| 10 | 10 | 'name' => 'ayecode/invoicing', |
| 11 | 11 | ), |
| 12 | 12 | 'versions' => |
| 13 | - array ( |
|
| 13 | + array( |
|
| 14 | 14 | 'ayecode/ayecode-connect-helper' => |
| 15 | - array ( |
|
| 15 | + array( |
|
| 16 | 16 | 'pretty_version' => '1.0.3', |
| 17 | 17 | 'version' => '1.0.3.0', |
| 18 | 18 | 'aliases' => |
| 19 | - array ( |
|
| 19 | + array( |
|
| 20 | 20 | ), |
| 21 | 21 | 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
| 22 | 22 | ), |
| 23 | 23 | 'ayecode/invoicing' => |
| 24 | - array ( |
|
| 24 | + array( |
|
| 25 | 25 | 'pretty_version' => 'dev-master', |
| 26 | 26 | 'version' => 'dev-master', |
| 27 | 27 | 'aliases' => |
| 28 | - array ( |
|
| 28 | + array( |
|
| 29 | 29 | ), |
| 30 | 30 | 'reference' => 'e4ac59f9dd63142f0c58042dfd18283fcaf0d7ab', |
| 31 | 31 | ), |
| 32 | 32 | 'ayecode/wp-ayecode-ui' => |
| 33 | - array ( |
|
| 33 | + array( |
|
| 34 | 34 | 'pretty_version' => '0.1.53', |
| 35 | 35 | 'version' => '0.1.53.0', |
| 36 | 36 | 'aliases' => |
| 37 | - array ( |
|
| 37 | + array( |
|
| 38 | 38 | ), |
| 39 | 39 | 'reference' => '9b0918600744c2a2e785010460f2c0e5be17fc5a', |
| 40 | 40 | ), |
| 41 | 41 | 'ayecode/wp-deactivation-survey' => |
| 42 | - array ( |
|
| 42 | + array( |
|
| 43 | 43 | 'pretty_version' => '1.0.3', |
| 44 | 44 | 'version' => '1.0.3.0', |
| 45 | 45 | 'aliases' => |
| 46 | - array ( |
|
| 46 | + array( |
|
| 47 | 47 | ), |
| 48 | 48 | 'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667', |
| 49 | 49 | ), |
| 50 | 50 | 'ayecode/wp-font-awesome-settings' => |
| 51 | - array ( |
|
| 51 | + array( |
|
| 52 | 52 | 'pretty_version' => '1.0.13', |
| 53 | 53 | 'version' => '1.0.13.0', |
| 54 | 54 | 'aliases' => |
| 55 | - array ( |
|
| 55 | + array( |
|
| 56 | 56 | ), |
| 57 | 57 | 'reference' => 'a7a11ee4290674ec214d1fe694139af275350402', |
| 58 | 58 | ), |
| 59 | 59 | 'ayecode/wp-super-duper' => |
| 60 | - array ( |
|
| 60 | + array( |
|
| 61 | 61 | 'pretty_version' => '1.0.26', |
| 62 | 62 | 'version' => '1.0.26.0', |
| 63 | 63 | 'aliases' => |
| 64 | - array ( |
|
| 64 | + array( |
|
| 65 | 65 | ), |
| 66 | 66 | 'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131', |
| 67 | 67 | ), |
| 68 | 68 | 'composer/installers' => |
| 69 | - array ( |
|
| 69 | + array( |
|
| 70 | 70 | 'pretty_version' => 'v1.11.0', |
| 71 | 71 | 'version' => '1.11.0.0', |
| 72 | 72 | 'aliases' => |
| 73 | - array ( |
|
| 73 | + array( |
|
| 74 | 74 | ), |
| 75 | 75 | 'reference' => 'ae03311f45dfe194412081526be2e003960df74b', |
| 76 | 76 | ), |
| 77 | 77 | 'maxmind-db/reader' => |
| 78 | - array ( |
|
| 78 | + array( |
|
| 79 | 79 | 'pretty_version' => 'v1.6.0', |
| 80 | 80 | 'version' => '1.6.0.0', |
| 81 | 81 | 'aliases' => |
| 82 | - array ( |
|
| 82 | + array( |
|
| 83 | 83 | ), |
| 84 | 84 | 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
| 85 | 85 | ), |
| 86 | 86 | 'roundcube/plugin-installer' => |
| 87 | - array ( |
|
| 87 | + array( |
|
| 88 | 88 | 'replaced' => |
| 89 | - array ( |
|
| 89 | + array( |
|
| 90 | 90 | 0 => '*', |
| 91 | 91 | ), |
| 92 | 92 | ), |
| 93 | 93 | 'shama/baton' => |
| 94 | - array ( |
|
| 94 | + array( |
|
| 95 | 95 | 'replaced' => |
| 96 | - array ( |
|
| 96 | + array( |
|
| 97 | 97 | 0 => '*', |
| 98 | 98 | ), |
| 99 | 99 | ), |