| 1 |
<?php defined('ABSPATH') or die("Protected By WT!"); |
| 2 |
|
| 3 |
|
| 4 |
class WTSEC_LIBRARY_Session |
| 5 |
{ |
| 6 |
public static function notifications() |
| 7 |
{ |
| 8 |
$notification_types = [ |
| 9 |
"error","info","warning","success" |
| 10 |
]; |
| 11 |
foreach ($notification_types as $type) { |
| 12 |
if ($notifications = get_option(WTSEC_PLUGIN_PREFIX.$type)) { |
| 13 |
if(is_array($notifications)) { |
| 14 |
foreach ($notifications as $notification) { |
| 15 |
echo '<div class="ww-main ww-main--grid" id="ww-alert" title="" data-tlite=""> |
| 16 |
<div class="ww-alert ww-alert--'.$type.'" title="" data-tlite=""> |
| 17 |
<div class="ww-alert__info">'.strtoupper($type).':</div> |
| 18 |
<div class="ww-alert__text" title="" data-tlite="">'.$notification.'</div><button class="ww-alert__close" type="button" onclick="removeAlert()"> |
| 19 |
<div class="ww-icon ww-icon--close"></div> |
| 20 |
</button> |
| 21 |
</div> |
| 22 |
</div>'; |
| 23 |
} |
| 24 |
} |
| 25 |
self::deleteNotification($type); |
| 26 |
} |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
protected static function deleteNotification($name){ |
| 31 |
return delete_option(WTSEC_PLUGIN_PREFIX.$name); |
| 32 |
} |
| 33 |
|
| 34 |
public static function setNotification($type,$value){ |
| 35 |
if($notifications = get_option(WTSEC_PLUGIN_PREFIX.$type)){ |
| 36 |
$notifications[] = $value; |
| 37 |
update_option(WTSEC_PLUGIN_PREFIX.$type,$notifications); |
| 38 |
}else{ |
| 39 |
update_option(WTSEC_PLUGIN_PREFIX.$type,[$value]); |
| 40 |
} |
| 41 |
} |
| 42 |
} |