@@ -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 |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * |
| 6 | 6 | */ |
| 7 | 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | - exit; |
|
| 8 | + exit; |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | /** |
@@ -15,197 +15,197 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class GetPaid_Subscription_Data_Store { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * A map of database fields to data types. |
|
| 20 | - * |
|
| 21 | - * @since 1.0.19 |
|
| 22 | - * @var array |
|
| 23 | - */ |
|
| 24 | - protected $database_fields_to_data_type = array( |
|
| 25 | - 'id' => '%d', |
|
| 26 | - 'customer_id' => '%d', |
|
| 27 | - 'frequency' => '%d', |
|
| 28 | - 'period' => '%s', |
|
| 29 | - 'initial_amount' => '%s', |
|
| 30 | - 'recurring_amount' => '%s', |
|
| 31 | - 'bill_times' => '%d', |
|
| 32 | - 'transaction_id' => '%s', |
|
| 33 | - 'parent_payment_id' => '%d', |
|
| 34 | - 'product_id' => '%d', |
|
| 35 | - 'created' => '%s', |
|
| 36 | - 'expiration' => '%s', |
|
| 37 | - 'trial_period' => '%s', |
|
| 38 | - 'status' => '%s', |
|
| 39 | - 'profile_id' => '%s', |
|
| 40 | - ); |
|
| 41 | - |
|
| 42 | - /* |
|
| 18 | + /** |
|
| 19 | + * A map of database fields to data types. |
|
| 20 | + * |
|
| 21 | + * @since 1.0.19 |
|
| 22 | + * @var array |
|
| 23 | + */ |
|
| 24 | + protected $database_fields_to_data_type = array( |
|
| 25 | + 'id' => '%d', |
|
| 26 | + 'customer_id' => '%d', |
|
| 27 | + 'frequency' => '%d', |
|
| 28 | + 'period' => '%s', |
|
| 29 | + 'initial_amount' => '%s', |
|
| 30 | + 'recurring_amount' => '%s', |
|
| 31 | + 'bill_times' => '%d', |
|
| 32 | + 'transaction_id' => '%s', |
|
| 33 | + 'parent_payment_id' => '%d', |
|
| 34 | + 'product_id' => '%d', |
|
| 35 | + 'created' => '%s', |
|
| 36 | + 'expiration' => '%s', |
|
| 37 | + 'trial_period' => '%s', |
|
| 38 | + 'status' => '%s', |
|
| 39 | + 'profile_id' => '%s', |
|
| 40 | + ); |
|
| 41 | + |
|
| 42 | + /* |
|
| 43 | 43 | |-------------------------------------------------------------------------- |
| 44 | 44 | | CRUD Methods |
| 45 | 45 | |-------------------------------------------------------------------------- |
| 46 | 46 | */ |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Method to create a new subscription in the database. |
|
| 50 | - * |
|
| 51 | - * @param WPInv_Subscription $subscription Subscription object. |
|
| 52 | - */ |
|
| 53 | - public function create( &$subscription ) { |
|
| 54 | - global $wpdb; |
|
| 55 | - |
|
| 56 | - $values = array(); |
|
| 57 | - $formats = array(); |
|
| 58 | - |
|
| 59 | - $fields = $this->database_fields_to_data_type; |
|
| 60 | - unset( $fields['id'] ); |
|
| 61 | - |
|
| 62 | - foreach ( $fields as $key => $format ) { |
|
| 63 | - $method = "get_$key"; |
|
| 64 | - $values[$key] = $subscription->$method( 'edit' ); |
|
| 65 | - $formats[] = $format; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - $result = $wpdb->insert( $wpdb->prefix . 'wpinv_subscriptions', $values, $formats ); |
|
| 69 | - |
|
| 70 | - if ( $result ) { |
|
| 71 | - $subscription->set_id( $wpdb->insert_id ); |
|
| 72 | - $subscription->apply_changes(); |
|
| 73 | - $subscription->clear_cache(); |
|
| 74 | - update_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscription_id', $subscription->get_id() ); |
|
| 75 | - do_action( 'getpaid_new_subscription', $subscription ); |
|
| 76 | - return true; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - return false; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * Method to read a subscription from the database. |
|
| 84 | - * |
|
| 85 | - * @param WPInv_Subscription $subscription Subscription object. |
|
| 86 | - * |
|
| 87 | - */ |
|
| 88 | - public function read( &$subscription ) { |
|
| 89 | - global $wpdb; |
|
| 90 | - |
|
| 91 | - $subscription->set_defaults(); |
|
| 92 | - |
|
| 93 | - if ( ! $subscription->get_id() ) { |
|
| 94 | - $subscription->last_error = __( 'Invalid subscription ID.', 'invoicing' ); |
|
| 95 | - $subscription->set_id( 0 ); |
|
| 96 | - return false; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - // Maybe retrieve from the cache. |
|
| 100 | - $raw_subscription = wp_cache_get( $subscription->get_id(), 'getpaid_subscriptions' ); |
|
| 101 | - |
|
| 102 | - // If not found, retrieve from the db. |
|
| 103 | - if ( false === $raw_subscription ) { |
|
| 104 | - |
|
| 105 | - $raw_subscription = $wpdb->get_row( |
|
| 106 | - $wpdb->prepare( |
|
| 107 | - "SELECT * FROM {$wpdb->prefix}wpinv_subscriptions WHERE id = %d", |
|
| 108 | - $subscription->get_id() |
|
| 109 | - ) |
|
| 110 | - ); |
|
| 111 | - |
|
| 112 | - // Update the cache with our data |
|
| 113 | - wp_cache_set( $subscription->get_id(), $raw_subscription, 'getpaid_subscriptions' ); |
|
| 114 | - |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - if ( ! $raw_subscription ) { |
|
| 118 | - $subscription->last_error = __( 'Invalid subscription ID.', 'invoicing' ); |
|
| 119 | - return false; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - foreach ( array_keys( $this->database_fields_to_data_type ) as $key ) { |
|
| 123 | - $method = "set_$key"; |
|
| 124 | - $subscription->$method( $raw_subscription->$key ); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - $subscription->set_object_read( true ); |
|
| 128 | - do_action( 'getpaid_read_subscription', $subscription ); |
|
| 129 | - |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * Method to update a subscription in the database. |
|
| 134 | - * |
|
| 135 | - * @param WPInv_Subscription $subscription Subscription object. |
|
| 136 | - */ |
|
| 137 | - public function update( &$subscription ) { |
|
| 138 | - global $wpdb; |
|
| 139 | - |
|
| 140 | - $changes = $subscription->get_changes(); |
|
| 141 | - $values = array(); |
|
| 142 | - $formats = array(); |
|
| 143 | - |
|
| 144 | - foreach ( $this->database_fields_to_data_type as $key => $format ) { |
|
| 145 | - if ( array_key_exists( $key, $changes ) ) { |
|
| 146 | - $method = "get_$key"; |
|
| 147 | - $values[$key] = $subscription->$method( 'edit' ); |
|
| 148 | - $formats[] = $format; |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - if ( empty( $values ) ) { |
|
| 153 | - return; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - $wpdb->update( |
|
| 157 | - $wpdb->prefix . 'wpinv_subscriptions', |
|
| 158 | - $values, |
|
| 159 | - array( |
|
| 160 | - 'id' => $subscription->get_id(), |
|
| 161 | - ), |
|
| 162 | - $formats, |
|
| 163 | - '%d' |
|
| 164 | - ); |
|
| 165 | - |
|
| 166 | - // Apply the changes. |
|
| 167 | - $subscription->apply_changes(); |
|
| 168 | - |
|
| 169 | - // Delete cache. |
|
| 170 | - $subscription->clear_cache(); |
|
| 171 | - |
|
| 172 | - update_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscr_profile_id', $subscription->get_profile_id() ); |
|
| 173 | - update_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscription_id', $subscription->get_id() ); |
|
| 174 | - |
|
| 175 | - // Fire a hook. |
|
| 176 | - do_action( 'getpaid_update_subscription', $subscription ); |
|
| 177 | - |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * Method to delete a subscription from the database. |
|
| 182 | - * |
|
| 183 | - * @param WPInv_Subscription $subscription |
|
| 184 | - */ |
|
| 185 | - public function delete( &$subscription ) { |
|
| 186 | - global $wpdb; |
|
| 187 | - |
|
| 188 | - $wpdb->query( |
|
| 189 | - $wpdb->prepare( |
|
| 190 | - "DELETE FROM {$wpdb->prefix}wpinv_subscriptions |
|
| 48 | + /** |
|
| 49 | + * Method to create a new subscription in the database. |
|
| 50 | + * |
|
| 51 | + * @param WPInv_Subscription $subscription Subscription object. |
|
| 52 | + */ |
|
| 53 | + public function create( &$subscription ) { |
|
| 54 | + global $wpdb; |
|
| 55 | + |
|
| 56 | + $values = array(); |
|
| 57 | + $formats = array(); |
|
| 58 | + |
|
| 59 | + $fields = $this->database_fields_to_data_type; |
|
| 60 | + unset( $fields['id'] ); |
|
| 61 | + |
|
| 62 | + foreach ( $fields as $key => $format ) { |
|
| 63 | + $method = "get_$key"; |
|
| 64 | + $values[$key] = $subscription->$method( 'edit' ); |
|
| 65 | + $formats[] = $format; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + $result = $wpdb->insert( $wpdb->prefix . 'wpinv_subscriptions', $values, $formats ); |
|
| 69 | + |
|
| 70 | + if ( $result ) { |
|
| 71 | + $subscription->set_id( $wpdb->insert_id ); |
|
| 72 | + $subscription->apply_changes(); |
|
| 73 | + $subscription->clear_cache(); |
|
| 74 | + update_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscription_id', $subscription->get_id() ); |
|
| 75 | + do_action( 'getpaid_new_subscription', $subscription ); |
|
| 76 | + return true; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + return false; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * Method to read a subscription from the database. |
|
| 84 | + * |
|
| 85 | + * @param WPInv_Subscription $subscription Subscription object. |
|
| 86 | + * |
|
| 87 | + */ |
|
| 88 | + public function read( &$subscription ) { |
|
| 89 | + global $wpdb; |
|
| 90 | + |
|
| 91 | + $subscription->set_defaults(); |
|
| 92 | + |
|
| 93 | + if ( ! $subscription->get_id() ) { |
|
| 94 | + $subscription->last_error = __( 'Invalid subscription ID.', 'invoicing' ); |
|
| 95 | + $subscription->set_id( 0 ); |
|
| 96 | + return false; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + // Maybe retrieve from the cache. |
|
| 100 | + $raw_subscription = wp_cache_get( $subscription->get_id(), 'getpaid_subscriptions' ); |
|
| 101 | + |
|
| 102 | + // If not found, retrieve from the db. |
|
| 103 | + if ( false === $raw_subscription ) { |
|
| 104 | + |
|
| 105 | + $raw_subscription = $wpdb->get_row( |
|
| 106 | + $wpdb->prepare( |
|
| 107 | + "SELECT * FROM {$wpdb->prefix}wpinv_subscriptions WHERE id = %d", |
|
| 108 | + $subscription->get_id() |
|
| 109 | + ) |
|
| 110 | + ); |
|
| 111 | + |
|
| 112 | + // Update the cache with our data |
|
| 113 | + wp_cache_set( $subscription->get_id(), $raw_subscription, 'getpaid_subscriptions' ); |
|
| 114 | + |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + if ( ! $raw_subscription ) { |
|
| 118 | + $subscription->last_error = __( 'Invalid subscription ID.', 'invoicing' ); |
|
| 119 | + return false; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + foreach ( array_keys( $this->database_fields_to_data_type ) as $key ) { |
|
| 123 | + $method = "set_$key"; |
|
| 124 | + $subscription->$method( $raw_subscription->$key ); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + $subscription->set_object_read( true ); |
|
| 128 | + do_action( 'getpaid_read_subscription', $subscription ); |
|
| 129 | + |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * Method to update a subscription in the database. |
|
| 134 | + * |
|
| 135 | + * @param WPInv_Subscription $subscription Subscription object. |
|
| 136 | + */ |
|
| 137 | + public function update( &$subscription ) { |
|
| 138 | + global $wpdb; |
|
| 139 | + |
|
| 140 | + $changes = $subscription->get_changes(); |
|
| 141 | + $values = array(); |
|
| 142 | + $formats = array(); |
|
| 143 | + |
|
| 144 | + foreach ( $this->database_fields_to_data_type as $key => $format ) { |
|
| 145 | + if ( array_key_exists( $key, $changes ) ) { |
|
| 146 | + $method = "get_$key"; |
|
| 147 | + $values[$key] = $subscription->$method( 'edit' ); |
|
| 148 | + $formats[] = $format; |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + if ( empty( $values ) ) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + $wpdb->update( |
|
| 157 | + $wpdb->prefix . 'wpinv_subscriptions', |
|
| 158 | + $values, |
|
| 159 | + array( |
|
| 160 | + 'id' => $subscription->get_id(), |
|
| 161 | + ), |
|
| 162 | + $formats, |
|
| 163 | + '%d' |
|
| 164 | + ); |
|
| 165 | + |
|
| 166 | + // Apply the changes. |
|
| 167 | + $subscription->apply_changes(); |
|
| 168 | + |
|
| 169 | + // Delete cache. |
|
| 170 | + $subscription->clear_cache(); |
|
| 171 | + |
|
| 172 | + update_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscr_profile_id', $subscription->get_profile_id() ); |
|
| 173 | + update_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscription_id', $subscription->get_id() ); |
|
| 174 | + |
|
| 175 | + // Fire a hook. |
|
| 176 | + do_action( 'getpaid_update_subscription', $subscription ); |
|
| 177 | + |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * Method to delete a subscription from the database. |
|
| 182 | + * |
|
| 183 | + * @param WPInv_Subscription $subscription |
|
| 184 | + */ |
|
| 185 | + public function delete( &$subscription ) { |
|
| 186 | + global $wpdb; |
|
| 187 | + |
|
| 188 | + $wpdb->query( |
|
| 189 | + $wpdb->prepare( |
|
| 190 | + "DELETE FROM {$wpdb->prefix}wpinv_subscriptions |
|
| 191 | 191 | WHERE id = %d", |
| 192 | - $subscription->get_id() |
|
| 193 | - ) |
|
| 194 | - ); |
|
| 192 | + $subscription->get_id() |
|
| 193 | + ) |
|
| 194 | + ); |
|
| 195 | 195 | |
| 196 | - delete_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscr_profile_id' ); |
|
| 197 | - delete_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscription_id' ); |
|
| 196 | + delete_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscr_profile_id' ); |
|
| 197 | + delete_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscription_id' ); |
|
| 198 | 198 | |
| 199 | - // Delete cache. |
|
| 200 | - $subscription->clear_cache(); |
|
| 199 | + // Delete cache. |
|
| 200 | + $subscription->clear_cache(); |
|
| 201 | 201 | |
| 202 | - // Fire a hook. |
|
| 203 | - do_action( 'getpaid_delete_subscription', $subscription ); |
|
| 202 | + // Fire a hook. |
|
| 203 | + do_action( 'getpaid_delete_subscription', $subscription ); |
|
| 204 | 204 | |
| 205 | - $subscription->set_id( 0 ); |
|
| 206 | - } |
|
| 205 | + $subscription->set_id( 0 ); |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | - /* |
|
| 208 | + /* |
|
| 209 | 209 | |-------------------------------------------------------------------------- |
| 210 | 210 | | Additional Methods |
| 211 | 211 | |-------------------------------------------------------------------------- |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * GetPaid_Subscription_Data_Store class file. |
| 5 | 5 | * |
| 6 | 6 | */ |
| 7 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 7 | +if (!defined('ABSPATH')) { |
|
| 8 | 8 | exit; |
| 9 | 9 | } |
| 10 | 10 | |
@@ -50,29 +50,29 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @param WPInv_Subscription $subscription Subscription object. |
| 52 | 52 | */ |
| 53 | - public function create( &$subscription ) { |
|
| 53 | + public function create(&$subscription) { |
|
| 54 | 54 | global $wpdb; |
| 55 | 55 | |
| 56 | 56 | $values = array(); |
| 57 | 57 | $formats = array(); |
| 58 | 58 | |
| 59 | 59 | $fields = $this->database_fields_to_data_type; |
| 60 | - unset( $fields['id'] ); |
|
| 60 | + unset($fields['id']); |
|
| 61 | 61 | |
| 62 | - foreach ( $fields as $key => $format ) { |
|
| 62 | + foreach ($fields as $key => $format) { |
|
| 63 | 63 | $method = "get_$key"; |
| 64 | - $values[$key] = $subscription->$method( 'edit' ); |
|
| 64 | + $values[$key] = $subscription->$method('edit'); |
|
| 65 | 65 | $formats[] = $format; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $result = $wpdb->insert( $wpdb->prefix . 'wpinv_subscriptions', $values, $formats ); |
|
| 68 | + $result = $wpdb->insert($wpdb->prefix . 'wpinv_subscriptions', $values, $formats); |
|
| 69 | 69 | |
| 70 | - if ( $result ) { |
|
| 71 | - $subscription->set_id( $wpdb->insert_id ); |
|
| 70 | + if ($result) { |
|
| 71 | + $subscription->set_id($wpdb->insert_id); |
|
| 72 | 72 | $subscription->apply_changes(); |
| 73 | 73 | $subscription->clear_cache(); |
| 74 | - update_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscription_id', $subscription->get_id() ); |
|
| 75 | - do_action( 'getpaid_new_subscription', $subscription ); |
|
| 74 | + update_post_meta($subscription->get_parent_invoice_id(), '_wpinv_subscription_id', $subscription->get_id()); |
|
| 75 | + do_action('getpaid_new_subscription', $subscription); |
|
| 76 | 76 | return true; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -85,22 +85,22 @@ discard block |
||
| 85 | 85 | * @param WPInv_Subscription $subscription Subscription object. |
| 86 | 86 | * |
| 87 | 87 | */ |
| 88 | - public function read( &$subscription ) { |
|
| 88 | + public function read(&$subscription) { |
|
| 89 | 89 | global $wpdb; |
| 90 | 90 | |
| 91 | 91 | $subscription->set_defaults(); |
| 92 | 92 | |
| 93 | - if ( ! $subscription->get_id() ) { |
|
| 94 | - $subscription->last_error = __( 'Invalid subscription ID.', 'invoicing' ); |
|
| 95 | - $subscription->set_id( 0 ); |
|
| 93 | + if (!$subscription->get_id()) { |
|
| 94 | + $subscription->last_error = __('Invalid subscription ID.', 'invoicing'); |
|
| 95 | + $subscription->set_id(0); |
|
| 96 | 96 | return false; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // Maybe retrieve from the cache. |
| 100 | - $raw_subscription = wp_cache_get( $subscription->get_id(), 'getpaid_subscriptions' ); |
|
| 100 | + $raw_subscription = wp_cache_get($subscription->get_id(), 'getpaid_subscriptions'); |
|
| 101 | 101 | |
| 102 | 102 | // If not found, retrieve from the db. |
| 103 | - if ( false === $raw_subscription ) { |
|
| 103 | + if (false === $raw_subscription) { |
|
| 104 | 104 | |
| 105 | 105 | $raw_subscription = $wpdb->get_row( |
| 106 | 106 | $wpdb->prepare( |
@@ -110,22 +110,22 @@ discard block |
||
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | 112 | // Update the cache with our data |
| 113 | - wp_cache_set( $subscription->get_id(), $raw_subscription, 'getpaid_subscriptions' ); |
|
| 113 | + wp_cache_set($subscription->get_id(), $raw_subscription, 'getpaid_subscriptions'); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if ( ! $raw_subscription ) { |
|
| 118 | - $subscription->last_error = __( 'Invalid subscription ID.', 'invoicing' ); |
|
| 117 | + if (!$raw_subscription) { |
|
| 118 | + $subscription->last_error = __('Invalid subscription ID.', 'invoicing'); |
|
| 119 | 119 | return false; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - foreach ( array_keys( $this->database_fields_to_data_type ) as $key ) { |
|
| 123 | - $method = "set_$key"; |
|
| 124 | - $subscription->$method( $raw_subscription->$key ); |
|
| 122 | + foreach (array_keys($this->database_fields_to_data_type) as $key) { |
|
| 123 | + $method = "set_$key"; |
|
| 124 | + $subscription->$method($raw_subscription->$key); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $subscription->set_object_read( true ); |
|
| 128 | - do_action( 'getpaid_read_subscription', $subscription ); |
|
| 127 | + $subscription->set_object_read(true); |
|
| 128 | + do_action('getpaid_read_subscription', $subscription); |
|
| 129 | 129 | |
| 130 | 130 | } |
| 131 | 131 | |
@@ -134,22 +134,22 @@ discard block |
||
| 134 | 134 | * |
| 135 | 135 | * @param WPInv_Subscription $subscription Subscription object. |
| 136 | 136 | */ |
| 137 | - public function update( &$subscription ) { |
|
| 137 | + public function update(&$subscription) { |
|
| 138 | 138 | global $wpdb; |
| 139 | 139 | |
| 140 | 140 | $changes = $subscription->get_changes(); |
| 141 | 141 | $values = array(); |
| 142 | 142 | $formats = array(); |
| 143 | 143 | |
| 144 | - foreach ( $this->database_fields_to_data_type as $key => $format ) { |
|
| 145 | - if ( array_key_exists( $key, $changes ) ) { |
|
| 144 | + foreach ($this->database_fields_to_data_type as $key => $format) { |
|
| 145 | + if (array_key_exists($key, $changes)) { |
|
| 146 | 146 | $method = "get_$key"; |
| 147 | - $values[$key] = $subscription->$method( 'edit' ); |
|
| 147 | + $values[$key] = $subscription->$method('edit'); |
|
| 148 | 148 | $formats[] = $format; |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if ( empty( $values ) ) { |
|
| 152 | + if (empty($values)) { |
|
| 153 | 153 | return; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | // Delete cache. |
| 170 | 170 | $subscription->clear_cache(); |
| 171 | 171 | |
| 172 | - update_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscr_profile_id', $subscription->get_profile_id() ); |
|
| 173 | - update_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscription_id', $subscription->get_id() ); |
|
| 172 | + update_post_meta($subscription->get_parent_invoice_id(), '_wpinv_subscr_profile_id', $subscription->get_profile_id()); |
|
| 173 | + update_post_meta($subscription->get_parent_invoice_id(), '_wpinv_subscription_id', $subscription->get_id()); |
|
| 174 | 174 | |
| 175 | 175 | // Fire a hook. |
| 176 | - do_action( 'getpaid_update_subscription', $subscription ); |
|
| 176 | + do_action('getpaid_update_subscription', $subscription); |
|
| 177 | 177 | |
| 178 | 178 | } |
| 179 | 179 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * |
| 183 | 183 | * @param WPInv_Subscription $subscription |
| 184 | 184 | */ |
| 185 | - public function delete( &$subscription ) { |
|
| 185 | + public function delete(&$subscription) { |
|
| 186 | 186 | global $wpdb; |
| 187 | 187 | |
| 188 | 188 | $wpdb->query( |
@@ -193,16 +193,16 @@ discard block |
||
| 193 | 193 | ) |
| 194 | 194 | ); |
| 195 | 195 | |
| 196 | - delete_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscr_profile_id' ); |
|
| 197 | - delete_post_meta( $subscription->get_parent_invoice_id(), '_wpinv_subscription_id' ); |
|
| 196 | + delete_post_meta($subscription->get_parent_invoice_id(), '_wpinv_subscr_profile_id'); |
|
| 197 | + delete_post_meta($subscription->get_parent_invoice_id(), '_wpinv_subscription_id'); |
|
| 198 | 198 | |
| 199 | 199 | // Delete cache. |
| 200 | 200 | $subscription->clear_cache(); |
| 201 | 201 | |
| 202 | 202 | // Fire a hook. |
| 203 | - do_action( 'getpaid_delete_subscription', $subscription ); |
|
| 203 | + do_action('getpaid_delete_subscription', $subscription); |
|
| 204 | 204 | |
| 205 | - $subscription->set_id( 0 ); |
|
| 205 | + $subscription->set_id(0); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /* |
@@ -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 | } |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -$email_footer = apply_filters( 'wpinv_email_footer_text', wpinv_get_option( 'email_footer_text', get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ) ) ); |
|
| 7 | -$email_footer = $email_footer ? wpautop( wp_kses_post( wptexturize( $email_footer ) ) ) : ''; |
|
| 6 | +$email_footer = apply_filters('wpinv_email_footer_text', wpinv_get_option('email_footer_text', get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'))); |
|
| 7 | +$email_footer = $email_footer ? wpautop(wp_kses_post(wptexturize($email_footer))) : ''; |
|
| 8 | 8 | ?> |
| 9 | 9 | </div> |
| 10 | 10 | </td> |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if ( !defined('ABSPATH') ) { |
|
| 4 | 4 | die('-1'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | $email_footer = apply_filters( 'wpinv_email_footer_text', wpinv_get_option( 'email_footer_text', get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ) ) ); |
| 7 | 8 | $email_footer = $email_footer ? wpautop( wp_kses_post( wptexturize( $email_footer ) ) ) : ''; |
@@ -7,35 +7,35 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | $value = ''; |
| 13 | 13 | $class = ''; |
| 14 | 14 | |
| 15 | -if ( ! empty( $form->invoice ) ) { |
|
| 16 | - $value = sanitize_email( $form->invoice->get_email() ); |
|
| 17 | -} else if ( is_user_logged_in() ) { |
|
| 15 | +if (!empty($form->invoice)) { |
|
| 16 | + $value = sanitize_email($form->invoice->get_email()); |
|
| 17 | +} else if (is_user_logged_in()) { |
|
| 18 | 18 | $user = wp_get_current_user(); |
| 19 | - $value = sanitize_email( $user->user_email ); |
|
| 19 | + $value = sanitize_email($user->user_email); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -if ( ! empty( $value ) && ! empty( $hide_billing_email ) ) { |
|
| 22 | +if (!empty($value) && !empty($hide_billing_email)) { |
|
| 23 | 23 | $class = 'd-none'; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | -do_action( 'getpaid_before_payment_form_billing_email', $form ); |
|
| 26 | +do_action('getpaid_before_payment_form_billing_email', $form); |
|
| 27 | 27 | |
| 28 | 28 | echo "<span class='$class'>"; |
| 29 | 29 | |
| 30 | 30 | echo aui()->input( |
| 31 | 31 | array( |
| 32 | 32 | 'name' => 'billing_email', |
| 33 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 34 | - 'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 35 | - 'required' => ! empty( $required ), |
|
| 36 | - 'label' => empty( $label ) ? '' : wp_kses_post( $label ) . '<span class="text-danger"> *</span>', |
|
| 33 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 34 | + 'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 35 | + 'required' => !empty($required), |
|
| 36 | + 'label' => empty($label) ? '' : wp_kses_post($label) . '<span class="text-danger"> *</span>', |
|
| 37 | 37 | 'label_type' => 'vertical', |
| 38 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 38 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 39 | 39 | 'type' => 'email', |
| 40 | 40 | 'value' => $value, |
| 41 | 41 | 'class' => 'wpinv_billing_email', |
@@ -47,4 +47,4 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | echo '</span>'; |
| 49 | 49 | |
| 50 | -do_action( 'getpaid_after_payment_form_billing_email', $form ); |
|
| 50 | +do_action('getpaid_after_payment_form_billing_email', $form); |
|