| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
use EBS\Security\Sanitizer; |
| 6 |
|
| 7 |
/* * ********************************************************* |
| 8 |
* BUTTONS |
| 9 |
* ********************************************************* */ |
| 10 |
|
| 11 |
function osc_theme_progressbar( $params, $content = null ) { |
| 12 |
$atts = shortcode_atts( |
| 13 |
array( |
| 14 |
'value' => '50', |
| 15 |
'barstyle' => '', |
| 16 |
'bartype' => '', |
| 17 |
'class' => '', |
| 18 |
'label' => '', |
| 19 |
), |
| 20 |
$params |
| 21 |
); |
| 22 |
|
| 23 |
$value = Sanitizer::int( $atts['value'] ); |
| 24 |
$barstyle = Sanitizer::class_list( $atts['barstyle'] ); |
| 25 |
$bartype = Sanitizer::class_list( $atts['bartype'] ); |
| 26 |
$class = Sanitizer::class_list( $atts['class'] ); |
| 27 |
$label = Sanitizer::html( $atts['label'] ); |
| 28 |
|
| 29 |
$out = '' !== $atts['label'] ? '<div class="osc_bar_outer"><label class="osc-progressbar-label' . EBS_CONTAINER_CLASS . '">' . $label . '</label>' : ''; |
| 30 |
$out .= '<div class="progress ' . $barstyle . ' ' . $class . ' osc-progressbar' . EBS_CONTAINER_CLASS . '"> |
| 31 |
<div class="progress-bar ' . $bartype . EBS_CONTAINER_CLASS . '" role="progressbar" aria-valuenow="' . $value . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . $value . '%"> |
| 32 |
<span class="sr-only' . EBS_CONTAINER_CLASS . '">' . $value . '% Complete</span> |
| 33 |
</div> |
| 34 |
</div>'; |
| 35 |
$out .= '' !== $atts['label'] ? '</div>' : ''; |
| 36 |
|
| 37 |
return $out; |
| 38 |
} |
| 39 |
|
| 40 |
ebs_backward_compatibility_callback( 'progressbar', 'osc_theme_progressbar' ); |
| 41 |
|