PluginProbe
Easy Bootstrap Shortcode / trunk
Easy Bootstrap Shortcode vtrunk
trunk 2.4.0 2.5 3.4 3.5 3.6 3.7 4.0.0 4.4 4.5 4.5.4 5.0.0 5.0.1 5.0.2
easy-bootstrap-shortcodes / shortcode / progressbar / plugin_shortcode.php

plugin_shortcode.php in Easy Bootstrap Shortcode trunk, at shortcode/progressbar/plugin_shortcode.php

41 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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