Passed
Push — master ( 1efd62...4d9a77 )
by Brian
03:50
created
includes/admin/class-getpaid-admin.php 1 patch
Spacing   +126 added lines, -126 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.
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
     /**
38 38
 	 * Class constructor.
39 39
 	 */
40
-	public function __construct(){
40
+	public function __construct() {
41 41
 
42
-        $this->admin_path  = plugin_dir_path( __FILE__ );
43
-		$this->admin_url   = plugins_url( '/', __FILE__ );
42
+        $this->admin_path = plugin_dir_path(__FILE__);
43
+		$this->admin_url   = plugins_url('/', __FILE__);
44 44
 		$this->reports     = new GetPaid_Reports();
45 45
 
46
-        if ( is_admin() ) {
46
+        if (is_admin()) {
47 47
 			$this->init_admin_hooks();
48 48
         }
49 49
 
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 */
56 56
 	private function init_admin_hooks() {
57
-        add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) );
58
-        add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
59
-        add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) );
60
-        add_action( 'admin_init', array( $this, 'activation_redirect') );
61
-        add_action( 'admin_init', array( $this, 'maybe_do_admin_action') );
62
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
63
-		add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
64
-		add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
65
-        add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) );
66
-		do_action( 'getpaid_init_admin_hooks', $this );
57
+        add_action('admin_enqueue_scripts', array($this, 'enqeue_scripts'));
58
+        add_filter('admin_body_class', array($this, 'admin_body_class'));
59
+        add_action('admin_init', array($this, 'init_ayecode_connect_helper'));
60
+        add_action('admin_init', array($this, 'activation_redirect'));
61
+        add_action('admin_init', array($this, 'maybe_do_admin_action'));
62
+		add_action('admin_notices', array($this, 'show_notices'));
63
+		add_action('getpaid_authenticated_admin_action_send_invoice', array($this, 'send_customer_invoice'));
64
+		add_action('getpaid_authenticated_admin_action_send_invoice_reminder', array($this, 'send_customer_payment_reminder'));
65
+        add_action('getpaid_authenticated_admin_action_reset_tax_rates', array($this, 'admin_reset_tax_rates'));
66
+		do_action('getpaid_init_admin_hooks', $this);
67 67
 
68 68
     }
69 69
 
@@ -74,39 +74,39 @@  discard block
 block discarded – undo
74 74
 	public function enqeue_scripts() {
75 75
         global $current_screen, $pagenow;
76 76
 
77
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
77
+		$page    = isset($_GET['page']) ? $_GET['page'] : '';
78 78
 		$editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
79 79
 
80
-        if ( ! empty( $current_screen->post_type ) ) {
80
+        if (!empty($current_screen->post_type)) {
81 81
 			$page = $current_screen->post_type;
82 82
         }
83 83
 
84 84
         // General styles.
85
-        if ( false !== stripos( $page, 'wpi' ) ) {
85
+        if (false !== stripos($page, 'wpi')) {
86 86
 
87 87
             // Styles.
88
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
89
-            wp_enqueue_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array( 'wp-color-picker' ), $version );
90
-            wp_enqueue_style( 'select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all' );
91
-            wp_enqueue_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui.min.css', array(), '1.8.16' );
88
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
89
+            wp_enqueue_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array('wp-color-picker'), $version);
90
+            wp_enqueue_style('select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all');
91
+            wp_enqueue_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui.min.css', array(), '1.8.16');
92 92
 
93 93
             // Scripts.
94
-            wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '4.0.13', true );
95
-            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array( 'jquery' ), WPINV_VERSION );
94
+            wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '4.0.13', true);
95
+            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array('jquery'), WPINV_VERSION);
96 96
 
97
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' );
98
-            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 );
99
-            wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', apply_filters( 'wpinv_admin_js_localize', $this->get_admin_i18() ) );
97
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js');
98
+            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);
99
+            wp_localize_script('wpinv-admin-script', 'WPInv_Admin', apply_filters('wpinv_admin_js_localize', $this->get_admin_i18()));
100 100
 
101 101
         }
102 102
 
103 103
         // Payment form scripts.
104
-		if ( 'wpi_payment_form' == $page && $editing ) {
104
+		if ('wpi_payment_form' == $page && $editing) {
105 105
             $this->load_payment_form_scripts();
106 106
         }
107 107
 
108
-		if ( $page == 'wpinv-subscriptions' ) {
109
-			wp_enqueue_script( 'postbox' );
108
+		if ($page == 'wpinv-subscriptions') {
109
+			wp_enqueue_script('postbox');
110 110
 		}
111 111
 
112 112
     }
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
         global $post;
120 120
 
121 121
         $i18n = array(
122
-            'ajax_url'                  => admin_url( 'admin-ajax.php' ),
123
-            'post_ID'                   => isset( $post->ID ) ? $post->ID : '',
124
-            'wpinv_nonce'               => wp_create_nonce( 'wpinv-nonce' ),
125
-            'add_invoice_note_nonce'    => wp_create_nonce( 'add-invoice-note' ),
126
-            'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ),
127
-            'invoice_item_nonce'        => wp_create_nonce( 'invoice-item' ),
128
-            'billing_details_nonce'     => wp_create_nonce( 'get-billing-details' ),
122
+            'ajax_url'                  => admin_url('admin-ajax.php'),
123
+            'post_ID'                   => isset($post->ID) ? $post->ID : '',
124
+            'wpinv_nonce'               => wp_create_nonce('wpinv-nonce'),
125
+            'add_invoice_note_nonce'    => wp_create_nonce('add-invoice-note'),
126
+            'delete_invoice_note_nonce' => wp_create_nonce('delete-invoice-note'),
127
+            'invoice_item_nonce'        => wp_create_nonce('invoice-item'),
128
+            'billing_details_nonce'     => wp_create_nonce('get-billing-details'),
129 129
             'tax'                       => wpinv_tax_amount(),
130 130
             'discount'                  => 0,
131 131
             'currency_symbol'           => wpinv_currency_symbol(),
@@ -133,35 +133,35 @@  discard block
 block discarded – undo
133 133
             'thousand_sep'              => wpinv_thousands_separator(),
134 134
             'decimal_sep'               => wpinv_decimal_separator(),
135 135
             'decimals'                  => wpinv_decimals(),
136
-            'save_invoice'              => __( 'Save Invoice', 'invoicing' ),
137
-            'status_publish'            => wpinv_status_nicename( 'publish' ),
138
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
139
-            'delete_tax_rate'           => __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ),
140
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
141
-            'FillBillingDetails'        => __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ),
142
-            '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' ),
143
-            'AreYouSure'                => __( 'Are you sure?', 'invoicing' ),
144
-            'errDeleteItem'             => __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ),
145
-            'delete_subscription'       => __( 'Are you sure you want to delete this subscription?', 'invoicing' ),
146
-            'action_edit'               => __( 'Edit', 'invoicing' ),
147
-            'action_cancel'             => __( 'Cancel', 'invoicing' ),
148
-            'item_description'          => __( 'Item Description', 'invoicing' ),
149
-            'invoice_description'       => __( 'Invoice Description', 'invoicing' ),
150
-            'discount_description'      => __( 'Discount Description', 'invoicing' ),
151
-            'searching'                 => __( 'Searching', 'invoicing' ),
136
+            'save_invoice'              => __('Save Invoice', 'invoicing'),
137
+            'status_publish'            => wpinv_status_nicename('publish'),
138
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
139
+            'delete_tax_rate'           => __('Are you sure you wish to delete this tax rate?', 'invoicing'),
140
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
141
+            'FillBillingDetails'        => __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'),
142
+            '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'),
143
+            'AreYouSure'                => __('Are you sure?', 'invoicing'),
144
+            'errDeleteItem'             => __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'),
145
+            'delete_subscription'       => __('Are you sure you want to delete this subscription?', 'invoicing'),
146
+            'action_edit'               => __('Edit', 'invoicing'),
147
+            'action_cancel'             => __('Cancel', 'invoicing'),
148
+            'item_description'          => __('Item Description', 'invoicing'),
149
+            'invoice_description'       => __('Invoice Description', 'invoicing'),
150
+            'discount_description'      => __('Discount Description', 'invoicing'),
151
+            'searching'                 => __('Searching', 'invoicing'),
152 152
         );
153 153
 
154
-		if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
154
+		if (!empty($post) && getpaid_is_invoice_post_type($post->post_type)) {
155 155
 
156
-			$invoice              = new WPInv_Invoice( $post );
156
+			$invoice              = new WPInv_Invoice($post);
157 157
 			$i18n['save_invoice'] = sprintf(
158
-				__( 'Save %s', 'invoicing' ),
159
-				ucfirst( $invoice->get_type() )
158
+				__('Save %s', 'invoicing'),
159
+				ucfirst($invoice->get_type())
160 160
 			);
161 161
 
162 162
 			$i18n['invoice_description'] = sprintf(
163
-				__( '%s Description', 'invoicing' ),
164
-				ucfirst( $invoice->get_type() )
163
+				__('%s Description', 'invoicing'),
164
+				ucfirst($invoice->get_type())
165 165
 			);
166 166
 
167 167
 		}
@@ -175,30 +175,30 @@  discard block
 block discarded – undo
175 175
 	protected function load_payment_form_scripts() {
176 176
         global $post;
177 177
 
178
-        wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
179
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
180
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
178
+        wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
179
+		wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
180
+		wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
181 181
 
182
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
183
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
182
+		$version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
183
+		wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
184 184
 
185 185
 		wp_localize_script(
186 186
             'wpinv-admin-payment-form-script',
187 187
             'wpinvPaymentFormAdmin',
188 188
             array(
189
-				'elements'      => wpinv_get_data( 'payment-form-elements' ),
190
-				'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
189
+				'elements'      => wpinv_get_data('payment-form-elements'),
190
+				'form_elements' => getpaid_get_payment_form_elements($post->ID),
191 191
 				'currency'      => wpinv_currency_symbol(),
192 192
 				'position'      => wpinv_currency_position(),
193 193
 				'decimals'      => (int) wpinv_decimals(),
194 194
 				'thousands_sep' => wpinv_thousands_separator(),
195 195
 				'decimals_sep'  => wpinv_decimal_separator(),
196
-				'form_items'    => gepaid_get_form_items( $post->ID ),
196
+				'form_items'    => gepaid_get_form_items($post->ID),
197 197
 				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
198 198
             )
199 199
         );
200 200
 
201
-        wp_enqueue_script( 'wpinv-admin-payment-form-script' );
201
+        wp_enqueue_script('wpinv-admin-payment-form-script');
202 202
 
203 203
     }
204 204
 
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
      * @return string
210 210
 	 *
211 211
 	 */
212
-    public function admin_body_class( $classes ) {
212
+    public function admin_body_class($classes) {
213 213
 		global $pagenow, $post, $current_screen;
214 214
 
215 215
 
216
-        $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
216
+        $page = isset($_GET['page']) ? $_GET['page'] : '';
217 217
 
218
-        if ( ! empty( $current_screen->post_type ) ) {
218
+        if (!empty($current_screen->post_type)) {
219 219
 			$page = $current_screen->post_type;
220 220
         }
221 221
 
222
-        if ( false !== stripos( $page, 'wpi' ) ) {
223
-            $classes .= ' wpi-' . sanitize_key( $page );
222
+        if (false !== stripos($page, 'wpi')) {
223
+            $classes .= ' wpi-' . sanitize_key($page);
224 224
         }
225 225
 
226
-        if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) {
226
+        if (in_array($page, wpinv_parse_list('wpi_invoice wpi_payment_form wpi_quote'))) {
227 227
             $classes .= ' wpinv-cpt wpinv';
228 228
 		}
229 229
 		
230
-		if ( getpaid_is_invoice_post_type( $page ) ) {
230
+		if (getpaid_is_invoice_post_type($page)) {
231 231
             $classes .= ' getpaid-is-invoice-cpt';
232 232
         }
233 233
 
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
     /**
238 238
 	 * Maybe show the AyeCode Connect Notice.
239 239
 	 */
240
-	public function init_ayecode_connect_helper(){
240
+	public function init_ayecode_connect_helper() {
241 241
 
242 242
         new AyeCode_Connect_Helper(
243 243
             array(
244
-				'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
245
-				'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
246
-				'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>" ),
247
-				'connect_button'    => __("Connect Site","invoicing"),
248
-				'connecting_button'    => __("Connecting...","invoicing"),
249
-				'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
250
-				'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
244
+				'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
245
+				'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
246
+				'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>"),
247
+				'connect_button'    => __("Connect Site", "invoicing"),
248
+				'connecting_button'    => __("Connecting...", "invoicing"),
249
+				'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
250
+				'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
251 251
             ),
252
-            array( 'wpi-addons' )
252
+            array('wpi-addons')
253 253
         );
254 254
 
255 255
     }
@@ -260,19 +260,19 @@  discard block
 block discarded – undo
260 260
     public function activation_redirect() {
261 261
 
262 262
 		// Bail if no activation redirect.
263
-		if ( ! get_transient( '_wpinv_activation_redirect' ) || wp_doing_ajax() ) {
263
+		if (!get_transient('_wpinv_activation_redirect') || wp_doing_ajax()) {
264 264
 			return;
265 265
 		}
266 266
 
267 267
 		// Delete the redirect transient.
268
-		delete_transient( '_wpinv_activation_redirect' );
268
+		delete_transient('_wpinv_activation_redirect');
269 269
 
270 270
 		// Bail if activating from network, or bulk
271
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
271
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
272 272
 			return;
273 273
 		}
274 274
 
275
-		wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
275
+		wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
276 276
 		exit;
277 277
     }
278 278
 
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
      */
282 282
     public function maybe_do_admin_action() {
283 283
 
284
-        if ( wpinv_current_user_can_manage_invoicing() && isset( $_REQUEST['getpaid-admin-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
285
-            $key = sanitize_key( $_REQUEST['getpaid-admin-action'] );
286
-            do_action( "getpaid_authenticated_admin_action_$key", $_REQUEST );
284
+        if (wpinv_current_user_can_manage_invoicing() && isset($_REQUEST['getpaid-admin-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) {
285
+            $key = sanitize_key($_REQUEST['getpaid-admin-action']);
286
+            do_action("getpaid_authenticated_admin_action_$key", $_REQUEST);
287 287
         }
288 288
 
289 289
     }
@@ -293,16 +293,16 @@  discard block
 block discarded – undo
293 293
 	 * 
294 294
 	 * @param array $args
295 295
      */
296
-    public function send_customer_invoice( $args ) {
297
-		$sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ) );
296
+    public function send_customer_invoice($args) {
297
+		$sent = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($args['invoice_id']));
298 298
 
299
-		if ( $sent ) {
300
-			$this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
299
+		if ($sent) {
300
+			$this->show_success(__('Invoice was successfully sent to the customer', 'invoicing'));
301 301
 		} else {
302
-			$this->show_error( __( 'Could not sent the invoice to the customer', 'invoicing' ) );
302
+			$this->show_error(__('Could not sent the invoice to the customer', 'invoicing'));
303 303
 		}
304 304
 
305
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
305
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
306 306
 		exit;
307 307
 	}
308 308
 
@@ -311,16 +311,16 @@  discard block
 block discarded – undo
311 311
 	 * 
312 312
 	 * @param array $args
313 313
      */
314
-    public function send_customer_payment_reminder( $args ) {
315
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
314
+    public function send_customer_payment_reminder($args) {
315
+		$sent = getpaid()->get('invoice_emails')->force_send_overdue_notice(new WPInv_Invoice($args['invoice_id']));
316 316
 
317
-		if ( $sent ) {
318
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
317
+		if ($sent) {
318
+			$this->show_success(__('Payment reminder was successfully sent to the customer', 'invoicing'));
319 319
 		} else {
320
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
320
+			$this->show_error(__('Could not sent payment reminder to the customer', 'invoicing'));
321 321
 		}
322 322
 
323
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
323
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
324 324
 		exit;
325 325
 	}
326 326
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
      */
331 331
     public function admin_reset_tax_rates() {
332 332
 
333
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
334
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
333
+		update_option('wpinv_tax_rates', wpinv_get_data('tax-rates'));
334
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
335 335
 		exit;
336 336
 
337 337
 	}
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
      * @return array
344 344
 	 */
345 345
 	public function get_notices() {
346
-		$notices = get_option( 'wpinv_admin_notices' );
347
-        return is_array( $notices ) ? $notices : array();
346
+		$notices = get_option('wpinv_admin_notices');
347
+        return is_array($notices) ? $notices : array();
348 348
 	}
349 349
 
350 350
 	/**
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 * @since       1.0.19
355 355
 	 */
356 356
 	public function clear_notices() {
357
-		delete_option( 'wpinv_admin_notices' );
357
+		delete_option('wpinv_admin_notices');
358 358
 	}
359 359
 
360 360
 	/**
@@ -363,16 +363,16 @@  discard block
 block discarded – undo
363 363
 	 * @access      public
364 364
 	 * @since       1.0.19
365 365
 	 */
366
-	public function save_notice( $type, $message ) {
366
+	public function save_notice($type, $message) {
367 367
 		$notices = $this->get_notices();
368 368
 
369
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
370
-			$notices[ $type ] = array();
369
+		if (empty($notices[$type]) || !is_array($notices[$type])) {
370
+			$notices[$type] = array();
371 371
 		}
372 372
 
373
-		$notices[ $type ][] = $message;
373
+		$notices[$type][] = $message;
374 374
 
375
-		update_option( 'wpinv_admin_notices', $notices );
375
+		update_option('wpinv_admin_notices', $notices);
376 376
 	}
377 377
 
378 378
 	/**
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 	 * @access      public
383 383
 	 * @since       1.0.19
384 384
 	 */
385
-	public function show_success( $msg ) {
386
-		$this->save_notice( 'success', $msg );
385
+	public function show_success($msg) {
386
+		$this->save_notice('success', $msg);
387 387
 	}
388 388
 
389 389
 	/**
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 * @param       string $msg The message to qeue.
394 394
 	 * @since       1.0.19
395 395
 	 */
396
-	public function show_error( $msg ) {
397
-		$this->save_notice( 'error', $msg );
396
+	public function show_error($msg) {
397
+		$this->save_notice('error', $msg);
398 398
 	}
399 399
 
400 400
 	/**
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	 * @param       string $msg The message to qeue.
405 405
 	 * @since       1.0.19
406 406
 	 */
407
-	public function show_warning( $msg ) {
408
-		$this->save_notice( 'warning', $msg );
407
+	public function show_warning($msg) {
408
+		$this->save_notice('warning', $msg);
409 409
 	}
410 410
 
411 411
 	/**
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
 	 * @param       string $msg The message to qeue.
416 416
 	 * @since       1.0.19
417 417
 	 */
418
-	public function show_info( $msg ) {
419
-		$this->save_notice( 'info', $msg );
418
+	public function show_info($msg) {
419
+		$this->save_notice('info', $msg);
420 420
 	}
421 421
 
422 422
 	/**
@@ -430,15 +430,15 @@  discard block
 block discarded – undo
430 430
         $notices = $this->get_notices();
431 431
         $this->clear_notices();
432 432
 
433
-		foreach ( $notices as $type => $messages ) {
433
+		foreach ($notices as $type => $messages) {
434 434
 
435
-			if ( ! is_array( $messages ) ) {
435
+			if (!is_array($messages)) {
436 436
 				continue;
437 437
 			}
438 438
 
439
-            $type  = sanitize_key( $type );
440
-			foreach ( $messages as $message ) {
441
-                $message = wp_kses_post( $message );
439
+            $type = sanitize_key($type);
440
+			foreach ($messages as $message) {
441
+                $message = wp_kses_post($message);
442 442
 				echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
443 443
             }
444 444
 
Please login to merge, or discard this patch.