PluginProbe
Easy Bootstrap Shortcode / 3.7
Easy Bootstrap Shortcode v3.7
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
← All changes | shortcode/buttons/plugin_shortcode.php +24 -57 trunk3.7 View file →
@@ -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 * BUTTONS
9 5 * ********************************************************* */
@@ -8,64 +4,35 @@
8 4 * BUTTONS
9 5 * ********************************************************* */
10 6
11 7 function osc_theme_button($params, $content = null) {
12 - $atts = shortcode_atts(array(
13 - 'title' => 'osCitas',
14 - 'link' => '',
15 - 'linkrel' => '',
16 - 'type' => 'link',
17 - 'style' => '',
18 - 'align' => '',
19 - 'target' => '',
20 - 'icon' => '',
21 - 'class' => '',
22 - 'iconcolor' => ''
23 - ), $params);
24 -
25 - $title = Sanitizer::html( $atts['title'] );
26 - $link = Sanitizer::url( $atts['link'] );
27 - $linkrel = Sanitizer::attr( $atts['linkrel'] );
28 - $style = Sanitizer::class_list( $atts['style'] );
29 - $class = Sanitizer::class_list( $atts['class'] );
30 - $align = $atts['align'];
31 - $type = $atts['type'];
32 - $target = $atts['target'];
33 - $icon = Sanitizer::class_list( $atts['icon'] );
34 - $iconcolor = Sanitizer::hex_color( $atts['iconcolor'] );
35 -
8 + extract(shortcode_atts(array(
9 + 'title' => 'osCitas',
10 + 'link' => '',
11 + 'type' => 'link',
12 + 'style' => '',
13 + 'align' => '',
14 + 'target' => '',
15 + 'icon' => '',
16 + 'class' => ''
17 + ), $params));
36 18 $out = '';
37 - $iconcount = array();
38 - if ( $icon ) {
39 - $iconcount = explode( ' ', $atts['icon'] );
40 - }
41 - array_filter( $iconcount );
42 - if ( count( $iconcount ) === 1 ) {
43 - $icon = 'glyphicon ' . $icon;
44 - }
45 -
46 - $iconcolor_attr = '';
47 - if ( $iconcolor !== '' ) {
48 - $iconcolor_attr = 'style="color:' . $iconcolor . ';"';
49 - }
50 -
51 - if ( $icon !== '' ) {
52 - if ( $align === 'right' ) {
53 - $value = $title . ' <i class="' . $icon . '" ' . $iconcolor_attr . '></i>';
54 - } else {
55 - $value = '<i class="' . $icon . '" ' . $iconcolor_attr . '></i> ' . $title;
19 + if($icon!=''){
20 + if($align=='right'){
21 + $value=$title.' <i class="glyphicon '.$icon.'"></i>';
22 + } else{
23 + $value='<i class="glyphicon '.$icon.'"></i> '.$title;
56 24 }
57 - } else {
58 - $value = $title;
25 + }else{
26 + $value=$title;
59 27 }
60 -
61 - $target_attr = ' target="' . ( $target !== 'false' ? '_blank' : '_self' ) . '"';
62 -
63 - if ( $type === 'link' ) {
64 - $out = '<a class="btn ' . $style . ' ' . $class . ' ' . EBS_CONTAINER_CLASS . '" href="' . $link . '" rel="' . $linkrel . '" ' . $target_attr . '>' . $value . '</a>';
65 - } elseif ( $type === 'button' ) {
66 - $out = '<button class="btn ' . $style . ' ' . $class . ' ' . EBS_CONTAINER_CLASS . '">' . $value . '</button>';
28 + $target = ' target="'.($target != 'false' ? '_blank':'_self').'"';
29 + if ($type == 'link') {
30 + $out = '<a class="btn ' . $style . ' ' . $class . '" href="' . $link . '" ' . ($target) . '>' . $value . '</a>';
31 + } elseif ($type == 'button') {
32 + $out = '<button class="btn ' . $style . ' ' . $class . '" >' . $value . '</button>';
67 33 }
68 34 return $out;
69 35 }
70 36
71 -ebs_backward_compatibility_callback('button', 'osc_theme_button');
37 +add_shortcode('button', 'osc_theme_button');
38 +