@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | if( !key_exists( $handle, $this->notifications ) ) |
42 | 42 | { |
43 | 43 | $this->notifications[$handle] = $options; |
44 | + } else { |
|
45 | + trigger_error( "The handle <strong>$handle</strong> has already been registered. Please choose a different handle for your notification." ); |
|
44 | 46 | } |
45 | - else trigger_error( "The handle <strong>$handle</strong> has already been registered. Please choose a different handle for your notification." ); |
|
46 | 47 | } |
47 | 48 | |
48 | 49 | public function render_notifications() |
@@ -57,7 +58,9 @@ discard block |
||
57 | 58 | { |
58 | 59 | foreach( $this->notifications as $handle => $notification ) |
59 | 60 | { |
60 | - if( $notification['network'] ) $this->render_notification( $handle, $notification ); |
|
61 | + if( $notification['network'] ) { |
|
62 | + $this->render_notification( $handle, $notification ); |
|
63 | + } |
|
61 | 64 | } |
62 | 65 | } |
63 | 66 | |
@@ -74,7 +77,9 @@ discard block |
||
74 | 77 | |
75 | 78 | public function render_script() |
76 | 79 | { |
77 | - if( 0 === count( $this->notifications ) ) return; |
|
80 | + if( 0 === count( $this->notifications ) ) { |
|
81 | + return; |
|
82 | + } |
|
78 | 83 | ?> |
79 | 84 | <script> |
80 | 85 | jQuery(document).ready(function($){ |
@@ -91,7 +96,9 @@ discard block |
||
91 | 96 | |
92 | 97 | private function render_notification( $id, $n ) |
93 | 98 | { |
94 | - if( in_array( $id, $this->dismissed_notices ) ) return; |
|
99 | + if( in_array( $id, $this->dismissed_notices ) ) { |
|
100 | + return; |
|
101 | + } |
|
95 | 102 | |
96 | 103 | printf( |
97 | 104 | '<div id="%s" class="notice notice-%s %s%s"><p>%s</p></div>', |