Passed
Push — master ( d39dbf...c19bc8 )
by Brian
04:33
created
includes/admin/class-getpaid-admin.php 2 patches
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -14,62 +14,62 @@  discard block
 block discarded – undo
14 14
 class GetPaid_Admin {
15 15
 
16 16
     /**
17
-	 * Local path to this plugins admin directory
18
-	 *
19
-	 * @var         string
20
-	 */
21
-	public $admin_path;
22
-
23
-	/**
24
-	 * Web path to this plugins admin directory
25
-	 *
26
-	 * @var         string
27
-	 */
17
+     * Local path to this plugins admin directory
18
+     *
19
+     * @var         string
20
+     */
21
+    public $admin_path;
22
+
23
+    /**
24
+     * Web path to this plugins admin directory
25
+     *
26
+     * @var         string
27
+     */
28 28
     public $admin_url;
29 29
 
30 30
     /**
31
-	 * Class constructor.
32
-	 */
33
-	public function __construct(){
31
+     * Class constructor.
32
+     */
33
+    public function __construct(){
34 34
 
35 35
         $this->admin_path  = plugin_dir_path( __FILE__ );
36 36
         $this->admin_url   = plugins_url( '/', __FILE__ );
37 37
 
38 38
         if ( is_admin() ) {
39
-			$this->init_admin_hooks();
39
+            $this->init_admin_hooks();
40 40
         }
41 41
 
42 42
     }
43 43
 
44 44
     /**
45
-	 * Init action and filter hooks
46
-	 *
47
-	 */
48
-	private function init_admin_hooks() {
45
+     * Init action and filter hooks
46
+     *
47
+     */
48
+    private function init_admin_hooks() {
49 49
         add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) );
50 50
         add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
51 51
         add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) );
52 52
         add_action( 'admin_init', array( $this, 'activation_redirect') );
53 53
         add_action( 'admin_init', array( $this, 'maybe_do_admin_action') );
54
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
55
-		add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
56
-		add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
57
-		do_action( 'getpaid_init_admin_hooks', $this );
54
+        add_action( 'admin_notices', array( $this, 'show_notices' ) );
55
+        add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
56
+        add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
57
+        do_action( 'getpaid_init_admin_hooks', $this );
58 58
 
59 59
     }
60 60
 
61 61
     /**
62
-	 * Register admin scripts
63
-	 *
64
-	 */
65
-	public function enqeue_scripts() {
62
+     * Register admin scripts
63
+     *
64
+     */
65
+    public function enqeue_scripts() {
66 66
         global $current_screen, $pagenow;
67 67
 
68
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
69
-		$editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
68
+        $page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
69
+        $editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
70 70
 
71 71
         if ( ! empty( $current_screen->post_type ) ) {
72
-			$page = $current_screen->post_type;
72
+            $page = $current_screen->post_type;
73 73
         }
74 74
 
75 75
         // General styles.
@@ -93,30 +93,30 @@  discard block
 block discarded – undo
93 93
         }
94 94
 
95 95
         // Payment form scripts.
96
-		if ( 'wpi_payment_form' == $page && $editing ) {
96
+        if ( 'wpi_payment_form' == $page && $editing ) {
97 97
             $this->load_payment_form_scripts();
98 98
         }
99 99
 
100 100
         if ( $page == 'wpinv-subscriptions' ) {
101
-			wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
102
-			wp_enqueue_script( 'wpinv-sub-admin-script' );
103
-		}
101
+            wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
102
+            wp_enqueue_script( 'wpinv-sub-admin-script' );
103
+        }
104 104
 
105
-		if ( $page == 'wpinv-reports' ) {
106
-			wp_enqueue_script( 'jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array( 'jquery' ), '0.7' );
107
-		}
105
+        if ( $page == 'wpinv-reports' ) {
106
+            wp_enqueue_script( 'jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array( 'jquery' ), '0.7' );
107
+        }
108 108
 
109
-		if ( $page == 'wpinv-subscriptions' ) {
110
-			wp_enqueue_script( 'postbox' );
111
-		}
109
+        if ( $page == 'wpinv-subscriptions' ) {
110
+            wp_enqueue_script( 'postbox' );
111
+        }
112 112
 
113 113
     }
114 114
 
115 115
     /**
116
-	 * Returns admin js translations.
117
-	 *
118
-	 */
119
-	protected function get_admin_i18() {
116
+     * Returns admin js translations.
117
+     *
118
+     */
119
+    protected function get_admin_i18() {
120 120
         global $post;
121 121
 
122 122
         return array(
@@ -157,33 +157,33 @@  discard block
 block discarded – undo
157 157
     }
158 158
 
159 159
     /**
160
-	 * Loads payment form js.
161
-	 *
162
-	 */
163
-	protected function load_payment_form_scripts() {
160
+     * Loads payment form js.
161
+     *
162
+     */
163
+    protected function load_payment_form_scripts() {
164 164
         global $post;
165 165
 
166 166
         wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.min.js', array(), WPINV_VERSION );
167
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
168
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
167
+        wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
168
+        wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
169 169
 
170
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
171
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
170
+        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
171
+        wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
172 172
 
173
-		wp_localize_script(
173
+        wp_localize_script(
174 174
             'wpinv-admin-payment-form-script',
175 175
             'wpinvPaymentFormAdmin',
176 176
             array(
177
-				'elements'      => getpaid()->form_elements->get_elements(),
178
-				'form_elements' => getpaid()->form_elements->get_form_elements( $post->ID ),
179
-				'all_items'     => getpaid()->form_elements->get_published_items(),
180
-				'currency'      => wpinv_currency_symbol(),
181
-				'position'      => wpinv_currency_position(),
182
-				'decimals'      => (int) wpinv_decimals(),
183
-				'thousands_sep' => wpinv_thousands_separator(),
184
-				'decimals_sep'  => wpinv_decimal_separator(),
185
-				'form_items'    => getpaid()->form_elements->get_form_items( $post->ID ),
186
-				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
177
+                'elements'      => getpaid()->form_elements->get_elements(),
178
+                'form_elements' => getpaid()->form_elements->get_form_elements( $post->ID ),
179
+                'all_items'     => getpaid()->form_elements->get_published_items(),
180
+                'currency'      => wpinv_currency_symbol(),
181
+                'position'      => wpinv_currency_position(),
182
+                'decimals'      => (int) wpinv_decimals(),
183
+                'thousands_sep' => wpinv_thousands_separator(),
184
+                'decimals_sep'  => wpinv_decimal_separator(),
185
+                'form_items'    => getpaid()->form_elements->get_form_items( $post->ID ),
186
+                'is_default'    => $post->ID == wpinv_get_default_payment_form(),
187 187
             )
188 188
         );
189 189
 
@@ -192,20 +192,20 @@  discard block
 block discarded – undo
192 192
     }
193 193
 
194 194
     /**
195
-	 * Add our classes to admin pages.
195
+     * Add our classes to admin pages.
196 196
      *
197 197
      * @param string $classes
198 198
      * @return string
199
-	 *
200
-	 */
199
+     *
200
+     */
201 201
     public function admin_body_class( $classes ) {
202
-		global $pagenow, $post, $current_screen;
202
+        global $pagenow, $post, $current_screen;
203 203
 
204 204
 
205 205
         $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
206 206
 
207 207
         if ( ! empty( $current_screen->post_type ) ) {
208
-			$page = $current_screen->post_type;
208
+            $page = $current_screen->post_type;
209 209
         }
210 210
 
211 211
         if ( false !== stripos( $page, 'wpi' ) ) {
@@ -216,27 +216,27 @@  discard block
 block discarded – undo
216 216
             $classes .= ' wpinv-cpt wpinv';
217 217
         }
218 218
 
219
-		if ( $pagenow == 'post.php' && $page == 'wpi_item' && ! empty( $post ) && ! wpinv_item_is_editable( $post ) ) {
220
-			$classes .= ' wpi-editable-n';
221
-		}
219
+        if ( $pagenow == 'post.php' && $page == 'wpi_item' && ! empty( $post ) && ! wpinv_item_is_editable( $post ) ) {
220
+            $classes .= ' wpi-editable-n';
221
+        }
222 222
 
223
-		return $classes;
223
+        return $classes;
224 224
     }
225 225
 
226 226
     /**
227
-	 * Maybe show the AyeCode Connect Notice.
228
-	 */
229
-	public function init_ayecode_connect_helper(){
227
+     * Maybe show the AyeCode Connect Notice.
228
+     */
229
+    public function init_ayecode_connect_helper(){
230 230
 
231 231
         new AyeCode_Connect_Helper(
232 232
             array(
233
-				'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
234
-				'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
235
-				'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
236
-				'connect_button'    => __("Connect Site","invoicing"),
237
-				'connecting_button'    => __("Connecting...","invoicing"),
238
-				'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
239
-				'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
233
+                'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
234
+                'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
235
+                'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
236
+                'connect_button'    => __("Connect Site","invoicing"),
237
+                'connecting_button'    => __("Connecting...","invoicing"),
238
+                'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
239
+                'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
240 240
             ),
241 241
             array( 'wpi-addons' )
242 242
         );
@@ -248,21 +248,21 @@  discard block
 block discarded – undo
248 248
      */
249 249
     public function activation_redirect() {
250 250
 
251
-		// Bail if no activation redirect.
252
-		if ( ! get_transient( '_wpinv_activation_redirect' ) || wp_doing_ajax() ) {
253
-			return;
254
-		}
251
+        // Bail if no activation redirect.
252
+        if ( ! get_transient( '_wpinv_activation_redirect' ) || wp_doing_ajax() ) {
253
+            return;
254
+        }
255 255
 
256
-		// Delete the redirect transient.
257
-		delete_transient( '_wpinv_activation_redirect' );
256
+        // Delete the redirect transient.
257
+        delete_transient( '_wpinv_activation_redirect' );
258 258
 
259
-		// Bail if activating from network, or bulk
260
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
261
-			return;
262
-		}
259
+        // Bail if activating from network, or bulk
260
+        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
261
+            return;
262
+        }
263 263
 
264
-		wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
265
-		exit;
264
+        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
265
+        exit;
266 266
     }
267 267
 
268 268
     /**
@@ -277,150 +277,150 @@  discard block
 block discarded – undo
277 277
 
278 278
     }
279 279
 
280
-	/**
280
+    /**
281 281
      * Sends a payment reminder to a customer.
282
-	 * 
283
-	 * @param array $args
282
+     * 
283
+     * @param array $args
284 284
      */
285 285
     public function send_customer_invoice( $args ) {
286
-		$sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ) );
286
+        $sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ) );
287 287
 
288
-		if ( $sent ) {
289
-			$this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
290
-		} else {
291
-			$this->show_error( __( 'Could not sent the invoice to the customer', 'invoicing' ) );
292
-		}
288
+        if ( $sent ) {
289
+            $this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
290
+        } else {
291
+            $this->show_error( __( 'Could not sent the invoice to the customer', 'invoicing' ) );
292
+        }
293 293
 
294
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
295
-		exit;
296
-	}
294
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
295
+        exit;
296
+    }
297 297
 
298
-	/**
298
+    /**
299 299
      * Sends a payment reminder to a customer.
300
-	 * 
301
-	 * @param array $args
300
+     * 
301
+     * @param array $args
302 302
      */
303 303
     public function send_customer_payment_reminder( $args ) {
304
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
304
+        $sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
305 305
 
306
-		if ( $sent ) {
307
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
308
-		} else {
309
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
310
-		}
306
+        if ( $sent ) {
307
+            $this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
308
+        } else {
309
+            $this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
310
+        }
311 311
 
312
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
313
-		exit;
314
-	}
312
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
313
+        exit;
314
+    }
315 315
 
316 316
     /**
317
-	 * Returns an array of admin notices.
318
-	 *
319
-	 * @since       1.0.19
317
+     * Returns an array of admin notices.
318
+     *
319
+     * @since       1.0.19
320 320
      * @return array
321
-	 */
322
-	public function get_notices() {
323
-		$notices = get_option( 'wpinv_admin_notices' );
321
+     */
322
+    public function get_notices() {
323
+        $notices = get_option( 'wpinv_admin_notices' );
324 324
         return is_array( $notices ) ? $notices : array();
325
-	}
326
-
327
-	/**
328
-	 * Clears all admin notices
329
-	 *
330
-	 * @access      public
331
-	 * @since       1.0.19
332
-	 */
333
-	public function clear_notices() {
334
-		delete_option( 'wpinv_admin_notices' );
335
-	}
336
-
337
-	/**
338
-	 * Saves a new admin notice
339
-	 *
340
-	 * @access      public
341
-	 * @since       1.0.19
342
-	 */
343
-	public function save_notice( $type, $message ) {
344
-		$notices = $this->get_notices();
345
-
346
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
347
-			$notices[ $type ] = array();
348
-		}
349
-
350
-		$notices[ $type ][] = $message;
351
-
352
-		update_option( 'wpinv_admin_notices', $notices );
353
-	}
354
-
355
-	/**
356
-	 * Displays a success notice
357
-	 *
358
-	 * @param       string $msg The message to qeue.
359
-	 * @access      public
360
-	 * @since       1.0.19
361
-	 */
362
-	public function show_success( $msg ) {
363
-		$this->save_notice( 'success', $msg );
364
-	}
365
-
366
-	/**
367
-	 * Displays a error notice
368
-	 *
369
-	 * @access      public
370
-	 * @param       string $msg The message to qeue.
371
-	 * @since       1.0.19
372
-	 */
373
-	public function show_error( $msg ) {
374
-		$this->save_notice( 'error', $msg );
375
-	}
376
-
377
-	/**
378
-	 * Displays a warning notice
379
-	 *
380
-	 * @access      public
381
-	 * @param       string $msg The message to qeue.
382
-	 * @since       1.0.19
383
-	 */
384
-	public function show_warning( $msg ) {
385
-		$this->save_notice( 'warning', $msg );
386
-	}
387
-
388
-	/**
389
-	 * Displays a info notice
390
-	 *
391
-	 * @access      public
392
-	 * @param       string $msg The message to qeue.
393
-	 * @since       1.0.19
394
-	 */
395
-	public function show_info( $msg ) {
396
-		$this->save_notice( 'info', $msg );
397
-	}
398
-
399
-	/**
400
-	 * Show notices
401
-	 *
402
-	 * @access      public
403
-	 * @since       1.0.19
404
-	 */
405
-	public function show_notices() {
325
+    }
326
+
327
+    /**
328
+     * Clears all admin notices
329
+     *
330
+     * @access      public
331
+     * @since       1.0.19
332
+     */
333
+    public function clear_notices() {
334
+        delete_option( 'wpinv_admin_notices' );
335
+    }
336
+
337
+    /**
338
+     * Saves a new admin notice
339
+     *
340
+     * @access      public
341
+     * @since       1.0.19
342
+     */
343
+    public function save_notice( $type, $message ) {
344
+        $notices = $this->get_notices();
345
+
346
+        if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
347
+            $notices[ $type ] = array();
348
+        }
349
+
350
+        $notices[ $type ][] = $message;
351
+
352
+        update_option( 'wpinv_admin_notices', $notices );
353
+    }
354
+
355
+    /**
356
+     * Displays a success notice
357
+     *
358
+     * @param       string $msg The message to qeue.
359
+     * @access      public
360
+     * @since       1.0.19
361
+     */
362
+    public function show_success( $msg ) {
363
+        $this->save_notice( 'success', $msg );
364
+    }
365
+
366
+    /**
367
+     * Displays a error notice
368
+     *
369
+     * @access      public
370
+     * @param       string $msg The message to qeue.
371
+     * @since       1.0.19
372
+     */
373
+    public function show_error( $msg ) {
374
+        $this->save_notice( 'error', $msg );
375
+    }
376
+
377
+    /**
378
+     * Displays a warning notice
379
+     *
380
+     * @access      public
381
+     * @param       string $msg The message to qeue.
382
+     * @since       1.0.19
383
+     */
384
+    public function show_warning( $msg ) {
385
+        $this->save_notice( 'warning', $msg );
386
+    }
387
+
388
+    /**
389
+     * Displays a info notice
390
+     *
391
+     * @access      public
392
+     * @param       string $msg The message to qeue.
393
+     * @since       1.0.19
394
+     */
395
+    public function show_info( $msg ) {
396
+        $this->save_notice( 'info', $msg );
397
+    }
398
+
399
+    /**
400
+     * Show notices
401
+     *
402
+     * @access      public
403
+     * @since       1.0.19
404
+     */
405
+    public function show_notices() {
406 406
 
407 407
         $notices = $this->get_notices();
408 408
         $this->clear_notices();
409 409
 
410
-		foreach ( $notices as $type => $messages ) {
410
+        foreach ( $notices as $type => $messages ) {
411 411
 
412
-			if ( ! is_array( $messages ) ) {
413
-				continue;
414
-			}
412
+            if ( ! is_array( $messages ) ) {
413
+                continue;
414
+            }
415 415
 
416 416
             $type  = sanitize_key( $type );
417
-			foreach ( $messages as $message ) {
417
+            foreach ( $messages as $message ) {
418 418
                 $message = wp_kses_post( $message );
419
-				echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
419
+                echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
420 420
             }
421 421
 
422 422
         }
423 423
 
424
-	}
424
+    }
425 425
 
426 426
 }
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * The main admin class.
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
     /**
31 31
 	 * Class constructor.
32 32
 	 */
33
-	public function __construct(){
33
+	public function __construct() {
34 34
 
35
-        $this->admin_path  = plugin_dir_path( __FILE__ );
36
-        $this->admin_url   = plugins_url( '/', __FILE__ );
35
+        $this->admin_path  = plugin_dir_path(__FILE__);
36
+        $this->admin_url   = plugins_url('/', __FILE__);
37 37
 
38
-        if ( is_admin() ) {
38
+        if (is_admin()) {
39 39
 			$this->init_admin_hooks();
40 40
         }
41 41
 
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 */
48 48
 	private function init_admin_hooks() {
49
-        add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) );
50
-        add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
51
-        add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) );
52
-        add_action( 'admin_init', array( $this, 'activation_redirect') );
53
-        add_action( 'admin_init', array( $this, 'maybe_do_admin_action') );
54
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
55
-		add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
56
-		add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
57
-		do_action( 'getpaid_init_admin_hooks', $this );
49
+        add_action('admin_enqueue_scripts', array($this, 'enqeue_scripts'));
50
+        add_filter('admin_body_class', array($this, 'admin_body_class'));
51
+        add_action('admin_init', array($this, 'init_ayecode_connect_helper'));
52
+        add_action('admin_init', array($this, 'activation_redirect'));
53
+        add_action('admin_init', array($this, 'maybe_do_admin_action'));
54
+		add_action('admin_notices', array($this, 'show_notices'));
55
+		add_action('getpaid_authenticated_admin_action_send_invoice', array($this, 'send_customer_invoice'));
56
+		add_action('getpaid_authenticated_admin_action_send_invoice_reminder', array($this, 'send_customer_payment_reminder'));
57
+		do_action('getpaid_init_admin_hooks', $this);
58 58
 
59 59
     }
60 60
 
@@ -65,49 +65,49 @@  discard block
 block discarded – undo
65 65
 	public function enqeue_scripts() {
66 66
         global $current_screen, $pagenow;
67 67
 
68
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
68
+		$page    = isset($_GET['page']) ? $_GET['page'] : '';
69 69
 		$editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
70 70
 
71
-        if ( ! empty( $current_screen->post_type ) ) {
71
+        if (!empty($current_screen->post_type)) {
72 72
 			$page = $current_screen->post_type;
73 73
         }
74 74
 
75 75
         // General styles.
76
-        if ( false !== stripos( $page, 'wpi' ) ) {
76
+        if (false !== stripos($page, 'wpi')) {
77 77
 
78 78
             // Styles.
79
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
80
-            wp_enqueue_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array( 'wp-color-picker' ), $version );
81
-            wp_enqueue_style( 'select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all' );
82
-            wp_enqueue_style( 'wp_enqueue_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
83
-            wp_enqueue_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui.min.css', array(), '1.8.16' );
79
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
80
+            wp_enqueue_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array('wp-color-picker'), $version);
81
+            wp_enqueue_style('select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all');
82
+            wp_enqueue_style('wp_enqueue_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
83
+            wp_enqueue_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui.min.css', array(), '1.8.16');
84 84
 
85 85
             // Scripts.
86
-            wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '4.0.13', true );
87
-            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array( 'jquery' ), WPINV_VERSION );
86
+            wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '4.0.13', true);
87
+            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array('jquery'), WPINV_VERSION);
88 88
 
89
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' );
90
-            wp_enqueue_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip', 'wp-color-picker', 'jquery-ui-datepicker' ),  $version );
91
-            wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', apply_filters( 'wpinv_admin_js_localize', $this->get_admin_i18() ) );
89
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js');
90
+            wp_enqueue_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip', 'wp-color-picker', 'jquery-ui-datepicker'), $version);
91
+            wp_localize_script('wpinv-admin-script', 'WPInv_Admin', apply_filters('wpinv_admin_js_localize', $this->get_admin_i18()));
92 92
 
93 93
         }
94 94
 
95 95
         // Payment form scripts.
96
-		if ( 'wpi_payment_form' == $page && $editing ) {
96
+		if ('wpi_payment_form' == $page && $editing) {
97 97
             $this->load_payment_form_scripts();
98 98
         }
99 99
 
100
-        if ( $page == 'wpinv-subscriptions' ) {
101
-			wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
102
-			wp_enqueue_script( 'wpinv-sub-admin-script' );
100
+        if ($page == 'wpinv-subscriptions') {
101
+			wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array('wpinv-admin-script'), WPINV_VERSION);
102
+			wp_enqueue_script('wpinv-sub-admin-script');
103 103
 		}
104 104
 
105
-		if ( $page == 'wpinv-reports' ) {
106
-			wp_enqueue_script( 'jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array( 'jquery' ), '0.7' );
105
+		if ($page == 'wpinv-reports') {
106
+			wp_enqueue_script('jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array('jquery'), '0.7');
107 107
 		}
108 108
 
109
-		if ( $page == 'wpinv-subscriptions' ) {
110
-			wp_enqueue_script( 'postbox' );
109
+		if ($page == 'wpinv-subscriptions') {
110
+			wp_enqueue_script('postbox');
111 111
 		}
112 112
 
113 113
     }
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
         global $post;
121 121
 
122 122
         return array(
123
-            'ajax_url'                  => admin_url( 'admin-ajax.php' ),
124
-            'post_ID'                   => isset( $post->ID ) ? $post->ID : '',
125
-            'wpinv_nonce'               => wp_create_nonce( 'wpinv-nonce' ),
126
-            'add_invoice_note_nonce'    => wp_create_nonce( 'add-invoice-note' ),
127
-            'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ),
128
-            'invoice_item_nonce'        => wp_create_nonce( 'invoice-item' ),
129
-            'billing_details_nonce'     => wp_create_nonce( 'get-billing-details' ),
123
+            'ajax_url'                  => admin_url('admin-ajax.php'),
124
+            'post_ID'                   => isset($post->ID) ? $post->ID : '',
125
+            'wpinv_nonce'               => wp_create_nonce('wpinv-nonce'),
126
+            'add_invoice_note_nonce'    => wp_create_nonce('add-invoice-note'),
127
+            'delete_invoice_note_nonce' => wp_create_nonce('delete-invoice-note'),
128
+            'invoice_item_nonce'        => wp_create_nonce('invoice-item'),
129
+            'billing_details_nonce'     => wp_create_nonce('get-billing-details'),
130 130
             'tax'                       => wpinv_tax_amount(),
131 131
             'discount'                  => wpinv_discount_amount(),
132 132
             'currency_symbol'           => wpinv_currency_symbol(),
@@ -134,24 +134,24 @@  discard block
 block discarded – undo
134 134
             'thousand_sep'              => wpinv_thousands_separator(),
135 135
             'decimal_sep'               => wpinv_decimal_separator(),
136 136
             'decimals'                  => wpinv_decimals(),
137
-            'save_invoice'              => __( 'Save Invoice', 'invoicing' ),
138
-            'status_publish'            => wpinv_status_nicename( 'publish' ),
139
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
140
-            'delete_tax_rate'           => __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ),
141
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
142
-            'OneItemMin'                => __( 'Invoice must contain at least one item', 'invoicing' ),
143
-            'FillBillingDetails'        => __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ),
144
-            'confirmCalcTotals'         => __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' ),
145
-            'AreYouSure'                => __( 'Are you sure?', 'invoicing' ),
146
-            'emptyInvoice'              => __( 'Add at least one item to save invoice!', 'invoicing' ),
147
-            'errDeleteItem'             => __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ),
148
-            'delete_subscription'       => __( 'Are you sure you want to delete this subscription?', 'invoicing' ),
149
-            'action_edit'               => __( 'Edit', 'invoicing' ),
150
-            'action_cancel'             => __( 'Cancel', 'invoicing' ),
151
-            'item_description'          => __( 'Item Description', 'invoicing' ),
152
-            'invoice_description'       => __( 'Invoice Description', 'invoicing' ),
153
-            'discount_description'      => __( 'Discount Description', 'invoicing' ),
154
-            'searching'                 => __( 'Searching', 'invoicing' ),
137
+            'save_invoice'              => __('Save Invoice', 'invoicing'),
138
+            'status_publish'            => wpinv_status_nicename('publish'),
139
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
140
+            'delete_tax_rate'           => __('Are you sure you wish to delete this tax rate?', 'invoicing'),
141
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
142
+            'OneItemMin'                => __('Invoice must contain at least one item', 'invoicing'),
143
+            'FillBillingDetails'        => __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'),
144
+            'confirmCalcTotals'         => __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing'),
145
+            'AreYouSure'                => __('Are you sure?', 'invoicing'),
146
+            'emptyInvoice'              => __('Add at least one item to save invoice!', 'invoicing'),
147
+            'errDeleteItem'             => __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'),
148
+            'delete_subscription'       => __('Are you sure you want to delete this subscription?', 'invoicing'),
149
+            'action_edit'               => __('Edit', 'invoicing'),
150
+            'action_cancel'             => __('Cancel', 'invoicing'),
151
+            'item_description'          => __('Item Description', 'invoicing'),
152
+            'invoice_description'       => __('Invoice Description', 'invoicing'),
153
+            'discount_description'      => __('Discount Description', 'invoicing'),
154
+            'searching'                 => __('Searching', 'invoicing'),
155 155
         );
156 156
 
157 157
     }
@@ -163,31 +163,31 @@  discard block
 block discarded – undo
163 163
 	protected function load_payment_form_scripts() {
164 164
         global $post;
165 165
 
166
-        wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.min.js', array(), WPINV_VERSION );
167
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
168
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
166
+        wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.min.js', array(), WPINV_VERSION);
167
+		wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
168
+		wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
169 169
 
170
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
171
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
170
+		$version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
171
+		wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
172 172
 
173 173
 		wp_localize_script(
174 174
             'wpinv-admin-payment-form-script',
175 175
             'wpinvPaymentFormAdmin',
176 176
             array(
177 177
 				'elements'      => getpaid()->form_elements->get_elements(),
178
-				'form_elements' => getpaid()->form_elements->get_form_elements( $post->ID ),
178
+				'form_elements' => getpaid()->form_elements->get_form_elements($post->ID),
179 179
 				'all_items'     => getpaid()->form_elements->get_published_items(),
180 180
 				'currency'      => wpinv_currency_symbol(),
181 181
 				'position'      => wpinv_currency_position(),
182 182
 				'decimals'      => (int) wpinv_decimals(),
183 183
 				'thousands_sep' => wpinv_thousands_separator(),
184 184
 				'decimals_sep'  => wpinv_decimal_separator(),
185
-				'form_items'    => getpaid()->form_elements->get_form_items( $post->ID ),
185
+				'form_items'    => getpaid()->form_elements->get_form_items($post->ID),
186 186
 				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
187 187
             )
188 188
         );
189 189
 
190
-        wp_enqueue_script( 'wpinv-admin-payment-form-script' );
190
+        wp_enqueue_script('wpinv-admin-payment-form-script');
191 191
 
192 192
     }
193 193
 
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
      * @return string
199 199
 	 *
200 200
 	 */
201
-    public function admin_body_class( $classes ) {
201
+    public function admin_body_class($classes) {
202 202
 		global $pagenow, $post, $current_screen;
203 203
 
204 204
 
205
-        $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
205
+        $page = isset($_GET['page']) ? $_GET['page'] : '';
206 206
 
207
-        if ( ! empty( $current_screen->post_type ) ) {
207
+        if (!empty($current_screen->post_type)) {
208 208
 			$page = $current_screen->post_type;
209 209
         }
210 210
 
211
-        if ( false !== stripos( $page, 'wpi' ) ) {
212
-            $classes .= ' wpi-' . sanitize_key( $page );
211
+        if (false !== stripos($page, 'wpi')) {
212
+            $classes .= ' wpi-' . sanitize_key($page);
213 213
         }
214 214
 
215
-        if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) {
215
+        if (in_array($page, wpinv_parse_list('wpi_invoice wpi_payment_form wpi_quote'))) {
216 216
             $classes .= ' wpinv-cpt wpinv';
217 217
         }
218 218
 
219
-		if ( $pagenow == 'post.php' && $page == 'wpi_item' && ! empty( $post ) && ! wpinv_item_is_editable( $post ) ) {
219
+		if ($pagenow == 'post.php' && $page == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
220 220
 			$classes .= ' wpi-editable-n';
221 221
 		}
222 222
 
@@ -226,19 +226,19 @@  discard block
 block discarded – undo
226 226
     /**
227 227
 	 * Maybe show the AyeCode Connect Notice.
228 228
 	 */
229
-	public function init_ayecode_connect_helper(){
229
+	public function init_ayecode_connect_helper() {
230 230
 
231 231
         new AyeCode_Connect_Helper(
232 232
             array(
233
-				'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
234
-				'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
235
-				'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
236
-				'connect_button'    => __("Connect Site","invoicing"),
237
-				'connecting_button'    => __("Connecting...","invoicing"),
238
-				'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
239
-				'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
233
+				'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
234
+				'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
235
+				'connect'           => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"),
236
+				'connect_button'    => __("Connect Site", "invoicing"),
237
+				'connecting_button'    => __("Connecting...", "invoicing"),
238
+				'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
239
+				'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
240 240
             ),
241
-            array( 'wpi-addons' )
241
+            array('wpi-addons')
242 242
         );
243 243
 
244 244
     }
@@ -249,19 +249,19 @@  discard block
 block discarded – undo
249 249
     public function activation_redirect() {
250 250
 
251 251
 		// Bail if no activation redirect.
252
-		if ( ! get_transient( '_wpinv_activation_redirect' ) || wp_doing_ajax() ) {
252
+		if (!get_transient('_wpinv_activation_redirect') || wp_doing_ajax()) {
253 253
 			return;
254 254
 		}
255 255
 
256 256
 		// Delete the redirect transient.
257
-		delete_transient( '_wpinv_activation_redirect' );
257
+		delete_transient('_wpinv_activation_redirect');
258 258
 
259 259
 		// Bail if activating from network, or bulk
260
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
260
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
261 261
 			return;
262 262
 		}
263 263
 
264
-		wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
264
+		wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
265 265
 		exit;
266 266
     }
267 267
 
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
      */
271 271
     public function maybe_do_admin_action() {
272 272
 
273
-        if ( wpinv_current_user_can_manage_invoicing() && isset( $_REQUEST['getpaid-admin-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
274
-            $key = sanitize_key( $_REQUEST['getpaid-admin-action'] );
275
-            do_action( "getpaid_authenticated_admin_action_$key", $_REQUEST );
273
+        if (wpinv_current_user_can_manage_invoicing() && isset($_REQUEST['getpaid-admin-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) {
274
+            $key = sanitize_key($_REQUEST['getpaid-admin-action']);
275
+            do_action("getpaid_authenticated_admin_action_$key", $_REQUEST);
276 276
         }
277 277
 
278 278
     }
@@ -282,16 +282,16 @@  discard block
 block discarded – undo
282 282
 	 * 
283 283
 	 * @param array $args
284 284
      */
285
-    public function send_customer_invoice( $args ) {
286
-		$sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ) );
285
+    public function send_customer_invoice($args) {
286
+		$sent = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($args['invoice_id']));
287 287
 
288
-		if ( $sent ) {
289
-			$this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
288
+		if ($sent) {
289
+			$this->show_success(__('Invoice was successfully sent to the customer', 'invoicing'));
290 290
 		} else {
291
-			$this->show_error( __( 'Could not sent the invoice to the customer', 'invoicing' ) );
291
+			$this->show_error(__('Could not sent the invoice to the customer', 'invoicing'));
292 292
 		}
293 293
 
294
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
294
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
295 295
 		exit;
296 296
 	}
297 297
 
@@ -300,16 +300,16 @@  discard block
 block discarded – undo
300 300
 	 * 
301 301
 	 * @param array $args
302 302
      */
303
-    public function send_customer_payment_reminder( $args ) {
304
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
303
+    public function send_customer_payment_reminder($args) {
304
+		$sent = getpaid()->get('invoice_emails')->force_send_overdue_notice(new WPInv_Invoice($args['invoice_id']));
305 305
 
306
-		if ( $sent ) {
307
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
306
+		if ($sent) {
307
+			$this->show_success(__('Payment reminder was successfully sent to the customer', 'invoicing'));
308 308
 		} else {
309
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
309
+			$this->show_error(__('Could not sent payment reminder to the customer', 'invoicing'));
310 310
 		}
311 311
 
312
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
312
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
313 313
 		exit;
314 314
 	}
315 315
 
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
      * @return array
321 321
 	 */
322 322
 	public function get_notices() {
323
-		$notices = get_option( 'wpinv_admin_notices' );
324
-        return is_array( $notices ) ? $notices : array();
323
+		$notices = get_option('wpinv_admin_notices');
324
+        return is_array($notices) ? $notices : array();
325 325
 	}
326 326
 
327 327
 	/**
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 * @since       1.0.19
332 332
 	 */
333 333
 	public function clear_notices() {
334
-		delete_option( 'wpinv_admin_notices' );
334
+		delete_option('wpinv_admin_notices');
335 335
 	}
336 336
 
337 337
 	/**
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
 	 * @access      public
341 341
 	 * @since       1.0.19
342 342
 	 */
343
-	public function save_notice( $type, $message ) {
343
+	public function save_notice($type, $message) {
344 344
 		$notices = $this->get_notices();
345 345
 
346
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
347
-			$notices[ $type ] = array();
346
+		if (empty($notices[$type]) || !is_array($notices[$type])) {
347
+			$notices[$type] = array();
348 348
 		}
349 349
 
350
-		$notices[ $type ][] = $message;
350
+		$notices[$type][] = $message;
351 351
 
352
-		update_option( 'wpinv_admin_notices', $notices );
352
+		update_option('wpinv_admin_notices', $notices);
353 353
 	}
354 354
 
355 355
 	/**
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
 	 * @access      public
360 360
 	 * @since       1.0.19
361 361
 	 */
362
-	public function show_success( $msg ) {
363
-		$this->save_notice( 'success', $msg );
362
+	public function show_success($msg) {
363
+		$this->save_notice('success', $msg);
364 364
 	}
365 365
 
366 366
 	/**
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 	 * @param       string $msg The message to qeue.
371 371
 	 * @since       1.0.19
372 372
 	 */
373
-	public function show_error( $msg ) {
374
-		$this->save_notice( 'error', $msg );
373
+	public function show_error($msg) {
374
+		$this->save_notice('error', $msg);
375 375
 	}
376 376
 
377 377
 	/**
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
 	 * @param       string $msg The message to qeue.
382 382
 	 * @since       1.0.19
383 383
 	 */
384
-	public function show_warning( $msg ) {
385
-		$this->save_notice( 'warning', $msg );
384
+	public function show_warning($msg) {
385
+		$this->save_notice('warning', $msg);
386 386
 	}
387 387
 
388 388
 	/**
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 * @param       string $msg The message to qeue.
393 393
 	 * @since       1.0.19
394 394
 	 */
395
-	public function show_info( $msg ) {
396
-		$this->save_notice( 'info', $msg );
395
+	public function show_info($msg) {
396
+		$this->save_notice('info', $msg);
397 397
 	}
398 398
 
399 399
 	/**
@@ -407,15 +407,15 @@  discard block
 block discarded – undo
407 407
         $notices = $this->get_notices();
408 408
         $this->clear_notices();
409 409
 
410
-		foreach ( $notices as $type => $messages ) {
410
+		foreach ($notices as $type => $messages) {
411 411
 
412
-			if ( ! is_array( $messages ) ) {
412
+			if (!is_array($messages)) {
413 413
 				continue;
414 414
 			}
415 415
 
416
-            $type  = sanitize_key( $type );
417
-			foreach ( $messages as $message ) {
418
-                $message = wp_kses_post( $message );
416
+            $type = sanitize_key($type);
417
+			foreach ($messages as $message) {
418
+                $message = wp_kses_post($message);
419 419
 				echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
420 420
             }
421 421
 
Please login to merge, or discard this patch.