PluginProbe
Boxzilla – WordPress Popup Builder / 3.2.6
Boxzilla – WordPress Popup Builder v3.2.6
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
boxzilla / src / admin / class-notices.php

class-notices.php in Boxzilla – WordPress Popup Builder 3.2.6, at src/admin/class-notices.php

43 lines 676 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Boxzilla\Admin;
4
5 class Notices {
6
7 /**
8 * @var array
9 */
10 protected $notices = array();
11
12 /**
13 * Constructor
14 */
15 public function __construct() {
16 add_action( 'admin_notices', array( $this, 'show' ) );
17 }
18
19 /**
20 * @param $message
21 * @param $type
22 *
23 * @return $this
24 */
25 public function add( $message, $type = 'updated' ) {
26 $this->notices[] = array(
27 'message' => $message,
28 'type' => $type,
29 );
30
31 return $this;
32 }
33
34 /**
35 * Output the registered notices
36 */
37 public function show() {
38 foreach( $this->notices as $notice ) {
39 echo sprintf( '<div class="notice notice-%s"><p>%s</p></div>', $notice['type'], $notice['message'] );
40 }
41 }
42 }
43