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

Boxzilla – WordPress Popup Builder, version 3.2.21. 44 lines.

- Page: https://pluginprobe.com/plugins/boxzilla/3.2.21/code/src/admin/class-notices.php
- Raw: https://pluginprobe.com/plugins/boxzilla/3.2.21/raw/src/admin/class-notices.php
- Modified: 2019-11-15T10:39:14+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/3.2.21/code/src/admin/class-notices.php#L10-L20`.

```php
<?php

namespace Boxzilla\Admin;

class Notices {


	/**
	 * @var array
	 */
	protected $notices = array();

	/**
	 * Constructor
	 */
	public function __construct() {
		add_action( 'admin_notices', array( $this, 'show' ) );
	}

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

		return $this;
	}

	/**
	 * Output the registered notices
	 */
	public function show() {
		foreach ( $this->notices as $notice ) {
			echo sprintf( '<div class="notice notice-%s"><p>%s</p></div>', $notice['type'], $notice['message'] );
		}
	}
}

```
