| @@ -1,32 +1,20 @@ | ||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; | |
| 4 | -} | |
| 5 | -use EBS\Security\Sanitizer; | |
| 6 | 2 | |
| 7 | 3 | /* * ********************************************************* |
| 8 | 4 | * BUTTONS |
| 9 | 5 | * ********************************************************* */ |
| 10 | 6 | |
| 11 | -function osc_theme_labels( $params, $content = 'Label' ) { | |
| 12 | - $atts = shortcode_atts( | |
| 13 | - array( | |
| 14 | - 'type' => 'label-default', | |
| 15 | - 'class' => '', | |
| 16 | - ), | |
| 17 | - $params | |
| 18 | - ); | |
| 7 | +function osc_theme_labels($params, $content = 'Label') { | |
| 8 | + extract(shortcode_atts(array( | |
| 9 | + 'type' => 'label-default', | |
| 10 | + 'class' => '' | |
| 11 | + ), $params)); | |
| 12 | + $out = ''; | |
| 13 | + $content = str_replace("<br />", '', $content); | |
| 14 | + $content = str_replace("<br />\n", '', $content); | |
| 15 | + $out = '<span class="label ' . $type . ' ' . $class . '">' . do_shortcode($content) . '</span>'; | |
| 16 | + return $out; | |
| 17 | +} | |
| 19 | 18 | |
| 20 | - $out = ''; | |
| 21 | - $content = str_replace( '<br />', '', $content ); | |
| 22 | - $content = str_replace( "<br />\n", '', $content ); | |
| 19 | +add_shortcode('label', 'osc_theme_labels'); | |
| 23 | 20 | |
| 24 | - $type = Sanitizer::class_list( $atts['type'] ); | |
| 25 | - $class = Sanitizer::class_list( $atts['class'] ); | |
| 26 | - | |
| 27 | - $out = '<span class="label ' . $type . ' ' . $class . EBS_CONTAINER_CLASS . '">' . do_shortcode( $content ) . '</span>'; | |
| 28 | - | |
| 29 | - return $out; | |
| 30 | -} | |
| 31 | - | |
| 32 | -ebs_backward_compatibility_callback( 'label', 'osc_theme_labels' ); | |