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 / lists / plugin_shortcode.php

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

45 lines 1.0 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 function osc_theme_list( $params, $content = null ) {
8 $atts = shortcode_atts(
9 array(
10 'class' => '',
11 ),
12 $params
13 );
14
15 $content = str_replace( ']<br />', ']', $content );
16 $content = str_replace( "]<br />\n", ']', $content );
17 $content = str_replace( "<br />\n[", '[', $content );
18
19 $class = Sanitizer::class_list( $atts['class'] );
20
21 return '<ul class="list-group ' . $class . EBS_CONTAINER_CLASS . '">' . do_shortcode( $content ) . '</ul>';
22 }
23
24 ebs_backward_compatibility_callback( 'list', 'osc_theme_list' );
25
26 function osc_theme_li( $params, $content = null ) {
27 $atts = shortcode_atts(
28 array(
29 'type' => '',
30 ),
31 $params
32 );
33
34 $type = Sanitizer::class_list( $atts['type'] );
35 if ( '' !== $type ) {
36 $osc_class = '<span class="glyphicon ' . $type . '"></span> ';
37 } else {
38 $osc_class = '';
39 }
40
41 return '<li class="list-group-item' . EBS_CONTAINER_CLASS . '">' . $osc_class . do_shortcode( $content ) . '</li>';
42 }
43
44 ebs_backward_compatibility_callback( 'li', 'osc_theme_li' );
45