# boxzilla/trunk/src/admin/class-notices.php

Boxzilla – WordPress Popup Builder, version trunk. 51 lines.

- Page: https://pluginprobe.com/plugins/boxzilla/trunk/code/src/admin/class-notices.php
- Raw: https://pluginprobe.com/plugins/boxzilla/trunk/raw/src/admin/class-notices.php
- Modified: 2026-05-20T09:51:30+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/boxzilla/trunk/code/src/admin/class-notices.php#L10-L20`.

```php
<?php

namespace Boxzilla\Admin;

if (! defined('ABSPATH')) {
    exit;
}

class Notices
{
    /**
     * @var array
     */
    protected $notices = [];

    /**
     * Constructor
     */
    public function __construct()
    {
        add_action('admin_notices', [ $this, 'action_admin_notices' ], 10, 0);
    }

    /**
     * @param $message
     * @param $type
     *
     * @return $this
     */
    public function add($message, $type = 'updated')
    {
        $this->notices[] = [
            'message' => $message,
            'type'    => $type,
        ];

        return $this;
    }

    /**
     * Output the registered notices
     */
    public function admin_notices(): void
    {
        $allowed_html = [ 'strong' => [], 'em' => [], 'a' => [ 'href' => [] ] ];
        foreach ($this->notices as $notice) {
            echo "<div class=\"notice notice-", esc_attr($notice['type']), "><p>", wp_kses($notice['message'], $allowed_html), "</p></div>";
        }
    }
}

```
