| @@ -1,80 +1,61 @@ | ||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; | |
| 4 | -} | |
| 5 | -use EBS\Security\Sanitizer; | |
| 6 | 2 | |
| 7 | 3 | /* * ********************************************************* |
| 8 | 4 | * TABLES |
| 9 | 5 | * ********************************************************* */ |
| 10 | 6 | |
| 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; | |
| 7 | +function osc_theme_os_table($params, $content = null) { | |
| 8 | + extract(shortcode_atts(array( | |
| 9 | + 'width' => '100%', | |
| 10 | + 'style' => '', | |
| 11 | + 'responsive' => 'false', | |
| 12 | + 'class' => '' | |
| 13 | + ), $params)); | |
| 14 | + $content = str_replace("]<br />", ']', $content); | |
| 15 | + $out = '<table width="' . $width . '" class="table ' . $style . ' '.$class.'">' . do_shortcode($content) . '</table>'; | |
| 16 | + $out = strtolower($responsive) == 'true' ? '<div class="table-responsive">' . $out . '</div>' : $out; | |
| 17 | + return $out; | |
| 32 | 18 | } |
| 33 | 19 | |
| 34 | -ebs_backward_compatibility_callback( 'table', 'osc_theme_os_table' ); | |
| 20 | +add_shortcode('table', 'osc_theme_os_table'); | |
| 35 | 21 | |
| 36 | -function osc_theme_os_table_head( $params, $content = null ) { | |
| 37 | - $out = '<thead><tr>' . do_shortcode( $content ) . '</tr></thead>'; | |
| 38 | - | |
| 39 | - return $out; | |
| 22 | +function osc_theme_os_table_head($params, $content = null) { | |
| 23 | + $out = '<thead><tr>' . do_shortcode($content) . '</tr></thead>'; | |
| 24 | + return $out; | |
| 40 | 25 | } |
| 41 | 26 | |
| 42 | -ebs_backward_compatibility_callback( 'table_head', 'osc_theme_os_table_head' ); | |
| 27 | +add_shortcode('table_head', 'osc_theme_os_table_head'); | |
| 43 | 28 | |
| 44 | -function osc_theme_os_table_body( $params, $content = null ) { | |
| 45 | - $out = '<tbody>' . do_shortcode( $content ) . '</tbody>'; | |
| 46 | - | |
| 47 | - return $out; | |
| 29 | +function osc_theme_os_table_body($params, $content = null) { | |
| 30 | + $out = '<tbody>' . do_shortcode($content) . '</tbody>'; | |
| 31 | + return $out; | |
| 48 | 32 | } |
| 49 | 33 | |
| 50 | -ebs_backward_compatibility_callback( 'table_body', 'osc_theme_os_table_body' ); | |
| 34 | +add_shortcode('table_body', 'osc_theme_os_table_body'); | |
| 51 | 35 | |
| 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; | |
| 36 | +function osc_theme_os_table_row($params, $content = null) { | |
| 37 | + $out = '<tr>'; | |
| 38 | + $out .= do_shortcode($content); | |
| 39 | + $out .= '</tr>'; | |
| 40 | + return $out; | |
| 58 | 41 | } |
| 59 | 42 | |
| 60 | -ebs_backward_compatibility_callback( 'table_row', 'osc_theme_os_table_row' ); | |
| 43 | +add_shortcode('table_row', 'osc_theme_os_table_row'); | |
| 61 | 44 | |
| 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; | |
| 45 | +function osc_theme_os_row_column($params, $content = null) { | |
| 46 | + $out = '<td>'; | |
| 47 | + $out .= do_shortcode($content); | |
| 48 | + $out .= '</td>'; | |
| 49 | + return $out; | |
| 68 | 50 | } |
| 69 | 51 | |
| 70 | -ebs_backward_compatibility_callback( 'row_column', 'osc_theme_os_row_column' ); | |
| 52 | +add_shortcode('row_column', 'osc_theme_os_row_column'); | |
| 71 | 53 | |
| 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; | |
| 54 | +function osc_theme_os_th_column($params, $content = null) { | |
| 55 | + $out = '<th>'; | |
| 56 | + $out .= do_shortcode($content); | |
| 57 | + $out .= '</th>'; | |
| 58 | + return $out; | |
| 78 | 59 | } |
| 79 | 60 | |
| 80 | -ebs_backward_compatibility_callback( 'th_column', 'osc_theme_os_th_column' ); | |
| 61 | +add_shortcode('th_column', 'osc_theme_os_th_column'); | |