# wt-security/2.1.7/library/Session.php

WebTotem Security, version 2.1.7. 47 lines.

- Page: https://pluginprobe.com/plugins/wt-security/2.1.7/code/library/Session.php
- Raw: https://pluginprobe.com/plugins/wt-security/2.1.7/raw/library/Session.php
- Modified: 2020-07-13T13:03:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wt-security/2.1.7/code/library/Session.php#L10-L20`.

```php
<?php defined('ABSPATH') or die("Protected By WT!");


class WTSEC_LIBRARY_Session
{
    public static function notifications()
    {
        $notification_types = [
            "error","info","warning","success"
        ];

        //need upgrade code style
        $styles = ["error" => ["color" => "red","class" =>"wtotem_alert__img_cross","img" => ""],"info" => ["color" => "","class" => "","img" => ""],"warning" => ["color" => "yellow","class" => "", "img" => '<img src="'.wtsec_getImagePath("alert-warning.svg").'">'],"success" => ["color" => "green","class" => "" ,"img" => '<img src="'.wtsec_getImagePath("alert-success.svg").'">']];

        foreach ($notification_types as $type) {
            if ($notifications = get_option(WTSEC_PLUGIN_PREFIX.$type)) {
                if(is_array($notifications)) {
                    foreach ($notifications as $notification) {
                        $style = $styles[$type];
                        echo '<div class="wtotem_alert wt_card" id="wtotem_alert" style="margin-bottom:0">
            <div class="wtotem_alert__desc">
                <div class="wtotem_alert__img '.$style["class"].'">'.$style["img"].'</div>
                <div class="wtotem_alert__title wtotem_alert__title_'.$style["color"].'">'.strtoupper($type).':</div>
                <p class="wtotem_alert__text">'.$notification.'</p>
            </div>
            <div class="wtotem_alert__close" onclick="removeAlert()"></div>
        </div>';
                    }
                }
                self::deleteNotification($type);
            }
        }
    }

    protected static function deleteNotification($name){
        return delete_option(WTSEC_PLUGIN_PREFIX.$name);
    }

    public static function setNotification($type,$value){
        if($notifications = get_option(WTSEC_PLUGIN_PREFIX.$type)){
            $notifications[] = $value;
            update_option(WTSEC_PLUGIN_PREFIX.$type,$notifications);
        }else{
            update_option(WTSEC_PLUGIN_PREFIX.$type,[$value]);
        }
    }
}
```
