| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying global message. |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/learnpress/global/message.php. |
| 6 |
* |
| 7 |
* @author ThimPress |
| 8 |
* @package Learnpress/Templates |
| 9 |
* @version 3.0.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
|
| 13 |
defined( 'ABSPATH' ) || exit(); |
| 14 |
|
| 15 |
if ( ! isset( $messages ) ) { |
| 16 |
return; |
| 17 |
} |
| 18 |
?> |
| 19 |
|
| 20 |
<?php foreach ( $messages as $type => $message ) { ?> |
| 21 |
<?php if ( $message ) { ?> |
| 22 |
<?php foreach ( $message as $content ) { ?> |
| 23 |
<?php |
| 24 |
$options = array(); |
| 25 |
|
| 26 |
if ( is_array( $content ) ) { |
| 27 |
$options = $content['options']; |
| 28 |
$content = $content['content']; |
| 29 |
$options = wp_parse_args( |
| 30 |
$options, |
| 31 |
array( |
| 32 |
'position' => '', |
| 33 |
'delay-in' => 0, |
| 34 |
'delay-out' => 0, |
| 35 |
) |
| 36 |
); |
| 37 |
} |
| 38 |
|
| 39 |
$classes = array( 'learn-press-message', esc_attr( $type ) ); |
| 40 |
$data = array(); |
| 41 |
|
| 42 |
if ( ! empty( $options['position'] ) ) { |
| 43 |
$classes[] = $options['position']; |
| 44 |
if ( ! empty( $options['delay-in'] ) ) { |
| 45 |
$data[] = sprintf( 'data-delay-in="%s"', $options['delay-in'] ); |
| 46 |
} |
| 47 |
|
| 48 |
if ( ! empty( $options['delay-in'] ) ) { |
| 49 |
$data[] = sprintf( 'data-delay-out="%s"', $options['delay-out'] ); |
| 50 |
} |
| 51 |
} |
| 52 |
?> |
| 53 |
<div class="<?php echo esc_attr( join( ' ', $classes ) ); ?>" <?php echo esc_attr( $data ? join( ' ', $data ) : '' ); ?>> |
| 54 |
<?php echo apply_filters( 'learn-press/message', wp_kses_post( $content ), $content ); ?> |
| 55 |
</div> |
| 56 |
|
| 57 |
<?php } ?> |
| 58 |
|
| 59 |
<?php } ?> |
| 60 |
|
| 61 |
<?php } ?> |
| 62 |
|