@@ -7,25 +7,25 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 15 | +if (!empty($required)) { |
|
| 16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | aui()->select( |
| 20 | 20 | array( |
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 21 | + 'name' => esc_attr($id), |
|
| 22 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 23 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 24 | + 'required' => !empty($required), |
|
| 25 | 25 | 'label' => $label, |
| 26 | 26 | 'label_type' => 'vertical', |
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 28 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 29 | 29 | 'class' => $label_class, |
| 30 | 30 | ), |
| 31 | 31 | true |
@@ -7,26 +7,26 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 15 | +if (!empty($required)) { |
|
| 16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | aui()->radio( |
| 20 | 20 | array( |
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 23 | - 'required' => ! empty( $required ), |
|
| 21 | + 'name' => esc_attr($id), |
|
| 22 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 23 | + 'required' => !empty($required), |
|
| 24 | 24 | 'label' => $label, |
| 25 | 25 | 'label_type' => 'vertical', |
| 26 | 26 | 'class' => 'w-auto', |
| 27 | 27 | 'inline' => false, |
| 28 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 29 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 29 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 30 | 30 | 'class' => $label_class, |
| 31 | 31 | ), |
| 32 | 32 | true |
@@ -7,31 +7,31 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Prepare the selectable items. |
| 13 | 13 | $selectable = array(); |
| 14 | -foreach ( $form->get_items() as $item ) { |
|
| 15 | - if ( ! $item->is_required ) { |
|
| 16 | - $selectable[ $item->get_id() ] = $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ); |
|
| 14 | +foreach ($form->get_items() as $item) { |
|
| 15 | + if (!$item->is_required) { |
|
| 16 | + $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price($item->get_initial_price()); |
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 20 | +if (empty($selectable)) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | echo '<div class="getpaid-payment-form-items-checkbox form-group">'; |
| 25 | 25 | |
| 26 | -foreach ( $selectable as $item_id => $item_name ) { |
|
| 26 | +foreach ($selectable as $item_id => $item_name) { |
|
| 27 | 27 | |
| 28 | - $is_checked = get_post_meta( $item_id, 'selected_by_default', true ); |
|
| 28 | + $is_checked = get_post_meta($item_id, 'selected_by_default', true); |
|
| 29 | 29 | |
| 30 | 30 | aui()->input( |
| 31 | 31 | array( |
| 32 | 32 | 'type' => 'checkbox', |
| 33 | 33 | 'name' => 'getpaid-payment-form-selected-item', |
| 34 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
| 34 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_') . $item_id, |
|
| 35 | 35 | 'label' => $item_name, |
| 36 | 36 | 'value' => $item_id, |
| 37 | 37 | 'no_wrap' => true, |
@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Prepare the selectable items. |
| 13 | 13 | $selectable = array(); |
| 14 | -foreach ( $form->get_items() as $item ) { |
|
| 15 | - if ( ! $item->is_required ) { |
|
| 16 | - $selectable[ $item->get_id() ] = strip_tags( $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ) ); |
|
| 14 | +foreach ($form->get_items() as $item) { |
|
| 15 | + if (!$item->is_required) { |
|
| 16 | + $selectable[$item->get_id()] = strip_tags($item->get_name() . ' — ' . wpinv_price($item->get_initial_price())); |
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 20 | +if (empty($selectable)) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | aui()->select( |
| 28 | 28 | array( |
| 29 | 29 | 'name' => 'getpaid-payment-form-selected-item', |
| 30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
| 30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_'), |
|
| 31 | 31 | 'required' => true, |
| 32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
| 32 | + 'label' => __('Select Item', 'invoicing'), |
|
| 33 | 33 | 'label_type' => 'vertical', |
| 34 | 34 | 'inline' => false, |
| 35 | 35 | 'options' => $selectable, |
@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Prepare the selectable items. |
| 13 | 13 | $selectable = array(); |
| 14 | -foreach ( $form->get_items() as $item ) { |
|
| 15 | - if ( ! $item->is_required ) { |
|
| 16 | - $selectable[ $item->get_id() ] = $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ); |
|
| 14 | +foreach ($form->get_items() as $item) { |
|
| 15 | + if (!$item->is_required) { |
|
| 16 | + $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price($item->get_initial_price()); |
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 20 | +if (empty($selectable)) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | aui()->radio( |
| 28 | 28 | array( |
| 29 | 29 | 'name' => 'getpaid-payment-form-selected-item', |
| 30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
| 30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_'), |
|
| 31 | 31 | 'required' => true, |
| 32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
| 32 | + 'label' => __('Select Item', 'invoicing'), |
|
| 33 | 33 | 'label_type' => 'vertical', |
| 34 | 34 | 'class' => 'w-auto', |
| 35 | 35 | 'inline' => false, |
@@ -7,14 +7,14 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Make sure that the form is active. |
| 13 | -if ( ! $form->is_active() ) { |
|
| 13 | +if (!$form->is_active()) { |
|
| 14 | 14 | aui()->alert( |
| 15 | 15 | array( |
| 16 | 16 | 'type' => 'warning', |
| 17 | - 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
| 17 | + 'content' => __('This payment form is no longer active', 'invoicing'), |
|
| 18 | 18 | ), |
| 19 | 19 | true |
| 20 | 20 | ); |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | // Require login to checkout. |
| 25 | -if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) { |
|
| 25 | +if (wpinv_require_login_to_checkout() && !get_current_user_id()) { |
|
| 26 | 26 | |
| 27 | 27 | aui()->alert( |
| 28 | 28 | array( |
| 29 | 29 | 'type' => 'danger', |
| 30 | - 'content' => __( 'You must be logged in to checkout.', 'invoicing' ), |
|
| 30 | + 'content' => __('You must be logged in to checkout.', 'invoicing'), |
|
| 31 | 31 | ), |
| 32 | 32 | true |
| 33 | 33 | ); |
@@ -36,29 +36,29 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Fires before displaying a payment form. |
| 39 | -do_action( 'getpaid_before_payment_form', $form ); |
|
| 39 | +do_action('getpaid_before_payment_form', $form); |
|
| 40 | 40 | ?> |
| 41 | 41 | |
| 42 | -<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid( 'gpf' ); ?>' data-currency='<?php echo esc_attr( empty( $form->invoice ) ? wpinv_get_currency() : $form->invoice->get_currency() ); ?>' novalidate> |
|
| 42 | +<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid('gpf'); ?>' data-currency='<?php echo esc_attr(empty($form->invoice) ? wpinv_get_currency() : $form->invoice->get_currency()); ?>' novalidate> |
|
| 43 | 43 | |
| 44 | 44 | <?php |
| 45 | 45 | |
| 46 | 46 | // Fires when printing the top of a payment form. |
| 47 | - do_action( 'getpaid_payment_form_top', $form ); |
|
| 47 | + do_action('getpaid_payment_form_top', $form); |
|
| 48 | 48 | |
| 49 | 49 | // And the optional invoice id. |
| 50 | - if ( ! empty( $form->invoice ) ) { |
|
| 51 | - echo getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
| 50 | + if (!empty($form->invoice)) { |
|
| 51 | + echo getpaid_hidden_field('invoice_id', $form->invoice->get_id()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // We also want to include the form id. |
| 55 | - echo getpaid_hidden_field( 'form_id', $form->get_id() ); |
|
| 55 | + echo getpaid_hidden_field('form_id', $form->get_id()); |
|
| 56 | 56 | |
| 57 | 57 | // And an indication that this is a payment form submission. |
| 58 | - echo getpaid_hidden_field( 'getpaid_payment_form_submission', '1' ); |
|
| 58 | + echo getpaid_hidden_field('getpaid_payment_form_submission', '1'); |
|
| 59 | 59 | |
| 60 | 60 | // Fires before displaying payment form elements. |
| 61 | - do_action( 'getpaid_payment_form_before_elements', $form ); |
|
| 61 | + do_action('getpaid_payment_form_before_elements', $form); |
|
| 62 | 62 | |
| 63 | 63 | // Display the elements. |
| 64 | 64 | ?> |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | <div class="row"> |
| 67 | 67 | <?php |
| 68 | 68 | |
| 69 | - foreach ( $form->get_elements() as $element ) { |
|
| 69 | + foreach ($form->get_elements() as $element) { |
|
| 70 | 70 | |
| 71 | - if ( isset( $element['type'] ) ) { |
|
| 72 | - $grid_class = esc_attr( getpaid_get_form_element_grid_class( $element ) ); |
|
| 71 | + if (isset($element['type'])) { |
|
| 72 | + $grid_class = esc_attr(getpaid_get_form_element_grid_class($element)); |
|
| 73 | 73 | echo "<div class='$grid_class'>"; |
| 74 | - do_action( 'getpaid_payment_form_element', $element, $form ); |
|
| 75 | - do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
| 74 | + do_action('getpaid_payment_form_element', $element, $form); |
|
| 75 | + do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form); |
|
| 76 | 76 | echo '</div>'; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -83,28 +83,28 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | <?php |
| 85 | 85 | // Fires after displaying payment form elements. |
| 86 | - do_action( 'getpaid_payment_form_after_elements', $form ); |
|
| 86 | + do_action('getpaid_payment_form_after_elements', $form); |
|
| 87 | 87 | |
| 88 | 88 | echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>"; |
| 89 | 89 | |
| 90 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 90 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
| 91 | 91 | |
| 92 | 92 | edit_post_link( |
| 93 | - __( 'Edit this form.', 'invoicing' ), |
|
| 93 | + __('Edit this form.', 'invoicing'), |
|
| 94 | 94 | '<small class="form-text text-muted">', |
| 95 | - ' ' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>', |
|
| 95 | + ' ' . __('This is only visible to website administators.', 'invoicing') . '</small>', |
|
| 96 | 96 | $form->get_id(), |
| 97 | 97 | 'text-danger' |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - echo wp_kses_post( $extra_markup ); |
|
| 102 | + echo wp_kses_post($extra_markup); |
|
| 103 | 103 | ?> |
| 104 | 104 | |
| 105 | 105 | <div class="loading_div overlay overlay-black position-absolute row m-0 rounded overflow-hidden" style="height: 100%;width: 100%;top: 0px;z-index: 2;display:none;"> |
| 106 | 106 | <div class="spinner-border mx-auto align-self-center text-white" role="status"> |
| 107 | - <span class="sr-only"><?php esc_html_e( 'Loading...', 'invoicing' ); ?></span> |
|
| 107 | + <span class="sr-only"><?php esc_html_e('Loading...', 'invoicing'); ?></span> |
|
| 108 | 108 | </div> |
| 109 | 109 | </div> |
| 110 | 110 | |
@@ -113,4 +113,4 @@ discard block |
||
| 113 | 113 | <?php |
| 114 | 114 | |
| 115 | 115 | // Fires after displaying a payment form. |
| 116 | -do_action( 'getpaid_after_payment_form', $form ); |
|
| 116 | +do_action('getpaid_after_payment_form', $form); |
|
@@ -1,51 +1,51 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | - die( '-1' ); |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | + die('-1'); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -do_action( 'wpinv_email_before_billing_details', $invoice ); ?> |
|
| 7 | +do_action('wpinv_email_before_billing_details', $invoice); ?> |
|
| 8 | 8 | <div id="wpinv-email-billing"> |
| 9 | - <h3 class="wpinv-address-t"><?php echo esc_html( apply_filters( 'wpinv_email_billing_title', __( 'Billing Details', 'invoicing' ) ) ); ?></h3> |
|
| 9 | + <h3 class="wpinv-address-t"><?php echo esc_html(apply_filters('wpinv_email_billing_title', __('Billing Details', 'invoicing'))); ?></h3> |
|
| 10 | 10 | |
| 11 | 11 | <table class="table table-bordered table-sm wpi-billing-details"> |
| 12 | 12 | <tbody> |
| 13 | - <?php do_action( 'wpinv_email_billing_fields_first', $invoice ); ?> |
|
| 13 | + <?php do_action('wpinv_email_billing_fields_first', $invoice); ?> |
|
| 14 | 14 | <tr class="wpi-receipt-name"> |
| 15 | - <th class="text-left"><?php esc_html_e( 'Name', 'invoicing' ); ?></th> |
|
| 15 | + <th class="text-left"><?php esc_html_e('Name', 'invoicing'); ?></th> |
|
| 16 | 16 | <td> |
| 17 | 17 | <?php |
| 18 | - if ( $sent_to_admin && $invoice->get_user_id() ) { |
|
| 18 | + if ($sent_to_admin && $invoice->get_user_id()) { |
|
| 19 | 19 | ?> |
| 20 | -<a href="<?php echo esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), self_admin_url( 'user-edit.php' ) ) ); ?>"><?php echo esc_html( $invoice->get_user_full_name() ); ?></a> |
|
| 20 | +<a href="<?php echo esc_url(add_query_arg('user_id', $invoice->get_user_id(), self_admin_url('user-edit.php'))); ?>"><?php echo esc_html($invoice->get_user_full_name()); ?></a> |
|
| 21 | 21 | <?php |
| 22 | 22 | } else { |
| 23 | - echo esc_html( $invoice->get_user_full_name() ); } |
|
| 23 | + echo esc_html($invoice->get_user_full_name()); } |
|
| 24 | 24 | ?> |
| 25 | 25 | </td> |
| 26 | 26 | </tr> |
| 27 | 27 | <tr class="wpi-receipt-email"> |
| 28 | - <th class="text-left"><?php esc_html_e( 'Email', 'invoicing' ); ?></th> |
|
| 29 | - <td><?php echo esc_html( sanitize_email( $invoice->get_email() ) ); ?></td> |
|
| 28 | + <th class="text-left"><?php esc_html_e('Email', 'invoicing'); ?></th> |
|
| 29 | + <td><?php echo esc_html(sanitize_email($invoice->get_email())); ?></td> |
|
| 30 | 30 | </tr> |
| 31 | - <?php if ( $invoice->get_company() ) { ?> |
|
| 31 | + <?php if ($invoice->get_company()) { ?> |
|
| 32 | 32 | <tr class="wpi-receipt-company"> |
| 33 | - <th class="text-left"><?php esc_html_e( 'Company', 'invoicing' ); ?></th> |
|
| 34 | - <td><?php echo esc_html( $invoice->get_company() ); ?></td> |
|
| 33 | + <th class="text-left"><?php esc_html_e('Company', 'invoicing'); ?></th> |
|
| 34 | + <td><?php echo esc_html($invoice->get_company()); ?></td> |
|
| 35 | 35 | </tr> |
| 36 | 36 | <?php } ?> |
| 37 | 37 | <tr class="wpi-receipt-address"> |
| 38 | - <th class="text-left"><?php esc_html_e( 'Address', 'invoicing' ); ?></th> |
|
| 39 | - <td><?php echo wp_kses_post( wpinv_get_invoice_address_markup( $invoice->get_user_info() ) ); ?></td> |
|
| 38 | + <th class="text-left"><?php esc_html_e('Address', 'invoicing'); ?></th> |
|
| 39 | + <td><?php echo wp_kses_post(wpinv_get_invoice_address_markup($invoice->get_user_info())); ?></td> |
|
| 40 | 40 | </tr> |
| 41 | - <?php if ( $invoice->get_phone() ) { ?> |
|
| 41 | + <?php if ($invoice->get_phone()) { ?> |
|
| 42 | 42 | <tr class="wpi-receipt-phone"> |
| 43 | - <th class="text-left"><?php esc_html_e( 'Phone', 'invoicing' ); ?></th> |
|
| 44 | - <td><?php echo esc_html( $invoice->get_phone() ); ?></td> |
|
| 43 | + <th class="text-left"><?php esc_html_e('Phone', 'invoicing'); ?></th> |
|
| 44 | + <td><?php echo esc_html($invoice->get_phone()); ?></td> |
|
| 45 | 45 | </tr> |
| 46 | 46 | <?php } ?> |
| 47 | - <?php do_action( 'wpinv_email_billing_fields_last', $invoice ); ?> |
|
| 47 | + <?php do_action('wpinv_email_billing_fields_last', $invoice); ?> |
|
| 48 | 48 | </tbody> |
| 49 | 49 | </table> |
| 50 | 50 | </div> |
| 51 | -<?php do_action( 'wpinv_email_after_billing_details', $invoice ); ?> |
|
| 51 | +<?php do_action('wpinv_email_after_billing_details', $invoice); ?> |
|
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | <?php |
| 26 | 26 | $img = wpinv_get_option( 'email_header_image', '' ); |
| 27 | 27 | if ( $img ) { |
| 28 | - echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url( $img ) . '" alt="' . esc_attr( wpinv_get_blogname() ) . '" /></p>'; |
|
| 28 | + echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url( $img ) . '" alt="' . esc_attr( wpinv_get_blogname() ) . '" /></p>'; |
|
| 29 | 29 | } |
| 30 | 30 | ?> |
| 31 | 31 | </div> |
@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | - die( '-1' ); |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | + die('-1'); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! isset( $email_heading ) ) { |
|
| 7 | +if (!isset($email_heading)) { |
|
| 8 | 8 | global $email_heading; |
| 9 | 9 | } |
| 10 | 10 | ?> |
| 11 | 11 | <!DOCTYPE html> |
| 12 | 12 | <html dir="<?php echo is_rtl() ? 'rtl' : 'ltr'; ?>"> |
| 13 | 13 | <head> |
| 14 | - <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" /> |
|
| 14 | + <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" /> |
|
| 15 | 15 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 16 | 16 | <meta name="robots" content="noindex,nofollow"> |
| 17 | - <title><?php echo esc_html( wpinv_get_blogname() ); ?></title> |
|
| 17 | + <title><?php echo esc_html(wpinv_get_blogname()); ?></title> |
|
| 18 | 18 | </head> |
| 19 | 19 | <body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"> |
| 20 | 20 | <div id="wrapper" dir="<?php echo is_rtl() ? 'rtl' : 'ltr'; ?>"> |
@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | <td align="center" valign="top"> |
| 24 | 24 | <div id="template_header_image"> |
| 25 | 25 | <?php |
| 26 | - $img = wpinv_get_option( 'email_header_image', '' ); |
|
| 27 | - if ( $img ) { |
|
| 28 | - echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url( $img ) . '" alt="' . esc_attr( wpinv_get_blogname() ) . '" /></p>'; |
|
| 26 | + $img = wpinv_get_option('email_header_image', ''); |
|
| 27 | + if ($img) { |
|
| 28 | + echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url($img) . '" alt="' . esc_attr(wpinv_get_blogname()) . '" /></p>'; |
|
| 29 | 29 | } |
| 30 | 30 | ?> |
| 31 | 31 | </div> |
| 32 | 32 | <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_container"> |
| 33 | - <?php if ( ! empty( $email_heading ) ) { ?> |
|
| 33 | + <?php if (!empty($email_heading)) { ?> |
|
| 34 | 34 | <tr> |
| 35 | 35 | <td align="center" valign="top"> |
| 36 | 36 | <!-- Header --> |
| 37 | 37 | <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_header"> |
| 38 | 38 | <tr> |
| 39 | 39 | <td id="header_wrapper"> |
| 40 | - <h1><?php echo esc_html( $email_heading ); ?></h1> |
|
| 40 | + <h1><?php echo esc_html($email_heading); ?></h1> |
|
| 41 | 41 | </td> |
| 42 | 42 | </tr> |
| 43 | 43 | </table> |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
| 36 | 36 | |
| 37 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 38 | - return 'manage_options'; |
|
| 39 | - }; |
|
| 37 | + if ( current_user_can( 'manage_options' ) ) { |
|
| 38 | + return 'manage_options'; |
|
| 39 | + }; |
|
| 40 | 40 | |
| 41 | - return $capalibilty; |
|
| 41 | + return $capalibilty; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | // Prepare user values. |
| 63 | 63 | $prefix = preg_replace( '/\s+/', '', $prefix ); |
| 64 | 64 | $prefix = empty( $prefix ) ? $email : $prefix; |
| 65 | - $args = array( |
|
| 66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
| 67 | - 'user_pass' => wp_generate_password(), |
|
| 68 | - 'user_email' => $email, |
|
| 65 | + $args = array( |
|
| 66 | + 'user_login' => wpinv_generate_user_name( $prefix ), |
|
| 67 | + 'user_pass' => wp_generate_password(), |
|
| 68 | + 'user_email' => $email, |
|
| 69 | 69 | 'role' => 'subscriber', |
| 70 | 70 | ); |
| 71 | 71 | |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | function wpinv_generate_user_name( $prefix = '' ) { |
| 83 | 83 | |
| 84 | 84 | // If prefix is an email, retrieve the part before the email. |
| 85 | - $prefix = strtok( $prefix, '@' ); |
|
| 85 | + $prefix = strtok( $prefix, '@' ); |
|
| 86 | 86 | $prefix = trim( $prefix, '.' ); |
| 87 | 87 | |
| 88 | - // Sanitize the username. |
|
| 89 | - $prefix = sanitize_user( $prefix, true ); |
|
| 88 | + // Sanitize the username. |
|
| 89 | + $prefix = sanitize_user( $prefix, true ); |
|
| 90 | 90 | |
| 91 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
| 92 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
| 93 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
| 94 | - } |
|
| 91 | + $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
| 92 | + if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
| 93 | + $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | $username = $prefix; |
| 97 | 97 | $postfix = 2; |
@@ -220,42 +220,42 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | foreach ( getpaid_user_address_fields() as $key => $label ) { |
| 222 | 222 | |
| 223 | - // Display the country. |
|
| 224 | - if ( 'country' == $key ) { |
|
| 225 | - |
|
| 226 | - aui()->select( |
|
| 227 | - array( |
|
| 228 | - 'options' => wpinv_get_country_list(), |
|
| 229 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 230 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 231 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 232 | - 'placeholder' => $label, |
|
| 233 | - 'label' => wp_kses_post( $label ), |
|
| 234 | - 'label_type' => 'vertical', |
|
| 235 | - 'class' => 'getpaid-address-field', |
|
| 223 | + // Display the country. |
|
| 224 | + if ( 'country' == $key ) { |
|
| 225 | + |
|
| 226 | + aui()->select( |
|
| 227 | + array( |
|
| 228 | + 'options' => wpinv_get_country_list(), |
|
| 229 | + 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 230 | + 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 231 | + 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 232 | + 'placeholder' => $label, |
|
| 233 | + 'label' => wp_kses_post( $label ), |
|
| 234 | + 'label_type' => 'vertical', |
|
| 235 | + 'class' => 'getpaid-address-field', |
|
| 236 | 236 | ), |
| 237 | 237 | true |
| 238 | - ); |
|
| 238 | + ); |
|
| 239 | 239 | |
| 240 | - } |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - // Display the state. |
|
| 243 | - elseif ( 'state' == $key ) { |
|
| 242 | + // Display the state. |
|
| 243 | + elseif ( 'state' == $key ) { |
|
| 244 | 244 | |
| 245 | - echo getpaid_get_states_select_markup( |
|
| 246 | - getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
| 247 | - getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
| 248 | - $label, |
|
| 249 | - $label, |
|
| 250 | - '', |
|
| 251 | - false, |
|
| 252 | - '', |
|
| 253 | - 'getpaid_address[' . esc_attr( $key ) . ']' |
|
| 254 | - ); |
|
| 245 | + echo getpaid_get_states_select_markup( |
|
| 246 | + getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
| 247 | + getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
| 248 | + $label, |
|
| 249 | + $label, |
|
| 250 | + '', |
|
| 251 | + false, |
|
| 252 | + '', |
|
| 253 | + 'getpaid_address[' . esc_attr( $key ) . ']' |
|
| 254 | + ); |
|
| 255 | 255 | |
| 256 | 256 | } else { |
| 257 | 257 | |
| 258 | - aui()->input( |
|
| 258 | + aui()->input( |
|
| 259 | 259 | array( |
| 260 | 260 | 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
| 261 | 261 | 'id' => 'wpinv-' . sanitize_html_class( $key ), |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | 'class' => 'getpaid-address-field', |
| 268 | 268 | ), |
| 269 | 269 | true |
| 270 | - ); |
|
| 270 | + ); |
|
| 271 | 271 | |
| 272 | 272 | } |
| 273 | 273 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package GetPaid |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Generates a users select dropdown. |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | * @param array $args |
| 17 | 17 | * @see wp_dropdown_users |
| 18 | 18 | */ |
| 19 | -function wpinv_dropdown_users( $args = '' ) { |
|
| 19 | +function wpinv_dropdown_users($args = '') { |
|
| 20 | 20 | |
| 21 | - if ( is_array( $args ) && ! empty( $args['show'] ) && 'display_name_with_email' == $args['show'] ) { |
|
| 21 | + if (is_array($args) && !empty($args['show']) && 'display_name_with_email' == $args['show']) { |
|
| 22 | 22 | $args['show'] = 'display_name_with_login'; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - return wp_dropdown_users( $args ); |
|
| 25 | + return wp_dropdown_users($args); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | * @return string capability to check against |
| 33 | 33 | * @param string $capalibilty Optional. The alternative capability to check against. |
| 34 | 34 | */ |
| 35 | -function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
|
| 35 | +function wpinv_get_capability($capalibilty = 'manage_invoicing') { |
|
| 36 | 36 | |
| 37 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 37 | + if (current_user_can('manage_options')) { |
|
| 38 | 38 | return 'manage_options'; |
| 39 | 39 | }; |
| 40 | 40 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @return bool |
| 49 | 49 | */ |
| 50 | 50 | function wpinv_current_user_can_manage_invoicing() { |
| 51 | - return current_user_can( wpinv_get_capability() ); |
|
| 51 | + return current_user_can(wpinv_get_capability()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -57,19 +57,19 @@ discard block |
||
| 57 | 57 | * @since 1.0.19 |
| 58 | 58 | * @return int|WP_Error |
| 59 | 59 | */ |
| 60 | -function wpinv_create_user( $email, $prefix = '' ) { |
|
| 60 | +function wpinv_create_user($email, $prefix = '') { |
|
| 61 | 61 | |
| 62 | 62 | // Prepare user values. |
| 63 | - $prefix = preg_replace( '/\s+/', '', $prefix ); |
|
| 64 | - $prefix = empty( $prefix ) ? $email : $prefix; |
|
| 65 | - $args = array( |
|
| 66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
| 63 | + $prefix = preg_replace('/\s+/', '', $prefix); |
|
| 64 | + $prefix = empty($prefix) ? $email : $prefix; |
|
| 65 | + $args = array( |
|
| 66 | + 'user_login' => wpinv_generate_user_name($prefix), |
|
| 67 | 67 | 'user_pass' => wp_generate_password(), |
| 68 | 68 | 'user_email' => $email, |
| 69 | 69 | 'role' => 'subscriber', |
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | - return wp_insert_user( $args ); |
|
| 72 | + return wp_insert_user($args); |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
@@ -79,26 +79,26 @@ discard block |
||
| 79 | 79 | * @since 1.0.19 |
| 80 | 80 | * @return bool|WP_User |
| 81 | 81 | */ |
| 82 | -function wpinv_generate_user_name( $prefix = '' ) { |
|
| 82 | +function wpinv_generate_user_name($prefix = '') { |
|
| 83 | 83 | |
| 84 | 84 | // If prefix is an email, retrieve the part before the email. |
| 85 | - $prefix = strtok( $prefix, '@' ); |
|
| 86 | - $prefix = trim( $prefix, '.' ); |
|
| 85 | + $prefix = strtok($prefix, '@'); |
|
| 86 | + $prefix = trim($prefix, '.'); |
|
| 87 | 87 | |
| 88 | 88 | // Sanitize the username. |
| 89 | - $prefix = sanitize_user( $prefix, true ); |
|
| 89 | + $prefix = sanitize_user($prefix, true); |
|
| 90 | 90 | |
| 91 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
| 92 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
| 93 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
| 91 | + $illegal_logins = (array) apply_filters('illegal_user_logins', array()); |
|
| 92 | + if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) { |
|
| 93 | + $prefix = 'gtp_' . zeroise(wp_rand(0, 9999), 4); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $username = $prefix; |
| 97 | 97 | $postfix = 2; |
| 98 | 98 | |
| 99 | - while ( username_exists( $username ) ) { |
|
| 99 | + while (username_exists($username)) { |
|
| 100 | 100 | $username = $prefix + $postfix; |
| 101 | - $postfix ++; |
|
| 101 | + $postfix++; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | return $username; |
@@ -115,31 +115,31 @@ discard block |
||
| 115 | 115 | $tabs = array( |
| 116 | 116 | |
| 117 | 117 | 'gp-invoices' => array( |
| 118 | - 'label' => __( 'Invoices', 'invoicing' ), // Name of the tab. |
|
| 118 | + 'label' => __('Invoices', 'invoicing'), // Name of the tab. |
|
| 119 | 119 | 'content' => '[wpinv_history]', // Content of the tab. Or specify "callback" to provide a callback instead. |
| 120 | 120 | 'icon' => 'fas fa-file-invoice', // Shown on some profile plugins. |
| 121 | 121 | ), |
| 122 | 122 | |
| 123 | 123 | 'gp-subscriptions' => array( |
| 124 | - 'label' => __( 'Subscriptions', 'invoicing' ), |
|
| 124 | + 'label' => __('Subscriptions', 'invoicing'), |
|
| 125 | 125 | 'content' => '[wpinv_subscriptions]', |
| 126 | 126 | 'icon' => 'fas fa-redo', |
| 127 | 127 | ), |
| 128 | 128 | |
| 129 | 129 | 'gp-edit-address' => array( |
| 130 | - 'label' => __( 'Billing Address', 'invoicing' ), |
|
| 130 | + 'label' => __('Billing Address', 'invoicing'), |
|
| 131 | 131 | 'callback' => 'getpaid_display_address_edit_tab', |
| 132 | 132 | 'icon' => 'fas fa-credit-card', |
| 133 | 133 | ), |
| 134 | 134 | |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | - $tabs = apply_filters( 'getpaid_user_content_tabs', $tabs ); |
|
| 137 | + $tabs = apply_filters('getpaid_user_content_tabs', $tabs); |
|
| 138 | 138 | |
| 139 | 139 | // Make sure address editing is last on the list. |
| 140 | - if ( isset( $tabs['gp-edit-address'] ) ) { |
|
| 140 | + if (isset($tabs['gp-edit-address'])) { |
|
| 141 | 141 | $address = $tabs['gp-edit-address']; |
| 142 | - unset( $tabs['gp-edit-address'] ); |
|
| 142 | + unset($tabs['gp-edit-address']); |
|
| 143 | 143 | $tabs['gp-edit-address'] = $address; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -153,19 +153,19 @@ discard block |
||
| 153 | 153 | * @param array $tab |
| 154 | 154 | * @return array |
| 155 | 155 | */ |
| 156 | -function getpaid_prepare_user_content_tab( $tab ) { |
|
| 156 | +function getpaid_prepare_user_content_tab($tab) { |
|
| 157 | 157 | |
| 158 | - if ( ! empty( $tab['callback'] ) ) { |
|
| 159 | - return call_user_func( $tab['callback'] ); |
|
| 158 | + if (!empty($tab['callback'])) { |
|
| 159 | + return call_user_func($tab['callback']); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if ( ! empty( $tab['content'] ) ) { |
|
| 163 | - return convert_smilies( capital_P_dangit( wp_filter_content_tags( do_shortcode( shortcode_unautop( wpautop( wptexturize( do_blocks( $tab['content'] ) ) ) ) ) ) ) ); |
|
| 162 | + if (!empty($tab['content'])) { |
|
| 163 | + return convert_smilies(capital_P_dangit(wp_filter_content_tags(do_shortcode(shortcode_unautop(wpautop(wptexturize(do_blocks($tab['content'])))))))); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | $notice = aui()->alert( |
| 167 | 167 | array( |
| 168 | - 'content' => __( 'This tab has no content or content callback.', 'invoicing' ), |
|
| 168 | + 'content' => __('This tab has no content or content callback.', 'invoicing'), |
|
| 169 | 169 | 'type' => 'error', |
| 170 | 170 | ) |
| 171 | 171 | ); |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | * @param string $default |
| 182 | 182 | * @return array |
| 183 | 183 | */ |
| 184 | -function getpaid_get_tab_url( $tab, $default ) { |
|
| 184 | +function getpaid_get_tab_url($tab, $default) { |
|
| 185 | 185 | global $getpaid_tab_url; |
| 186 | 186 | |
| 187 | - if ( empty( $getpaid_tab_url ) ) { |
|
| 187 | + if (empty($getpaid_tab_url)) { |
|
| 188 | 188 | return $default; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - return sprintf( $getpaid_tab_url, $tab ); |
|
| 191 | + return sprintf($getpaid_tab_url, $tab); |
|
| 192 | 192 | |
| 193 | 193 | } |
| 194 | 194 | |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | function getpaid_display_address_edit_tab() { |
| 202 | 202 | |
| 203 | - if ( 0 === get_current_user_id() ) { |
|
| 203 | + if (0 === get_current_user_id()) { |
|
| 204 | 204 | return '<div class="bsui">' . aui()->alert( |
| 205 | 205 | array( |
| 206 | 206 | 'type' => 'error', |
| 207 | - 'content' => __( 'Your must be logged in to view this section', 'invoicing' ), |
|
| 207 | + 'content' => __('Your must be logged in to view this section', 'invoicing'), |
|
| 208 | 208 | 'dismissible' => false, |
| 209 | 209 | ) |
| 210 | 210 | ) . '</div>'; |
@@ -218,19 +218,19 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | <?php |
| 220 | 220 | |
| 221 | - foreach ( getpaid_user_address_fields() as $key => $label ) { |
|
| 221 | + foreach (getpaid_user_address_fields() as $key => $label) { |
|
| 222 | 222 | |
| 223 | 223 | // Display the country. |
| 224 | - if ( 'country' == $key ) { |
|
| 224 | + if ('country' == $key) { |
|
| 225 | 225 | |
| 226 | 226 | aui()->select( |
| 227 | 227 | array( |
| 228 | 228 | 'options' => wpinv_get_country_list(), |
| 229 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 230 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 231 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 229 | + 'name' => 'getpaid_address[' . esc_attr($key) . ']', |
|
| 230 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
| 231 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
| 232 | 232 | 'placeholder' => $label, |
| 233 | - 'label' => wp_kses_post( $label ), |
|
| 233 | + 'label' => wp_kses_post($label), |
|
| 234 | 234 | 'label_type' => 'vertical', |
| 235 | 235 | 'class' => 'getpaid-address-field', |
| 236 | 236 | ), |
@@ -240,30 +240,30 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // Display the state. |
| 243 | - elseif ( 'state' == $key ) { |
|
| 243 | + elseif ('state' == $key) { |
|
| 244 | 244 | |
| 245 | 245 | echo getpaid_get_states_select_markup( |
| 246 | - getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
| 247 | - getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
| 246 | + getpaid_get_user_address_field(get_current_user_id(), 'country'), |
|
| 247 | + getpaid_get_user_address_field(get_current_user_id(), 'state'), |
|
| 248 | 248 | $label, |
| 249 | 249 | $label, |
| 250 | 250 | '', |
| 251 | 251 | false, |
| 252 | 252 | '', |
| 253 | - 'getpaid_address[' . esc_attr( $key ) . ']' |
|
| 253 | + 'getpaid_address[' . esc_attr($key) . ']' |
|
| 254 | 254 | ); |
| 255 | 255 | |
| 256 | 256 | } else { |
| 257 | 257 | |
| 258 | 258 | aui()->input( |
| 259 | 259 | array( |
| 260 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 261 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 260 | + 'name' => 'getpaid_address[' . esc_attr($key) . ']', |
|
| 261 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
| 262 | 262 | 'placeholder' => $label, |
| 263 | - 'label' => wp_kses_post( $label ), |
|
| 263 | + 'label' => wp_kses_post($label), |
|
| 264 | 264 | 'label_type' => 'vertical', |
| 265 | 265 | 'type' => 'text', |
| 266 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 266 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
| 267 | 267 | 'class' => 'getpaid-address-field', |
| 268 | 268 | ), |
| 269 | 269 | true |
@@ -277,32 +277,32 @@ discard block |
||
| 277 | 277 | 'name' => 'getpaid_address[email_cc]', |
| 278 | 278 | 'id' => 'wpinv-email_cc', |
| 279 | 279 | 'placeholder' => '[email protected], [email protected]', |
| 280 | - 'label' => __( 'Other email addresses', 'invoicing' ), |
|
| 280 | + 'label' => __('Other email addresses', 'invoicing'), |
|
| 281 | 281 | 'label_type' => 'vertical', |
| 282 | 282 | 'type' => 'text', |
| 283 | - 'value' => sanitize_text_field( get_user_meta( get_current_user_id(), '_wpinv_email_cc', true ) ), |
|
| 283 | + 'value' => sanitize_text_field(get_user_meta(get_current_user_id(), '_wpinv_email_cc', true)), |
|
| 284 | 284 | 'class' => 'getpaid-address-field', |
| 285 | - 'help_text' => __( 'Optionally provide other email addresses where we should send payment notifications', 'invoicing' ), |
|
| 285 | + 'help_text' => __('Optionally provide other email addresses where we should send payment notifications', 'invoicing'), |
|
| 286 | 286 | ), |
| 287 | 287 | true |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | - do_action( 'getpaid_display_address_edit_tab' ); |
|
| 290 | + do_action('getpaid_display_address_edit_tab'); |
|
| 291 | 291 | |
| 292 | 292 | aui()->input( |
| 293 | 293 | array( |
| 294 | 294 | 'name' => 'getpaid_profile_edit_submit_button', |
| 295 | 295 | 'id' => 'getpaid_profile_edit_submit_button', |
| 296 | - 'value' => __( 'Save Address', 'invoicing' ), |
|
| 297 | - 'help_text' => __( 'New invoices will use this address as the billing address.', 'invoicing' ), |
|
| 296 | + 'value' => __('Save Address', 'invoicing'), |
|
| 297 | + 'help_text' => __('New invoices will use this address as the billing address.', 'invoicing'), |
|
| 298 | 298 | 'type' => 'submit', |
| 299 | 299 | 'class' => 'btn btn-primary btn-block submit-button', |
| 300 | 300 | ), |
| 301 | 301 | true |
| 302 | 302 | ); |
| 303 | 303 | |
| 304 | - wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); |
|
| 305 | - getpaid_hidden_field( 'getpaid-action', 'edit_billing_details' ); |
|
| 304 | + wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); |
|
| 305 | + getpaid_hidden_field('getpaid-action', 'edit_billing_details'); |
|
| 306 | 306 | ?> |
| 307 | 307 | |
| 308 | 308 | </form> |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | return ob_get_clean(); |
| 314 | 314 | } |
| 315 | -add_shortcode( 'getpaid_edit_address', 'getpaid_display_address_edit_tab' ); |
|
| 315 | +add_shortcode('getpaid_edit_address', 'getpaid_display_address_edit_tab'); |
|
| 316 | 316 | |
| 317 | 317 | /** |
| 318 | 318 | * Saves the billing address edit tab. |
@@ -320,30 +320,30 @@ discard block |
||
| 320 | 320 | * @since 2.1.4 |
| 321 | 321 | * @param array $data |
| 322 | 322 | */ |
| 323 | -function getpaid_save_address_edit_tab( $data ) { |
|
| 323 | +function getpaid_save_address_edit_tab($data) { |
|
| 324 | 324 | |
| 325 | - if ( empty( $data['getpaid_address'] ) || ! is_array( $data['getpaid_address'] ) ) { |
|
| 325 | + if (empty($data['getpaid_address']) || !is_array($data['getpaid_address'])) { |
|
| 326 | 326 | return; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | $data = $data['getpaid_address']; |
| 330 | 330 | $user_id = get_current_user_id(); |
| 331 | 331 | |
| 332 | - foreach ( array_keys( getpaid_user_address_fields() ) as $field ) { |
|
| 332 | + foreach (array_keys(getpaid_user_address_fields()) as $field) { |
|
| 333 | 333 | |
| 334 | - if ( isset( $data[ $field ] ) ) { |
|
| 335 | - $value = sanitize_text_field( $data[ $field ] ); |
|
| 336 | - update_user_meta( $user_id, '_wpinv_' . $field, $value ); |
|
| 334 | + if (isset($data[$field])) { |
|
| 335 | + $value = sanitize_text_field($data[$field]); |
|
| 336 | + update_user_meta($user_id, '_wpinv_' . $field, $value); |
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if ( isset( $data['email_cc'] ) ) { |
|
| 341 | - update_user_meta( $user_id, '_wpinv_email_cc', sanitize_text_field( $data['email_cc'] ) ); |
|
| 340 | + if (isset($data['email_cc'])) { |
|
| 341 | + update_user_meta($user_id, '_wpinv_email_cc', sanitize_text_field($data['email_cc'])); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - wpinv_set_error( 'address_updated', __( 'Your billing address has been updated', 'invoicing' ), 'success' ); |
|
| 344 | + wpinv_set_error('address_updated', __('Your billing address has been updated', 'invoicing'), 'success'); |
|
| 345 | 345 | } |
| 346 | -add_action( 'getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab' ); |
|
| 346 | +add_action('getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab'); |
|
| 347 | 347 | |
| 348 | 348 | |
| 349 | 349 | /* |
@@ -361,27 +361,27 @@ discard block |
||
| 361 | 361 | * @param array $tabs |
| 362 | 362 | * @return array |
| 363 | 363 | */ |
| 364 | -function getpaid_filter_userswp_account_tabs( $tabs ) { |
|
| 364 | +function getpaid_filter_userswp_account_tabs($tabs) { |
|
| 365 | 365 | |
| 366 | 366 | // Abort if the integration is inactive. |
| 367 | - if ( ! getpaid_is_userswp_integration_active() ) { |
|
| 367 | + if (!getpaid_is_userswp_integration_active()) { |
|
| 368 | 368 | return $tabs; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - $new_tabs = array(); |
|
| 371 | + $new_tabs = array(); |
|
| 372 | 372 | |
| 373 | - foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) { |
|
| 373 | + foreach (getpaid_get_user_content_tabs() as $slug => $tab) { |
|
| 374 | 374 | |
| 375 | - $new_tabs[ $slug ] = array( |
|
| 375 | + $new_tabs[$slug] = array( |
|
| 376 | 376 | 'title' => $tab['label'], |
| 377 | 377 | 'icon' => $tab['icon'], |
| 378 | 378 | ); |
| 379 | 379 | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - return array_merge( $tabs, $new_tabs ); |
|
| 382 | + return array_merge($tabs, $new_tabs); |
|
| 383 | 383 | } |
| 384 | -add_filter( 'uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs' ); |
|
| 384 | +add_filter('uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs'); |
|
| 385 | 385 | |
| 386 | 386 | /** |
| 387 | 387 | * Display our UsersWP account tabs. |
@@ -390,18 +390,18 @@ discard block |
||
| 390 | 390 | * @param array $tabs |
| 391 | 391 | * @return array |
| 392 | 392 | */ |
| 393 | -function getpaid_display_userswp_account_tabs( $tab ) { |
|
| 393 | +function getpaid_display_userswp_account_tabs($tab) { |
|
| 394 | 394 | global $getpaid_tab_url; |
| 395 | 395 | |
| 396 | 396 | $our_tabs = getpaid_get_user_content_tabs(); |
| 397 | 397 | |
| 398 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
| 399 | - $getpaid_tab_url = add_query_arg( 'type', '%s', uwp_get_account_page_url() ); |
|
| 400 | - echo getpaid_prepare_user_content_tab( $our_tabs[ $tab ] ); |
|
| 398 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
| 399 | + $getpaid_tab_url = add_query_arg('type', '%s', uwp_get_account_page_url()); |
|
| 400 | + echo getpaid_prepare_user_content_tab($our_tabs[$tab]); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | } |
| 404 | -add_action( 'uwp_account_form_display', 'getpaid_display_userswp_account_tabs' ); |
|
| 404 | +add_action('uwp_account_form_display', 'getpaid_display_userswp_account_tabs'); |
|
| 405 | 405 | |
| 406 | 406 | |
| 407 | 407 | /** |
@@ -412,17 +412,17 @@ discard block |
||
| 412 | 412 | * @param string $tab Current tab. |
| 413 | 413 | * @return string Title. |
| 414 | 414 | */ |
| 415 | -function getpaid_filter_userswp_account_title( $title, $tab ) { |
|
| 415 | +function getpaid_filter_userswp_account_title($title, $tab) { |
|
| 416 | 416 | |
| 417 | - $our_tabs = getpaid_get_user_content_tabs(); |
|
| 417 | + $our_tabs = getpaid_get_user_content_tabs(); |
|
| 418 | 418 | |
| 419 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
| 420 | - return $our_tabs[ $tab ]['label']; |
|
| 419 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
| 420 | + return $our_tabs[$tab]['label']; |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | return $title; |
| 424 | 424 | } |
| 425 | -add_filter( 'uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2 ); |
|
| 425 | +add_filter('uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2); |
|
| 426 | 426 | |
| 427 | 427 | /** |
| 428 | 428 | * Registers the UsersWP integration settings. |
@@ -431,26 +431,26 @@ discard block |
||
| 431 | 431 | * @param array $settings An array of integration settings. |
| 432 | 432 | * @return array |
| 433 | 433 | */ |
| 434 | -function getpaid_register_userswp_settings( $settings ) { |
|
| 434 | +function getpaid_register_userswp_settings($settings) { |
|
| 435 | 435 | |
| 436 | - if ( defined( 'USERSWP_PLUGIN_FILE' ) ) { |
|
| 436 | + if (defined('USERSWP_PLUGIN_FILE')) { |
|
| 437 | 437 | |
| 438 | 438 | $settings[] = array( |
| 439 | 439 | |
| 440 | 440 | 'id' => 'userswp', |
| 441 | - 'label' => __( 'UsersWP', 'invoicing' ), |
|
| 441 | + 'label' => __('UsersWP', 'invoicing'), |
|
| 442 | 442 | 'settings' => array( |
| 443 | 443 | |
| 444 | 444 | 'userswp_settings' => array( |
| 445 | 445 | 'id' => 'userswp_settings', |
| 446 | - 'name' => '<h3>' . __( 'UsersWP', 'invoicing' ) . '</h3>', |
|
| 446 | + 'name' => '<h3>' . __('UsersWP', 'invoicing') . '</h3>', |
|
| 447 | 447 | 'type' => 'header', |
| 448 | 448 | ), |
| 449 | 449 | |
| 450 | 450 | 'enable_userswp' => array( |
| 451 | 451 | 'id' => 'enable_userswp', |
| 452 | - 'name' => __( 'Enable Integration', 'invoicing' ), |
|
| 453 | - 'desc' => __( 'Display GetPaid items on UsersWP account page.', 'invoicing' ), |
|
| 452 | + 'name' => __('Enable Integration', 'invoicing'), |
|
| 453 | + 'desc' => __('Display GetPaid items on UsersWP account page.', 'invoicing'), |
|
| 454 | 454 | 'type' => 'checkbox', |
| 455 | 455 | 'std' => 1, |
| 456 | 456 | ), |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | |
| 464 | 464 | return $settings; |
| 465 | 465 | } |
| 466 | -add_filter( 'getpaid_integration_settings', 'getpaid_register_userswp_settings' ); |
|
| 466 | +add_filter('getpaid_integration_settings', 'getpaid_register_userswp_settings'); |
|
| 467 | 467 | |
| 468 | 468 | /** |
| 469 | 469 | * Ovewrites the invoices history page to UsersWP. |
@@ -471,18 +471,18 @@ discard block |
||
| 471 | 471 | * @since 2.3.1 |
| 472 | 472 | * @return bool |
| 473 | 473 | */ |
| 474 | -function getpaid_userswp_overwrite_invoice_history_page( $url, $post_type ) { |
|
| 474 | +function getpaid_userswp_overwrite_invoice_history_page($url, $post_type) { |
|
| 475 | 475 | |
| 476 | 476 | $our_tabs = getpaid_get_user_content_tabs(); |
| 477 | 477 | $tab = "gp-{$post_type}s"; |
| 478 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
| 479 | - return add_query_arg( 'type', $tab, uwp_get_account_page_url() ); |
|
| 478 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
| 479 | + return add_query_arg('type', $tab, uwp_get_account_page_url()); |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | return $url; |
| 483 | 483 | |
| 484 | 484 | } |
| 485 | -add_filter( 'wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2 ); |
|
| 485 | +add_filter('wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2); |
|
| 486 | 486 | |
| 487 | 487 | /** |
| 488 | 488 | * Checks if the integration is enabled. |
@@ -491,8 +491,8 @@ discard block |
||
| 491 | 491 | * @return bool |
| 492 | 492 | */ |
| 493 | 493 | function getpaid_is_userswp_integration_active() { |
| 494 | - $enabled = wpinv_get_option( 'enable_userswp', 1 ); |
|
| 495 | - return defined( 'USERSWP_PLUGIN_FILE' ) && ! empty( $enabled ); |
|
| 494 | + $enabled = wpinv_get_option('enable_userswp', 1); |
|
| 495 | + return defined('USERSWP_PLUGIN_FILE') && !empty($enabled); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | /* |
@@ -510,26 +510,26 @@ discard block |
||
| 510 | 510 | * @param array $settings An array of integration settings. |
| 511 | 511 | * @return array |
| 512 | 512 | */ |
| 513 | -function getpaid_register_buddypress_settings( $settings ) { |
|
| 513 | +function getpaid_register_buddypress_settings($settings) { |
|
| 514 | 514 | |
| 515 | - if ( class_exists( 'BuddyPress' ) ) { |
|
| 515 | + if (class_exists('BuddyPress')) { |
|
| 516 | 516 | |
| 517 | 517 | $settings[] = array( |
| 518 | 518 | |
| 519 | 519 | 'id' => 'buddypress', |
| 520 | - 'label' => __( 'BuddyPress', 'invoicing' ), |
|
| 520 | + 'label' => __('BuddyPress', 'invoicing'), |
|
| 521 | 521 | 'settings' => array( |
| 522 | 522 | |
| 523 | 523 | 'buddypress_settings' => array( |
| 524 | 524 | 'id' => 'buddypress_settings', |
| 525 | - 'name' => '<h3>' . __( 'BuddyPress', 'invoicing' ) . '</h3>', |
|
| 525 | + 'name' => '<h3>' . __('BuddyPress', 'invoicing') . '</h3>', |
|
| 526 | 526 | 'type' => 'header', |
| 527 | 527 | ), |
| 528 | 528 | |
| 529 | 529 | 'enable_buddypress' => array( |
| 530 | 530 | 'id' => 'enable_buddypress', |
| 531 | - 'name' => __( 'Enable Integration', 'invoicing' ), |
|
| 532 | - 'desc' => __( 'Display GetPaid items on BuddyPress account pages.', 'invoicing' ), |
|
| 531 | + 'name' => __('Enable Integration', 'invoicing'), |
|
| 532 | + 'desc' => __('Display GetPaid items on BuddyPress account pages.', 'invoicing'), |
|
| 533 | 533 | 'type' => 'checkbox', |
| 534 | 534 | 'std' => 1, |
| 535 | 535 | ), |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | return $settings; |
| 544 | 544 | } |
| 545 | -add_filter( 'getpaid_integration_settings', 'getpaid_register_buddypress_settings' ); |
|
| 545 | +add_filter('getpaid_integration_settings', 'getpaid_register_buddypress_settings'); |
|
| 546 | 546 | |
| 547 | 547 | /** |
| 548 | 548 | * Checks if the integration is enabled. |
@@ -551,8 +551,8 @@ discard block |
||
| 551 | 551 | * @return bool |
| 552 | 552 | */ |
| 553 | 553 | function getpaid_is_buddypress_integration_active() { |
| 554 | - $enabled = wpinv_get_option( 'enable_buddypress', 1 ); |
|
| 555 | - return class_exists( 'BuddyPress' ) && ! empty( $enabled ); |
|
| 554 | + $enabled = wpinv_get_option('enable_buddypress', 1); |
|
| 555 | + return class_exists('BuddyPress') && !empty($enabled); |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /** |
@@ -563,10 +563,10 @@ discard block |
||
| 563 | 563 | */ |
| 564 | 564 | function getpaid_setup_buddypress_integration() { |
| 565 | 565 | |
| 566 | - if ( getpaid_is_buddypress_integration_active() ) { |
|
| 566 | + if (getpaid_is_buddypress_integration_active()) { |
|
| 567 | 567 | require_once WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php'; |
| 568 | 568 | buddypress()->getpaid = new BP_GetPaid_Component(); |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | } |
| 572 | -add_action( 'bp_setup_components', 'getpaid_setup_buddypress_integration' ); |
|
| 572 | +add_action('bp_setup_components', 'getpaid_setup_buddypress_integration'); |
|