Completed
Pull Request — master (#6)
by
unknown
01:49
created
bootstrap.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@  discard block
 block discarded – undo
15 15
 /**
16 16
  * Prevent loading the library more than once
17 17
  */
18
-if( defined( 'WP_ADMIN_NOTIFICATION' ) ) return;
18
+if( defined( 'WP_ADMIN_NOTIFICATION' ) ) {
19
+    return;
20
+}
19 21
 define( 'WP_ADMIN_NOTIFICATION', true );
20 22
 
21 23
 /**
@@ -59,7 +61,9 @@  discard block
 block discarded – undo
59 61
         $offset = 0;
60 62
         foreach($dismissed as $id)
61 63
         {
62
-            if( $id === $handle ) break;
64
+            if( $id === $handle ) {
65
+                break;
66
+            }
63 67
             $offset++;
64 68
         }
65 69
         array_splice( $dismissed, $offset, 1);
Please login to merge, or discard this patch.
handler.php 1 patch
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
             add_action( 'wp_ajax_dismiss_admin_notification', array( $this, 'dismiss_notification' ) );
35 35
             add_action( 'admin_footer', array( $this, 'render_script' ) ); // Must be hooked to a late action hook
36 36
             $this->dismissed_notices = get_option('wp_dismissed_notices');
37
-            if( false === $this->dismissed_notices ) $this->dismissed_notices = array();
37
+            if( false === $this->dismissed_notices ) {
38
+                $this->dismissed_notices = array();
39
+            }
38 40
         }
39 41
         
40 42
         public function register_notification( $handle, $options )
@@ -42,8 +44,9 @@  discard block
 block discarded – undo
42 44
             if( !key_exists( $handle, $this->notifications ) )
43 45
             {
44 46
                 $this->notifications[$handle] = $options;
47
+            } else {
48
+                trigger_error( "The handle <strong>$handle</strong> has already been registered. Please choose a different handle for your notification." );
45 49
             }
46
-            else trigger_error( "The handle <strong>$handle</strong> has already been registered. Please choose a different handle for your notification." );
47 50
         }
48 51
         
49 52
         public function render_notifications()
@@ -58,7 +61,9 @@  discard block
 block discarded – undo
58 61
         {
59 62
             foreach( $this->notifications as $handle => $notification )
60 63
             {
61
-                if( $notification['network'] ) $this->render_notification( $handle, $notification );
64
+                if( $notification['network'] ) {
65
+                    $this->render_notification( $handle, $notification );
66
+                }
62 67
             }
63 68
         }
64 69
         
@@ -75,7 +80,9 @@  discard block
 block discarded – undo
75 80
         
76 81
         public function render_script()
77 82
         {
78
-            if( 0 === count( $this->notifications ) ) return;
83
+            if( 0 === count( $this->notifications ) ) {
84
+                return;
85
+            }
79 86
             ?>
80 87
             <script>
81 88
             jQuery(document).ready(function($){
@@ -92,7 +99,9 @@  discard block
 block discarded – undo
92 99
         
93 100
         private function render_notification( $id, $n )
94 101
         {
95
-            if( in_array( $id, $this->dismissed_notices ) ) return;
102
+            if( in_array( $id, $this->dismissed_notices ) ) {
103
+                return;
104
+            }
96 105
             
97 106
             printf( 
98 107
                 '<div id="%s" class="notice notice-%s %s%s"><p>%s</p></div>',
Please login to merge, or discard this patch.