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

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

44 lines 1.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 function osc_theme_deslist( $params, $content = null ) {
8 $atts = shortcode_atts(
9 array(
10 'class' => '',
11 'style' => '',
12 ),
13 $params
14 );
15
16 $content = str_replace( ']<br />', ']', $content );
17 $content = str_replace( "]<br />\n", ']', $content );
18 $content = str_replace( "<br />\n[", '[', $content );
19
20 $style = Sanitizer::class_list( $atts['style'] );
21 $class = Sanitizer::class_list( $atts['class'] );
22
23 return '<dl class="osc-deslist ' . $style . ' ' . $class . EBS_CONTAINER_CLASS . '">' . do_shortcode( $content ) . '</dl>';
24 }
25
26 ebs_backward_compatibility_callback( 'dl', 'osc_theme_deslist' );
27
28 function osc_theme_dlitem( $params, $content = null ) {
29 $atts = shortcode_atts(
30 array(
31 'heading' => '',
32 ),
33 $params
34 );
35
36 $heading = do_shortcode( Sanitizer::shortcode_content( $atts['heading'] ) );
37 $out = '<dt>' . $heading . '</dt>';
38 $out .= '<dd>' . do_shortcode( $content ) . '</dd>';
39
40 return $out;
41 }
42
43 ebs_backward_compatibility_callback( 'dlitem', 'osc_theme_dlitem' );
44