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/tabs/plugin_shortcode.php +36 -55 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 * jQuery UI Tabs
9 5 * ********************************************************* */
@@ -8,60 +4,45 @@
8 4 * jQuery UI Tabs
9 5 * ********************************************************* */
10 6 $_oscitas_tabs = array();
11 7
12 -function osc_theme_tabs( $params, $content = null ) {
13 - global $_oscitas_tabs;
8 +function osc_theme_tabs($params, $content = null) {
9 + global $_oscitas_tabs;
10 + extract(shortcode_atts(array(
11 + 'id' => count($_oscitas_tabs),
12 + 'class' => ''
13 + ), $params));
14 + $_oscitas_tabs[$id] = array();
15 + do_shortcode($content);
16 + $scontent = '<ul class="nav nav-tabs " id="oscitas-tabs-' . $id . '">' . implode('', $_oscitas_tabs[$id]['tabs']) . '</ul><div
17 + class="tab-content">' . implode('', $_oscitas_tabs[$id]['panes']) . '</div>';
18 + if (trim($scontent) != "") {
19 + $output = '<div class="' . $class . '">' . $scontent;
20 + $output .= '</div>';
14 21
15 - $atts = shortcode_atts(
16 - array(
17 - 'id' => count( $_oscitas_tabs ),
18 - 'class' => '',
19 - ),
20 - $params
21 - );
22 -
23 - $id = Sanitizer::int( $atts['id'] );
24 - $class = Sanitizer::class_list( $atts['class'] );
25 -
26 - $_oscitas_tabs[ $id ] = array();
27 - do_shortcode( $content );
28 - $scontent = '<ul class="nav nav-tabs' . EBS_CONTAINER_CLASS . '" id="oscitas-tabs-' . $id . '">' . implode( '', $_oscitas_tabs[ $id ]['tabs'] ) . '</ul><div class="tab-content' . EBS_CONTAINER_CLASS . '">' . implode( '', $_oscitas_tabs[ $id ]['panes'] ) . '</div>';
29 -
30 - if ( '' !== trim( $scontent ) ) {
31 - $output = '<div class="' . $class . '">' . $scontent;
32 - $output .= '</div>';
33 -
34 - return $output;
35 - }
36 -
37 - return '';
22 + return $output;
23 + } else {
24 + return "";
25 + }
38 26 }
27 +add_shortcode('tabs', 'osc_theme_tabs');
39 28
40 -ebs_backward_compatibility_callback( 'tabs', 'osc_theme_tabs' );
29 +function osc_theme_tab($params, $content = null) {
30 + global $_oscitas_tabs;
31 + extract(shortcode_atts(array(
32 + 'title' => 'title',
33 + 'active' => '',
34 + ), $params));
41 35
42 -function osc_theme_tab( $params, $content = null ) {
43 - global $_oscitas_tabs;
44 -
45 - $atts = shortcode_atts(
46 - array(
47 - 'title' => 'title',
48 - 'active' => '',
49 - ),
50 - $params
51 - );
52 -
53 - $title = Sanitizer::html( $atts['title'] );
54 - $active = Sanitizer::class_list( $atts['active'] );
55 -
56 - $index = count( $_oscitas_tabs ) - 1;
57 - if ( ! isset( $_oscitas_tabs[ $index ]['tabs'] ) ) {
58 - $_oscitas_tabs[ $index ]['tabs'] = array();
59 - }
60 -
61 - $pane_id = 'pane-' . $index . '-' . count( $_oscitas_tabs[ $index ]['tabs'] );
62 -
63 - $_oscitas_tabs[ $index ]['tabs'][] = '<li class="' . $active . EBS_CONTAINER_CLASS . '"><a class="' . EBS_CONTAINER_CLASS . '" href="#' . Sanitizer::attr( $pane_id ) . '" data-toggle="tab">' . $title . '</a></li>';
64 - $_oscitas_tabs[ $index ]['panes'][] = '<div class="tab-pane ' . $active . EBS_CONTAINER_CLASS . '" id="' . Sanitizer::attr( $pane_id ) . '">' . do_shortcode( trim( $content ) ) . '</div>';
36 + $index = count($_oscitas_tabs) - 1;
37 + if (!isset($_oscitas_tabs[$index]['tabs'])) {
38 + $_oscitas_tabs[$index]['tabs'] = array();
39 + }
40 + $pane_id = 'pane-' . $index . '-' . count($_oscitas_tabs[$index]['tabs']);
41 + $_oscitas_tabs[$index]['tabs'][] = '<li class="' . $active . '"><a href="#' . $pane_id . '" data-toggle="tab">' . $title
42 + . '</a></li>';
43 + $_oscitas_tabs[$index]['panes'][] = '<div class="tab-pane ' . $active . '" id="'
44 + . $pane_id . '">'
45 + . do_shortcode
46 + (trim($content)) . '</div>';
65 47 }
66 -
67 -ebs_backward_compatibility_callback( 'tab', 'osc_theme_tab' );
48 +add_shortcode('tab', 'osc_theme_tab');