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/oscpopover/plugin_shortcode.php +13 -98 trunk3.7 View file →
@@ -1,34 +1,21 @@
1 1 <?php
2 -if ( ! defined( 'ABSPATH' ) ) {
3 - exit;
4 -}
5 -use EBS\Security\Sanitizer;
6 2
7 3 function osc_theme_popover($params, $content = 'Popover') {
8 - $atts = shortcode_atts(array(
9 - 'trigger' => '',
10 - 'title' => '',
11 - 'pop_content' => '',
12 - 'style' => '',
13 - 'size' => '',
14 - 'type' => '',
15 - 'class' => ''
16 - ), $params);
4 + extract(shortcode_atts(array(
5 + 'trigger' => '',
6 + 'title' => '',
7 + 'pop_content' => '',
8 + 'style' => '',
9 + 'size' => '',
10 + 'type' => '',
11 + 'class' => ''
12 + ), $params));
13 + $out = '';
14 + $out = '<button class="osc_popover btn ' . $size . ' ' . $type . ' ' . $class . '" data-content="' . $pop_content . '" data-placement="' . $style . '" data-toggle="popover" data-trigger="' . $trigger . '" data-container="body" type="button" data-title="' . $title . '"> ' . do_shortcode($content) . ' </button>';
17 15
18 - $trigger = Sanitizer::attr( $atts['trigger'] );
19 - $title = Sanitizer::attr( $atts['title'] );
20 - $pop_content = Sanitizer::attr( $atts['pop_content'] );
21 - $style = Sanitizer::attr( $atts['style'] );
22 - $size = Sanitizer::class_list( $atts['size'] );
23 - $type = Sanitizer::class_list( $atts['type'] );
24 - $class = Sanitizer::class_list( $atts['class'] );
25 16
26 - $out = '';
27 - $out = '<button class="osc_popover btn ' . $size . ' ' . $type . ' ' . $class . EBS_CONTAINER_CLASS . '" data-content="' . $pop_content . '" data-placement="' . $style . '" data-toggle="popover" data-trigger="' . $trigger . '" data-container="body" type="button" data-title="' . $title . '"> ' . do_shortcode( $content ) . ' </button>';
28 -
29 - if ( EBS_POPOVER_TEMPLATE === '' ) {
30 - $out .= "
17 + $out .= "
31 18 <script>
32 19 jQuery(document).ready(function(){
33 20 jQuery('.osc_popover').popover();
34 21 });
@@ -34,80 +21,8 @@
34 21 });
35 22 </script>
36 23 ";
37 24
38 - } else {
39 - $out .= "
40 - <script>
41 - jQuery(document).ready(function(){
42 - jQuery('.osc_popover').popover({template:'" . EBS_POPOVER_TEMPLATE . "'});
43 - });
44 - </script>
45 - ";
46 - }
47 25 return $out;
48 26 }
49 27
50 -$_osc_popover_array = array( 'count' => 0 );
51 -
52 -function osc_theme_popover_new($params, $content = '') {
53 - global $_osc_popover_array;
54 - $atts = shortcode_atts(array(
55 - 'id' => count( $_osc_popover_array ),
56 - 'trigger' => '',
57 - 'title' => '',
58 - 'button_text' => 'Popover',
59 - 'style' => '',
60 - 'size' => '',
61 - 'type' => '',
62 - 'class' => ''
63 - ), $params);
64 -
65 - $id = Sanitizer::int( $atts['id'] );
66 - $trigger = Sanitizer::attr( $atts['trigger'] );
67 - $title = Sanitizer::attr( $atts['title'] );
68 - $button_text = Sanitizer::html( $atts['button_text'] );
69 - $style = Sanitizer::attr( $atts['style'] );
70 - $size = Sanitizer::class_list( $atts['size'] );
71 - $type = Sanitizer::class_list( $atts['type'] );
72 - $class = Sanitizer::class_list( $atts['class'] );
73 -
74 - $_osc_popover_array[ $id ] = array();
75 - $out = '';
76 - $out = '<button class="osc_popover_new btn ' . $size . ' ' . $type . ' ' . $class . EBS_CONTAINER_CLASS . '" data-placement="' . $style . '" data-toggle="popover" data-trigger="' . $trigger . '" data-container="body" type="button" data-title="' . $title . '" data-contentwrapper="osc_popover_' . $id . '"> ' . $button_text . ' </button>';
77 - $out .= '<div id="osc_popover_' . $id . '" style="display:none;">' . do_shortcode( $content ) . '</div>';
78 -
79 - if ( EBS_POPOVER_TEMPLATE === '' ) {
80 - $out .= "
81 - <script>
82 - jQuery(document).ready(function(){
83 - jQuery('.osc_popover_new').popover({
84 - html:true,
85 - content:function(){
86 - return jQuery('#'+jQuery(this).data('contentwrapper')).html();
87 - }
88 -
89 - });
90 - });
91 - </script>
92 - ";
93 -
94 - } else {
95 - $out .= "
96 - <script>
97 - jQuery(document).ready(function(){
98 - jQuery('.osc_popover_new').popover({
99 - template:'" . EBS_POPOVER_TEMPLATE . "',
100 - html:true,
101 - content:function(){
102 - return jQuery('#'+jQuery(this).data('contentwrapper')).html();
103 - }
104 - });
105 - });
106 - </script>
107 - ";
108 - }
109 - return $out;
110 -}
111 -
112 -ebs_backward_compatibility_callback('popover', 'osc_theme_popover');
113 -ebs_backward_compatibility_callback('popovernew', 'osc_theme_popover_new');
28 +add_shortcode('popover', 'osc_theme_popover');