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

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

36 lines 860 B
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_notification( $atts, $content = null ) {
8 $atts = shortcode_atts(
9 array(
10 'type' => '',
11 'close' => 'false',
12 'class' => '',
13 ),
14 $atts
15 );
16
17 $type = Sanitizer::class_list( $atts['type'] );
18 $class = Sanitizer::class_list( $atts['class'] );
19
20 if ( 'true' === $atts['close'] ) {
21 $type .= ' alert-dismissable';
22 }
23
24 $result = '<div class = "alert ' . $type . ' ' . $class . EBS_CONTAINER_CLASS . '">';
25 if ( 'true' === $atts['close'] ) {
26 $result .= '<button type = "button" class = "close' . EBS_CONTAINER_CLASS . '" data-dismiss = "alert" aria-hidden = "true">&times;
27 </button>';
28 }
29 $result .= do_shortcode( $content );
30 $result .= '</div>';
31
32 return $result;
33 }
34
35 ebs_backward_compatibility_callback( 'notification', 'osc_theme_notification' );
36