| 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">× |
| 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 |
|