@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Prepare the selectable items. |
13 | 13 | $selectable = array(); |
14 | -foreach ( $form->get_items() as $item ) { |
|
15 | - if ( ! $item->is_required ) { |
|
16 | - $selectable[$item->get_id()] = strip_tags( $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ) ); |
|
14 | +foreach ($form->get_items() as $item) { |
|
15 | + if (!$item->is_required) { |
|
16 | + $selectable[$item->get_id()] = strip_tags($item->get_name() . ' — ' . wpinv_price($item->get_initial_price())); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | -if ( empty( $selectable ) ) { |
|
20 | +if (empty($selectable)) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | echo aui()->select( |
28 | 28 | array( |
29 | 29 | 'name' => 'getpaid-payment-form-selected-item', |
30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_'), |
|
31 | 31 | 'required' => true, |
32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
32 | + 'label' => __('Select Item', 'invoicing'), |
|
33 | 33 | 'label_type' => 'vertical', |
34 | 34 | 'inline' => false, |
35 | 35 | 'options' => $selectable, |
@@ -7,29 +7,29 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Prepare the selectable items. |
13 | 13 | $selectable = array(); |
14 | -foreach ( $form->get_items() as $item ) { |
|
15 | - if ( ! $item->is_required ) { |
|
16 | - $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ); |
|
14 | +foreach ($form->get_items() as $item) { |
|
15 | + if (!$item->is_required) { |
|
16 | + $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price($item->get_initial_price()); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | -if ( empty( $selectable ) ) { |
|
20 | +if (empty($selectable)) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
24 | 24 | echo '<div class="getpaid-payment-form-items-checkbox form-group">'; |
25 | 25 | |
26 | -foreach ( $selectable as $item_id => $item_name ) { |
|
26 | +foreach ($selectable as $item_id => $item_name) { |
|
27 | 27 | |
28 | 28 | echo aui()->input( |
29 | 29 | array( |
30 | 30 | 'type' => 'checkbox', |
31 | 31 | 'name' => 'getpaid-payment-form-selected-item', |
32 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
32 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_') . $item_id, |
|
33 | 33 | 'label' => $item_name, |
34 | 34 | 'value' => $item_id, |
35 | 35 | 'no_wrap' => true, |
@@ -8,22 +8,22 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | // Totals rows. |
14 | -$totals = getpaid_invoice_totals_rows( $invoice ); |
|
14 | +$totals = getpaid_invoice_totals_rows($invoice); |
|
15 | 15 | |
16 | -do_action( 'getpaid_before_email_line_totals', $invoice, $totals ); |
|
16 | +do_action('getpaid_before_email_line_totals', $invoice, $totals); |
|
17 | 17 | |
18 | 18 | ?> |
19 | 19 | |
20 | 20 | |
21 | -<?php if ( has_action( 'wpinv_email_footer_buttons' ) ) : ?> |
|
21 | +<?php if (has_action('wpinv_email_footer_buttons')) : ?> |
|
22 | 22 | |
23 | 23 | <tr class="wpinv_cart_footer_row"> |
24 | 24 | |
25 | - <td colspan="<?php echo ( (int) $column_count ); ?>"> |
|
26 | - <?php do_action( 'wpinv_email_footer_buttons' ); ?> |
|
25 | + <td colspan="<?php echo ((int) $column_count); ?>"> |
|
26 | + <?php do_action('wpinv_email_footer_buttons'); ?> |
|
27 | 27 | </td> |
28 | 28 | |
29 | 29 | </tr> |
@@ -31,44 +31,44 @@ discard block |
||
31 | 31 | <?php endif; ?> |
32 | 32 | |
33 | 33 | |
34 | -<?php foreach ( $totals as $key => $label ) : ?> |
|
34 | +<?php foreach ($totals as $key => $label) : ?> |
|
35 | 35 | |
36 | - <tr class="wpinv_cart_footer_row wpinv_cart_<?php echo sanitize_html_class( $key ); ?>_row"> |
|
36 | + <tr class="wpinv_cart_footer_row wpinv_cart_<?php echo sanitize_html_class($key); ?>_row"> |
|
37 | 37 | |
38 | - <td colspan="<?php echo ( $column_count - 1 ); ?>" class="wpinv_cart_<?php echo sanitize_html_class( $key ); ?>_label text-right"> |
|
39 | - <strong><?php echo sanitize_text_field( $label ); ?>:</strong> |
|
38 | + <td colspan="<?php echo ($column_count - 1); ?>" class="wpinv_cart_<?php echo sanitize_html_class($key); ?>_label text-right"> |
|
39 | + <strong><?php echo sanitize_text_field($label); ?>:</strong> |
|
40 | 40 | </td> |
41 | 41 | |
42 | - <td class="wpinv_cart_<?php echo sanitize_html_class( $key ); ?> text-right"> |
|
42 | + <td class="wpinv_cart_<?php echo sanitize_html_class($key); ?> text-right"> |
|
43 | 43 | |
44 | 44 | <?php |
45 | 45 | |
46 | 46 | // Total tax. |
47 | - if ( 'tax' == $key ) { |
|
48 | - echo wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ); |
|
47 | + if ('tax' == $key) { |
|
48 | + echo wpinv_price($invoice->get_total_tax(), $invoice->get_currency()); |
|
49 | 49 | } |
50 | 50 | |
51 | - if ( 'fee' == $key ) { |
|
52 | - echo wpinv_price( $invoice->get_total_fees(), $invoice->get_currency() ); |
|
51 | + if ('fee' == $key) { |
|
52 | + echo wpinv_price($invoice->get_total_fees(), $invoice->get_currency()); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // Total discount. |
56 | - if ( 'discount' == $key ) { |
|
57 | - echo wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ); |
|
56 | + if ('discount' == $key) { |
|
57 | + echo wpinv_price($invoice->get_total_discount(), $invoice->get_currency()); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // Sub total. |
61 | - if ( 'subtotal' == $key ) { |
|
62 | - echo wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ); |
|
61 | + if ('subtotal' == $key) { |
|
62 | + echo wpinv_price($invoice->get_subtotal(), $invoice->get_currency()); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Total. |
66 | - if ( 'total' == $key ) { |
|
67 | - echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
66 | + if ('total' == $key) { |
|
67 | + echo wpinv_price($invoice->get_total(), $invoice->get_currency()); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Fires when printing a cart total in an email. |
71 | - do_action( "getpaid_email_cart_totals_$key", $invoice ); |
|
71 | + do_action("getpaid_email_cart_totals_$key", $invoice); |
|
72 | 72 | |
73 | 73 | ?> |
74 | 74 | |
@@ -80,4 +80,4 @@ discard block |
||
80 | 80 | |
81 | 81 | <?php |
82 | 82 | |
83 | - do_action( 'getpaid_after_email_line_totals', $invoice, $totals ); |
|
83 | + do_action('getpaid_after_email_line_totals', $invoice, $totals); |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | -$column_count = count( $columns ); |
|
13 | +$column_count = count($columns); |
|
14 | 14 | ?> |
15 | 15 | |
16 | -<?php do_action( 'wpinv_before_email_items', $invoice ); ?> |
|
16 | +<?php do_action('wpinv_before_email_items', $invoice); ?> |
|
17 | 17 | |
18 | 18 | |
19 | 19 | <div id="wpinv-email-items"> |
20 | 20 | |
21 | 21 | <h3 class="invoice-items-title"> |
22 | - <?php echo sprintf( esc_html__( '%s Items', 'invoicing' ), ucfirst( $invoice->get_invoice_quote_type() )); ?> |
|
22 | + <?php echo sprintf(esc_html__('%s Items', 'invoicing'), ucfirst($invoice->get_invoice_quote_type())); ?> |
|
23 | 23 | </h3> |
24 | 24 | |
25 | 25 | <table class="table table-bordered table-hover"> |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <tr class="wpinv_cart_header_row"> |
30 | 30 | |
31 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
32 | - <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class( $key ); ?>"> |
|
33 | - <?php echo sanitize_text_field( $label ); ?> |
|
31 | + <?php foreach ($columns as $key => $label) : ?> |
|
32 | + <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class($key); ?>"> |
|
33 | + <?php echo sanitize_text_field($label); ?> |
|
34 | 34 | </th> |
35 | 35 | <?php endforeach; ?> |
36 | 36 | |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | <?php |
44 | 44 | |
45 | 45 | // Display the item totals. |
46 | - foreach ( $invoice->get_items() as $item ) { |
|
47 | - wpinv_get_template( 'emails/invoice-item.php', compact( 'invoice', 'item', 'columns' ) ); |
|
46 | + foreach ($invoice->get_items() as $item) { |
|
47 | + wpinv_get_template('emails/invoice-item.php', compact('invoice', 'item', 'columns')); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // Display the fee totals. |
51 | - foreach ( $invoice->get_fees() as $fee ) { |
|
52 | - wpinv_get_template( 'emails/fee-item.php', compact( 'invoice', 'fee', 'columns' ) ); |
|
51 | + foreach ($invoice->get_fees() as $fee) { |
|
52 | + wpinv_get_template('emails/fee-item.php', compact('invoice', 'fee', 'columns')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | ?> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | </tbody> |
58 | 58 | |
59 | 59 | <tfoot> |
60 | - <?php wpinv_get_template( 'emails/invoice-totals.php', compact( 'invoice', 'column_count' ) ); ?> |
|
60 | + <?php wpinv_get_template('emails/invoice-totals.php', compact('invoice', 'column_count')); ?> |
|
61 | 61 | </tfoot> |
62 | 62 | |
63 | 63 | </table> |
@@ -8,45 +8,45 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | * @var array $columns |
10 | 10 | */ |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | -$meta_data = getpaid_get_invoice_meta( $invoice ); |
|
13 | +$meta_data = getpaid_get_invoice_meta($invoice); |
|
14 | 14 | |
15 | -if ( isset( $meta_data['status'] ) ) { |
|
15 | +if (isset($meta_data['status'])) { |
|
16 | 16 | $meta_data['status']['value'] = $invoice->get_status_nicename(); |
17 | 17 | } |
18 | 18 | |
19 | -do_action( 'wpinv_email_before_invoice_details', $invoice, $sent_to_admin ); |
|
19 | +do_action('wpinv_email_before_invoice_details', $invoice, $sent_to_admin); |
|
20 | 20 | |
21 | 21 | ?> |
22 | 22 | |
23 | 23 | <div id="wpinv-email-details"> |
24 | 24 | |
25 | 25 | <h3 class="invoice-details-title"> |
26 | - <?php echo sprintf( esc_html__( '%s Details', 'invoicing' ), ucfirst( $invoice->get_invoice_quote_type() )); ?> |
|
26 | + <?php echo sprintf(esc_html__('%s Details', 'invoicing'), ucfirst($invoice->get_invoice_quote_type())); ?> |
|
27 | 27 | </h3> |
28 | 28 | |
29 | 29 | <table class="table table-bordered table-sm"> |
30 | 30 | |
31 | - <?php foreach ( $meta_data as $key => $data ) : ?> |
|
31 | + <?php foreach ($meta_data as $key => $data) : ?> |
|
32 | 32 | |
33 | - <?php if ( ! empty( $data['value'] ) ) : ?> |
|
33 | + <?php if (!empty($data['value'])) : ?> |
|
34 | 34 | |
35 | - <?php do_action( "getpaid_before_email_details_$key", $invoice, $data ); ?> |
|
35 | + <?php do_action("getpaid_before_email_details_$key", $invoice, $data); ?> |
|
36 | 36 | |
37 | - <tr class="getpaid-email-details-<?php echo sanitize_html_class( $key ); ?>"> |
|
37 | + <tr class="getpaid-email-details-<?php echo sanitize_html_class($key); ?>"> |
|
38 | 38 | |
39 | 39 | <td class="getpaid-lable-td"> |
40 | - <?php echo sanitize_text_field( $data['label'] ); ?> |
|
40 | + <?php echo sanitize_text_field($data['label']); ?> |
|
41 | 41 | </td> |
42 | 42 | |
43 | 43 | <td class="getpaid-value-td"> |
44 | - <span class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span> |
|
44 | + <span class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span> |
|
45 | 45 | </td> |
46 | 46 | |
47 | 47 | </tr> |
48 | 48 | |
49 | - <?php do_action( "getpaid_after_email_details_$key", $invoice, $data ); ?> |
|
49 | + <?php do_action("getpaid_after_email_details_$key", $invoice, $data); ?> |
|
50 | 50 | |
51 | 51 | <?php endif; ?> |
52 | 52 | |
@@ -56,4 +56,4 @@ discard block |
||
56 | 56 | |
57 | 57 | </div> |
58 | 58 | |
59 | -<?php do_action( 'wpinv_email_after_invoice_details', $invoice, $sent_to_admin ); ?> |
|
59 | +<?php do_action('wpinv_email_after_invoice_details', $invoice, $sent_to_admin); ?> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | ?> |
14 | 14 | |
@@ -21,43 +21,43 @@ discard block |
||
21 | 21 | $actions[] = sprintf( |
22 | 22 | '<a href="javascript:void(0)" class="btn btn-sm m-1 d-inline-block btn-secondary invoice-action-print d-none d-lg-inline-block" onclick="window.print();">%s</a>', |
23 | 23 | sprintf( |
24 | - __( 'Print %s', 'invoicing' ), |
|
25 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
24 | + __('Print %s', 'invoicing'), |
|
25 | + ucfirst($invoice->get_invoice_quote_type()) |
|
26 | 26 | ) |
27 | 27 | ); |
28 | 28 | |
29 | - if ( is_user_logged_in() ) { |
|
29 | + if (is_user_logged_in()) { |
|
30 | 30 | |
31 | 31 | $actions[] = sprintf( |
32 | 32 | '<a href="%s" class="btn btn-sm btn-secondary m-1 d-inline-block invoice-action-history">%s</a>', |
33 | - esc_url( wpinv_get_history_page_uri( $invoice->get_post_type() ) ), |
|
33 | + esc_url(wpinv_get_history_page_uri($invoice->get_post_type())), |
|
34 | 34 | sprintf( |
35 | - __( '%s History', 'invoicing' ), |
|
36 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
35 | + __('%s History', 'invoicing'), |
|
36 | + ucfirst($invoice->get_invoice_quote_type()) |
|
37 | 37 | ) |
38 | 38 | ); |
39 | 39 | |
40 | 40 | } |
41 | 41 | |
42 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
42 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
43 | 43 | |
44 | 44 | $actions[] = sprintf( |
45 | 45 | '<a href="%s" class="btn btn-sm btn-secondary m-1 d-inline-block invoice-action-edit">%s</a>', |
46 | - esc_url( get_edit_post_link( $invoice->get_id() ) ), |
|
46 | + esc_url(get_edit_post_link($invoice->get_id())), |
|
47 | 47 | sprintf( |
48 | - __( 'Edit %s', 'invoicing' ), |
|
49 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
48 | + __('Edit %s', 'invoicing'), |
|
49 | + ucfirst($invoice->get_invoice_quote_type()) |
|
50 | 50 | ) |
51 | 51 | ); |
52 | 52 | |
53 | 53 | } |
54 | 54 | |
55 | - $actions = apply_filters( 'getpaid_invoice_header_right_actions_array', $actions, $invoice ); |
|
56 | - echo implode( '', $actions ); |
|
55 | + $actions = apply_filters('getpaid_invoice_header_right_actions_array', $actions, $invoice); |
|
56 | + echo implode('', $actions); |
|
57 | 57 | |
58 | 58 | ?> |
59 | 59 | |
60 | - <?php do_action('wpinv_invoice_display_right_actions', $invoice ); ?> |
|
60 | + <?php do_action('wpinv_invoice_display_right_actions', $invoice); ?> |
|
61 | 61 | </div> |
62 | 62 | |
63 | 63 | <?php |
@@ -7,11 +7,11 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | <h2 class="h3 text-dark"> |
14 | - <?php echo apply_filters( 'getpaid_invoice_type_label', ucfirst( $invoice->get_invoice_quote_type() ), $invoice ); ?> |
|
14 | + <?php echo apply_filters('getpaid_invoice_type_label', ucfirst($invoice->get_invoice_quote_type()), $invoice); ?> |
|
15 | 15 | </h2> |
16 | 16 | |
17 | 17 | <?php |
@@ -12,49 +12,49 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class GetPaid_Reports { |
14 | 14 | |
15 | - /** |
|
16 | - * Class constructor. |
|
17 | - * |
|
18 | - */ |
|
19 | - public function __construct() { |
|
20 | - add_action( 'admin_menu', array( $this, 'register_reports_page' ), 20 ); |
|
21 | - add_action( 'wpinv_reports_tab_reports', array( $this, 'display_reports_tab' ) ); |
|
22 | - add_action( 'wpinv_reports_tab_export', array( $this, 'display_exports_tab' ) ); |
|
23 | - add_action( 'getpaid_authenticated_admin_action_download_graph', array( $this, 'download_graph' ) ); |
|
24 | - add_action( 'getpaid_authenticated_admin_action_export_invoices', array( $this, 'export_invoices' ) ); |
|
25 | - |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * Registers the reports page. |
|
30 | - * |
|
31 | - */ |
|
32 | - public function register_reports_page() { |
|
33 | - |
|
34 | - add_submenu_page( |
|
15 | + /** |
|
16 | + * Class constructor. |
|
17 | + * |
|
18 | + */ |
|
19 | + public function __construct() { |
|
20 | + add_action( 'admin_menu', array( $this, 'register_reports_page' ), 20 ); |
|
21 | + add_action( 'wpinv_reports_tab_reports', array( $this, 'display_reports_tab' ) ); |
|
22 | + add_action( 'wpinv_reports_tab_export', array( $this, 'display_exports_tab' ) ); |
|
23 | + add_action( 'getpaid_authenticated_admin_action_download_graph', array( $this, 'download_graph' ) ); |
|
24 | + add_action( 'getpaid_authenticated_admin_action_export_invoices', array( $this, 'export_invoices' ) ); |
|
25 | + |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * Registers the reports page. |
|
30 | + * |
|
31 | + */ |
|
32 | + public function register_reports_page() { |
|
33 | + |
|
34 | + add_submenu_page( |
|
35 | 35 | 'wpinv', |
36 | 36 | __( 'Reports', 'invoicing' ), |
37 | 37 | __( 'Reports', 'invoicing' ), |
38 | 38 | wpinv_get_capability(), |
39 | 39 | 'wpinv-reports', |
40 | 40 | array( $this, 'display_reports_page' ) |
41 | - ); |
|
41 | + ); |
|
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Displays the reports page. |
|
47 | - * |
|
48 | - */ |
|
49 | - public function display_reports_page() { |
|
45 | + /** |
|
46 | + * Displays the reports page. |
|
47 | + * |
|
48 | + */ |
|
49 | + public function display_reports_page() { |
|
50 | 50 | |
51 | - // Prepare variables. |
|
52 | - $tabs = $this->get_tabs(); |
|
53 | - $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'reports'; |
|
54 | - $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'reports'; |
|
51 | + // Prepare variables. |
|
52 | + $tabs = $this->get_tabs(); |
|
53 | + $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'reports'; |
|
54 | + $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'reports'; |
|
55 | 55 | |
56 | - // Display the current tab. |
|
57 | - ?> |
|
56 | + // Display the current tab. |
|
57 | + ?> |
|
58 | 58 | |
59 | 59 | <div class="wrap"> |
60 | 60 | |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | <nav class="nav-tab-wrapper"> |
64 | 64 | |
65 | 65 | <?php |
66 | - foreach( $tabs as $key => $label ) { |
|
66 | + foreach( $tabs as $key => $label ) { |
|
67 | 67 | |
68 | - $key = sanitize_text_field( $key ); |
|
69 | - $label = sanitize_text_field( $label ); |
|
70 | - $class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab'; |
|
71 | - $url = esc_url( |
|
72 | - add_query_arg( 'tab', $key, admin_url( 'admin.php?page=wpinv-reports' ) ) |
|
73 | - ); |
|
68 | + $key = sanitize_text_field( $key ); |
|
69 | + $label = sanitize_text_field( $label ); |
|
70 | + $class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab'; |
|
71 | + $url = esc_url( |
|
72 | + add_query_arg( 'tab', $key, admin_url( 'admin.php?page=wpinv-reports' ) ) |
|
73 | + ); |
|
74 | 74 | |
75 | - echo "\n\t\t\t<a href='$url' class='$class'>$label</a>"; |
|
75 | + echo "\n\t\t\t<a href='$url' class='$class'>$label</a>"; |
|
76 | 76 | |
77 | - } |
|
78 | - ?> |
|
77 | + } |
|
78 | + ?> |
|
79 | 79 | |
80 | 80 | </nav> |
81 | 81 | |
@@ -86,77 +86,77 @@ discard block |
||
86 | 86 | </div> |
87 | 87 | <?php |
88 | 88 | |
89 | - // Wordfence loads an unsupported version of chart js on our page. |
|
90 | - wp_deregister_style( 'chart-js' ); |
|
91 | - wp_deregister_script( 'chart-js' ); |
|
92 | - wp_enqueue_script( 'chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.bundle.min.js', array( 'jquery' ), '2.9.4', true ); |
|
93 | - wp_enqueue_style( 'chart-js', WPINV_PLUGIN_URL . 'assets/css/chart.min.css', array(), '2.9.4' ); |
|
94 | - |
|
95 | - } |
|
96 | - |
|
97 | - /** |
|
98 | - * Retrieves reports page tabs. |
|
99 | - * |
|
100 | - * @return array |
|
101 | - */ |
|
102 | - public function get_tabs() { |
|
103 | - |
|
104 | - $tabs = array( |
|
105 | - 'reports' => __( 'Reports', 'invoicing' ), |
|
106 | - 'export' => __( 'Export', 'invoicing' ), |
|
107 | - ); |
|
108 | - |
|
109 | - return apply_filters( 'getpaid_report_tabs', $tabs ); |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Displays the reports tab. |
|
114 | - * |
|
115 | - */ |
|
116 | - public function display_reports_tab() { |
|
117 | - |
|
118 | - $reports = new GetPaid_Reports_Report(); |
|
119 | - $reports->display(); |
|
120 | - |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * Displays the exports tab. |
|
125 | - * |
|
126 | - */ |
|
127 | - public function display_exports_tab() { |
|
128 | - |
|
129 | - $exports = new GetPaid_Reports_Export(); |
|
130 | - $exports->display(); |
|
131 | - |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * Donwnloads a graph. |
|
136 | - * |
|
137 | - * @param array $args |
|
138 | - */ |
|
139 | - public function download_graph( $args ) { |
|
140 | - |
|
141 | - if ( ! empty( $args['graph'] ) ) { |
|
142 | - $downloader = new GetPaid_Graph_Downloader(); |
|
143 | - $downloader->download( $args['graph'] ); |
|
144 | - } |
|
145 | - |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Exports invoices. |
|
150 | - * |
|
151 | - * @param array $args |
|
152 | - */ |
|
153 | - public function export_invoices( $args ) { |
|
154 | - |
|
155 | - if ( ! empty( $args['post_type'] ) ) { |
|
156 | - $downloader = new GetPaid_Invoice_Exporter(); |
|
157 | - $downloader->export( $args['post_type'], $args ); |
|
158 | - } |
|
159 | - |
|
160 | - } |
|
89 | + // Wordfence loads an unsupported version of chart js on our page. |
|
90 | + wp_deregister_style( 'chart-js' ); |
|
91 | + wp_deregister_script( 'chart-js' ); |
|
92 | + wp_enqueue_script( 'chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.bundle.min.js', array( 'jquery' ), '2.9.4', true ); |
|
93 | + wp_enqueue_style( 'chart-js', WPINV_PLUGIN_URL . 'assets/css/chart.min.css', array(), '2.9.4' ); |
|
94 | + |
|
95 | + } |
|
96 | + |
|
97 | + /** |
|
98 | + * Retrieves reports page tabs. |
|
99 | + * |
|
100 | + * @return array |
|
101 | + */ |
|
102 | + public function get_tabs() { |
|
103 | + |
|
104 | + $tabs = array( |
|
105 | + 'reports' => __( 'Reports', 'invoicing' ), |
|
106 | + 'export' => __( 'Export', 'invoicing' ), |
|
107 | + ); |
|
108 | + |
|
109 | + return apply_filters( 'getpaid_report_tabs', $tabs ); |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Displays the reports tab. |
|
114 | + * |
|
115 | + */ |
|
116 | + public function display_reports_tab() { |
|
117 | + |
|
118 | + $reports = new GetPaid_Reports_Report(); |
|
119 | + $reports->display(); |
|
120 | + |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * Displays the exports tab. |
|
125 | + * |
|
126 | + */ |
|
127 | + public function display_exports_tab() { |
|
128 | + |
|
129 | + $exports = new GetPaid_Reports_Export(); |
|
130 | + $exports->display(); |
|
131 | + |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * Donwnloads a graph. |
|
136 | + * |
|
137 | + * @param array $args |
|
138 | + */ |
|
139 | + public function download_graph( $args ) { |
|
140 | + |
|
141 | + if ( ! empty( $args['graph'] ) ) { |
|
142 | + $downloader = new GetPaid_Graph_Downloader(); |
|
143 | + $downloader->download( $args['graph'] ); |
|
144 | + } |
|
145 | + |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * Exports invoices. |
|
150 | + * |
|
151 | + * @param array $args |
|
152 | + */ |
|
153 | + public function export_invoices( $args ) { |
|
154 | + |
|
155 | + if ( ! empty( $args['post_type'] ) ) { |
|
156 | + $downloader = new GetPaid_Invoice_Exporter(); |
|
157 | + $downloader->export( $args['post_type'], $args ); |
|
158 | + } |
|
159 | + |
|
160 | + } |
|
161 | 161 | |
162 | 162 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * GetPaid_Reports Class. |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | * |
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | - add_action( 'admin_menu', array( $this, 'register_reports_page' ), 20 ); |
|
21 | - add_action( 'wpinv_reports_tab_reports', array( $this, 'display_reports_tab' ) ); |
|
22 | - add_action( 'wpinv_reports_tab_export', array( $this, 'display_exports_tab' ) ); |
|
23 | - add_action( 'getpaid_authenticated_admin_action_download_graph', array( $this, 'download_graph' ) ); |
|
24 | - add_action( 'getpaid_authenticated_admin_action_export_invoices', array( $this, 'export_invoices' ) ); |
|
20 | + add_action('admin_menu', array($this, 'register_reports_page'), 20); |
|
21 | + add_action('wpinv_reports_tab_reports', array($this, 'display_reports_tab')); |
|
22 | + add_action('wpinv_reports_tab_export', array($this, 'display_exports_tab')); |
|
23 | + add_action('getpaid_authenticated_admin_action_download_graph', array($this, 'download_graph')); |
|
24 | + add_action('getpaid_authenticated_admin_action_export_invoices', array($this, 'export_invoices')); |
|
25 | 25 | |
26 | 26 | } |
27 | 27 | |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | |
34 | 34 | add_submenu_page( |
35 | 35 | 'wpinv', |
36 | - __( 'Reports', 'invoicing' ), |
|
37 | - __( 'Reports', 'invoicing' ), |
|
36 | + __('Reports', 'invoicing'), |
|
37 | + __('Reports', 'invoicing'), |
|
38 | 38 | wpinv_get_capability(), |
39 | 39 | 'wpinv-reports', |
40 | - array( $this, 'display_reports_page' ) |
|
40 | + array($this, 'display_reports_page') |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | } |
@@ -50,26 +50,26 @@ discard block |
||
50 | 50 | |
51 | 51 | // Prepare variables. |
52 | 52 | $tabs = $this->get_tabs(); |
53 | - $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'reports'; |
|
54 | - $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'reports'; |
|
53 | + $current_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'reports'; |
|
54 | + $current_tab = array_key_exists($current_tab, $tabs) ? $current_tab : 'reports'; |
|
55 | 55 | |
56 | 56 | // Display the current tab. |
57 | 57 | ?> |
58 | 58 | |
59 | 59 | <div class="wrap"> |
60 | 60 | |
61 | - <h1><?php echo sanitize_text_field( $tabs[ $current_tab ] ); ?></h1> |
|
61 | + <h1><?php echo sanitize_text_field($tabs[$current_tab]); ?></h1> |
|
62 | 62 | |
63 | 63 | <nav class="nav-tab-wrapper"> |
64 | 64 | |
65 | 65 | <?php |
66 | - foreach( $tabs as $key => $label ) { |
|
66 | + foreach ($tabs as $key => $label) { |
|
67 | 67 | |
68 | - $key = sanitize_text_field( $key ); |
|
69 | - $label = sanitize_text_field( $label ); |
|
68 | + $key = sanitize_text_field($key); |
|
69 | + $label = sanitize_text_field($label); |
|
70 | 70 | $class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab'; |
71 | 71 | $url = esc_url( |
72 | - add_query_arg( 'tab', $key, admin_url( 'admin.php?page=wpinv-reports' ) ) |
|
72 | + add_query_arg('tab', $key, admin_url('admin.php?page=wpinv-reports')) |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | echo "\n\t\t\t<a href='$url' class='$class'>$label</a>"; |
@@ -79,18 +79,18 @@ discard block |
||
79 | 79 | |
80 | 80 | </nav> |
81 | 81 | |
82 | - <div class="bsui <?php echo esc_attr( $current_tab ); ?>"> |
|
83 | - <?php do_action( "wpinv_reports_tab_{$current_tab}" ); ?> |
|
82 | + <div class="bsui <?php echo esc_attr($current_tab); ?>"> |
|
83 | + <?php do_action("wpinv_reports_tab_{$current_tab}"); ?> |
|
84 | 84 | </div> |
85 | 85 | |
86 | 86 | </div> |
87 | 87 | <?php |
88 | 88 | |
89 | 89 | // Wordfence loads an unsupported version of chart js on our page. |
90 | - wp_deregister_style( 'chart-js' ); |
|
91 | - wp_deregister_script( 'chart-js' ); |
|
92 | - wp_enqueue_script( 'chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.bundle.min.js', array( 'jquery' ), '2.9.4', true ); |
|
93 | - wp_enqueue_style( 'chart-js', WPINV_PLUGIN_URL . 'assets/css/chart.min.css', array(), '2.9.4' ); |
|
90 | + wp_deregister_style('chart-js'); |
|
91 | + wp_deregister_script('chart-js'); |
|
92 | + wp_enqueue_script('chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.bundle.min.js', array('jquery'), '2.9.4', true); |
|
93 | + wp_enqueue_style('chart-js', WPINV_PLUGIN_URL . 'assets/css/chart.min.css', array(), '2.9.4'); |
|
94 | 94 | |
95 | 95 | } |
96 | 96 | |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | public function get_tabs() { |
103 | 103 | |
104 | 104 | $tabs = array( |
105 | - 'reports' => __( 'Reports', 'invoicing' ), |
|
106 | - 'export' => __( 'Export', 'invoicing' ), |
|
105 | + 'reports' => __('Reports', 'invoicing'), |
|
106 | + 'export' => __('Export', 'invoicing'), |
|
107 | 107 | ); |
108 | 108 | |
109 | - return apply_filters( 'getpaid_report_tabs', $tabs ); |
|
109 | + return apply_filters('getpaid_report_tabs', $tabs); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @param array $args |
138 | 138 | */ |
139 | - public function download_graph( $args ) { |
|
139 | + public function download_graph($args) { |
|
140 | 140 | |
141 | - if ( ! empty( $args['graph'] ) ) { |
|
141 | + if (!empty($args['graph'])) { |
|
142 | 142 | $downloader = new GetPaid_Graph_Downloader(); |
143 | - $downloader->download( $args['graph'] ); |
|
143 | + $downloader->download($args['graph']); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | } |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @param array $args |
152 | 152 | */ |
153 | - public function export_invoices( $args ) { |
|
153 | + public function export_invoices($args) { |
|
154 | 154 | |
155 | - if ( ! empty( $args['post_type'] ) ) { |
|
155 | + if (!empty($args['post_type'])) { |
|
156 | 156 | $downloader = new GetPaid_Invoice_Exporter(); |
157 | - $downloader->export( $args['post_type'], $args ); |
|
157 | + $downloader->export($args['post_type'], $args); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } |
@@ -15,319 +15,319 @@ |
||
15 | 15 | class GetPaid_Post_Types { |
16 | 16 | |
17 | 17 | /** |
18 | - * Hook in methods. |
|
19 | - */ |
|
20 | - public function __construct() { |
|
21 | - add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 ); |
|
22 | - add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 ); |
|
23 | - add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
24 | - add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) ); |
|
25 | - } |
|
18 | + * Hook in methods. |
|
19 | + */ |
|
20 | + public function __construct() { |
|
21 | + add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 ); |
|
22 | + add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 ); |
|
23 | + add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
24 | + add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) ); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Register core post types. |
|
29 | - */ |
|
30 | - public static function register_post_types() { |
|
27 | + /** |
|
28 | + * Register core post types. |
|
29 | + */ |
|
30 | + public static function register_post_types() { |
|
31 | 31 | |
32 | - if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) { |
|
33 | - return; |
|
34 | - } |
|
32 | + if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) { |
|
33 | + return; |
|
34 | + } |
|
35 | 35 | |
36 | - // Fires before registering post types. |
|
37 | - do_action( 'getpaid_register_post_types' ); |
|
36 | + // Fires before registering post types. |
|
37 | + do_action( 'getpaid_register_post_types' ); |
|
38 | 38 | |
39 | - // Register item post type. |
|
40 | - register_post_type( |
|
41 | - 'wpi_item', |
|
42 | - apply_filters( |
|
43 | - 'wpinv_register_post_type_invoice_item', |
|
44 | - array( |
|
45 | - 'labels' => array( |
|
46 | - 'name' => _x( 'Items', 'post type general name', 'invoicing' ), |
|
47 | - 'singular_name' => _x( 'Item', 'post type singular name', 'invoicing' ), |
|
48 | - 'menu_name' => _x( 'Items', 'admin menu', 'invoicing' ), |
|
49 | - 'name_admin_bar' => _x( 'Item', 'add new on admin bar', 'invoicing' ), |
|
50 | - 'add_new' => _x( 'Add New', 'Item', 'invoicing' ), |
|
51 | - 'add_new_item' => __( 'Add New Item', 'invoicing' ), |
|
52 | - 'new_item' => __( 'New Item', 'invoicing' ), |
|
53 | - 'edit_item' => __( 'Edit Item', 'invoicing' ), |
|
54 | - 'view_item' => __( 'View Item', 'invoicing' ), |
|
55 | - 'all_items' => __( 'Items', 'invoicing' ), |
|
56 | - 'search_items' => __( 'Search items', 'invoicing' ), |
|
57 | - 'parent_item_colon' => __( 'Parent item:', 'invoicing' ), |
|
58 | - 'not_found' => __( 'No items found.', 'invoicing' ), |
|
59 | - 'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' ) |
|
60 | - ), |
|
61 | - 'description' => __( 'This is where you can add new invoice items.', 'invoicing' ), |
|
62 | - 'public' => false, |
|
63 | - 'has_archive' => false, |
|
64 | - '_builtin' => false, |
|
65 | - 'show_ui' => true, |
|
66 | - 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
67 | - 'show_in_nav_menus' => false, |
|
68 | - 'supports' => array( 'title', 'excerpt', 'thumbnail' ), |
|
69 | - 'rewrite' => false, |
|
70 | - 'query_var' => false, |
|
71 | - 'map_meta_cap' => true, |
|
72 | - 'show_in_admin_bar' => true, |
|
73 | - 'can_export' => true, |
|
74 | - ) |
|
75 | - ) |
|
76 | - ); |
|
39 | + // Register item post type. |
|
40 | + register_post_type( |
|
41 | + 'wpi_item', |
|
42 | + apply_filters( |
|
43 | + 'wpinv_register_post_type_invoice_item', |
|
44 | + array( |
|
45 | + 'labels' => array( |
|
46 | + 'name' => _x( 'Items', 'post type general name', 'invoicing' ), |
|
47 | + 'singular_name' => _x( 'Item', 'post type singular name', 'invoicing' ), |
|
48 | + 'menu_name' => _x( 'Items', 'admin menu', 'invoicing' ), |
|
49 | + 'name_admin_bar' => _x( 'Item', 'add new on admin bar', 'invoicing' ), |
|
50 | + 'add_new' => _x( 'Add New', 'Item', 'invoicing' ), |
|
51 | + 'add_new_item' => __( 'Add New Item', 'invoicing' ), |
|
52 | + 'new_item' => __( 'New Item', 'invoicing' ), |
|
53 | + 'edit_item' => __( 'Edit Item', 'invoicing' ), |
|
54 | + 'view_item' => __( 'View Item', 'invoicing' ), |
|
55 | + 'all_items' => __( 'Items', 'invoicing' ), |
|
56 | + 'search_items' => __( 'Search items', 'invoicing' ), |
|
57 | + 'parent_item_colon' => __( 'Parent item:', 'invoicing' ), |
|
58 | + 'not_found' => __( 'No items found.', 'invoicing' ), |
|
59 | + 'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' ) |
|
60 | + ), |
|
61 | + 'description' => __( 'This is where you can add new invoice items.', 'invoicing' ), |
|
62 | + 'public' => false, |
|
63 | + 'has_archive' => false, |
|
64 | + '_builtin' => false, |
|
65 | + 'show_ui' => true, |
|
66 | + 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
67 | + 'show_in_nav_menus' => false, |
|
68 | + 'supports' => array( 'title', 'excerpt', 'thumbnail' ), |
|
69 | + 'rewrite' => false, |
|
70 | + 'query_var' => false, |
|
71 | + 'map_meta_cap' => true, |
|
72 | + 'show_in_admin_bar' => true, |
|
73 | + 'can_export' => true, |
|
74 | + ) |
|
75 | + ) |
|
76 | + ); |
|
77 | 77 | |
78 | - // Register payment form post type. |
|
79 | - register_post_type( |
|
80 | - 'wpi_payment_form', |
|
81 | - apply_filters( |
|
82 | - 'wpinv_register_post_type_payment_form', |
|
83 | - array( |
|
84 | - 'labels' => array( |
|
85 | - 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
86 | - 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
87 | - 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
88 | - 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
89 | - 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
90 | - 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
91 | - 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
92 | - 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
93 | - 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
94 | - 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
95 | - 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
96 | - 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
97 | - 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
98 | - 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ) |
|
99 | - ), |
|
100 | - 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
101 | - 'public' => false, |
|
102 | - 'show_ui' => true, |
|
103 | - 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : true, |
|
104 | - 'show_in_nav_menus' => false, |
|
105 | - 'query_var' => false, |
|
106 | - 'rewrite' => true, |
|
107 | - 'map_meta_cap' => true, |
|
108 | - 'has_archive' => false, |
|
109 | - 'hierarchical' => false, |
|
110 | - 'menu_position' => null, |
|
111 | - 'supports' => array( 'title' ), |
|
112 | - 'menu_icon' => 'dashicons-media-form', |
|
113 | - ) |
|
114 | - ) |
|
115 | - ); |
|
78 | + // Register payment form post type. |
|
79 | + register_post_type( |
|
80 | + 'wpi_payment_form', |
|
81 | + apply_filters( |
|
82 | + 'wpinv_register_post_type_payment_form', |
|
83 | + array( |
|
84 | + 'labels' => array( |
|
85 | + 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
86 | + 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
87 | + 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
88 | + 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
89 | + 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
90 | + 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
91 | + 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
92 | + 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
93 | + 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
94 | + 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
95 | + 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
96 | + 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
97 | + 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
98 | + 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ) |
|
99 | + ), |
|
100 | + 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
101 | + 'public' => false, |
|
102 | + 'show_ui' => true, |
|
103 | + 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : true, |
|
104 | + 'show_in_nav_menus' => false, |
|
105 | + 'query_var' => false, |
|
106 | + 'rewrite' => true, |
|
107 | + 'map_meta_cap' => true, |
|
108 | + 'has_archive' => false, |
|
109 | + 'hierarchical' => false, |
|
110 | + 'menu_position' => null, |
|
111 | + 'supports' => array( 'title' ), |
|
112 | + 'menu_icon' => 'dashicons-media-form', |
|
113 | + ) |
|
114 | + ) |
|
115 | + ); |
|
116 | 116 | |
117 | - // Register invoice post type. |
|
118 | - register_post_type( |
|
119 | - 'wpi_invoice', |
|
120 | - apply_filters( |
|
121 | - 'wpinv_register_post_type_invoice', |
|
122 | - array( |
|
123 | - 'labels' => array( |
|
124 | - 'name' => __( 'Invoices', 'invoicing' ), |
|
125 | - 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
126 | - 'all_items' => __( 'Invoices', 'invoicing' ), |
|
127 | - 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
128 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
129 | - 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
130 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
131 | - 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
132 | - 'new_item' => __( 'New invoice', 'invoicing' ), |
|
133 | - 'view_item' => __( 'View invoice', 'invoicing' ), |
|
134 | - 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
135 | - 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
136 | - 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
137 | - 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
138 | - 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
139 | - 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
140 | - 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
141 | - 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
142 | - 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
143 | - 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
144 | - 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
145 | - 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
146 | - 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
147 | - 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
148 | - ), |
|
149 | - 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
150 | - 'public' => true, |
|
151 | - 'has_archive' => false, |
|
152 | - 'publicly_queryable' => true, |
|
153 | - 'exclude_from_search' => true, |
|
154 | - 'show_ui' => true, |
|
155 | - 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
156 | - 'show_in_nav_menus' => false, |
|
157 | - 'supports' => array( 'title', 'author', 'excerpt' ), |
|
158 | - 'rewrite' => array( |
|
159 | - 'slug' => 'invoice', |
|
160 | - 'with_front' => false, |
|
161 | - ), |
|
162 | - 'query_var' => false, |
|
163 | - 'map_meta_cap' => true, |
|
164 | - 'show_in_admin_bar' => true, |
|
165 | - 'can_export' => true, |
|
166 | - 'hierarchical' => false, |
|
167 | - 'menu_position' => null, |
|
168 | - 'menu_icon' => 'dashicons-media-spreadsheet', |
|
169 | - ) |
|
170 | - ) |
|
171 | - ); |
|
117 | + // Register invoice post type. |
|
118 | + register_post_type( |
|
119 | + 'wpi_invoice', |
|
120 | + apply_filters( |
|
121 | + 'wpinv_register_post_type_invoice', |
|
122 | + array( |
|
123 | + 'labels' => array( |
|
124 | + 'name' => __( 'Invoices', 'invoicing' ), |
|
125 | + 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
126 | + 'all_items' => __( 'Invoices', 'invoicing' ), |
|
127 | + 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
128 | + 'add_new' => __( 'Add New', 'invoicing' ), |
|
129 | + 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
130 | + 'edit' => __( 'Edit', 'invoicing' ), |
|
131 | + 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
132 | + 'new_item' => __( 'New invoice', 'invoicing' ), |
|
133 | + 'view_item' => __( 'View invoice', 'invoicing' ), |
|
134 | + 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
135 | + 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
136 | + 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
137 | + 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
138 | + 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
139 | + 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
140 | + 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
141 | + 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
142 | + 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
143 | + 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
144 | + 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
145 | + 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
146 | + 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
147 | + 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
148 | + ), |
|
149 | + 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
150 | + 'public' => true, |
|
151 | + 'has_archive' => false, |
|
152 | + 'publicly_queryable' => true, |
|
153 | + 'exclude_from_search' => true, |
|
154 | + 'show_ui' => true, |
|
155 | + 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
156 | + 'show_in_nav_menus' => false, |
|
157 | + 'supports' => array( 'title', 'author', 'excerpt' ), |
|
158 | + 'rewrite' => array( |
|
159 | + 'slug' => 'invoice', |
|
160 | + 'with_front' => false, |
|
161 | + ), |
|
162 | + 'query_var' => false, |
|
163 | + 'map_meta_cap' => true, |
|
164 | + 'show_in_admin_bar' => true, |
|
165 | + 'can_export' => true, |
|
166 | + 'hierarchical' => false, |
|
167 | + 'menu_position' => null, |
|
168 | + 'menu_icon' => 'dashicons-media-spreadsheet', |
|
169 | + ) |
|
170 | + ) |
|
171 | + ); |
|
172 | 172 | |
173 | - // Register discount post type. |
|
174 | - register_post_type( |
|
175 | - 'wpi_discount', |
|
176 | - apply_filters( |
|
177 | - 'wpinv_register_post_type_discount', |
|
178 | - array( |
|
179 | - 'labels' => array( |
|
180 | - 'name' => __( 'Discounts', 'invoicing' ), |
|
181 | - 'singular_name' => __( 'Discount', 'invoicing' ), |
|
182 | - 'all_items' => __( 'Discounts', 'invoicing' ), |
|
183 | - 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
184 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
185 | - 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
186 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
187 | - 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
188 | - 'new_item' => __( 'New discount', 'invoicing' ), |
|
189 | - 'view_item' => __( 'View discount', 'invoicing' ), |
|
190 | - 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
191 | - 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
192 | - 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
193 | - 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
194 | - 'parent' => __( 'Parent discount', 'invoicing' ), |
|
195 | - 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
196 | - 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
197 | - 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
198 | - 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
199 | - 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
200 | - 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
201 | - 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
202 | - 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
203 | - 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
204 | - ), |
|
205 | - 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
206 | - 'public' => false, |
|
207 | - 'can_export' => true, |
|
208 | - '_builtin' => false, |
|
209 | - 'publicly_queryable' => false, |
|
210 | - 'exclude_from_search'=> true, |
|
211 | - 'show_ui' => true, |
|
212 | - 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
213 | - 'query_var' => false, |
|
214 | - 'rewrite' => false, |
|
215 | - 'map_meta_cap' => true, |
|
216 | - 'has_archive' => false, |
|
217 | - 'hierarchical' => false, |
|
218 | - 'supports' => array( 'title', 'excerpt' ), |
|
219 | - 'show_in_nav_menus' => false, |
|
220 | - 'show_in_admin_bar' => true, |
|
221 | - 'menu_position' => null, |
|
222 | - ) |
|
223 | - ) |
|
224 | - ); |
|
173 | + // Register discount post type. |
|
174 | + register_post_type( |
|
175 | + 'wpi_discount', |
|
176 | + apply_filters( |
|
177 | + 'wpinv_register_post_type_discount', |
|
178 | + array( |
|
179 | + 'labels' => array( |
|
180 | + 'name' => __( 'Discounts', 'invoicing' ), |
|
181 | + 'singular_name' => __( 'Discount', 'invoicing' ), |
|
182 | + 'all_items' => __( 'Discounts', 'invoicing' ), |
|
183 | + 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
184 | + 'add_new' => __( 'Add New', 'invoicing' ), |
|
185 | + 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
186 | + 'edit' => __( 'Edit', 'invoicing' ), |
|
187 | + 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
188 | + 'new_item' => __( 'New discount', 'invoicing' ), |
|
189 | + 'view_item' => __( 'View discount', 'invoicing' ), |
|
190 | + 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
191 | + 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
192 | + 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
193 | + 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
194 | + 'parent' => __( 'Parent discount', 'invoicing' ), |
|
195 | + 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
196 | + 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
197 | + 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
198 | + 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
199 | + 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
200 | + 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
201 | + 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
202 | + 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
203 | + 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
204 | + ), |
|
205 | + 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
206 | + 'public' => false, |
|
207 | + 'can_export' => true, |
|
208 | + '_builtin' => false, |
|
209 | + 'publicly_queryable' => false, |
|
210 | + 'exclude_from_search'=> true, |
|
211 | + 'show_ui' => true, |
|
212 | + 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
213 | + 'query_var' => false, |
|
214 | + 'rewrite' => false, |
|
215 | + 'map_meta_cap' => true, |
|
216 | + 'has_archive' => false, |
|
217 | + 'hierarchical' => false, |
|
218 | + 'supports' => array( 'title', 'excerpt' ), |
|
219 | + 'show_in_nav_menus' => false, |
|
220 | + 'show_in_admin_bar' => true, |
|
221 | + 'menu_position' => null, |
|
222 | + ) |
|
223 | + ) |
|
224 | + ); |
|
225 | 225 | |
226 | - do_action( 'getpaid_after_register_post_types' ); |
|
227 | - } |
|
226 | + do_action( 'getpaid_after_register_post_types' ); |
|
227 | + } |
|
228 | 228 | |
229 | - /** |
|
230 | - * Register our custom post statuses. |
|
231 | - */ |
|
232 | - public static function register_post_status() { |
|
229 | + /** |
|
230 | + * Register our custom post statuses. |
|
231 | + */ |
|
232 | + public static function register_post_status() { |
|
233 | 233 | |
234 | - $invoice_statuses = apply_filters( |
|
235 | - 'getpaid_register_invoice_post_statuses', |
|
236 | - array( |
|
234 | + $invoice_statuses = apply_filters( |
|
235 | + 'getpaid_register_invoice_post_statuses', |
|
236 | + array( |
|
237 | 237 | |
238 | - 'wpi-pending' => array( |
|
239 | - 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
240 | - 'public' => true, |
|
241 | - 'exclude_from_search' => true, |
|
242 | - 'show_in_admin_all_list' => true, |
|
243 | - 'show_in_admin_status_list' => true, |
|
244 | - /* translators: %s: number of invoices */ |
|
245 | - 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ) |
|
246 | - ), |
|
238 | + 'wpi-pending' => array( |
|
239 | + 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
240 | + 'public' => true, |
|
241 | + 'exclude_from_search' => true, |
|
242 | + 'show_in_admin_all_list' => true, |
|
243 | + 'show_in_admin_status_list' => true, |
|
244 | + /* translators: %s: number of invoices */ |
|
245 | + 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ) |
|
246 | + ), |
|
247 | 247 | |
248 | - 'wpi-processing' => array( |
|
249 | - 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
250 | - 'public' => true, |
|
251 | - 'exclude_from_search' => true, |
|
252 | - 'show_in_admin_all_list' => true, |
|
253 | - 'show_in_admin_status_list' => true, |
|
254 | - /* translators: %s: number of invoices */ |
|
255 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ) |
|
256 | - ), |
|
248 | + 'wpi-processing' => array( |
|
249 | + 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
250 | + 'public' => true, |
|
251 | + 'exclude_from_search' => true, |
|
252 | + 'show_in_admin_all_list' => true, |
|
253 | + 'show_in_admin_status_list' => true, |
|
254 | + /* translators: %s: number of invoices */ |
|
255 | + 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ) |
|
256 | + ), |
|
257 | 257 | |
258 | - 'wpi-onhold' => array( |
|
259 | - 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
260 | - 'public' => true, |
|
261 | - 'exclude_from_search' => true, |
|
262 | - 'show_in_admin_all_list' => true, |
|
263 | - 'show_in_admin_status_list' => true, |
|
264 | - /* translators: %s: number of invoices */ |
|
265 | - 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ) |
|
266 | - ), |
|
258 | + 'wpi-onhold' => array( |
|
259 | + 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
260 | + 'public' => true, |
|
261 | + 'exclude_from_search' => true, |
|
262 | + 'show_in_admin_all_list' => true, |
|
263 | + 'show_in_admin_status_list' => true, |
|
264 | + /* translators: %s: number of invoices */ |
|
265 | + 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ) |
|
266 | + ), |
|
267 | 267 | |
268 | - 'wpi-cancelled' => array( |
|
269 | - 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
270 | - 'public' => true, |
|
271 | - 'exclude_from_search' => true, |
|
272 | - 'show_in_admin_all_list' => true, |
|
273 | - 'show_in_admin_status_list' => true, |
|
274 | - /* translators: %s: number of invoices */ |
|
275 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ) |
|
276 | - ), |
|
268 | + 'wpi-cancelled' => array( |
|
269 | + 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
270 | + 'public' => true, |
|
271 | + 'exclude_from_search' => true, |
|
272 | + 'show_in_admin_all_list' => true, |
|
273 | + 'show_in_admin_status_list' => true, |
|
274 | + /* translators: %s: number of invoices */ |
|
275 | + 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ) |
|
276 | + ), |
|
277 | 277 | |
278 | - 'wpi-refunded' => array( |
|
279 | - 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
280 | - 'public' => true, |
|
281 | - 'exclude_from_search' => true, |
|
282 | - 'show_in_admin_all_list' => true, |
|
283 | - 'show_in_admin_status_list' => true, |
|
284 | - /* translators: %s: number of invoices */ |
|
285 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ) |
|
286 | - ), |
|
278 | + 'wpi-refunded' => array( |
|
279 | + 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
280 | + 'public' => true, |
|
281 | + 'exclude_from_search' => true, |
|
282 | + 'show_in_admin_all_list' => true, |
|
283 | + 'show_in_admin_status_list' => true, |
|
284 | + /* translators: %s: number of invoices */ |
|
285 | + 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ) |
|
286 | + ), |
|
287 | 287 | |
288 | - 'wpi-failed' => array( |
|
289 | - 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
290 | - 'public' => true, |
|
291 | - 'exclude_from_search' => true, |
|
292 | - 'show_in_admin_all_list' => true, |
|
293 | - 'show_in_admin_status_list' => true, |
|
294 | - /* translators: %s: number of invoices */ |
|
295 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ) |
|
296 | - ), |
|
288 | + 'wpi-failed' => array( |
|
289 | + 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
290 | + 'public' => true, |
|
291 | + 'exclude_from_search' => true, |
|
292 | + 'show_in_admin_all_list' => true, |
|
293 | + 'show_in_admin_status_list' => true, |
|
294 | + /* translators: %s: number of invoices */ |
|
295 | + 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ) |
|
296 | + ), |
|
297 | 297 | |
298 | - 'wpi-renewal' => array( |
|
299 | - 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
300 | - 'public' => true, |
|
301 | - 'exclude_from_search' => true, |
|
302 | - 'show_in_admin_all_list' => true, |
|
303 | - 'show_in_admin_status_list' => true, |
|
304 | - /* translators: %s: number of invoices */ |
|
305 | - 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ) |
|
306 | - ) |
|
307 | - ) |
|
308 | - ); |
|
298 | + 'wpi-renewal' => array( |
|
299 | + 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
300 | + 'public' => true, |
|
301 | + 'exclude_from_search' => true, |
|
302 | + 'show_in_admin_all_list' => true, |
|
303 | + 'show_in_admin_status_list' => true, |
|
304 | + /* translators: %s: number of invoices */ |
|
305 | + 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ) |
|
306 | + ) |
|
307 | + ) |
|
308 | + ); |
|
309 | 309 | |
310 | - foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
311 | - register_post_status( $invoice_statuse, $args ); |
|
312 | - } |
|
313 | - } |
|
310 | + foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
311 | + register_post_status( $invoice_statuse, $args ); |
|
312 | + } |
|
313 | + } |
|
314 | 314 | |
315 | - /** |
|
316 | - * Flush rewrite rules. |
|
317 | - */ |
|
318 | - public static function flush_rewrite_rules() { |
|
319 | - flush_rewrite_rules(); |
|
320 | - } |
|
315 | + /** |
|
316 | + * Flush rewrite rules. |
|
317 | + */ |
|
318 | + public static function flush_rewrite_rules() { |
|
319 | + flush_rewrite_rules(); |
|
320 | + } |
|
321 | 321 | |
322 | - /** |
|
323 | - * Flush rules to prevent 404. |
|
324 | - * |
|
325 | - */ |
|
326 | - public static function maybe_flush_rewrite_rules() { |
|
327 | - if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
328 | - update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
329 | - self::flush_rewrite_rules(); |
|
330 | - } |
|
331 | - } |
|
322 | + /** |
|
323 | + * Flush rules to prevent 404. |
|
324 | + * |
|
325 | + */ |
|
326 | + public static function maybe_flush_rewrite_rules() { |
|
327 | + if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
328 | + update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
329 | + self::flush_rewrite_rules(); |
|
330 | + } |
|
331 | + } |
|
332 | 332 | |
333 | 333 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Post types Class |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | * Hook in methods. |
19 | 19 | */ |
20 | 20 | public function __construct() { |
21 | - add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 ); |
|
22 | - add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 ); |
|
23 | - add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
24 | - add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) ); |
|
21 | + add_action('init', array(__CLASS__, 'register_post_types'), 1); |
|
22 | + add_action('init', array(__CLASS__, 'register_post_status'), 4); |
|
23 | + add_action('getpaid_flush_rewrite_rules', array(__CLASS__, 'flush_rewrite_rules')); |
|
24 | + add_action('getpaid_after_register_post_types', array(__CLASS__, 'maybe_flush_rewrite_rules')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public static function register_post_types() { |
31 | 31 | |
32 | - if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) { |
|
32 | + if (!is_blog_installed() || post_type_exists('wpi_item')) { |
|
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | 36 | // Fires before registering post types. |
37 | - do_action( 'getpaid_register_post_types' ); |
|
37 | + do_action('getpaid_register_post_types'); |
|
38 | 38 | |
39 | 39 | // Register item post type. |
40 | 40 | register_post_type( |
@@ -43,29 +43,29 @@ discard block |
||
43 | 43 | 'wpinv_register_post_type_invoice_item', |
44 | 44 | array( |
45 | 45 | 'labels' => array( |
46 | - 'name' => _x( 'Items', 'post type general name', 'invoicing' ), |
|
47 | - 'singular_name' => _x( 'Item', 'post type singular name', 'invoicing' ), |
|
48 | - 'menu_name' => _x( 'Items', 'admin menu', 'invoicing' ), |
|
49 | - 'name_admin_bar' => _x( 'Item', 'add new on admin bar', 'invoicing' ), |
|
50 | - 'add_new' => _x( 'Add New', 'Item', 'invoicing' ), |
|
51 | - 'add_new_item' => __( 'Add New Item', 'invoicing' ), |
|
52 | - 'new_item' => __( 'New Item', 'invoicing' ), |
|
53 | - 'edit_item' => __( 'Edit Item', 'invoicing' ), |
|
54 | - 'view_item' => __( 'View Item', 'invoicing' ), |
|
55 | - 'all_items' => __( 'Items', 'invoicing' ), |
|
56 | - 'search_items' => __( 'Search items', 'invoicing' ), |
|
57 | - 'parent_item_colon' => __( 'Parent item:', 'invoicing' ), |
|
58 | - 'not_found' => __( 'No items found.', 'invoicing' ), |
|
59 | - 'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' ) |
|
46 | + 'name' => _x('Items', 'post type general name', 'invoicing'), |
|
47 | + 'singular_name' => _x('Item', 'post type singular name', 'invoicing'), |
|
48 | + 'menu_name' => _x('Items', 'admin menu', 'invoicing'), |
|
49 | + 'name_admin_bar' => _x('Item', 'add new on admin bar', 'invoicing'), |
|
50 | + 'add_new' => _x('Add New', 'Item', 'invoicing'), |
|
51 | + 'add_new_item' => __('Add New Item', 'invoicing'), |
|
52 | + 'new_item' => __('New Item', 'invoicing'), |
|
53 | + 'edit_item' => __('Edit Item', 'invoicing'), |
|
54 | + 'view_item' => __('View Item', 'invoicing'), |
|
55 | + 'all_items' => __('Items', 'invoicing'), |
|
56 | + 'search_items' => __('Search items', 'invoicing'), |
|
57 | + 'parent_item_colon' => __('Parent item:', 'invoicing'), |
|
58 | + 'not_found' => __('No items found.', 'invoicing'), |
|
59 | + 'not_found_in_trash' => __('No items found in trash.', 'invoicing') |
|
60 | 60 | ), |
61 | - 'description' => __( 'This is where you can add new invoice items.', 'invoicing' ), |
|
61 | + 'description' => __('This is where you can add new invoice items.', 'invoicing'), |
|
62 | 62 | 'public' => false, |
63 | 63 | 'has_archive' => false, |
64 | 64 | '_builtin' => false, |
65 | 65 | 'show_ui' => true, |
66 | 66 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
67 | 67 | 'show_in_nav_menus' => false, |
68 | - 'supports' => array( 'title', 'excerpt', 'thumbnail' ), |
|
68 | + 'supports' => array('title', 'excerpt', 'thumbnail'), |
|
69 | 69 | 'rewrite' => false, |
70 | 70 | 'query_var' => false, |
71 | 71 | 'map_meta_cap' => true, |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | 'wpinv_register_post_type_payment_form', |
83 | 83 | array( |
84 | 84 | 'labels' => array( |
85 | - 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
86 | - 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
87 | - 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
88 | - 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
89 | - 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
90 | - 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
91 | - 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
92 | - 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
93 | - 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
94 | - 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
95 | - 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
96 | - 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
97 | - 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
98 | - 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ) |
|
85 | + 'name' => _x('Payment Forms', 'post type general name', 'invoicing'), |
|
86 | + 'singular_name' => _x('Payment Form', 'post type singular name', 'invoicing'), |
|
87 | + 'menu_name' => _x('Payment Forms', 'admin menu', 'invoicing'), |
|
88 | + 'name_admin_bar' => _x('Payment Form', 'add new on admin bar', 'invoicing'), |
|
89 | + 'add_new' => _x('Add New', 'Payment Form', 'invoicing'), |
|
90 | + 'add_new_item' => __('Add New Payment Form', 'invoicing'), |
|
91 | + 'new_item' => __('New Payment Form', 'invoicing'), |
|
92 | + 'edit_item' => __('Edit Payment Form', 'invoicing'), |
|
93 | + 'view_item' => __('View Payment Form', 'invoicing'), |
|
94 | + 'all_items' => __('Payment Forms', 'invoicing'), |
|
95 | + 'search_items' => __('Search Payment Forms', 'invoicing'), |
|
96 | + 'parent_item_colon' => __('Parent Payment Forms:', 'invoicing'), |
|
97 | + 'not_found' => __('No payment forms found.', 'invoicing'), |
|
98 | + 'not_found_in_trash' => __('No payment forms found in trash.', 'invoicing') |
|
99 | 99 | ), |
100 | - 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
100 | + 'description' => __('Add new payment forms.', 'invoicing'), |
|
101 | 101 | 'public' => false, |
102 | 102 | 'show_ui' => true, |
103 | 103 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : true, |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'has_archive' => false, |
109 | 109 | 'hierarchical' => false, |
110 | 110 | 'menu_position' => null, |
111 | - 'supports' => array( 'title' ), |
|
111 | + 'supports' => array('title'), |
|
112 | 112 | 'menu_icon' => 'dashicons-media-form', |
113 | 113 | ) |
114 | 114 | ) |
@@ -121,32 +121,32 @@ discard block |
||
121 | 121 | 'wpinv_register_post_type_invoice', |
122 | 122 | array( |
123 | 123 | 'labels' => array( |
124 | - 'name' => __( 'Invoices', 'invoicing' ), |
|
125 | - 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
126 | - 'all_items' => __( 'Invoices', 'invoicing' ), |
|
127 | - 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
128 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
129 | - 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
130 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
131 | - 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
132 | - 'new_item' => __( 'New invoice', 'invoicing' ), |
|
133 | - 'view_item' => __( 'View invoice', 'invoicing' ), |
|
134 | - 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
135 | - 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
136 | - 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
137 | - 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
138 | - 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
139 | - 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
140 | - 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
141 | - 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
142 | - 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
143 | - 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
144 | - 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
145 | - 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
146 | - 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
147 | - 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
124 | + 'name' => __('Invoices', 'invoicing'), |
|
125 | + 'singular_name' => __('Invoice', 'invoicing'), |
|
126 | + 'all_items' => __('Invoices', 'invoicing'), |
|
127 | + 'menu_name' => _x('Invoices', 'Admin menu name', 'invoicing'), |
|
128 | + 'add_new' => __('Add New', 'invoicing'), |
|
129 | + 'add_new_item' => __('Add new invoice', 'invoicing'), |
|
130 | + 'edit' => __('Edit', 'invoicing'), |
|
131 | + 'edit_item' => __('Edit invoice', 'invoicing'), |
|
132 | + 'new_item' => __('New invoice', 'invoicing'), |
|
133 | + 'view_item' => __('View invoice', 'invoicing'), |
|
134 | + 'view_items' => __('View Invoices', 'invoicing'), |
|
135 | + 'search_items' => __('Search invoices', 'invoicing'), |
|
136 | + 'not_found' => __('No invoices found', 'invoicing'), |
|
137 | + 'not_found_in_trash' => __('No invoices found in trash', 'invoicing'), |
|
138 | + 'parent' => __('Parent invoice', 'invoicing'), |
|
139 | + 'featured_image' => __('Invoice image', 'invoicing'), |
|
140 | + 'set_featured_image' => __('Set invoice image', 'invoicing'), |
|
141 | + 'remove_featured_image' => __('Remove invoice image', 'invoicing'), |
|
142 | + 'use_featured_image' => __('Use as invoice image', 'invoicing'), |
|
143 | + 'insert_into_item' => __('Insert into invoice', 'invoicing'), |
|
144 | + 'uploaded_to_this_item' => __('Uploaded to this invoice', 'invoicing'), |
|
145 | + 'filter_items_list' => __('Filter invoices', 'invoicing'), |
|
146 | + 'items_list_navigation' => __('Invoices navigation', 'invoicing'), |
|
147 | + 'items_list' => __('Invoices list', 'invoicing'), |
|
148 | 148 | ), |
149 | - 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
149 | + 'description' => __('This is where invoices are stored.', 'invoicing'), |
|
150 | 150 | 'public' => true, |
151 | 151 | 'has_archive' => false, |
152 | 152 | 'publicly_queryable' => true, |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'show_ui' => true, |
155 | 155 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
156 | 156 | 'show_in_nav_menus' => false, |
157 | - 'supports' => array( 'title', 'author', 'excerpt' ), |
|
157 | + 'supports' => array('title', 'author', 'excerpt'), |
|
158 | 158 | 'rewrite' => array( |
159 | 159 | 'slug' => 'invoice', |
160 | 160 | 'with_front' => false, |
@@ -177,32 +177,32 @@ discard block |
||
177 | 177 | 'wpinv_register_post_type_discount', |
178 | 178 | array( |
179 | 179 | 'labels' => array( |
180 | - 'name' => __( 'Discounts', 'invoicing' ), |
|
181 | - 'singular_name' => __( 'Discount', 'invoicing' ), |
|
182 | - 'all_items' => __( 'Discounts', 'invoicing' ), |
|
183 | - 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
184 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
185 | - 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
186 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
187 | - 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
188 | - 'new_item' => __( 'New discount', 'invoicing' ), |
|
189 | - 'view_item' => __( 'View discount', 'invoicing' ), |
|
190 | - 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
191 | - 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
192 | - 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
193 | - 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
194 | - 'parent' => __( 'Parent discount', 'invoicing' ), |
|
195 | - 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
196 | - 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
197 | - 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
198 | - 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
199 | - 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
200 | - 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
201 | - 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
202 | - 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
203 | - 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
180 | + 'name' => __('Discounts', 'invoicing'), |
|
181 | + 'singular_name' => __('Discount', 'invoicing'), |
|
182 | + 'all_items' => __('Discounts', 'invoicing'), |
|
183 | + 'menu_name' => _x('Discounts', 'Admin menu name', 'invoicing'), |
|
184 | + 'add_new' => __('Add New', 'invoicing'), |
|
185 | + 'add_new_item' => __('Add new discount', 'invoicing'), |
|
186 | + 'edit' => __('Edit', 'invoicing'), |
|
187 | + 'edit_item' => __('Edit discount', 'invoicing'), |
|
188 | + 'new_item' => __('New discount', 'invoicing'), |
|
189 | + 'view_item' => __('View discount', 'invoicing'), |
|
190 | + 'view_items' => __('View Discounts', 'invoicing'), |
|
191 | + 'search_items' => __('Search discounts', 'invoicing'), |
|
192 | + 'not_found' => __('No discounts found', 'invoicing'), |
|
193 | + 'not_found_in_trash' => __('No discounts found in trash', 'invoicing'), |
|
194 | + 'parent' => __('Parent discount', 'invoicing'), |
|
195 | + 'featured_image' => __('Discount image', 'invoicing'), |
|
196 | + 'set_featured_image' => __('Set discount image', 'invoicing'), |
|
197 | + 'remove_featured_image' => __('Remove discount image', 'invoicing'), |
|
198 | + 'use_featured_image' => __('Use as discount image', 'invoicing'), |
|
199 | + 'insert_into_item' => __('Insert into discount', 'invoicing'), |
|
200 | + 'uploaded_to_this_item' => __('Uploaded to this discount', 'invoicing'), |
|
201 | + 'filter_items_list' => __('Filter discounts', 'invoicing'), |
|
202 | + 'items_list_navigation' => __('Discount navigation', 'invoicing'), |
|
203 | + 'items_list' => __('Discounts list', 'invoicing'), |
|
204 | 204 | ), |
205 | - 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
205 | + 'description' => __('This is where you can add new discounts that users can use in invoices.', 'invoicing'), |
|
206 | 206 | 'public' => false, |
207 | 207 | 'can_export' => true, |
208 | 208 | '_builtin' => false, |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | 'map_meta_cap' => true, |
216 | 216 | 'has_archive' => false, |
217 | 217 | 'hierarchical' => false, |
218 | - 'supports' => array( 'title', 'excerpt' ), |
|
218 | + 'supports' => array('title', 'excerpt'), |
|
219 | 219 | 'show_in_nav_menus' => false, |
220 | 220 | 'show_in_admin_bar' => true, |
221 | 221 | 'menu_position' => null, |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ) |
224 | 224 | ); |
225 | 225 | |
226 | - do_action( 'getpaid_after_register_post_types' ); |
|
226 | + do_action('getpaid_after_register_post_types'); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -236,79 +236,79 @@ discard block |
||
236 | 236 | array( |
237 | 237 | |
238 | 238 | 'wpi-pending' => array( |
239 | - 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
239 | + 'label' => _x('Pending Payment', 'Invoice status', 'invoicing'), |
|
240 | 240 | 'public' => true, |
241 | 241 | 'exclude_from_search' => true, |
242 | 242 | 'show_in_admin_all_list' => true, |
243 | 243 | 'show_in_admin_status_list' => true, |
244 | 244 | /* translators: %s: number of invoices */ |
245 | - 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ) |
|
245 | + 'label_count' => _n_noop('Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing') |
|
246 | 246 | ), |
247 | 247 | |
248 | 248 | 'wpi-processing' => array( |
249 | - 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
249 | + 'label' => _x('Processing', 'Invoice status', 'invoicing'), |
|
250 | 250 | 'public' => true, |
251 | 251 | 'exclude_from_search' => true, |
252 | 252 | 'show_in_admin_all_list' => true, |
253 | 253 | 'show_in_admin_status_list' => true, |
254 | 254 | /* translators: %s: number of invoices */ |
255 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ) |
|
255 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing') |
|
256 | 256 | ), |
257 | 257 | |
258 | 258 | 'wpi-onhold' => array( |
259 | - 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
259 | + 'label' => _x('On Hold', 'Invoice status', 'invoicing'), |
|
260 | 260 | 'public' => true, |
261 | 261 | 'exclude_from_search' => true, |
262 | 262 | 'show_in_admin_all_list' => true, |
263 | 263 | 'show_in_admin_status_list' => true, |
264 | 264 | /* translators: %s: number of invoices */ |
265 | - 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ) |
|
265 | + 'label_count' => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing') |
|
266 | 266 | ), |
267 | 267 | |
268 | 268 | 'wpi-cancelled' => array( |
269 | - 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
269 | + 'label' => _x('Cancelled', 'Invoice status', 'invoicing'), |
|
270 | 270 | 'public' => true, |
271 | 271 | 'exclude_from_search' => true, |
272 | 272 | 'show_in_admin_all_list' => true, |
273 | 273 | 'show_in_admin_status_list' => true, |
274 | 274 | /* translators: %s: number of invoices */ |
275 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ) |
|
275 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing') |
|
276 | 276 | ), |
277 | 277 | |
278 | 278 | 'wpi-refunded' => array( |
279 | - 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
279 | + 'label' => _x('Refunded', 'Invoice status', 'invoicing'), |
|
280 | 280 | 'public' => true, |
281 | 281 | 'exclude_from_search' => true, |
282 | 282 | 'show_in_admin_all_list' => true, |
283 | 283 | 'show_in_admin_status_list' => true, |
284 | 284 | /* translators: %s: number of invoices */ |
285 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ) |
|
285 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing') |
|
286 | 286 | ), |
287 | 287 | |
288 | 288 | 'wpi-failed' => array( |
289 | - 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
289 | + 'label' => _x('Failed', 'Invoice status', 'invoicing'), |
|
290 | 290 | 'public' => true, |
291 | 291 | 'exclude_from_search' => true, |
292 | 292 | 'show_in_admin_all_list' => true, |
293 | 293 | 'show_in_admin_status_list' => true, |
294 | 294 | /* translators: %s: number of invoices */ |
295 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ) |
|
295 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing') |
|
296 | 296 | ), |
297 | 297 | |
298 | 298 | 'wpi-renewal' => array( |
299 | - 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
299 | + 'label' => _x('Renewal', 'Invoice status', 'invoicing'), |
|
300 | 300 | 'public' => true, |
301 | 301 | 'exclude_from_search' => true, |
302 | 302 | 'show_in_admin_all_list' => true, |
303 | 303 | 'show_in_admin_status_list' => true, |
304 | 304 | /* translators: %s: number of invoices */ |
305 | - 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ) |
|
305 | + 'label_count' => _n_noop('Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing') |
|
306 | 306 | ) |
307 | 307 | ) |
308 | 308 | ); |
309 | 309 | |
310 | - foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
311 | - register_post_status( $invoice_statuse, $args ); |
|
310 | + foreach ($invoice_statuses as $invoice_statuse => $args) { |
|
311 | + register_post_status($invoice_statuse, $args); |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | * |
325 | 325 | */ |
326 | 326 | public static function maybe_flush_rewrite_rules() { |
327 | - if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
328 | - update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
327 | + if (!get_option('getpaid_flushed_rewrite_rules')) { |
|
328 | + update_option('getpaid_flushed_rewrite_rules', '1'); |
|
329 | 329 | self::flush_rewrite_rules(); |
330 | 330 | } |
331 | 331 | } |