Passed
Push — master ( 75dadc...1ce22f )
by Brian
12:27 queued 06:18
created
includes/admin/wpinv-admin-functions.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 }
57 57
 
58 58
 function wpinv_admin_messages() {
59
-	settings_errors( 'wpinv-notices' );
59
+    settings_errors( 'wpinv-notices' );
60 60
 }
61 61
 add_action( 'admin_notices', 'wpinv_admin_messages' );
62 62
 
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin.php 1 patch
Indentation   +222 added lines, -222 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
         $i18n = array(
@@ -152,50 +152,50 @@  discard block
 block discarded – undo
152 152
             'searching'                 => __( 'Searching', 'invoicing' ),
153 153
         );
154 154
 
155
-		if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
155
+        if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
156 156
 
157
-			$invoice              = new WPInv_Invoice( $post );
158
-			$i18n['save_invoice'] = sprintf(
159
-				__( 'Save %s', 'invoicing' ),
160
-				ucfirst( $invoice->get_type() )
161
-			);
157
+            $invoice              = new WPInv_Invoice( $post );
158
+            $i18n['save_invoice'] = sprintf(
159
+                __( 'Save %s', 'invoicing' ),
160
+                ucfirst( $invoice->get_type() )
161
+            );
162 162
 
163
-			$i18n['invoice_description'] = sprintf(
164
-				__( '%s Description', 'invoicing' ),
165
-				ucfirst( $invoice->get_type() )
166
-			);
163
+            $i18n['invoice_description'] = sprintf(
164
+                __( '%s Description', 'invoicing' ),
165
+                ucfirst( $invoice->get_type() )
166
+            );
167 167
 
168
-		}
169
-		return $i18n;
168
+        }
169
+        return $i18n;
170 170
     }
171 171
 
172 172
     /**
173
-	 * Loads payment form js.
174
-	 *
175
-	 */
176
-	protected function load_payment_form_scripts() {
173
+     * Loads payment form js.
174
+     *
175
+     */
176
+    protected function load_payment_form_scripts() {
177 177
         global $post;
178 178
 
179 179
         wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
180
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
181
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
180
+        wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
181
+        wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
182 182
 
183
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
184
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
183
+        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
184
+        wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
185 185
 
186
-		wp_localize_script(
186
+        wp_localize_script(
187 187
             'wpinv-admin-payment-form-script',
188 188
             'wpinvPaymentFormAdmin',
189 189
             array(
190
-				'elements'      => wpinv_get_data( 'payment-form-elements' ),
191
-				'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
192
-				'currency'      => wpinv_currency_symbol(),
193
-				'position'      => wpinv_currency_position(),
194
-				'decimals'      => (int) wpinv_decimals(),
195
-				'thousands_sep' => wpinv_thousands_separator(),
196
-				'decimals_sep'  => wpinv_decimal_separator(),
197
-				'form_items'    => gepaid_get_form_items( $post->ID ),
198
-				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
190
+                'elements'      => wpinv_get_data( 'payment-form-elements' ),
191
+                'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
192
+                'currency'      => wpinv_currency_symbol(),
193
+                'position'      => wpinv_currency_position(),
194
+                'decimals'      => (int) wpinv_decimals(),
195
+                'thousands_sep' => wpinv_thousands_separator(),
196
+                'decimals_sep'  => wpinv_decimal_separator(),
197
+                'form_items'    => gepaid_get_form_items( $post->ID ),
198
+                'is_default'    => $post->ID == wpinv_get_default_payment_form(),
199 199
             )
200 200
         );
201 201
 
@@ -204,20 +204,20 @@  discard block
 block discarded – undo
204 204
     }
205 205
 
206 206
     /**
207
-	 * Add our classes to admin pages.
207
+     * Add our classes to admin pages.
208 208
      *
209 209
      * @param string $classes
210 210
      * @return string
211
-	 *
212
-	 */
211
+     *
212
+     */
213 213
     public function admin_body_class( $classes ) {
214
-		global $pagenow, $post, $current_screen;
214
+        global $pagenow, $post, $current_screen;
215 215
 
216 216
 
217 217
         $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
218 218
 
219 219
         if ( ! empty( $current_screen->post_type ) ) {
220
-			$page = $current_screen->post_type;
220
+            $page = $current_screen->post_type;
221 221
         }
222 222
 
223 223
         if ( false !== stripos( $page, 'wpi' ) ) {
@@ -226,29 +226,29 @@  discard block
 block discarded – undo
226 226
 
227 227
         if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) {
228 228
             $classes .= ' wpinv-cpt wpinv';
229
-		}
229
+        }
230 230
 		
231
-		if ( getpaid_is_invoice_post_type( $page ) ) {
231
+        if ( getpaid_is_invoice_post_type( $page ) ) {
232 232
             $classes .= ' getpaid-is-invoice-cpt';
233 233
         }
234 234
 
235
-		return $classes;
235
+        return $classes;
236 236
     }
237 237
 
238 238
     /**
239
-	 * Maybe show the AyeCode Connect Notice.
240
-	 */
241
-	public function init_ayecode_connect_helper(){
239
+     * Maybe show the AyeCode Connect Notice.
240
+     */
241
+    public function init_ayecode_connect_helper(){
242 242
 
243 243
         new AyeCode_Connect_Helper(
244 244
             array(
245
-				'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
246
-				'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
247
-				'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>" ),
248
-				'connect_button'    => __("Connect Site","invoicing"),
249
-				'connecting_button'    => __("Connecting...","invoicing"),
250
-				'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
251
-				'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
245
+                'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
246
+                'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
247
+                '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>" ),
248
+                'connect_button'    => __("Connect Site","invoicing"),
249
+                'connecting_button'    => __("Connecting...","invoicing"),
250
+                'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
251
+                'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
252 252
             ),
253 253
             array( 'wpi-addons' )
254 254
         );
@@ -260,21 +260,21 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function activation_redirect() {
262 262
 
263
-		// Bail if no activation redirect.
264
-		if ( ! get_transient( '_wpinv_activation_redirect' ) || wp_doing_ajax() ) {
265
-			return;
266
-		}
263
+        // Bail if no activation redirect.
264
+        if ( ! get_transient( '_wpinv_activation_redirect' ) || wp_doing_ajax() ) {
265
+            return;
266
+        }
267 267
 
268
-		// Delete the redirect transient.
269
-		delete_transient( '_wpinv_activation_redirect' );
268
+        // Delete the redirect transient.
269
+        delete_transient( '_wpinv_activation_redirect' );
270 270
 
271
-		// Bail if activating from network, or bulk
272
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
273
-			return;
274
-		}
271
+        // Bail if activating from network, or bulk
272
+        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
273
+            return;
274
+        }
275 275
 
276
-		wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
277
-		exit;
276
+        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
277
+        exit;
278 278
     }
279 279
 
280 280
     /**
@@ -289,150 +289,150 @@  discard block
 block discarded – undo
289 289
 
290 290
     }
291 291
 
292
-	/**
292
+    /**
293 293
      * Sends a payment reminder to a customer.
294
-	 * 
295
-	 * @param array $args
294
+     * 
295
+     * @param array $args
296 296
      */
297 297
     public function send_customer_invoice( $args ) {
298
-		$sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ) );
298
+        $sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ) );
299 299
 
300
-		if ( $sent ) {
301
-			$this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
302
-		} else {
303
-			$this->show_error( __( 'Could not sent the invoice to the customer', 'invoicing' ) );
304
-		}
300
+        if ( $sent ) {
301
+            $this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
302
+        } else {
303
+            $this->show_error( __( 'Could not sent the invoice to the customer', 'invoicing' ) );
304
+        }
305 305
 
306
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
307
-		exit;
308
-	}
306
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
307
+        exit;
308
+    }
309 309
 
310
-	/**
310
+    /**
311 311
      * Sends a payment reminder to a customer.
312
-	 * 
313
-	 * @param array $args
312
+     * 
313
+     * @param array $args
314 314
      */
315 315
     public function send_customer_payment_reminder( $args ) {
316
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
316
+        $sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
317 317
 
318
-		if ( $sent ) {
319
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
320
-		} else {
321
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
322
-		}
318
+        if ( $sent ) {
319
+            $this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
320
+        } else {
321
+            $this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
322
+        }
323 323
 
324
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
325
-		exit;
326
-	}
324
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
325
+        exit;
326
+    }
327 327
 
328 328
     /**
329
-	 * Returns an array of admin notices.
330
-	 *
331
-	 * @since       1.0.19
329
+     * Returns an array of admin notices.
330
+     *
331
+     * @since       1.0.19
332 332
      * @return array
333
-	 */
334
-	public function get_notices() {
335
-		$notices = get_option( 'wpinv_admin_notices' );
333
+     */
334
+    public function get_notices() {
335
+        $notices = get_option( 'wpinv_admin_notices' );
336 336
         return is_array( $notices ) ? $notices : array();
337
-	}
338
-
339
-	/**
340
-	 * Clears all admin notices
341
-	 *
342
-	 * @access      public
343
-	 * @since       1.0.19
344
-	 */
345
-	public function clear_notices() {
346
-		delete_option( 'wpinv_admin_notices' );
347
-	}
348
-
349
-	/**
350
-	 * Saves a new admin notice
351
-	 *
352
-	 * @access      public
353
-	 * @since       1.0.19
354
-	 */
355
-	public function save_notice( $type, $message ) {
356
-		$notices = $this->get_notices();
357
-
358
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
359
-			$notices[ $type ] = array();
360
-		}
361
-
362
-		$notices[ $type ][] = $message;
363
-
364
-		update_option( 'wpinv_admin_notices', $notices );
365
-	}
366
-
367
-	/**
368
-	 * Displays a success notice
369
-	 *
370
-	 * @param       string $msg The message to qeue.
371
-	 * @access      public
372
-	 * @since       1.0.19
373
-	 */
374
-	public function show_success( $msg ) {
375
-		$this->save_notice( 'success', $msg );
376
-	}
377
-
378
-	/**
379
-	 * Displays a error notice
380
-	 *
381
-	 * @access      public
382
-	 * @param       string $msg The message to qeue.
383
-	 * @since       1.0.19
384
-	 */
385
-	public function show_error( $msg ) {
386
-		$this->save_notice( 'error', $msg );
387
-	}
388
-
389
-	/**
390
-	 * Displays a warning notice
391
-	 *
392
-	 * @access      public
393
-	 * @param       string $msg The message to qeue.
394
-	 * @since       1.0.19
395
-	 */
396
-	public function show_warning( $msg ) {
397
-		$this->save_notice( 'warning', $msg );
398
-	}
399
-
400
-	/**
401
-	 * Displays a info notice
402
-	 *
403
-	 * @access      public
404
-	 * @param       string $msg The message to qeue.
405
-	 * @since       1.0.19
406
-	 */
407
-	public function show_info( $msg ) {
408
-		$this->save_notice( 'info', $msg );
409
-	}
410
-
411
-	/**
412
-	 * Show notices
413
-	 *
414
-	 * @access      public
415
-	 * @since       1.0.19
416
-	 */
417
-	public function show_notices() {
337
+    }
338
+
339
+    /**
340
+     * Clears all admin notices
341
+     *
342
+     * @access      public
343
+     * @since       1.0.19
344
+     */
345
+    public function clear_notices() {
346
+        delete_option( 'wpinv_admin_notices' );
347
+    }
348
+
349
+    /**
350
+     * Saves a new admin notice
351
+     *
352
+     * @access      public
353
+     * @since       1.0.19
354
+     */
355
+    public function save_notice( $type, $message ) {
356
+        $notices = $this->get_notices();
357
+
358
+        if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
359
+            $notices[ $type ] = array();
360
+        }
361
+
362
+        $notices[ $type ][] = $message;
363
+
364
+        update_option( 'wpinv_admin_notices', $notices );
365
+    }
366
+
367
+    /**
368
+     * Displays a success notice
369
+     *
370
+     * @param       string $msg The message to qeue.
371
+     * @access      public
372
+     * @since       1.0.19
373
+     */
374
+    public function show_success( $msg ) {
375
+        $this->save_notice( 'success', $msg );
376
+    }
377
+
378
+    /**
379
+     * Displays a error notice
380
+     *
381
+     * @access      public
382
+     * @param       string $msg The message to qeue.
383
+     * @since       1.0.19
384
+     */
385
+    public function show_error( $msg ) {
386
+        $this->save_notice( 'error', $msg );
387
+    }
388
+
389
+    /**
390
+     * Displays a warning notice
391
+     *
392
+     * @access      public
393
+     * @param       string $msg The message to qeue.
394
+     * @since       1.0.19
395
+     */
396
+    public function show_warning( $msg ) {
397
+        $this->save_notice( 'warning', $msg );
398
+    }
399
+
400
+    /**
401
+     * Displays a info notice
402
+     *
403
+     * @access      public
404
+     * @param       string $msg The message to qeue.
405
+     * @since       1.0.19
406
+     */
407
+    public function show_info( $msg ) {
408
+        $this->save_notice( 'info', $msg );
409
+    }
410
+
411
+    /**
412
+     * Show notices
413
+     *
414
+     * @access      public
415
+     * @since       1.0.19
416
+     */
417
+    public function show_notices() {
418 418
 
419 419
         $notices = $this->get_notices();
420 420
         $this->clear_notices();
421 421
 
422
-		foreach ( $notices as $type => $messages ) {
422
+        foreach ( $notices as $type => $messages ) {
423 423
 
424
-			if ( ! is_array( $messages ) ) {
425
-				continue;
426
-			}
424
+            if ( ! is_array( $messages ) ) {
425
+                continue;
426
+            }
427 427
 
428 428
             $type  = sanitize_key( $type );
429
-			foreach ( $messages as $message ) {
429
+            foreach ( $messages as $message ) {
430 430
                 $message = wp_kses_post( $message );
431
-				echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
431
+                echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
432 432
             }
433 433
 
434 434
         }
435 435
 
436
-	}
436
+    }
437 437
 
438 438
 }
Please login to merge, or discard this patch.
includes/data/item-schema.php 1 patch
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -13,233 +13,233 @@
 block discarded – undo
13 13
 
14 14
 return array(
15 15
 
16
-	'id'              => array(
17
-		'description' => __( 'Unique identifier for the item.', 'invoicing' ),
18
-		'type'        => 'integer',
19
-		'context'     => array( 'view', 'edit', 'embed' ),
20
-		'readonly'    => true,
21
-	),
22
-
23
-	'parent_id'       => array(
24
-		'description' => __( 'Parent item ID.', 'invoicing' ),
25
-		'type'        => 'integer',
26
-		'context'     => array( 'view', 'edit', 'embed' ),
27
-		'default'     => 0,
28
-	),
29
-
30
-	'status'          => array(
31
-		'description' => __( 'A named status for the item.', 'invoicing' ),
32
-		'type'        => 'string',
33
-		'enum'        => array( 'draft', 'pending', 'publish' ),
34
-		'context'     => array( 'view', 'edit', 'embed' ),
35
-		'default'     => 'draft',
36
-	),
37
-
38
-	'version'         => array(
39
-		'description' => __( 'Plugin version when the item was created.', 'invoicing' ),
40
-		'type'        => 'string',
41
-		'context'     => array( 'view', 'edit' ),
42
-		'readonly'    => true,
43
-	),
44
-
45
-	'date_created'    => array(
46
-		'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ),
47
-		'type'        => 'string',
48
-		'context'     => array( 'view', 'edit', 'embed' ),
49
-	),
50
-
51
-	'date_created_gmt'    => array(
52
-		'description' => __( 'The GMT date the item was created.', 'invoicing' ),
53
-		'type'        => 'string',
54
-		'context'     => array( 'view', 'edit', 'embed' ),
55
-		'readonly'    => true,
56
-	),
57
-
58
-	'date_modified'   => array(
59
-		'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ),
60
-		'type'        => 'string',
61
-		'context'     => array( 'view', 'edit', 'embed' ),
62
-		'readonly'    => true,
63
-	),
64
-
65
-	'date_modified_gmt'    => array(
66
-		'description' => __( 'The GMT date the item was last modified.', 'invoicing' ),
67
-		'type'        => 'string',
68
-		'context'     => array( 'view', 'edit', 'embed' ),
69
-		'readonly'    => true,
70
-	),
71
-
72
-	'name'			  => array(
73
-		'description' => __( "The item's name.", 'invoicing' ),
74
-		'type'        => 'string',
75
-		'context'     => array( 'view', 'edit', 'embed' ),
76
-		'required'    => true,
77
-	),
78
-
79
-	'description'     => array(
80
-		'description' => __( "The item's description.", 'invoicing' ),
81
-		'type'        => 'string',
82
-		'context'     => array( 'view', 'edit', 'embed' ),
83
-	),
84
-
85
-	'owner'           => array(
86
-		'description' => __( 'The owner of the item (user id).', 'invoicing' ),
87
-		'type'        => 'integer',
88
-		'context'     => array( 'view', 'edit', 'embed' ),
89
-	),
90
-
91
-	'price'           => array(
92
-		'description' => __( 'The price of the item.', 'invoicing' ),
93
-		'type'        => 'number',
94
-		'context'     => array( 'view', 'edit', 'embed' ),
95
-		'required'    => true,
96
-	),
97
-
98
-	'the_price'       => array(
99
-		'description' => __( 'The formatted price of the item.', 'invoicing' ),
100
-		'type'        => 'string',
101
-		'context'     => array( 'view', 'edit', 'embed' ),
102
-		'readonly'    => true,
103
-	),
104
-
105
-	'type'       => array(
106
-		'description' => __( 'The item type.', 'invoicing' ),
107
-		'type'        => 'string',
108
-		'enum'        => wpinv_item_types(),
109
-		'default'     => 'custom',
110
-		'context'     => array( 'view', 'edit', 'embed' ),
111
-	),
112
-
113
-	'vat_rule'       => array(
114
-		'description' => __( 'VAT rule applied to the item.', 'invoicing' ),
115
-		'type'        => 'string',
116
-		'enum'        => array_keys( getpaid_tax()->get_rules() ),
117
-		'context'     => array( 'view', 'edit', 'embed' ),
118
-	),
119
-
120
-	'vat_class'       => array(
121
-		'description' => __( 'VAT class for the item.', 'invoicing' ),
122
-		'type'        => 'string',
123
-		'context'     => array( 'view', 'edit', 'embed' ),
124
-		'enum'        => array_keys( getpaid_tax()->get_vat_groups() ),
125
-	),
126
-
127
-	'custom_id'       => array(
128
-		'description' => __( 'Custom id for the item.', 'invoicing' ),
129
-		'type'        => 'string',
130
-		'context'     => array( 'view', 'edit', 'embed' ),
131
-	),
16
+    'id'              => array(
17
+        'description' => __( 'Unique identifier for the item.', 'invoicing' ),
18
+        'type'        => 'integer',
19
+        'context'     => array( 'view', 'edit', 'embed' ),
20
+        'readonly'    => true,
21
+    ),
22
+
23
+    'parent_id'       => array(
24
+        'description' => __( 'Parent item ID.', 'invoicing' ),
25
+        'type'        => 'integer',
26
+        'context'     => array( 'view', 'edit', 'embed' ),
27
+        'default'     => 0,
28
+    ),
29
+
30
+    'status'          => array(
31
+        'description' => __( 'A named status for the item.', 'invoicing' ),
32
+        'type'        => 'string',
33
+        'enum'        => array( 'draft', 'pending', 'publish' ),
34
+        'context'     => array( 'view', 'edit', 'embed' ),
35
+        'default'     => 'draft',
36
+    ),
37
+
38
+    'version'         => array(
39
+        'description' => __( 'Plugin version when the item was created.', 'invoicing' ),
40
+        'type'        => 'string',
41
+        'context'     => array( 'view', 'edit' ),
42
+        'readonly'    => true,
43
+    ),
44
+
45
+    'date_created'    => array(
46
+        'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ),
47
+        'type'        => 'string',
48
+        'context'     => array( 'view', 'edit', 'embed' ),
49
+    ),
50
+
51
+    'date_created_gmt'    => array(
52
+        'description' => __( 'The GMT date the item was created.', 'invoicing' ),
53
+        'type'        => 'string',
54
+        'context'     => array( 'view', 'edit', 'embed' ),
55
+        'readonly'    => true,
56
+    ),
57
+
58
+    'date_modified'   => array(
59
+        'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ),
60
+        'type'        => 'string',
61
+        'context'     => array( 'view', 'edit', 'embed' ),
62
+        'readonly'    => true,
63
+    ),
64
+
65
+    'date_modified_gmt'    => array(
66
+        'description' => __( 'The GMT date the item was last modified.', 'invoicing' ),
67
+        'type'        => 'string',
68
+        'context'     => array( 'view', 'edit', 'embed' ),
69
+        'readonly'    => true,
70
+    ),
71
+
72
+    'name'			  => array(
73
+        'description' => __( "The item's name.", 'invoicing' ),
74
+        'type'        => 'string',
75
+        'context'     => array( 'view', 'edit', 'embed' ),
76
+        'required'    => true,
77
+    ),
78
+
79
+    'description'     => array(
80
+        'description' => __( "The item's description.", 'invoicing' ),
81
+        'type'        => 'string',
82
+        'context'     => array( 'view', 'edit', 'embed' ),
83
+    ),
84
+
85
+    'owner'           => array(
86
+        'description' => __( 'The owner of the item (user id).', 'invoicing' ),
87
+        'type'        => 'integer',
88
+        'context'     => array( 'view', 'edit', 'embed' ),
89
+    ),
90
+
91
+    'price'           => array(
92
+        'description' => __( 'The price of the item.', 'invoicing' ),
93
+        'type'        => 'number',
94
+        'context'     => array( 'view', 'edit', 'embed' ),
95
+        'required'    => true,
96
+    ),
97
+
98
+    'the_price'       => array(
99
+        'description' => __( 'The formatted price of the item.', 'invoicing' ),
100
+        'type'        => 'string',
101
+        'context'     => array( 'view', 'edit', 'embed' ),
102
+        'readonly'    => true,
103
+    ),
104
+
105
+    'type'       => array(
106
+        'description' => __( 'The item type.', 'invoicing' ),
107
+        'type'        => 'string',
108
+        'enum'        => wpinv_item_types(),
109
+        'default'     => 'custom',
110
+        'context'     => array( 'view', 'edit', 'embed' ),
111
+    ),
112
+
113
+    'vat_rule'       => array(
114
+        'description' => __( 'VAT rule applied to the item.', 'invoicing' ),
115
+        'type'        => 'string',
116
+        'enum'        => array_keys( getpaid_tax()->get_rules() ),
117
+        'context'     => array( 'view', 'edit', 'embed' ),
118
+    ),
119
+
120
+    'vat_class'       => array(
121
+        'description' => __( 'VAT class for the item.', 'invoicing' ),
122
+        'type'        => 'string',
123
+        'context'     => array( 'view', 'edit', 'embed' ),
124
+        'enum'        => array_keys( getpaid_tax()->get_vat_groups() ),
125
+    ),
126
+
127
+    'custom_id'       => array(
128
+        'description' => __( 'Custom id for the item.', 'invoicing' ),
129
+        'type'        => 'string',
130
+        'context'     => array( 'view', 'edit', 'embed' ),
131
+    ),
132 132
 	
133
-	'custom_name'       => array(
134
-		'description' => __( 'Custom name for the item.', 'invoicing' ),
135
-		'type'        => 'string',
136
-		'context'     => array( 'view', 'edit', 'embed' ),
137
-	),
138
-
139
-	'custom_singular_name'       => array(
140
-		'description' => __( 'Custom singular name for the item.', 'invoicing' ),
141
-		'type'        => 'string',
142
-		'context'     => array( 'view', 'edit', 'embed' ),
143
-	),
144
-
145
-	'is_dynamic_pricing'     => array(
146
-		'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ),
147
-		'type'        => 'integer',
148
-		'enum'        => array( 0, 1 ),
149
-		'context'     => array( 'view', 'edit', 'embed' ),
150
-	),
151
-
152
-	'minimum_price'   => array(
153
-		'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ),
154
-		'type'        => 'number',
155
-		'context'     => array( 'view', 'edit', 'embed' ),
156
-	),
157
-
158
-	'is_recurring'        => array(
159
-		'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ),
160
-		'type'        => 'integer',
161
-		'enum'        => array( 0, 1 ),
162
-		'context'     => array( 'view', 'edit', 'embed' ),
163
-	),
164
-
165
-	'initial_price'   => array(
166
-		'description' => __( 'The initial price of the item.', 'invoicing' ),
167
-		'type'        => 'number',
168
-		'context'     => array( 'view', 'edit', 'embed' ),
169
-		'readonly'    => true,
170
-	),
171
-
172
-	'the_initial_price'       => array(
173
-		'description' => __( 'The formatted initial price of the item.', 'invoicing' ),
174
-		'type'        => 'string',
175
-		'context'     => array( 'view', 'edit', 'embed' ),
176
-		'readonly'    => true,
177
-	),
178
-
179
-	'recurring_price' => array(
180
-		'description' => __( 'The recurring price of the item.', 'invoicing' ),
181
-		'type'        => 'number',
182
-		'context'     => array( 'view', 'edit', 'embed' ),
183
-		'readonly'    => true,
184
-	),
185
-
186
-	'the_recurring_price'       => array(
187
-		'description' => __( 'The formatted recurring price of the item.', 'invoicing' ),
188
-		'type'        => 'string',
189
-		'context'     => array( 'view', 'edit', 'embed' ),
190
-		'readonly'    => true,
191
-	),
192
-
193
-	'recurring_period'        => array(
194
-		'description' => __( 'The recurring period for a recurring item.', 'invoicing' ),
195
-		'type'        => 'string',
196
-		'context'     => array( 'view', 'edit', 'embed' ),
197
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
198
-	),
199
-
200
-	'recurring_interval'        => array(
201
-		'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ),
202
-		'type'        => 'integer',
203
-		'context'     => array( 'view', 'edit', 'embed' ),
204
-	),
205
-
206
-	'recurring_limit' => array(
207
-		'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ),
208
-		'type'        => 'integer',
209
-		'context'     => array( 'view', 'edit', 'embed' ),
210
-	),
211
-
212
-	'is_free_trial'   => array(
213
-		'description' => __( 'Whether the item has a free trial period.', 'invoicing' ),
214
-		'type'        => 'integer',
215
-		'enum'        => array( 0, 1 ),
216
-		'context'     => array( 'view', 'edit', 'embed' ),
217
-	),
218
-
219
-	'trial_period'    => array(
220
-		'description' => __( 'The trial period.', 'invoicing' ),
221
-		'type'        => 'string',
222
-		'context'     => array( 'view', 'edit', 'embed' ),
223
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
224
-	),
225
-
226
-	'trial_interval'  => array(
227
-		'description' => __( 'The trial interval.', 'invoicing' ),
228
-		'type'        => 'integer',
229
-		'context'     => array( 'view', 'edit', 'embed' ),
230
-	),
231
-
232
-	'first_renewal_date'       => array(
233
-		'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ),
234
-		'type'        => 'string',
235
-		'context'     => array( 'view', 'edit', 'embed' ),
236
-		'readonly'    => true,
237
-	),
238
-
239
-	'edit_url'        => array(
240
-		'description' => __( 'The URL to edit an item.', 'invoicing' ),
241
-		'type'        => 'string',
242
-		'context'     => array( 'view', 'edit', 'embed' ),
243
-		'readonly'    => true,
244
-	),
133
+    'custom_name'       => array(
134
+        'description' => __( 'Custom name for the item.', 'invoicing' ),
135
+        'type'        => 'string',
136
+        'context'     => array( 'view', 'edit', 'embed' ),
137
+    ),
138
+
139
+    'custom_singular_name'       => array(
140
+        'description' => __( 'Custom singular name for the item.', 'invoicing' ),
141
+        'type'        => 'string',
142
+        'context'     => array( 'view', 'edit', 'embed' ),
143
+    ),
144
+
145
+    'is_dynamic_pricing'     => array(
146
+        'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ),
147
+        'type'        => 'integer',
148
+        'enum'        => array( 0, 1 ),
149
+        'context'     => array( 'view', 'edit', 'embed' ),
150
+    ),
151
+
152
+    'minimum_price'   => array(
153
+        'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ),
154
+        'type'        => 'number',
155
+        'context'     => array( 'view', 'edit', 'embed' ),
156
+    ),
157
+
158
+    'is_recurring'        => array(
159
+        'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ),
160
+        'type'        => 'integer',
161
+        'enum'        => array( 0, 1 ),
162
+        'context'     => array( 'view', 'edit', 'embed' ),
163
+    ),
164
+
165
+    'initial_price'   => array(
166
+        'description' => __( 'The initial price of the item.', 'invoicing' ),
167
+        'type'        => 'number',
168
+        'context'     => array( 'view', 'edit', 'embed' ),
169
+        'readonly'    => true,
170
+    ),
171
+
172
+    'the_initial_price'       => array(
173
+        'description' => __( 'The formatted initial price of the item.', 'invoicing' ),
174
+        'type'        => 'string',
175
+        'context'     => array( 'view', 'edit', 'embed' ),
176
+        'readonly'    => true,
177
+    ),
178
+
179
+    'recurring_price' => array(
180
+        'description' => __( 'The recurring price of the item.', 'invoicing' ),
181
+        'type'        => 'number',
182
+        'context'     => array( 'view', 'edit', 'embed' ),
183
+        'readonly'    => true,
184
+    ),
185
+
186
+    'the_recurring_price'       => array(
187
+        'description' => __( 'The formatted recurring price of the item.', 'invoicing' ),
188
+        'type'        => 'string',
189
+        'context'     => array( 'view', 'edit', 'embed' ),
190
+        'readonly'    => true,
191
+    ),
192
+
193
+    'recurring_period'        => array(
194
+        'description' => __( 'The recurring period for a recurring item.', 'invoicing' ),
195
+        'type'        => 'string',
196
+        'context'     => array( 'view', 'edit', 'embed' ),
197
+        'enum'        => array( 'D', 'W', 'M', 'Y' ),
198
+    ),
199
+
200
+    'recurring_interval'        => array(
201
+        'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ),
202
+        'type'        => 'integer',
203
+        'context'     => array( 'view', 'edit', 'embed' ),
204
+    ),
205
+
206
+    'recurring_limit' => array(
207
+        'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ),
208
+        'type'        => 'integer',
209
+        'context'     => array( 'view', 'edit', 'embed' ),
210
+    ),
211
+
212
+    'is_free_trial'   => array(
213
+        'description' => __( 'Whether the item has a free trial period.', 'invoicing' ),
214
+        'type'        => 'integer',
215
+        'enum'        => array( 0, 1 ),
216
+        'context'     => array( 'view', 'edit', 'embed' ),
217
+    ),
218
+
219
+    'trial_period'    => array(
220
+        'description' => __( 'The trial period.', 'invoicing' ),
221
+        'type'        => 'string',
222
+        'context'     => array( 'view', 'edit', 'embed' ),
223
+        'enum'        => array( 'D', 'W', 'M', 'Y' ),
224
+    ),
225
+
226
+    'trial_interval'  => array(
227
+        'description' => __( 'The trial interval.', 'invoicing' ),
228
+        'type'        => 'integer',
229
+        'context'     => array( 'view', 'edit', 'embed' ),
230
+    ),
231
+
232
+    'first_renewal_date'       => array(
233
+        'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ),
234
+        'type'        => 'string',
235
+        'context'     => array( 'view', 'edit', 'embed' ),
236
+        'readonly'    => true,
237
+    ),
238
+
239
+    'edit_url'        => array(
240
+        'description' => __( 'The URL to edit an item.', 'invoicing' ),
241
+        'type'        => 'string',
242
+        'context'     => array( 'view', 'edit', 'embed' ),
243
+        'readonly'    => true,
244
+    ),
245 245
 );
Please login to merge, or discard this patch.