notice.php
54 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments - Libraries |
| 4 | * @subpackage html.system |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | /** |
| 15 | * Layout variables |
| 16 | * ----------------- |
| 17 | * @var string $text The text to display within the alert. |
| 18 | * @var string $type The alert type. |
| 19 | * @var string $id A unique alert signature. |
| 20 | * @var boolean $dismiss True if the alert can be dismissed. |
| 21 | * @var mixed $expdate If specified, indicates the date for |
| 22 | * the cookie expiration. |
| 23 | * @var array $attrs A list of field attributes. |
| 24 | */ |
| 25 | extract($displayData); |
| 26 | |
| 27 | // fetch attributes string |
| 28 | $attrs_str = ''; |
| 29 | |
| 30 | foreach ($attrs as $k => $v) |
| 31 | { |
| 32 | if ($k != 'class') |
| 33 | { |
| 34 | $attrs_str .= ' ' . $k; |
| 35 | |
| 36 | if (!is_bool($v)) |
| 37 | { |
| 38 | $attrs_str .= ' = "' . $this->escape($v) . '"'; |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | if (!preg_match("/^<(.*?)>/", $text)) |
| 44 | { |
| 45 | // wrap text in a paragraph if doesn't start with a tag |
| 46 | $text = '<p>' . $text . '</p>'; |
| 47 | } |
| 48 | |
| 49 | ?> |
| 50 | |
| 51 | <div class="notice notice-<?php echo $type . (!empty($attrs['class']) ? ' ' . $attrs['class'] : '') . ($dismiss ? ' is-dismissible' : ''); ?>"<?php echo $attrs_str; ?>> |
| 52 | <?php echo $text; ?> |
| 53 | </div> |
| 54 |