@@ -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>', |
@@ -64,7 +64,9 @@ |
||
| 64 | 64 | $offset = 0; |
| 65 | 65 | foreach($dismissed as $id) |
| 66 | 66 | { |
| 67 | - if( $id === $handle ) break; |
|
| 67 | + if( $id === $handle ) { |
|
| 68 | + break; |
|
| 69 | + } |
|
| 68 | 70 | $offset++; |
| 69 | 71 | } |
| 70 | 72 | array_splice( $dismissed, $offset, 1); |
@@ -11,7 +11,9 @@ |
||
| 11 | 11 | /** |
| 12 | 12 | * Prevent loading the library more than once |
| 13 | 13 | */ |
| 14 | -if( defined( 'AMARKAL_ADMIN_NOTIFICATION' ) ) return; |
|
| 14 | +if( defined( 'AMARKAL_ADMIN_NOTIFICATION' ) ) { |
|
| 15 | + return; |
|
| 16 | +} |
|
| 15 | 17 | define( 'AMARKAL_ADMIN_NOTIFICATION', true ); |
| 16 | 18 | |
| 17 | 19 | require_once 'functions.php'; |
@@ -11,7 +11,9 @@ |
||
| 11 | 11 | /** |
| 12 | 12 | * Prevent loading the library more than once |
| 13 | 13 | */ |
| 14 | -if( defined( 'AMARKAL_ADMIN_NOTIFICATION' ) ) return; |
|
| 14 | +if( defined( 'AMARKAL_ADMIN_NOTIFICATION' ) ) { |
|
| 15 | + return; |
|
| 16 | +} |
|
| 15 | 17 | define( 'AMARKAL_ADMIN_NOTIFICATION', true ); |
| 16 | 18 | |
| 17 | 19 | /** |