| @@ -1,9 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; | |
| 4 | -} | |
| 5 | -use EBS\Security\Sanitizer; | |
| 6 | 2 | |
| 7 | 3 | /* * ********************************************************* |
| 8 | 4 | * Tooltip |
| 9 | 5 | * ********************************************************* */ |
| @@ -8,34 +4,25 @@ | ||
| 8 | 4 | * Tooltip |
| 9 | 5 | * ********************************************************* */ |
| 10 | 6 | |
| 11 | 7 | function osc_theme_tooltip($params, $content = 'Tooltip') { |
| 12 | - $atts = shortcode_atts(array( | |
| 13 | - 'type' => '', | |
| 14 | - 'link' => '', | |
| 15 | - 'tooltip' => '', | |
| 16 | - 'style' => '', | |
| 17 | - 'class' => '', | |
| 18 | - 'target' => '', | |
| 19 | - ), $params); | |
| 20 | - | |
| 21 | - $type = $atts['type']; | |
| 22 | - $link = Sanitizer::url( $atts['link'] ); | |
| 23 | - $tooltip = Sanitizer::attr( $atts['tooltip'] ); | |
| 24 | - $style = Sanitizer::attr( $atts['style'] ); | |
| 25 | - $class = Sanitizer::class_list( $atts['class'] ); | |
| 26 | - $target = Sanitizer::attr( $atts['target'] ); | |
| 27 | - | |
| 8 | + extract(shortcode_atts(array( | |
| 9 | + 'type' => '', | |
| 10 | + 'link' => '', | |
| 11 | + 'tooltip' => '', | |
| 12 | + 'style' => '', | |
| 13 | + 'class' => '' | |
| 14 | + ), $params)); | |
| 28 | 15 | $out = ''; |
| 29 | - if ( $type === 'link' ) { | |
| 30 | - $out = '<a href="' . $link . '" data-placement="' . $style . '" title="' . $tooltip . '" class="osc_tooltip ' . $class . '" target="' . $target . '">' . do_shortcode( $content ) . '</a> | |
| 16 | + if ($type == 'link') { | |
| 17 | + $out = '<a href="' . $link . '" data-placement="' . $style . '" title="' . $tooltip . '" class="osc_tooltip ' . $class . '">' . do_shortcode($content) . '</a> | |
| 31 | 18 | '; |
| 32 | - } elseif ( $type === 'button' ) { | |
| 33 | - $out = '<button type="button" data-toggle="tooltip" data-placement="' . $style . '" title="' . $tooltip . '" class="btn osc_tooltip ' . $class . '">' . do_shortcode( $content ) . '</button>'; | |
| 19 | + } elseif ($type == 'button') { | |
| 20 | + $out = '<button type="button" data-toggle="tooltip" data-placement="' . $style . '" title="' . $tooltip . '" class="btn osc_tooltip ' . $class . '">' . do_shortcode($content) . '</button>'; | |
| 34 | 21 | } |
| 35 | 22 | |
| 36 | - if ( EBS_TOOLTIP_TEMPLATE === '' ) { | |
| 37 | - $out .= " | |
| 23 | + | |
| 24 | + $out .= " | |
| 38 | 25 | <script> |
| 39 | 26 | jQuery(document).ready(function() { |
| 40 | 27 | jQuery('.osc_tooltip').tooltip(); |
| 41 | 28 | }); |
| @@ -41,18 +28,9 @@ | ||
| 41 | 28 | }); |
| 42 | 29 | </script> |
| 43 | 30 | "; |
| 44 | 31 | |
| 45 | - } else { | |
| 46 | - $out .= " | |
| 47 | - <script> | |
| 48 | - jQuery(document).ready(function(){ | |
| 49 | - jQuery('.osc_tooltip').tooltip({template:'" . EBS_TOOLTIP_TEMPLATE . "'}); | |
| 50 | - }); | |
| 51 | - </script> | |
| 52 | - "; | |
| 53 | - } | |
| 54 | - | |
| 55 | 32 | return $out; |
| 56 | 33 | } |
| 57 | 34 | |
| 58 | -ebs_backward_compatibility_callback('tooltip', 'osc_theme_tooltip'); | |
| 35 | +add_shortcode('tooltip', 'osc_theme_tooltip'); | |
| 36 | + | |