@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if (!defined('ABSPATH')) { |
|
| 11 | 11 | exit; // Exit if accessed directly |
| 12 | 12 | } |
| 13 | 13 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param WP_Post $post |
| 23 | 23 | */ |
| 24 | - public static function output( $post ) { |
|
| 24 | + public static function output($post) { |
|
| 25 | 25 | |
| 26 | 26 | // Prepare the invoice. |
| 27 | - $invoice = new WPInv_Invoice( $post ); |
|
| 27 | + $invoice = new WPInv_Invoice($post); |
|
| 28 | 28 | |
| 29 | 29 | ?> |
| 30 | 30 | |
@@ -40,20 +40,20 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | <?php |
| 42 | 42 | |
| 43 | - if ( $invoice->is_draft() ) { |
|
| 43 | + if ($invoice->is_draft()) { |
|
| 44 | 44 | |
| 45 | 45 | // Set gateway. |
| 46 | 46 | echo aui()->select( |
| 47 | 47 | array( |
| 48 | 48 | 'id' => 'wpinv_gateway', |
| 49 | 49 | 'name' => 'wpinv_gateway', |
| 50 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
| 50 | + 'label' => __('Gateway:', 'invoicing'), |
|
| 51 | 51 | 'label_type' => 'vertical', |
| 52 | - 'placeholder' => __( 'Select Gateway', 'invoicing' ), |
|
| 52 | + 'placeholder' => __('Select Gateway', 'invoicing'), |
|
| 53 | 53 | 'value' => wpinv_get_default_gateway(), |
| 54 | 54 | 'select2' => true, |
| 55 | 55 | 'data-allow-clear' => 'false', |
| 56 | - 'options' => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ), |
|
| 56 | + 'options' => wp_list_pluck(wpinv_get_enabled_payment_gateways(true), 'admin_label'), |
|
| 57 | 57 | ) |
| 58 | 58 | ); |
| 59 | 59 | |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | 'id' => 'wpinv_key', |
| 66 | 66 | 'name' => 'wpinv_key', |
| 67 | 67 | 'label' => sprintf( |
| 68 | - __( '%s Key:', 'invoicing' ), |
|
| 69 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 68 | + __('%s Key:', 'invoicing'), |
|
| 69 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 70 | 70 | ), |
| 71 | 71 | 'label_type' => 'vertical', |
| 72 | 72 | 'class' => 'form-control-sm', |
| 73 | - 'value' => $invoice->get_key( 'edit' ), |
|
| 73 | + 'value' => $invoice->get_key('edit'), |
|
| 74 | 74 | 'extra_attributes' => array( |
| 75 | 75 | 'onclick' => 'this.select();', |
| 76 | 76 | 'readonly' => 'true', |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | 'id' => 'wpinv_view_url', |
| 86 | 86 | 'name' => 'wpinv_view_url', |
| 87 | 87 | 'label' => sprintf( |
| 88 | - __( '%s URL:', 'invoicing' ), |
|
| 89 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 90 | - ) . ' <a href="' . esc_url_raw( $invoice->get_view_url() ) . '" title="' . __( 'View invoice', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>', |
|
| 88 | + __('%s URL:', 'invoicing'), |
|
| 89 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 90 | + ) . ' <a href="' . esc_url_raw($invoice->get_view_url()) . '" title="' . __('View invoice', 'invoicing') . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>', |
|
| 91 | 91 | 'label_type' => 'vertical', |
| 92 | 92 | 'class' => 'form-control-sm', |
| 93 | 93 | 'value' => $invoice->get_view_url(), |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | 101 | // If the invoice is paid... |
| 102 | - if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
|
| 102 | + if ($invoice->is_paid() || $invoice->is_refunded()) { |
|
| 103 | 103 | |
| 104 | 104 | // Gateway. |
| 105 | 105 | echo aui()->input( |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | 'type' => 'text', |
| 108 | 108 | 'id' => 'wpinv_gateway', |
| 109 | 109 | 'name' => '', |
| 110 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
| 110 | + 'label' => __('Gateway:', 'invoicing'), |
|
| 111 | 111 | 'label_type' => 'vertical', |
| 112 | 112 | 'class' => 'form-control-sm', |
| 113 | - 'value' => wpinv_get_gateway_admin_label( $invoice->get_gateway( 'edit' ) ), |
|
| 113 | + 'value' => wpinv_get_gateway_admin_label($invoice->get_gateway('edit')), |
|
| 114 | 114 | 'extra_attributes' => array( |
| 115 | 115 | 'onclick' => 'this.select();', |
| 116 | 116 | 'readonly' => 'true', |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | 'type' => 'text', |
| 125 | 125 | 'id' => 'wpinv_transaction_id', |
| 126 | 126 | 'name' => 'wpinv_transaction_id', |
| 127 | - 'label' => __( 'Transaction ID:', 'invoicing' ), |
|
| 127 | + 'label' => __('Transaction ID:', 'invoicing'), |
|
| 128 | 128 | 'label_type' => 'vertical', |
| 129 | 129 | 'class' => 'form-control-sm', |
| 130 | - 'value' => $invoice->get_transaction_id( 'edit' ), |
|
| 131 | - 'help_text' => apply_filters( 'wpinv_invoice_transaction_link_' . $invoice->get_gateway( 'edit' ), '', $invoice->get_transaction_id(), $invoice ), |
|
| 130 | + 'value' => $invoice->get_transaction_id('edit'), |
|
| 131 | + 'help_text' => apply_filters('wpinv_invoice_transaction_link_' . $invoice->get_gateway('edit'), '', $invoice->get_transaction_id(), $invoice), |
|
| 132 | 132 | 'extra_attributes' => array( |
| 133 | 133 | 'onclick' => 'this.select();', |
| 134 | 134 | 'readonly' => 'true', |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | 'type' => 'text', |
| 143 | 143 | 'id' => 'wpinv_currency', |
| 144 | 144 | 'name' => 'wpinv_currency', |
| 145 | - 'label' => __( 'Currency:', 'invoicing' ), |
|
| 145 | + 'label' => __('Currency:', 'invoicing'), |
|
| 146 | 146 | 'label_type' => 'vertical', |
| 147 | 147 | 'class' => 'form-control-sm', |
| 148 | - 'value' => $invoice->get_currency( 'edit' ), |
|
| 148 | + 'value' => $invoice->get_currency('edit'), |
|
| 149 | 149 | 'extra_attributes' => array( |
| 150 | 150 | 'onclick' => 'this.select();', |
| 151 | 151 | 'readonly' => 'true', |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | } else { |
| 157 | 157 | |
| 158 | - if ( 'wpi_invoice' == $invoice->get_post_type() ) { |
|
| 158 | + if ('wpi_invoice' == $invoice->get_post_type()) { |
|
| 159 | 159 | |
| 160 | 160 | // Payment URL. |
| 161 | 161 | echo aui()->input( |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | 'type' => 'text', |
| 164 | 164 | 'id' => 'wpinv_payment_url', |
| 165 | 165 | 'name' => 'wpinv_payment_url', |
| 166 | - 'label' => __( 'Payment URL:', 'invoicing' ), |
|
| 166 | + 'label' => __('Payment URL:', 'invoicing'), |
|
| 167 | 167 | 'label_type' => 'vertical', |
| 168 | 168 | 'class' => 'form-control-sm', |
| 169 | 169 | 'value' => $invoice->get_checkout_payment_url(), |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | array( |
| 180 | 180 | 'id' => 'wpinv_gateway', |
| 181 | 181 | 'name' => 'wpinv_gateway', |
| 182 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
| 182 | + 'label' => __('Gateway:', 'invoicing'), |
|
| 183 | 183 | 'label_type' => 'vertical', |
| 184 | - 'placeholder' => __( 'Select Gateway', 'invoicing' ), |
|
| 185 | - 'value' => $invoice->get_gateway( 'edit' ), |
|
| 184 | + 'placeholder' => __('Select Gateway', 'invoicing'), |
|
| 185 | + 'value' => $invoice->get_gateway('edit'), |
|
| 186 | 186 | 'select2' => true, |
| 187 | 187 | 'data-allow-clear' => 'false', |
| 188 | - 'options' => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ), |
|
| 188 | + 'options' => wp_list_pluck(wpinv_get_enabled_payment_gateways(true), 'admin_label'), |
|
| 189 | 189 | ) |
| 190 | 190 | ); |
| 191 | 191 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Metaboxes Admin Class |
@@ -25,35 +25,35 @@ discard block |
||
| 25 | 25 | public static function init() { |
| 26 | 26 | |
| 27 | 27 | // Register metaboxes. |
| 28 | - add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::add_meta_boxes', 5, 2 ); |
|
| 28 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::add_meta_boxes', 5, 2); |
|
| 29 | 29 | |
| 30 | 30 | // Remove metaboxes. |
| 31 | - add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::remove_meta_boxes', 30 ); |
|
| 31 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::remove_meta_boxes', 30); |
|
| 32 | 32 | |
| 33 | 33 | // Rename metaboxes. |
| 34 | - add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::rename_meta_boxes', 45 ); |
|
| 34 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::rename_meta_boxes', 45); |
|
| 35 | 35 | |
| 36 | 36 | // Save metaboxes. |
| 37 | - add_action( 'save_post', 'GetPaid_Metaboxes::save_meta_boxes', 1, 2 ); |
|
| 37 | + add_action('save_post', 'GetPaid_Metaboxes::save_meta_boxes', 1, 2); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Register core metaboxes. |
| 42 | 42 | */ |
| 43 | - public static function add_meta_boxes( $post_type, $post ) { |
|
| 43 | + public static function add_meta_boxes($post_type, $post) { |
|
| 44 | 44 | |
| 45 | 45 | // For invoices... |
| 46 | - self::add_invoice_meta_boxes( $post_type, $post ); |
|
| 46 | + self::add_invoice_meta_boxes($post_type, $post); |
|
| 47 | 47 | |
| 48 | 48 | // For payment forms. |
| 49 | - self::add_payment_form_meta_boxes( $post_type ); |
|
| 49 | + self::add_payment_form_meta_boxes($post_type); |
|
| 50 | 50 | |
| 51 | 51 | // For invoice items. |
| 52 | - self::add_item_meta_boxes( $post_type ); |
|
| 52 | + self::add_item_meta_boxes($post_type); |
|
| 53 | 53 | |
| 54 | 54 | // For invoice discounts. |
| 55 | - if ( $post_type == 'wpi_discount' ) { |
|
| 56 | - add_meta_box( 'wpinv_discount_details', __( 'Discount Details', 'invoicing' ), 'GetPaid_Meta_Box_Discount_Details::output', 'wpi_discount', 'normal', 'high' ); |
|
| 55 | + if ($post_type == 'wpi_discount') { |
|
| 56 | + add_meta_box('wpinv_discount_details', __('Discount Details', 'invoicing'), 'GetPaid_Meta_Box_Discount_Details::output', 'wpi_discount', 'normal', 'high'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | } |
@@ -61,16 +61,16 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * Register core metaboxes. |
| 63 | 63 | */ |
| 64 | - protected static function add_payment_form_meta_boxes( $post_type ) { |
|
| 64 | + protected static function add_payment_form_meta_boxes($post_type) { |
|
| 65 | 65 | |
| 66 | 66 | // For payment forms. |
| 67 | - if ( $post_type == 'wpi_payment_form' ) { |
|
| 67 | + if ($post_type == 'wpi_payment_form') { |
|
| 68 | 68 | |
| 69 | 69 | // Design payment form. |
| 70 | - add_meta_box( 'wpinv-payment-form-design', __( 'Payment Form', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal' ); |
|
| 70 | + add_meta_box('wpinv-payment-form-design', __('Payment Form', 'invoicing'), 'GetPaid_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal'); |
|
| 71 | 71 | |
| 72 | 72 | // Payment form information. |
| 73 | - add_meta_box( 'wpinv-payment-form-info', __( 'Details', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form_Info::output', 'wpi_payment_form', 'side' ); |
|
| 73 | + add_meta_box('wpinv-payment-form-info', __('Details', 'invoicing'), 'GetPaid_Meta_Box_Payment_Form_Info::output', 'wpi_payment_form', 'side'); |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,20 +79,20 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * Register core metaboxes. |
| 81 | 81 | */ |
| 82 | - protected static function add_item_meta_boxes( $post_type ) { |
|
| 82 | + protected static function add_item_meta_boxes($post_type) { |
|
| 83 | 83 | |
| 84 | - if ( $post_type == 'wpi_item' ) { |
|
| 84 | + if ($post_type == 'wpi_item') { |
|
| 85 | 85 | |
| 86 | 86 | // Item details. |
| 87 | - add_meta_box( 'wpinv_item_details', __( 'Item Details', 'invoicing' ), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high' ); |
|
| 87 | + add_meta_box('wpinv_item_details', __('Item Details', 'invoicing'), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high'); |
|
| 88 | 88 | |
| 89 | 89 | // If taxes are enabled, register the tax metabox. |
| 90 | - if ( wpinv_use_taxes() ) { |
|
| 91 | - add_meta_box( 'wpinv_item_vat', __( 'Tax', 'invoicing' ), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high' ); |
|
| 90 | + if (wpinv_use_taxes()) { |
|
| 91 | + add_meta_box('wpinv_item_vat', __('Tax', 'invoicing'), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Item info. |
| 95 | - add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core' ); |
|
| 95 | + add_meta_box('wpinv_field_item_info', __('Item info', 'invoicing'), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core'); |
|
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,20 +101,20 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * Register invoice metaboxes. |
| 103 | 103 | */ |
| 104 | - protected static function add_invoice_meta_boxes( $post_type, $post ) { |
|
| 104 | + protected static function add_invoice_meta_boxes($post_type, $post) { |
|
| 105 | 105 | |
| 106 | 106 | // For invoices... |
| 107 | - if ( getpaid_is_invoice_post_type( $post_type ) ) { |
|
| 108 | - $invoice = new WPInv_Invoice( $post ); |
|
| 107 | + if (getpaid_is_invoice_post_type($post_type)) { |
|
| 108 | + $invoice = new WPInv_Invoice($post); |
|
| 109 | 109 | |
| 110 | 110 | // Resend invoice. |
| 111 | - if ( ! $invoice->is_draft() ) { |
|
| 111 | + if (!$invoice->is_draft()) { |
|
| 112 | 112 | |
| 113 | 113 | add_meta_box( |
| 114 | 114 | 'wpinv-mb-resend-invoice', |
| 115 | 115 | sprintf( |
| 116 | - __( 'Resend %s', 'invoicing' ), |
|
| 117 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 116 | + __('Resend %s', 'invoicing'), |
|
| 117 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 118 | 118 | ), |
| 119 | 119 | 'GetPaid_Meta_Box_Resend_Invoice::output', |
| 120 | 120 | $post_type, |
@@ -125,17 +125,17 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Subscriptions. |
| 128 | - $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
| 129 | - if ( ! empty( $subscriptions ) ) { |
|
| 128 | + $subscriptions = getpaid_get_invoice_subscriptions($invoice); |
|
| 129 | + if (!empty($subscriptions)) { |
|
| 130 | 130 | |
| 131 | - if ( is_array( $subscriptions ) ) { |
|
| 132 | - add_meta_box( 'wpinv-mb-subscriptions', __( 'Related Subscriptions', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output_related', $post_type, 'advanced' ); |
|
| 131 | + if (is_array($subscriptions)) { |
|
| 132 | + add_meta_box('wpinv-mb-subscriptions', __('Related Subscriptions', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output_related', $post_type, 'advanced'); |
|
| 133 | 133 | } else { |
| 134 | - add_meta_box( 'wpinv-mb-subscriptions', __( 'Subscription Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced' ); |
|
| 134 | + add_meta_box('wpinv-mb-subscriptions', __('Subscription Details', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced'); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if ( getpaid_count_subscription_invoices( $invoice->is_renewal() ? $invoice->get_parent_id() : $invoice->get_id() ) > 1 ) { |
|
| 138 | - add_meta_box( 'wpinv-mb-subscription-invoices', __( 'Related Payments', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced' ); |
|
| 137 | + if (getpaid_count_subscription_invoices($invoice->is_renewal() ? $invoice->get_parent_id() : $invoice->get_id()) > 1) { |
|
| 138 | + add_meta_box('wpinv-mb-subscription-invoices', __('Related Payments', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced'); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | } |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | add_meta_box( |
| 145 | 145 | 'wpinv-details', |
| 146 | 146 | sprintf( |
| 147 | - __( '%s Details', 'invoicing' ), |
|
| 148 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 147 | + __('%s Details', 'invoicing'), |
|
| 148 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 149 | 149 | ), |
| 150 | 150 | 'GetPaid_Meta_Box_Invoice_Details::output', |
| 151 | 151 | $post_type, |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | 155 | // Payment details. |
| 156 | - add_meta_box( 'wpinv-payment-meta', __( 'Payment Meta', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default' ); |
|
| 156 | + add_meta_box('wpinv-payment-meta', __('Payment Meta', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default'); |
|
| 157 | 157 | |
| 158 | 158 | // Billing details. |
| 159 | - add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high' ); |
|
| 159 | + add_meta_box('wpinv-address', __('Billing Details', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high'); |
|
| 160 | 160 | |
| 161 | 161 | // Invoice items. |
| 162 | 162 | add_meta_box( |
| 163 | 163 | 'wpinv-items', |
| 164 | 164 | sprintf( |
| 165 | - __( '%s Items', 'invoicing' ), |
|
| 166 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 165 | + __('%s Items', 'invoicing'), |
|
| 166 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 167 | 167 | ), |
| 168 | 168 | 'GetPaid_Meta_Box_Invoice_Items::output', |
| 169 | 169 | $post_type, |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | add_meta_box( |
| 176 | 176 | 'wpinv-notes', |
| 177 | 177 | sprintf( |
| 178 | - __( '%s Notes', 'invoicing' ), |
|
| 179 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 178 | + __('%s Notes', 'invoicing'), |
|
| 179 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 180 | 180 | ), |
| 181 | 181 | 'WPInv_Meta_Box_Notes::output', |
| 182 | 182 | $post_type, |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | 187 | // Shipping Address. |
| 188 | - if ( get_post_meta( $invoice->get_id(), 'shipping_address', true ) ) { |
|
| 189 | - add_meta_box( 'wpinv-invoice-shipping-details', __( 'Shipping Address', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high' ); |
|
| 188 | + if (get_post_meta($invoice->get_id(), 'shipping_address', true)) { |
|
| 189 | + add_meta_box('wpinv-invoice-shipping-details', __('Shipping Address', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high'); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // Payment form information. |
| 193 | - if ( get_post_meta( $invoice->get_id(), 'payment_form_data', true ) ) { |
|
| 194 | - add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high' ); |
|
| 193 | + if (get_post_meta($invoice->get_id(), 'payment_form_data', true)) { |
|
| 194 | + add_meta_box('wpinv-invoice-payment-form-details', __('Payment Form Details', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high'); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * Remove some metaboxes. |
| 203 | 203 | */ |
| 204 | 204 | public static function remove_meta_boxes() { |
| 205 | - remove_meta_box( 'wpseo_meta', 'wpi_invoice', 'normal' ); |
|
| 205 | + remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -218,46 +218,46 @@ discard block |
||
| 218 | 218 | * @param int $post_id Post ID. |
| 219 | 219 | * @param object $post Post object. |
| 220 | 220 | */ |
| 221 | - public static function save_meta_boxes( $post_id, $post ) { |
|
| 222 | - $post_id = absint( $post_id ); |
|
| 223 | - $data = wp_kses_post_deep( wp_unslash( $_POST ) ); |
|
| 221 | + public static function save_meta_boxes($post_id, $post) { |
|
| 222 | + $post_id = absint($post_id); |
|
| 223 | + $data = wp_kses_post_deep(wp_unslash($_POST)); |
|
| 224 | 224 | |
| 225 | 225 | // Do not save for ajax requests. |
| 226 | - if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
| 226 | + if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
| 227 | 227 | return; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // $post_id and $post are required |
| 231 | - if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) { |
|
| 231 | + if (empty($post_id) || empty($post) || self::$saved_meta_boxes) { |
|
| 232 | 232 | return; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // Dont' save meta boxes for revisions or autosaves. |
| 236 | - if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
| 236 | + if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
| 237 | 237 | return; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | // Check the nonce. |
| 241 | - if ( empty( $data['getpaid_meta_nonce'] ) || ! wp_verify_nonce( $data['getpaid_meta_nonce'], 'getpaid_meta_nonce' ) ) { |
|
| 241 | + if (empty($data['getpaid_meta_nonce']) || !wp_verify_nonce($data['getpaid_meta_nonce'], 'getpaid_meta_nonce')) { |
|
| 242 | 242 | return; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
| 246 | - if ( empty( $data['post_ID'] ) || absint( $data['post_ID'] ) !== $post_id ) { |
|
| 246 | + if (empty($data['post_ID']) || absint($data['post_ID']) !== $post_id) { |
|
| 247 | 247 | return; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // Check user has permission to edit. |
| 251 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 251 | + if (!current_user_can('edit_post', $post_id)) { |
|
| 252 | 252 | return; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if ( getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
| 255 | + if (getpaid_is_invoice_post_type($post->post_type)) { |
|
| 256 | 256 | |
| 257 | 257 | // We need this save event to run once to avoid potential endless loops. |
| 258 | 258 | self::$saved_meta_boxes = true; |
| 259 | 259 | |
| 260 | - return GetPaid_Meta_Box_Invoice_Address::save( $post_id ); |
|
| 260 | + return GetPaid_Meta_Box_Invoice_Address::save($post_id); |
|
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | ); |
| 270 | 270 | |
| 271 | 271 | // Is this our post type? |
| 272 | - if ( ! isset( $post_types_map[ $post->post_type ] ) ) { |
|
| 272 | + if (!isset($post_types_map[$post->post_type])) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | self::$saved_meta_boxes = true; |
| 278 | 278 | |
| 279 | 279 | // Save the post. |
| 280 | - $class = $post_types_map[ $post->post_type ]; |
|
| 281 | - $class::save( $post_id, $_POST, $post ); |
|
| 280 | + $class = $post_types_map[$post->post_type]; |
|
| 281 | + $class::save($post_id, $_POST, $post); |
|
| 282 | 282 | |
| 283 | 283 | } |
| 284 | 284 | |