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

Boxzilla – WordPress Popup Builder, version 3.2. 43 lines.

- Page: https://pluginprobe.com/plugins/boxzilla/3.2/code/src/admin/class-notices.php
- Raw: https://pluginprobe.com/plugins/boxzilla/3.2/raw/src/admin/class-notices.php
- Modified: 2017-07-13T12:34:48+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/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'] );
		}
	}
}

```
