PluginProbe
Easy Bootstrap Shortcode / trunk
Easy Bootstrap Shortcode vtrunk
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
easy-bootstrap-shortcodes / shortcode / tables / plugin_shortcode.php

plugin_shortcode.php in Easy Bootstrap Shortcode trunk, at shortcode/tables/plugin_shortcode.php

81 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5 use EBS\Security\Sanitizer;
6
7 /* * *********************************************************
8 * TABLES
9 * ********************************************************* */
10
11 function osc_theme_os_table( $params, $content = null ) {
12 $atts = shortcode_atts(
13 array(
14 'width' => '100%',
15 'style' => '',
16 'responsive' => 'false',
17 'class' => '',
18 ),
19 $params
20 );
21
22 $content = str_replace( ']<br />', ']', $content );
23
24 $width = Sanitizer::attr( $atts['width'] );
25 $style = Sanitizer::custom_css( $atts['style'] );
26 $class = Sanitizer::class_list( $atts['class'] );
27
28 $out = '<table width="' . $width . '" class="table ' . $class . EBS_CONTAINER_CLASS . '" style="' . Sanitizer::attr( $style ) . '">' . do_shortcode( $content ) . '</table>';
29 $out = 'true' === strtolower( $atts['responsive'] ) ? '<div class="table-responsive' . EBS_CONTAINER_CLASS . '">' . $out . '</div>' : $out;
30
31 return $out;
32 }
33
34 ebs_backward_compatibility_callback( 'table', 'osc_theme_os_table' );
35
36 function osc_theme_os_table_head( $params, $content = null ) {
37 $out = '<thead><tr>' . do_shortcode( $content ) . '</tr></thead>';
38
39 return $out;
40 }
41
42 ebs_backward_compatibility_callback( 'table_head', 'osc_theme_os_table_head' );
43
44 function osc_theme_os_table_body( $params, $content = null ) {
45 $out = '<tbody>' . do_shortcode( $content ) . '</tbody>';
46
47 return $out;
48 }
49
50 ebs_backward_compatibility_callback( 'table_body', 'osc_theme_os_table_body' );
51
52 function osc_theme_os_table_row( $params, $content = null ) {
53 $out = '<tr>';
54 $out .= do_shortcode( $content );
55 $out .= '</tr>';
56
57 return $out;
58 }
59
60 ebs_backward_compatibility_callback( 'table_row', 'osc_theme_os_table_row' );
61
62 function osc_theme_os_row_column( $params, $content = null ) {
63 $out = '<td>';
64 $out .= do_shortcode( $content );
65 $out .= '</td>';
66
67 return $out;
68 }
69
70 ebs_backward_compatibility_callback( 'row_column', 'osc_theme_os_row_column' );
71
72 function osc_theme_os_th_column( $params, $content = null ) {
73 $out = '<th>';
74 $out .= do_shortcode( $content );
75 $out .= '</th>';
76
77 return $out;
78 }
79
80 ebs_backward_compatibility_callback( 'th_column', 'osc_theme_os_th_column' );
81