| @@ -1,41 +1,22 @@ | ||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; | |
| 4 | -} | |
| 5 | -use EBS\Security\Sanitizer; | |
| 6 | 2 | |
| 7 | -function osc_theme_iconhead( $params, $content = null ) { | |
| 8 | - $atts = shortcode_atts( | |
| 9 | - array( | |
| 10 | - 'class' => '', | |
| 11 | - 'style' => '', | |
| 12 | - 'type' => 'h1', | |
| 13 | - 'color' => '', | |
| 14 | - ), | |
| 15 | - $params | |
| 16 | - ); | |
| 3 | +function osc_theme_iconhead($params, $content = null) { | |
| 4 | + extract(shortcode_atts(array( | |
| 5 | + 'class' => '', | |
| 6 | + 'style' => '', | |
| 7 | + 'type' => 'h1' | |
| 8 | + ), $params)); | |
| 9 | + $out = ''; | |
| 10 | + if ($style != '') { | |
| 11 | + $style = ' <span class="glyphicon ' . $style . '"></span> '; | |
| 12 | + } | |
| 13 | + if ($class != '') { | |
| 14 | + $class = ' class="' . $class . '"'; | |
| 15 | + } | |
| 16 | + $out = '<' . $type . $class . '>' . $style . do_shortcode($content) . '</' . $type . '>'; | |
| 17 | 17 | |
| 18 | - $out = ''; | |
| 19 | - $type = Sanitizer::heading_tag( $atts['type'] ); | |
| 20 | - $class = Sanitizer::class_list( $atts['class'] ); | |
| 21 | - $style = $atts['style']; | |
| 18 | + return $out; | |
| 19 | +} | |
| 22 | 20 | |
| 23 | - $color_attr = ''; | |
| 24 | - if ( '' !== $atts['color'] ) { | |
| 25 | - $color_attr = 'style="color:' . Sanitizer::hex_color( $atts['color'] ) . ';"'; | |
| 26 | - } | |
| 21 | +add_shortcode('iconheading', 'osc_theme_iconhead'); | |
| 27 | 22 | |
| 28 | - if ( '' !== $style ) { | |
| 29 | - $iconcount = array_filter( explode( ' ', $style ) ); | |
| 30 | - if ( 1 === count( $iconcount ) ) { | |
| 31 | - $style = 'glyphicon ' . $style; | |
| 32 | - } | |
| 33 | - $style = ' <span class=" ' . Sanitizer::class_list( $style ) . '" ' . $color_attr . '></span> '; | |
| 34 | - } | |
| 35 | - | |
| 36 | - $out = '<' . $type . ' class="' . $class . EBS_CONTAINER_CLASS . '" >' . $style . do_shortcode( $content ) . '</' . $type . '>'; | |
| 37 | - | |
| 38 | - return $out; | |
| 39 | -} | |
| 40 | - | |
| 41 | -ebs_backward_compatibility_callback( 'iconheading', 'osc_theme_iconhead' ); | |