@@ -4,11 +4,11 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -if ( ! defined( 'ABSPATH' ) ) { |
|
7 | +if (!defined('ABSPATH')) { |
|
8 | 8 | exit; // Exit if accessed directly |
9 | 9 | } |
10 | 10 | |
11 | -if ( ! class_exists( 'GetPaid_Admin_Profile', false ) ) : |
|
11 | +if (!class_exists('GetPaid_Admin_Profile', false)) : |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * GetPaid_Admin_Profile Class. |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | * Hook in tabs. |
20 | 20 | */ |
21 | 21 | public function __construct() { |
22 | - add_action( 'show_user_profile', array( $this, 'add_customer_meta_fields' ), 100 ); |
|
23 | - add_action( 'edit_user_profile', array( $this, 'add_customer_meta_fields' ), 100 ); |
|
22 | + add_action('show_user_profile', array($this, 'add_customer_meta_fields'), 100); |
|
23 | + add_action('edit_user_profile', array($this, 'add_customer_meta_fields'), 100); |
|
24 | 24 | |
25 | - add_action( 'personal_options_update', array( $this, 'save_customer_meta_fields' ) ); |
|
26 | - add_action( 'edit_user_profile_update', array( $this, 'save_customer_meta_fields' ) ); |
|
25 | + add_action('personal_options_update', array($this, 'save_customer_meta_fields')); |
|
26 | + add_action('edit_user_profile_update', array($this, 'save_customer_meta_fields')); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -37,54 +37,54 @@ discard block |
||
37 | 37 | 'getpaid_customer_meta_fields', |
38 | 38 | array( |
39 | 39 | 'billing' => array( |
40 | - 'title' => __( 'Billing Details (GetPaid)', 'invoicing' ), |
|
40 | + 'title' => __('Billing Details (GetPaid)', 'invoicing'), |
|
41 | 41 | 'fields' => array( |
42 | 42 | '_wpinv_first_name' => array( |
43 | - 'label' => __( 'First name', 'invoicing' ), |
|
43 | + 'label' => __('First name', 'invoicing'), |
|
44 | 44 | 'description' => '', |
45 | 45 | ), |
46 | 46 | '_wpinv_last_name' => array( |
47 | - 'label' => __( 'Last name', 'invoicing' ), |
|
47 | + 'label' => __('Last name', 'invoicing'), |
|
48 | 48 | 'description' => '', |
49 | 49 | ), |
50 | 50 | '_wpinv_company' => array( |
51 | - 'label' => __( 'Company', 'invoicing' ), |
|
51 | + 'label' => __('Company', 'invoicing'), |
|
52 | 52 | 'description' => '', |
53 | 53 | ), |
54 | 54 | '_wpinv_company_id' => array( |
55 | - 'label' => __( 'Company ID', 'invoicing' ), |
|
55 | + 'label' => __('Company ID', 'invoicing'), |
|
56 | 56 | 'description' => '', |
57 | 57 | ), |
58 | 58 | '_wpinv_address' => array( |
59 | - 'label' => __( 'Address', 'invoicing' ), |
|
59 | + 'label' => __('Address', 'invoicing'), |
|
60 | 60 | 'description' => '', |
61 | 61 | ), |
62 | 62 | '_wpinv_city' => array( |
63 | - 'label' => __( 'City', 'invoicing' ), |
|
63 | + 'label' => __('City', 'invoicing'), |
|
64 | 64 | 'description' => '', |
65 | 65 | ), |
66 | 66 | '_wpinv_zip' => array( |
67 | - 'label' => __( 'Postcode / ZIP', 'invoicing' ), |
|
67 | + 'label' => __('Postcode / ZIP', 'invoicing'), |
|
68 | 68 | 'description' => '', |
69 | 69 | ), |
70 | 70 | '_wpinv_country' => array( |
71 | - 'label' => __( 'Country / Region', 'invoicing' ), |
|
71 | + 'label' => __('Country / Region', 'invoicing'), |
|
72 | 72 | 'description' => '', |
73 | 73 | 'class' => 'getpaid_js_field-country', |
74 | 74 | 'type' => 'select', |
75 | - 'options' => array( '' => __( 'Select a country / region…', 'invoicing' ) ) + wpinv_get_country_list(), |
|
75 | + 'options' => array('' => __('Select a country / region…', 'invoicing')) + wpinv_get_country_list(), |
|
76 | 76 | ), |
77 | 77 | '_wpinv_state' => array( |
78 | - 'label' => __( 'State / County', 'invoicing' ), |
|
79 | - 'description' => __( 'State / County or state code', 'invoicing' ), |
|
78 | + 'label' => __('State / County', 'invoicing'), |
|
79 | + 'description' => __('State / County or state code', 'invoicing'), |
|
80 | 80 | 'class' => 'getpaid_js_field-state regular-text', |
81 | 81 | ), |
82 | 82 | '_wpinv_phone' => array( |
83 | - 'label' => __( 'Phone', 'invoicing' ), |
|
83 | + 'label' => __('Phone', 'invoicing'), |
|
84 | 84 | 'description' => '', |
85 | 85 | ), |
86 | 86 | '_wpinv_vat_number' => array( |
87 | - 'label' => __( 'VAT Number', 'invoicing' ), |
|
87 | + 'label' => __('VAT Number', 'invoicing'), |
|
88 | 88 | 'description' => '', |
89 | 89 | ), |
90 | 90 | ), |
@@ -99,52 +99,52 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @param WP_User $user |
101 | 101 | */ |
102 | - public function add_customer_meta_fields( $user ) { |
|
103 | - if ( ! apply_filters( 'getpaid_current_user_can_edit_customer_meta_fields', current_user_can( 'manage_options' ), $user->ID ) ) { |
|
102 | + public function add_customer_meta_fields($user) { |
|
103 | + if (!apply_filters('getpaid_current_user_can_edit_customer_meta_fields', current_user_can('manage_options'), $user->ID)) { |
|
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $show_fields = $this->get_customer_meta_fields(); |
108 | 108 | |
109 | - $customer = getpaid_get_customer_by_user_id( (int) $user->ID ); |
|
109 | + $customer = getpaid_get_customer_by_user_id((int) $user->ID); |
|
110 | 110 | |
111 | - foreach ( $show_fields as $fieldset_key => $fieldset ) : |
|
112 | - if ( ! wpinv_use_taxes() && isset( $fieldset['fields']['_wpinv_vat_number'] ) ) { |
|
113 | - unset( $fieldset['fields']['_wpinv_vat_number'] ); |
|
111 | + foreach ($show_fields as $fieldset_key => $fieldset) : |
|
112 | + if (!wpinv_use_taxes() && isset($fieldset['fields']['_wpinv_vat_number'])) { |
|
113 | + unset($fieldset['fields']['_wpinv_vat_number']); |
|
114 | 114 | } |
115 | 115 | ?> |
116 | - <h2><?php echo esc_html( $fieldset['title'] ); ?></h2> |
|
117 | - <table class="form-table" id="<?php echo esc_attr( 'getpaid-fieldset-' . $fieldset_key ); ?>"> |
|
118 | - <?php foreach ( $fieldset['fields'] as $key => $field ) : |
|
119 | - if ( ! empty( $customer ) ) { |
|
120 | - if ( strpos( $key, '_wpinv_' ) === 0 ) { |
|
121 | - $save_key = substr( $key , 7 ); |
|
116 | + <h2><?php echo esc_html($fieldset['title']); ?></h2> |
|
117 | + <table class="form-table" id="<?php echo esc_attr('getpaid-fieldset-' . $fieldset_key); ?>"> |
|
118 | + <?php foreach ($fieldset['fields'] as $key => $field) : |
|
119 | + if (!empty($customer)) { |
|
120 | + if (strpos($key, '_wpinv_') === 0) { |
|
121 | + $save_key = substr($key, 7); |
|
122 | 122 | } else { |
123 | 123 | $save_key = $key; |
124 | 124 | } |
125 | 125 | |
126 | - $value = $customer->get( $save_key ); |
|
126 | + $value = $customer->get($save_key); |
|
127 | 127 | } else { |
128 | - $value = $this->get_user_meta( $user->ID, $key ); |
|
128 | + $value = $this->get_user_meta($user->ID, $key); |
|
129 | 129 | } |
130 | 130 | ?> |
131 | 131 | <tr> |
132 | 132 | <th> |
133 | - <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ); ?></label> |
|
133 | + <label for="<?php echo esc_attr($key); ?>"><?php echo esc_html($field['label']); ?></label> |
|
134 | 134 | </th> |
135 | 135 | <td> |
136 | - <?php if ( ! empty( $field['type'] ) && 'select' === $field['type'] ) : ?> |
|
137 | - <select name="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" class="<?php echo esc_attr( $field['class'] ); ?> wpi_select2" style="width: 25em;"> |
|
138 | - <?php foreach ( $field['options'] as $option_key => $option_value ) : ?> |
|
139 | - <option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $value, $option_key, true ); ?>><?php echo esc_html( $option_value ); ?></option> |
|
136 | + <?php if (!empty($field['type']) && 'select' === $field['type']) : ?> |
|
137 | + <select name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" class="<?php echo esc_attr($field['class']); ?> wpi_select2" style="width: 25em;"> |
|
138 | + <?php foreach ($field['options'] as $option_key => $option_value) : ?> |
|
139 | + <option value="<?php echo esc_attr($option_key); ?>" <?php selected($value, $option_key, true); ?>><?php echo esc_html($option_value); ?></option> |
|
140 | 140 | <?php endforeach; ?> |
141 | 141 | </select> |
142 | - <?php elseif ( ! empty( $field['type'] ) && 'checkbox' === $field['type'] ) : ?> |
|
143 | - <input type="checkbox" name="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" value="1" class="<?php echo esc_attr( $field['class'] ); ?>" <?php checked( (int) $value, 1, true ); ?> /> |
|
142 | + <?php elseif (!empty($field['type']) && 'checkbox' === $field['type']) : ?> |
|
143 | + <input type="checkbox" name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" value="1" class="<?php echo esc_attr($field['class']); ?>" <?php checked((int) $value, 1, true); ?> /> |
|
144 | 144 | <?php else : ?> |
145 | - <input type="text" name="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $value ); ?>" class="<?php echo ( ! empty( $field['class'] ) ? esc_attr( $field['class'] ) : 'regular-text' ); ?>" /> |
|
145 | + <input type="text" name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" value="<?php echo esc_attr($value); ?>" class="<?php echo (!empty($field['class']) ? esc_attr($field['class']) : 'regular-text'); ?>" /> |
|
146 | 146 | <?php endif; ?> |
147 | - <p class="description"><?php echo wp_kses_post( $field['description'] ); ?></p> |
|
147 | + <p class="description"><?php echo wp_kses_post($field['description']); ?></p> |
|
148 | 148 | </td> |
149 | 149 | </tr> |
150 | 150 | <?php endforeach; ?> |
@@ -158,43 +158,43 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param int $user_id User ID of the user being saved |
160 | 160 | */ |
161 | - public function save_customer_meta_fields( $user_id ) { |
|
162 | - if ( ! apply_filters( 'getpaid_current_user_can_edit_customer_meta_fields', current_user_can( 'manage_options' ), $user_id ) ) { |
|
161 | + public function save_customer_meta_fields($user_id) { |
|
162 | + if (!apply_filters('getpaid_current_user_can_edit_customer_meta_fields', current_user_can('manage_options'), $user_id)) { |
|
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | 166 | $save_fields = $this->get_customer_meta_fields(); |
167 | 167 | $save_data = array(); |
168 | 168 | |
169 | - foreach ( $save_fields as $fieldset ) { |
|
170 | - foreach ( $fieldset['fields'] as $key => $field ) { |
|
171 | - if ( strpos( $key, '_wpinv_' ) === 0 ) { |
|
172 | - $save_key = substr( $key , 7 ); |
|
169 | + foreach ($save_fields as $fieldset) { |
|
170 | + foreach ($fieldset['fields'] as $key => $field) { |
|
171 | + if (strpos($key, '_wpinv_') === 0) { |
|
172 | + $save_key = substr($key, 7); |
|
173 | 173 | } else { |
174 | 174 | $save_key = $key; |
175 | 175 | } |
176 | 176 | |
177 | - if ( $save_key && isset( $field['type'] ) && 'checkbox' === $field['type'] ) { |
|
178 | - $save_data[ $save_key ] = ! empty( $_POST[ $key ] ) ? true : false; |
|
179 | - } else if ( $save_key && isset( $_POST[ $key ] ) ) { |
|
180 | - $save_data[ $save_key ] = wpinv_clean( $_POST[ $key ] ); |
|
177 | + if ($save_key && isset($field['type']) && 'checkbox' === $field['type']) { |
|
178 | + $save_data[$save_key] = !empty($_POST[$key]) ? true : false; |
|
179 | + } else if ($save_key && isset($_POST[$key])) { |
|
180 | + $save_data[$save_key] = wpinv_clean($_POST[$key]); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - if ( empty( $save_data ) ) { |
|
185 | + if (empty($save_data)) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
189 | - $customer = getpaid_get_customer_by_user_id( (int) $user_id ); |
|
189 | + $customer = getpaid_get_customer_by_user_id((int) $user_id); |
|
190 | 190 | |
191 | - if ( empty( $customer ) ) { |
|
192 | - $customer = new GetPaid_Customer( 0 ); |
|
193 | - $customer->clone_user( (int) $user_id ); |
|
191 | + if (empty($customer)) { |
|
192 | + $customer = new GetPaid_Customer(0); |
|
193 | + $customer->clone_user((int) $user_id); |
|
194 | 194 | } |
195 | 195 | |
196 | - foreach ( $save_data as $key => $value ) { |
|
197 | - $customer->set( $key, $value ); |
|
196 | + foreach ($save_data as $key => $value) { |
|
197 | + $customer->set($key, $value); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $customer->save(); |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | * @param string $key Key for user meta field |
209 | 209 | * @return string |
210 | 210 | */ |
211 | - protected function get_user_meta( $user_id, $key ) { |
|
212 | - $value = get_user_meta( $user_id, $key, true ); |
|
213 | - $existing_fields = array( '_wpinv_first_name', '_wpinv_last_name' ); |
|
211 | + protected function get_user_meta($user_id, $key) { |
|
212 | + $value = get_user_meta($user_id, $key, true); |
|
213 | + $existing_fields = array('_wpinv_first_name', '_wpinv_last_name'); |
|
214 | 214 | |
215 | - if ( ! $value && in_array( $key, $existing_fields ) ) { |
|
216 | - $value = get_user_meta( $user_id, str_replace( '_wpinv_', '', $key ), true ); |
|
215 | + if (!$value && in_array($key, $existing_fields)) { |
|
216 | + $value = get_user_meta($user_id, str_replace('_wpinv_', '', $key), true); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | return $value; |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$invoice = new WPInv_Invoice( $invoice ); |
|
13 | -$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() ); |
|
12 | +$invoice = new WPInv_Invoice($invoice); |
|
13 | +$address_row = wpinv_get_invoice_address_markup($invoice->get_user_info()); |
|
14 | 14 | $phone = $invoice->get_phone(); |
15 | 15 | $email = $invoice->get_email(); |
16 | 16 | $vat_number = $invoice->get_vat_number(); |
@@ -22,47 +22,47 @@ discard block |
||
22 | 22 | |
23 | 23 | |
24 | 24 | <div class="invoice-billing-address-label col-2"> |
25 | - <strong><?php esc_html_e( 'To:', 'invoicing' ); ?></strong> |
|
25 | + <strong><?php esc_html_e('To:', 'invoicing'); ?></strong> |
|
26 | 26 | </div> |
27 | 27 | |
28 | 28 | |
29 | 29 | <div class="invoice-billing-address-value col-10"> |
30 | 30 | |
31 | - <?php do_action( 'getpaid_billing_address_top' ); ?> |
|
31 | + <?php do_action('getpaid_billing_address_top'); ?> |
|
32 | 32 | |
33 | - <?php if ( ! empty( $address_row ) ) : ?> |
|
33 | + <?php if (!empty($address_row)) : ?> |
|
34 | 34 | <div class="billing-address"> |
35 | - <?php echo wp_kses_post( $address_row ); ?> |
|
35 | + <?php echo wp_kses_post($address_row); ?> |
|
36 | 36 | </div> |
37 | 37 | <?php endif; ?> |
38 | 38 | |
39 | 39 | |
40 | - <?php if ( ! empty( $phone ) ) : ?> |
|
40 | + <?php if (!empty($phone)) : ?> |
|
41 | 41 | <div class="billing-phone"> |
42 | - <?php echo wp_sprintf( esc_html__( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?> |
|
42 | + <?php echo wp_sprintf(esc_html__('Phone: %s', 'invoicing'), esc_html($phone)); ?> |
|
43 | 43 | </div> |
44 | 44 | <?php endif; ?> |
45 | 45 | |
46 | 46 | |
47 | - <?php if ( ! empty( $email ) ) : ?> |
|
47 | + <?php if (!empty($email)) : ?> |
|
48 | 48 | <div class="billing-email"> |
49 | - <?php echo wp_sprintf( esc_html__( 'Email: %s', 'invoicing' ), esc_html( $email ) ); ?> |
|
49 | + <?php echo wp_sprintf(esc_html__('Email: %s', 'invoicing'), esc_html($email)); ?> |
|
50 | 50 | </div> |
51 | 51 | <?php endif; ?> |
52 | 52 | |
53 | - <?php if ( ! empty( $vat_number ) && wpinv_use_taxes() ) : ?> |
|
53 | + <?php if (!empty($vat_number) && wpinv_use_taxes()) : ?> |
|
54 | 54 | <div class="vat-number"> |
55 | - <?php echo wp_sprintf( esc_html__( 'Vat Number: %s', 'invoicing' ), esc_html( $vat_number ) ); ?> |
|
55 | + <?php echo wp_sprintf(esc_html__('Vat Number: %s', 'invoicing'), esc_html($vat_number)); ?> |
|
56 | 56 | </div> |
57 | 57 | <?php endif; ?> |
58 | 58 | |
59 | - <?php if ( ! empty( $company_id ) ) : ?> |
|
59 | + <?php if (!empty($company_id)) : ?> |
|
60 | 60 | <div class="company-id"> |
61 | - <?php echo wp_sprintf( esc_html__( 'Company ID: %s', 'invoicing' ), esc_html( $company_id ) ); ?> |
|
61 | + <?php echo wp_sprintf(esc_html__('Company ID: %s', 'invoicing'), esc_html($company_id)); ?> |
|
62 | 62 | </div> |
63 | 63 | <?php endif; ?> |
64 | 64 | |
65 | - <?php do_action( 'getpaid_billing_address_bottom' ); ?> |
|
65 | + <?php do_action('getpaid_billing_address_bottom'); ?> |
|
66 | 66 | |
67 | 67 | </div> |
68 | 68 |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | // The calling class name |
46 | 46 | 'base_id' => 'hello_world', |
47 | 47 | // this is used as the widget id and the shortcode id. |
48 | - 'name' => __( 'Hello World', 'ayecode-connect' ), |
|
48 | + 'name' => __('Hello World', 'ayecode-connect'), |
|
49 | 49 | // the name of the widget/block |
50 | 50 | 'widget_ops' => array( |
51 | 51 | 'classname' => 'hello-world-class', |
52 | 52 | // widget class |
53 | - 'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect' ), |
|
53 | + 'description' => esc_html__('This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect'), |
|
54 | 54 | // widget description |
55 | 55 | ), |
56 | 56 | 'no_wrap' => true, // This will prevent the widget being wrapped in the containing widget class div. |
57 | 57 | 'arguments' => array( // these are the arguments that will be used in the widget, shortcode and block settings. |
58 | 58 | 'after_text' => array( // this is the input name='' |
59 | - 'title' => __( 'Text after hello:', 'ayecode-connect' ), |
|
59 | + 'title' => __('Text after hello:', 'ayecode-connect'), |
|
60 | 60 | // input title |
61 | - 'desc' => __( 'This is the text that will appear after `Hello:`.', 'ayecode-connect' ), |
|
61 | + 'desc' => __('This is the text that will appear after `Hello:`.', 'ayecode-connect'), |
|
62 | 62 | // input description |
63 | 63 | 'type' => 'text', |
64 | 64 | // the type of input, test, select, checkbox etc. |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ) |
75 | 75 | ); |
76 | 76 | |
77 | - parent::__construct( $options ); |
|
77 | + parent::__construct($options); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return string |
89 | 89 | */ |
90 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
90 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @var string $after_text |
94 | 94 | * @var string $another_input This is added by filter below. |
95 | 95 | */ |
96 | - extract( $args, EXTR_SKIP ); |
|
96 | + extract($args, EXTR_SKIP); |
|
97 | 97 | |
98 | 98 | /* |
99 | 99 | * This value is added by filter so might not exist if filter is removed so we check. |
100 | 100 | */ |
101 | - if ( ! isset( $another_input ) ) { |
|
101 | + if (!isset($another_input)) { |
|
102 | 102 | $another_input = ''; |
103 | 103 | } |
104 | 104 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | // register it. |
112 | -add_action( 'widgets_init', function () { |
|
113 | - register_widget( 'SD_Hello_World' ); |
|
112 | +add_action('widgets_init', function() { |
|
113 | + register_widget('SD_Hello_World'); |
|
114 | 114 | } ); |
115 | 115 | |
116 | 116 | |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return mixed |
123 | 123 | */ |
124 | -function _my_extra_arguments( $options ) { |
|
124 | +function _my_extra_arguments($options) { |
|
125 | 125 | |
126 | 126 | /* |
127 | 127 | * Add a new input option. |
128 | 128 | */ |
129 | 129 | $options['arguments']['another_input'] = array( |
130 | 130 | 'name' => 'another_input', // this is the input name='' |
131 | - 'title' => __( 'Another input:', 'ayecode-connect' ), // input title |
|
132 | - 'desc' => __( 'This is an input added via filter.', 'ayecode-connect' ), // input description |
|
131 | + 'title' => __('Another input:', 'ayecode-connect'), // input title |
|
132 | + 'desc' => __('This is an input added via filter.', 'ayecode-connect'), // input description |
|
133 | 133 | 'type' => 'text', // the type of input, test, select, checkbox etc. |
134 | 134 | 'placeholder' => 'Placeholder text', // the input placeholder text. |
135 | 135 | 'desc_tip' => true, // if the input should show the widget description text as a tooltip. |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | /* |
141 | 141 | * Output the new option in the block output also. |
142 | 142 | */ |
143 | - $options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]";; |
|
143 | + $options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]"; ; |
|
144 | 144 | |
145 | 145 | return $options; |
146 | 146 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @version 1.0.0 |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Contains the subscriptions widget. |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | 'block-keywords' => "['invoicing','subscriptions', 'getpaid']", |
28 | 28 | 'class_name' => __CLASS__, |
29 | 29 | 'base_id' => 'wpinv_subscriptions', |
30 | - 'name' => __( 'GetPaid > Subscriptions', 'invoicing' ), |
|
30 | + 'name' => __('GetPaid > Subscriptions', 'invoicing'), |
|
31 | 31 | 'widget_ops' => array( |
32 | 32 | 'classname' => 'getpaid-subscriptions bsui', |
33 | - 'description' => esc_html__( "Displays the current user's subscriptions.", 'invoicing' ), |
|
33 | + 'description' => esc_html__("Displays the current user's subscriptions.", 'invoicing'), |
|
34 | 34 | ), |
35 | 35 | 'arguments' => array( |
36 | 36 | 'title' => array( |
37 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
38 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
37 | + 'title' => __('Widget title', 'invoicing'), |
|
38 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
39 | 39 | 'type' => 'text', |
40 | 40 | 'desc_tip' => true, |
41 | 41 | 'default' => '', |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | ); |
47 | 47 | |
48 | - parent::__construct( $options ); |
|
48 | + parent::__construct($options); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | public function get_subscriptions() { |
57 | 57 | |
58 | 58 | // Prepare license args. |
59 | - $args = array( |
|
59 | + $args = array( |
|
60 | 60 | 'customer_in' => get_current_user_id(), |
61 | - 'paged' => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1, |
|
61 | + 'paged' => (get_query_var('paged')) ? absint(get_query_var('paged')) : 1, |
|
62 | 62 | ); |
63 | 63 | |
64 | - return new GetPaid_Subscriptions_Query( $args ); |
|
64 | + return new GetPaid_Subscriptions_Query($args); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return mixed|string|bool |
76 | 76 | */ |
77 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
77 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
78 | 78 | |
79 | 79 | // Ensure that the user is logged in. |
80 | - if ( ! is_user_logged_in() ) { |
|
80 | + if (!is_user_logged_in()) { |
|
81 | 81 | |
82 | 82 | return aui()->alert( |
83 | 83 | array( |
84 | - 'content' => wp_kses_post( __( 'You need to log-in or create an account to view this section.', 'invoicing' ) ), |
|
84 | + 'content' => wp_kses_post(__('You need to log-in or create an account to view this section.', 'invoicing')), |
|
85 | 85 | 'type' => 'error', |
86 | 86 | ) |
87 | 87 | ); |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | // Are we displaying a single subscription? |
92 | - if ( isset( $_GET['subscription'] ) ) { |
|
93 | - return $this->display_single_subscription( intval( $_GET['subscription'] ) ); |
|
92 | + if (isset($_GET['subscription'])) { |
|
93 | + return $this->display_single_subscription(intval($_GET['subscription'])); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | // Retrieve the user's subscriptions. |
@@ -100,27 +100,27 @@ discard block |
||
100 | 100 | ob_start(); |
101 | 101 | |
102 | 102 | // Backwards compatibility. |
103 | - do_action( 'wpinv_before_user_subscriptions' ); |
|
103 | + do_action('wpinv_before_user_subscriptions'); |
|
104 | 104 | |
105 | 105 | // Display errors and notices. |
106 | 106 | wpinv_print_errors(); |
107 | 107 | |
108 | - do_action( 'getpaid_license_manager_before_subscriptions', $subscriptions ); |
|
108 | + do_action('getpaid_license_manager_before_subscriptions', $subscriptions); |
|
109 | 109 | |
110 | 110 | // Print the table header. |
111 | 111 | $this->print_table_header(); |
112 | 112 | |
113 | 113 | // Print table body. |
114 | - $this->print_table_body( $subscriptions->get_results() ); |
|
114 | + $this->print_table_body($subscriptions->get_results()); |
|
115 | 115 | |
116 | 116 | // Print table footer. |
117 | 117 | $this->print_table_footer(); |
118 | 118 | |
119 | 119 | // Print the navigation. |
120 | - $this->print_navigation( $subscriptions->get_total() ); |
|
120 | + $this->print_navigation($subscriptions->get_total()); |
|
121 | 121 | |
122 | 122 | // Backwards compatibility. |
123 | - do_action( 'wpinv_after_user_subscriptions' ); |
|
123 | + do_action('wpinv_after_user_subscriptions'); |
|
124 | 124 | |
125 | 125 | // Return the output. |
126 | 126 | return ob_get_clean(); |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | public function get_subscriptions_table_columns() { |
136 | 136 | |
137 | 137 | $columns = array( |
138 | - 'subscription' => __( 'Subscription', 'invoicing' ), |
|
139 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
140 | - 'renewal-date' => __( 'Next payment', 'invoicing' ), |
|
141 | - 'status' => __( 'Status', 'invoicing' ), |
|
138 | + 'subscription' => __('Subscription', 'invoicing'), |
|
139 | + 'amount' => __('Amount', 'invoicing'), |
|
140 | + 'renewal-date' => __('Next payment', 'invoicing'), |
|
141 | + 'status' => __('Status', 'invoicing'), |
|
142 | 142 | ); |
143 | 143 | |
144 | - return apply_filters( 'getpaid_frontend_subscriptions_table_columns', $columns ); |
|
144 | + return apply_filters('getpaid_frontend_subscriptions_table_columns', $columns); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | |
157 | 157 | <thead> |
158 | 158 | <tr> |
159 | - <?php foreach ( $this->get_subscriptions_table_columns() as $key => $label ) : ?> |
|
160 | - <th scope="col" class="font-weight-bold getpaid-subscriptions-table-<?php echo esc_attr( $key ); ?>"> |
|
161 | - <?php echo esc_html( $label ); ?> |
|
159 | + <?php foreach ($this->get_subscriptions_table_columns() as $key => $label) : ?> |
|
160 | + <th scope="col" class="font-weight-bold getpaid-subscriptions-table-<?php echo esc_attr($key); ?>"> |
|
161 | + <?php echo esc_html($label); ?> |
|
162 | 162 | </th> |
163 | 163 | <?php endforeach; ?> |
164 | 164 | </tr> |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @param WPInv_Subscription[] $subscriptions |
175 | 175 | */ |
176 | - public function print_table_body( $subscriptions ) { |
|
176 | + public function print_table_body($subscriptions) { |
|
177 | 177 | |
178 | - if ( empty( $subscriptions ) ) { |
|
178 | + if (empty($subscriptions)) { |
|
179 | 179 | $this->print_table_body_no_subscriptions(); |
180 | 180 | } else { |
181 | - $this->print_table_body_subscriptions( $subscriptions ); |
|
181 | + $this->print_table_body_subscriptions($subscriptions); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | } |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | <tbody> |
194 | 194 | |
195 | 195 | <tr> |
196 | - <td colspan="<?php echo count( $this->get_subscriptions_table_columns() ); ?>"> |
|
196 | + <td colspan="<?php echo count($this->get_subscriptions_table_columns()); ?>"> |
|
197 | 197 | |
198 | 198 | <?php |
199 | 199 | aui()->alert( |
200 | 200 | array( |
201 | - 'content' => wp_kses_post( __( 'No subscriptions found.', 'invoicing' ) ), |
|
201 | + 'content' => wp_kses_post(__('No subscriptions found.', 'invoicing')), |
|
202 | 202 | 'type' => 'warning', |
203 | 203 | ), |
204 | 204 | true |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @param WPInv_Subscription[] $subscriptions |
219 | 219 | */ |
220 | - public function print_table_body_subscriptions( $subscriptions ) { |
|
220 | + public function print_table_body_subscriptions($subscriptions) { |
|
221 | 221 | |
222 | 222 | ?> |
223 | 223 | <tbody> |
224 | 224 | |
225 | - <?php foreach ( $subscriptions as $subscription ) : ?> |
|
225 | + <?php foreach ($subscriptions as $subscription) : ?> |
|
226 | 226 | <tr class="getpaid-subscriptions-table-row subscription-<?php echo (int) $subscription->get_id(); ?>"> |
227 | 227 | <?php |
228 | 228 | wpinv_get_template( |
@@ -248,28 +248,28 @@ discard block |
||
248 | 248 | * @since 1.0.0 |
249 | 249 | * @return string |
250 | 250 | */ |
251 | - public function add_row_actions( $content, $subscription ) { |
|
251 | + public function add_row_actions($content, $subscription) { |
|
252 | 252 | |
253 | 253 | // Prepare row actions. |
254 | 254 | $actions = array(); |
255 | 255 | |
256 | 256 | // View subscription action. |
257 | - $view_url = getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) ); |
|
258 | - $view_url = esc_url( add_query_arg( 'subscription', (int) $subscription->get_id(), $view_url ) ); |
|
259 | - $actions['view'] = "<a href='$view_url' class='text-decoration-none'>" . __( 'Manage Subscription', 'invoicing' ) . '</a>'; |
|
257 | + $view_url = getpaid_get_tab_url('gp-subscriptions', get_permalink((int) wpinv_get_option('invoice_subscription_page'))); |
|
258 | + $view_url = esc_url(add_query_arg('subscription', (int) $subscription->get_id(), $view_url)); |
|
259 | + $actions['view'] = "<a href='$view_url' class='text-decoration-none'>" . __('Manage Subscription', 'invoicing') . '</a>'; |
|
260 | 260 | |
261 | 261 | // Filter the actions. |
262 | - $actions = apply_filters( 'getpaid_subscriptions_table_subscription_actions', $actions, $subscription ); |
|
262 | + $actions = apply_filters('getpaid_subscriptions_table_subscription_actions', $actions, $subscription); |
|
263 | 263 | |
264 | - $sanitized = array(); |
|
265 | - foreach ( $actions as $key => $action ) { |
|
266 | - $key = sanitize_html_class( $key ); |
|
267 | - $action = wp_kses_post( $action ); |
|
264 | + $sanitized = array(); |
|
265 | + foreach ($actions as $key => $action) { |
|
266 | + $key = sanitize_html_class($key); |
|
267 | + $action = wp_kses_post($action); |
|
268 | 268 | $sanitized[] = "<span class='$key'>$action</span>"; |
269 | 269 | } |
270 | 270 | |
271 | 271 | $row_actions = "<small class='form-text getpaid-subscription-item-actions'>"; |
272 | - $row_actions .= implode( ' | ', $sanitized ); |
|
272 | + $row_actions .= implode(' | ', $sanitized); |
|
273 | 273 | $row_actions .= '</small>'; |
274 | 274 | |
275 | 275 | return $content . $row_actions; |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | |
286 | 286 | <tfoot> |
287 | 287 | <tr> |
288 | - <?php foreach ( $this->get_subscriptions_table_columns() as $key => $label ) : ?> |
|
289 | - <th class="font-weight-bold getpaid-subscriptions-<?php echo esc_attr( $key ); ?>"> |
|
290 | - <?php echo esc_html( $label ); ?> |
|
288 | + <?php foreach ($this->get_subscriptions_table_columns() as $key => $label) : ?> |
|
289 | + <th class="font-weight-bold getpaid-subscriptions-<?php echo esc_attr($key); ?>"> |
|
290 | + <?php echo esc_html($label); ?> |
|
291 | 291 | </th> |
292 | 292 | <?php endforeach; ?> |
293 | 293 | </tr> |
@@ -303,22 +303,22 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @param int $total |
305 | 305 | */ |
306 | - public function print_navigation( $total ) { |
|
306 | + public function print_navigation($total) { |
|
307 | 307 | |
308 | - if ( $total < 1 ) { |
|
308 | + if ($total < 1) { |
|
309 | 309 | |
310 | 310 | // Out-of-bounds, run the query again without LIMIT for total count. |
311 | - $args = array( |
|
311 | + $args = array( |
|
312 | 312 | 'customer_in' => get_current_user_id(), |
313 | 313 | 'fields' => 'id', |
314 | 314 | ); |
315 | 315 | |
316 | - $count_query = new GetPaid_Subscriptions_Query( $args ); |
|
316 | + $count_query = new GetPaid_Subscriptions_Query($args); |
|
317 | 317 | $total = $count_query->get_total(); |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Abort if we do not have pages. |
321 | - if ( 2 > $total ) { |
|
321 | + if (2 > $total) { |
|
322 | 322 | return; |
323 | 323 | } |
324 | 324 | |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | echo wp_kses_post( |
332 | 332 | getpaid_paginate_links( |
333 | 333 | array( |
334 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
334 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
335 | 335 | 'format' => '?paged=%#%', |
336 | - 'total' => (int) ceil( $total / 10 ), |
|
336 | + 'total' => (int) ceil($total / 10), |
|
337 | 337 | ) |
338 | 338 | ) |
339 | 339 | ); |
@@ -350,43 +350,43 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @return array |
352 | 352 | */ |
353 | - public function get_single_subscription_columns( $subscription ) { |
|
353 | + public function get_single_subscription_columns($subscription) { |
|
354 | 354 | |
355 | 355 | // Prepare subscription detail columns. |
356 | - $subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() ); |
|
357 | - $items_count = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] ); |
|
356 | + $subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_invoice_id(), $subscription->get_id()); |
|
357 | + $items_count = empty($subscription_group) ? 1 : count($subscription_group['items']); |
|
358 | 358 | $fields = apply_filters( |
359 | 359 | 'getpaid_single_subscription_details_fields', |
360 | 360 | array( |
361 | - 'status' => __( 'Status', 'invoicing' ), |
|
362 | - 'initial_amount' => __( 'Initial amount', 'invoicing' ), |
|
363 | - 'recurring_amount' => __( 'Recurring amount', 'invoicing' ), |
|
364 | - 'start_date' => __( 'Start date', 'invoicing' ), |
|
365 | - 'expiry_date' => __( 'Next payment', 'invoicing' ), |
|
366 | - 'payments' => __( 'Payments', 'invoicing' ), |
|
367 | - 'item' => $items_count > 1 ? __( 'Items', $items_count, 'invoicing' ) : __( 'Item', 'invoicing' ) |
|
361 | + 'status' => __('Status', 'invoicing'), |
|
362 | + 'initial_amount' => __('Initial amount', 'invoicing'), |
|
363 | + 'recurring_amount' => __('Recurring amount', 'invoicing'), |
|
364 | + 'start_date' => __('Start date', 'invoicing'), |
|
365 | + 'expiry_date' => __('Next payment', 'invoicing'), |
|
366 | + 'payments' => __('Payments', 'invoicing'), |
|
367 | + 'item' => $items_count > 1 ? __('Items', $items_count, 'invoicing') : __('Item', 'invoicing') |
|
368 | 368 | ), |
369 | 369 | $subscription, |
370 | 370 | $items_count |
371 | 371 | ); |
372 | 372 | |
373 | - if ( isset( $fields['expiry_date'] ) ) { |
|
373 | + if (isset($fields['expiry_date'])) { |
|
374 | 374 | |
375 | - if ( ! $subscription->is_active() || $subscription->is_last_renewal() ) { |
|
376 | - $fields['expiry_date'] = __( 'End date', 'invoicing' ); |
|
375 | + if (!$subscription->is_active() || $subscription->is_last_renewal()) { |
|
376 | + $fields['expiry_date'] = __('End date', 'invoicing'); |
|
377 | 377 | } |
378 | 378 | |
379 | - if ( 'pending' === $subscription->get_status() ) { |
|
380 | - unset( $fields['expiry_date'] ); |
|
379 | + if ('pending' === $subscription->get_status()) { |
|
380 | + unset($fields['expiry_date']); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | - if ( isset( $fields['start_date'] ) && 'pending' === $subscription->get_status() ) { |
|
385 | - unset( $fields['start_date'] ); |
|
384 | + if (isset($fields['start_date']) && 'pending' === $subscription->get_status()) { |
|
385 | + unset($fields['start_date']); |
|
386 | 386 | } |
387 | 387 | |
388 | - if ( $subscription->get_initial_amount() === $subscription->get_recurring_amount() ) { |
|
389 | - unset( $fields['initial_amount'] ); |
|
388 | + if ($subscription->get_initial_amount() === $subscription->get_recurring_amount()) { |
|
389 | + unset($fields['initial_amount']); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | return $fields; |
@@ -399,16 +399,16 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return string |
401 | 401 | */ |
402 | - public function display_single_subscription( $subscription ) { |
|
402 | + public function display_single_subscription($subscription) { |
|
403 | 403 | |
404 | 404 | // Fetch the subscription. |
405 | - $subscription = new WPInv_Subscription( (int) $subscription ); |
|
405 | + $subscription = new WPInv_Subscription((int) $subscription); |
|
406 | 406 | |
407 | - if ( ! $subscription->exists() ) { |
|
407 | + if (!$subscription->exists()) { |
|
408 | 408 | |
409 | 409 | return aui()->alert( |
410 | 410 | array( |
411 | - 'content' => wp_kses_post( __( 'Subscription not found.', 'invoicing' ) ), |
|
411 | + 'content' => wp_kses_post(__('Subscription not found.', 'invoicing')), |
|
412 | 412 | 'type' => 'error', |
413 | 413 | ) |
414 | 414 | ); |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | // Ensure that the user owns this subscription key. |
419 | - if ( get_current_user_id() != $subscription->get_customer_id() && ! wpinv_current_user_can_manage_invoicing() ) { |
|
419 | + if (get_current_user_id() != $subscription->get_customer_id() && !wpinv_current_user_can_manage_invoicing()) { |
|
420 | 420 | |
421 | 421 | return aui()->alert( |
422 | 422 | array( |
423 | - 'content' => wp_kses_post( __( 'You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing' ) ), |
|
423 | + 'content' => wp_kses_post(__('You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing')), |
|
424 | 424 | 'type' => 'error', |
425 | 425 | ) |
426 | 426 | ); |
@@ -7,52 +7,52 @@ |
||
7 | 7 | * @version 2.8.9 |
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 ) ); |
|
14 | -$id = esc_attr( $id ); |
|
15 | -$_id = $id . uniqid( '_' ); |
|
16 | -$max_file_num = empty( $max_file_num ) ? 1 : absint( $max_file_num ); |
|
17 | -$file_types = empty( $file_types ) ? array( 'jpg|jpeg|jpe', 'gif', 'png' ) : $file_types; |
|
12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
14 | +$id = esc_attr($id); |
|
15 | +$_id = $id . uniqid('_'); |
|
16 | +$max_file_num = empty($max_file_num) ? 1 : absint($max_file_num); |
|
17 | +$file_types = empty($file_types) ? array('jpg|jpeg|jpe', 'gif', 'png') : $file_types; |
|
18 | 18 | $all_types = getpaid_get_allowed_mime_types(); |
19 | 19 | $types = array(); |
20 | 20 | $_types = array(); |
21 | 21 | |
22 | -foreach ( $file_types as $file_type ) { |
|
22 | +foreach ($file_types as $file_type) { |
|
23 | 23 | |
24 | - if ( isset( $all_types[ $file_type ] ) ) { |
|
25 | - $types[] = $all_types[ $file_type ]; |
|
26 | - $file_type = explode( '|', $file_type ); |
|
24 | + if (isset($all_types[$file_type])) { |
|
25 | + $types[] = $all_types[$file_type]; |
|
26 | + $file_type = explode('|', $file_type); |
|
27 | 27 | |
28 | - foreach ( $file_type as $type ) { |
|
29 | - $type = trim( $type ); |
|
28 | + foreach ($file_type as $type) { |
|
29 | + $type = trim($type); |
|
30 | 30 | $types[] = ".$type"; |
31 | 31 | $_types[] = $type; |
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | -if ( ! empty( $required ) ) { |
|
36 | +if (!empty($required)) { |
|
37 | 37 | $label .= "<span class='text-danger'> *</span>"; |
38 | 38 | } |
39 | 39 | ?> |
40 | 40 | <label><span v-html="form_element.label"></span></label> |
41 | -<div class="form-group mb-3 <?php echo esc_attr( $label_class ); ?>" data-name="<?php echo esc_attr( $id ); ?>" data-max="<?php echo esc_attr( $max_file_num ); ?>"> |
|
42 | - <label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $label ); ?></label> |
|
43 | - <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr( $id ); ?>" accept="<?php echo esc_attr( implode( ', ', $types ) ); ?>" data-extensions="<?php echo esc_attr( wp_json_encode( $_types ) ); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
44 | - <label for="<?php echo esc_attr( $id ); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
41 | +<div class="form-group mb-3 <?php echo esc_attr($label_class); ?>" data-name="<?php echo esc_attr($id); ?>" data-max="<?php echo esc_attr($max_file_num); ?>"> |
|
42 | + <label for="<?php echo esc_attr($id); ?>"><?php echo wp_kses_post($label); ?></label> |
|
43 | + <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr($id); ?>" accept="<?php echo esc_attr(implode(', ', $types)); ?>" data-extensions="<?php echo esc_attr(wp_json_encode($_types)); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
44 | + <label for="<?php echo esc_attr($id); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
45 | 45 | <div class="h5 text-dark"> |
46 | - <?php echo esc_html( ( $max_file_num > 1 ? __( 'Drag files to this area or click to upload', 'invoicing' ) : __( 'Drag your file to this area or click to upload', 'invoicing' ) ) ); ?> |
|
46 | + <?php echo esc_html(($max_file_num > 1 ? __('Drag files to this area or click to upload', 'invoicing') : __('Drag your file to this area or click to upload', 'invoicing'))); ?> |
|
47 | 47 | </div> |
48 | - <?php if ( ! empty( $description ) ) : ?> |
|
49 | - <small class="form-text text-muted"><?php echo wp_kses_post( $description ); ?></small> |
|
48 | + <?php if (!empty($description)) : ?> |
|
49 | + <small class="form-text text-muted"><?php echo wp_kses_post($description); ?></small> |
|
50 | 50 | <?php endif; ?> |
51 | 51 | </label> |
52 | 52 | <div class="getpaid-uploaded-files"></div> |
53 | 53 | <div class="form-row row mb-3 d-none getpaid-progress-template"> |
54 | 54 | <div class="overflow-hidden text-nowrap col-7 col-sm-4"> |
55 | - <a href="" class="close float-none" title="<?php esc_attr_e( 'Remove File', 'invoicing' ); ?>">×<span class="sr-only"><?php esc_html_e( 'Close', 'invoicing' ); ?></span></a> |
|
55 | + <a href="" class="close float-none" title="<?php esc_attr_e('Remove File', 'invoicing'); ?>">×<span class="sr-only"><?php esc_html_e('Close', 'invoicing'); ?></span></a> |
|
56 | 56 | <i class="fa fa-file" aria-hidden="true"></i> <span class="getpaid-progress-file-name"></span> |
57 | 57 | </div> |
58 | 58 | <div class="col-5 col-sm-8 getpaid-progress"> |
@@ -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,14 +29,14 @@ 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 | $capabilities = wpinv_current_user_can_manage_invoicing(); |
37 | 37 | |
38 | 38 | // Fires before registering post types. |
39 | - do_action( 'getpaid_register_post_types' ); |
|
39 | + do_action('getpaid_register_post_types'); |
|
40 | 40 | |
41 | 41 | // Register item post type. |
42 | 42 | register_post_type( |
@@ -45,29 +45,29 @@ discard block |
||
45 | 45 | 'wpinv_register_post_type_invoice_item', |
46 | 46 | array( |
47 | 47 | 'labels' => array( |
48 | - 'name' => _x( 'Items', 'post type general name', 'invoicing' ), |
|
49 | - 'singular_name' => _x( 'Item', 'post type singular name', 'invoicing' ), |
|
50 | - 'menu_name' => _x( 'Items', 'admin menu', 'invoicing' ), |
|
51 | - 'name_admin_bar' => _x( 'Item', 'add new on admin bar', 'invoicing' ), |
|
52 | - 'add_new' => _x( 'Add New', 'Item', 'invoicing' ), |
|
53 | - 'add_new_item' => __( 'Add New Item', 'invoicing' ), |
|
54 | - 'new_item' => __( 'New Item', 'invoicing' ), |
|
55 | - 'edit_item' => __( 'Edit Item', 'invoicing' ), |
|
56 | - 'view_item' => __( 'View Item', 'invoicing' ), |
|
57 | - 'all_items' => __( 'Items', 'invoicing' ), |
|
58 | - 'search_items' => __( 'Search items', 'invoicing' ), |
|
59 | - 'parent_item_colon' => __( 'Parent item:', 'invoicing' ), |
|
60 | - 'not_found' => __( 'No items found.', 'invoicing' ), |
|
61 | - 'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' ), |
|
48 | + 'name' => _x('Items', 'post type general name', 'invoicing'), |
|
49 | + 'singular_name' => _x('Item', 'post type singular name', 'invoicing'), |
|
50 | + 'menu_name' => _x('Items', 'admin menu', 'invoicing'), |
|
51 | + 'name_admin_bar' => _x('Item', 'add new on admin bar', 'invoicing'), |
|
52 | + 'add_new' => _x('Add New', 'Item', 'invoicing'), |
|
53 | + 'add_new_item' => __('Add New Item', 'invoicing'), |
|
54 | + 'new_item' => __('New Item', 'invoicing'), |
|
55 | + 'edit_item' => __('Edit Item', 'invoicing'), |
|
56 | + 'view_item' => __('View Item', 'invoicing'), |
|
57 | + 'all_items' => __('Items', 'invoicing'), |
|
58 | + 'search_items' => __('Search items', 'invoicing'), |
|
59 | + 'parent_item_colon' => __('Parent item:', 'invoicing'), |
|
60 | + 'not_found' => __('No items found.', 'invoicing'), |
|
61 | + 'not_found_in_trash' => __('No items found in trash.', 'invoicing'), |
|
62 | 62 | ), |
63 | - 'description' => __( 'This is where you can add new invoice items.', 'invoicing' ), |
|
63 | + 'description' => __('This is where you can add new invoice items.', 'invoicing'), |
|
64 | 64 | 'public' => false, |
65 | 65 | 'has_archive' => false, |
66 | 66 | '_builtin' => false, |
67 | 67 | 'show_ui' => $capabilities ? true : false, |
68 | 68 | 'show_in_menu' => $capabilities ? 'wpinv' : false, |
69 | 69 | 'show_in_nav_menus' => false, |
70 | - 'supports' => array( 'title', 'excerpt', 'thumbnail' ), |
|
70 | + 'supports' => array('title', 'excerpt', 'thumbnail'), |
|
71 | 71 | 'rewrite' => false, |
72 | 72 | 'query_var' => false, |
73 | 73 | 'map_meta_cap' => true, |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | 'wpinv_register_post_type_payment_form', |
85 | 85 | array( |
86 | 86 | 'labels' => array( |
87 | - 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
88 | - 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
89 | - 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
90 | - 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
91 | - 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
92 | - 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
93 | - 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
94 | - 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
95 | - 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
96 | - 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
97 | - 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
98 | - 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
99 | - 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
100 | - 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ), |
|
87 | + 'name' => _x('Payment Forms', 'post type general name', 'invoicing'), |
|
88 | + 'singular_name' => _x('Payment Form', 'post type singular name', 'invoicing'), |
|
89 | + 'menu_name' => _x('Payment Forms', 'admin menu', 'invoicing'), |
|
90 | + 'name_admin_bar' => _x('Payment Form', 'add new on admin bar', 'invoicing'), |
|
91 | + 'add_new' => _x('Add New', 'Payment Form', 'invoicing'), |
|
92 | + 'add_new_item' => __('Add New Payment Form', 'invoicing'), |
|
93 | + 'new_item' => __('New Payment Form', 'invoicing'), |
|
94 | + 'edit_item' => __('Edit Payment Form', 'invoicing'), |
|
95 | + 'view_item' => __('View Payment Form', 'invoicing'), |
|
96 | + 'all_items' => __('Payment Forms', 'invoicing'), |
|
97 | + 'search_items' => __('Search Payment Forms', 'invoicing'), |
|
98 | + 'parent_item_colon' => __('Parent Payment Forms:', 'invoicing'), |
|
99 | + 'not_found' => __('No payment forms found.', 'invoicing'), |
|
100 | + 'not_found_in_trash' => __('No payment forms found in trash.', 'invoicing'), |
|
101 | 101 | ), |
102 | - 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
102 | + 'description' => __('Add new payment forms.', 'invoicing'), |
|
103 | 103 | 'public' => false, |
104 | 104 | 'show_ui' => $capabilities ? true : false, |
105 | 105 | 'show_in_menu' => $capabilities ? 'wpinv' : false, |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'has_archive' => false, |
111 | 111 | 'hierarchical' => false, |
112 | 112 | 'menu_position' => null, |
113 | - 'supports' => array( 'title' ), |
|
113 | + 'supports' => array('title'), |
|
114 | 114 | 'menu_icon' => 'dashicons-media-form', |
115 | 115 | ) |
116 | 116 | ) |
@@ -123,32 +123,32 @@ discard block |
||
123 | 123 | 'wpinv_register_post_type_invoice', |
124 | 124 | array( |
125 | 125 | 'labels' => array( |
126 | - 'name' => __( 'Invoices', 'invoicing' ), |
|
127 | - 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
128 | - 'all_items' => __( 'Invoices', 'invoicing' ), |
|
129 | - 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
130 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
131 | - 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
132 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
133 | - 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
134 | - 'new_item' => __( 'New invoice', 'invoicing' ), |
|
135 | - 'view_item' => __( 'View invoice', 'invoicing' ), |
|
136 | - 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
137 | - 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
138 | - 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
139 | - 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
140 | - 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
141 | - 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
142 | - 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
143 | - 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
144 | - 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
145 | - 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
146 | - 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
147 | - 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
148 | - 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
149 | - 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
126 | + 'name' => __('Invoices', 'invoicing'), |
|
127 | + 'singular_name' => __('Invoice', 'invoicing'), |
|
128 | + 'all_items' => __('Invoices', 'invoicing'), |
|
129 | + 'menu_name' => _x('Invoices', 'Admin menu name', 'invoicing'), |
|
130 | + 'add_new' => __('Add New', 'invoicing'), |
|
131 | + 'add_new_item' => __('Add new invoice', 'invoicing'), |
|
132 | + 'edit' => __('Edit', 'invoicing'), |
|
133 | + 'edit_item' => __('Edit invoice', 'invoicing'), |
|
134 | + 'new_item' => __('New invoice', 'invoicing'), |
|
135 | + 'view_item' => __('View invoice', 'invoicing'), |
|
136 | + 'view_items' => __('View Invoices', 'invoicing'), |
|
137 | + 'search_items' => __('Search invoices', 'invoicing'), |
|
138 | + 'not_found' => __('No invoices found', 'invoicing'), |
|
139 | + 'not_found_in_trash' => __('No invoices found in trash', 'invoicing'), |
|
140 | + 'parent' => __('Parent invoice', 'invoicing'), |
|
141 | + 'featured_image' => __('Invoice image', 'invoicing'), |
|
142 | + 'set_featured_image' => __('Set invoice image', 'invoicing'), |
|
143 | + 'remove_featured_image' => __('Remove invoice image', 'invoicing'), |
|
144 | + 'use_featured_image' => __('Use as invoice image', 'invoicing'), |
|
145 | + 'insert_into_item' => __('Insert into invoice', 'invoicing'), |
|
146 | + 'uploaded_to_this_item' => __('Uploaded to this invoice', 'invoicing'), |
|
147 | + 'filter_items_list' => __('Filter invoices', 'invoicing'), |
|
148 | + 'items_list_navigation' => __('Invoices navigation', 'invoicing'), |
|
149 | + 'items_list' => __('Invoices list', 'invoicing'), |
|
150 | 150 | ), |
151 | - 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
151 | + 'description' => __('This is where invoices are stored.', 'invoicing'), |
|
152 | 152 | 'public' => true, |
153 | 153 | 'has_archive' => false, |
154 | 154 | 'publicly_queryable' => true, |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | 'show_ui' => $capabilities ? true : false, |
157 | 157 | 'show_in_menu' => $capabilities ? 'wpinv' : false, |
158 | 158 | 'show_in_nav_menus' => false, |
159 | - 'supports' => array( 'title', 'author', 'excerpt' ), |
|
159 | + 'supports' => array('title', 'author', 'excerpt'), |
|
160 | 160 | 'rewrite' => array( |
161 | 161 | 'slug' => 'invoice', |
162 | 162 | 'with_front' => false, |
@@ -179,32 +179,32 @@ discard block |
||
179 | 179 | 'wpinv_register_post_type_discount', |
180 | 180 | array( |
181 | 181 | 'labels' => array( |
182 | - 'name' => __( 'Discounts', 'invoicing' ), |
|
183 | - 'singular_name' => __( 'Discount', 'invoicing' ), |
|
184 | - 'all_items' => __( 'Discounts', 'invoicing' ), |
|
185 | - 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
186 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
187 | - 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
188 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
189 | - 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
190 | - 'new_item' => __( 'New discount', 'invoicing' ), |
|
191 | - 'view_item' => __( 'View discount', 'invoicing' ), |
|
192 | - 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
193 | - 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
194 | - 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
195 | - 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
196 | - 'parent' => __( 'Parent discount', 'invoicing' ), |
|
197 | - 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
198 | - 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
199 | - 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
200 | - 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
201 | - 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
202 | - 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
203 | - 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
204 | - 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
205 | - 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
182 | + 'name' => __('Discounts', 'invoicing'), |
|
183 | + 'singular_name' => __('Discount', 'invoicing'), |
|
184 | + 'all_items' => __('Discounts', 'invoicing'), |
|
185 | + 'menu_name' => _x('Discounts', 'Admin menu name', 'invoicing'), |
|
186 | + 'add_new' => __('Add New', 'invoicing'), |
|
187 | + 'add_new_item' => __('Add new discount', 'invoicing'), |
|
188 | + 'edit' => __('Edit', 'invoicing'), |
|
189 | + 'edit_item' => __('Edit discount', 'invoicing'), |
|
190 | + 'new_item' => __('New discount', 'invoicing'), |
|
191 | + 'view_item' => __('View discount', 'invoicing'), |
|
192 | + 'view_items' => __('View Discounts', 'invoicing'), |
|
193 | + 'search_items' => __('Search discounts', 'invoicing'), |
|
194 | + 'not_found' => __('No discounts found', 'invoicing'), |
|
195 | + 'not_found_in_trash' => __('No discounts found in trash', 'invoicing'), |
|
196 | + 'parent' => __('Parent discount', 'invoicing'), |
|
197 | + 'featured_image' => __('Discount image', 'invoicing'), |
|
198 | + 'set_featured_image' => __('Set discount image', 'invoicing'), |
|
199 | + 'remove_featured_image' => __('Remove discount image', 'invoicing'), |
|
200 | + 'use_featured_image' => __('Use as discount image', 'invoicing'), |
|
201 | + 'insert_into_item' => __('Insert into discount', 'invoicing'), |
|
202 | + 'uploaded_to_this_item' => __('Uploaded to this discount', 'invoicing'), |
|
203 | + 'filter_items_list' => __('Filter discounts', 'invoicing'), |
|
204 | + 'items_list_navigation' => __('Discount navigation', 'invoicing'), |
|
205 | + 'items_list' => __('Discounts list', 'invoicing'), |
|
206 | 206 | ), |
207 | - 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
207 | + 'description' => __('This is where you can add new discounts that users can use in invoices.', 'invoicing'), |
|
208 | 208 | 'public' => false, |
209 | 209 | 'can_export' => $capabilities ? true : false, |
210 | 210 | '_builtin' => false, |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 'map_meta_cap' => true, |
218 | 218 | 'has_archive' => false, |
219 | 219 | 'hierarchical' => false, |
220 | - 'supports' => array( 'title', 'excerpt' ), |
|
220 | + 'supports' => array('title', 'excerpt'), |
|
221 | 221 | 'show_in_nav_menus' => false, |
222 | 222 | 'show_in_admin_bar' => $capabilities ? true : false, |
223 | 223 | 'menu_position' => null, |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | ) |
226 | 226 | ); |
227 | 227 | |
228 | - do_action( 'getpaid_after_register_post_types' ); |
|
228 | + do_action('getpaid_after_register_post_types'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -238,79 +238,79 @@ discard block |
||
238 | 238 | array( |
239 | 239 | |
240 | 240 | 'wpi-pending' => array( |
241 | - 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
241 | + 'label' => _x('Pending Payment', 'Invoice status', 'invoicing'), |
|
242 | 242 | 'public' => true, |
243 | 243 | 'exclude_from_search' => true, |
244 | 244 | 'show_in_admin_all_list' => true, |
245 | 245 | 'show_in_admin_status_list' => true, |
246 | 246 | /* translators: %s: number of invoices */ |
247 | - 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ), |
|
247 | + 'label_count' => _n_noop('Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing'), |
|
248 | 248 | ), |
249 | 249 | |
250 | 250 | 'wpi-processing' => array( |
251 | - 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
251 | + 'label' => _x('Processing', 'Invoice status', 'invoicing'), |
|
252 | 252 | 'public' => true, |
253 | 253 | 'exclude_from_search' => true, |
254 | 254 | 'show_in_admin_all_list' => true, |
255 | 255 | 'show_in_admin_status_list' => true, |
256 | 256 | /* translators: %s: number of invoices */ |
257 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ), |
|
257 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing'), |
|
258 | 258 | ), |
259 | 259 | |
260 | 260 | 'wpi-onhold' => array( |
261 | - 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
261 | + 'label' => _x('On Hold', 'Invoice status', 'invoicing'), |
|
262 | 262 | 'public' => true, |
263 | 263 | 'exclude_from_search' => true, |
264 | 264 | 'show_in_admin_all_list' => true, |
265 | 265 | 'show_in_admin_status_list' => true, |
266 | 266 | /* translators: %s: number of invoices */ |
267 | - 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ), |
|
267 | + 'label_count' => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing'), |
|
268 | 268 | ), |
269 | 269 | |
270 | 270 | 'wpi-cancelled' => array( |
271 | - 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
271 | + 'label' => _x('Cancelled', 'Invoice status', 'invoicing'), |
|
272 | 272 | 'public' => true, |
273 | 273 | 'exclude_from_search' => true, |
274 | 274 | 'show_in_admin_all_list' => true, |
275 | 275 | 'show_in_admin_status_list' => true, |
276 | 276 | /* translators: %s: number of invoices */ |
277 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ), |
|
277 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing'), |
|
278 | 278 | ), |
279 | 279 | |
280 | 280 | 'wpi-refunded' => array( |
281 | - 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
281 | + 'label' => _x('Refunded', 'Invoice status', 'invoicing'), |
|
282 | 282 | 'public' => true, |
283 | 283 | 'exclude_from_search' => true, |
284 | 284 | 'show_in_admin_all_list' => true, |
285 | 285 | 'show_in_admin_status_list' => true, |
286 | 286 | /* translators: %s: number of invoices */ |
287 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ), |
|
287 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing'), |
|
288 | 288 | ), |
289 | 289 | |
290 | 290 | 'wpi-failed' => array( |
291 | - 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
291 | + 'label' => _x('Failed', 'Invoice status', 'invoicing'), |
|
292 | 292 | 'public' => true, |
293 | 293 | 'exclude_from_search' => true, |
294 | 294 | 'show_in_admin_all_list' => true, |
295 | 295 | 'show_in_admin_status_list' => true, |
296 | 296 | /* translators: %s: number of invoices */ |
297 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ), |
|
297 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing'), |
|
298 | 298 | ), |
299 | 299 | |
300 | 300 | 'wpi-renewal' => array( |
301 | - 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
301 | + 'label' => _x('Renewal', 'Invoice status', 'invoicing'), |
|
302 | 302 | 'public' => true, |
303 | 303 | 'exclude_from_search' => true, |
304 | 304 | 'show_in_admin_all_list' => true, |
305 | 305 | 'show_in_admin_status_list' => true, |
306 | 306 | /* translators: %s: number of invoices */ |
307 | - 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ), |
|
307 | + 'label_count' => _n_noop('Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing'), |
|
308 | 308 | ), |
309 | 309 | ) |
310 | 310 | ); |
311 | 311 | |
312 | - foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
313 | - register_post_status( $invoice_statuse, $args ); |
|
312 | + foreach ($invoice_statuses as $invoice_statuse => $args) { |
|
313 | + register_post_status($invoice_statuse, $args); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | * |
327 | 327 | */ |
328 | 328 | public static function maybe_flush_rewrite_rules() { |
329 | - if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
330 | - update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
329 | + if (!get_option('getpaid_flushed_rewrite_rules')) { |
|
330 | + update_option('getpaid_flushed_rewrite_rules', '1'); |
|
331 | 331 | self::flush_rewrite_rules(); |
332 | 332 | } |
333 | 333 | } |
@@ -5,30 +5,30 @@ |
||
5 | 5 | * @var array $tax_rule |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | ?> |
11 | 11 | |
12 | 12 | <tr> |
13 | 13 | |
14 | 14 | <td class="wpinv-tax-rule-key"> |
15 | - <input type="text" name="tax_rules[<?php echo esc_attr( $tax_rule['key'] ); ?>][key]" value="<?php echo esc_attr( $tax_rule['key'] ); ?>" required/> |
|
15 | + <input type="text" name="tax_rules[<?php echo esc_attr($tax_rule['key']); ?>][key]" value="<?php echo esc_attr($tax_rule['key']); ?>" required/> |
|
16 | 16 | </td> |
17 | 17 | |
18 | 18 | <td class="wpinv-tax-rule-label"> |
19 | - <input type="text" name="tax_rules[<?php echo esc_attr( $tax_rule['key'] ); ?>][label]" value="<?php echo esc_attr( $tax_rule['label'] ); ?>" required/> |
|
19 | + <input type="text" name="tax_rules[<?php echo esc_attr($tax_rule['key']); ?>][label]" value="<?php echo esc_attr($tax_rule['label']); ?>" required/> |
|
20 | 20 | </td> |
21 | 21 | |
22 | 22 | <td class="wpinv-tax-rule-base-address"> |
23 | - <select name="tax_rules[<?php echo esc_attr( $tax_rule['key'] ); ?>][tax_base]" class="getpaid-tax-rule-base-address" required> |
|
24 | - <option value="billing" <?php selected( $tax_rule['tax_base'], 'billing' ); ?>><?php esc_html_e( 'Customer billing address', 'invoicing' ); ?></option> |
|
25 | - <option value="base" <?php selected( $tax_rule['tax_base'], 'base' ); ?>><?php esc_html_e( 'Shop base address', 'invoicing' ); ?></option> |
|
23 | + <select name="tax_rules[<?php echo esc_attr($tax_rule['key']); ?>][tax_base]" class="getpaid-tax-rule-base-address" required> |
|
24 | + <option value="billing" <?php selected($tax_rule['tax_base'], 'billing'); ?>><?php esc_html_e('Customer billing address', 'invoicing'); ?></option> |
|
25 | + <option value="base" <?php selected($tax_rule['tax_base'], 'base'); ?>><?php esc_html_e('Shop base address', 'invoicing'); ?></option> |
|
26 | 26 | </select> |
27 | 27 | </td> |
28 | 28 | |
29 | 29 | <td class="wpinv_tax_remove"> |
30 | - <button type="button" class="close btn-close wpinv_remove_tax_rule" aria-label="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>" title="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>"> |
|
31 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
30 | + <button type="button" class="close btn-close wpinv_remove_tax_rule" aria-label="<?php esc_attr_e('Delete', 'invoicing'); ?>" title="<?php esc_attr_e('Delete', 'invoicing'); ?>"> |
|
31 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
32 | 32 | <span aria-hidden="true">×</span> |
33 | 33 | <?php endif; ?> |
34 | 34 | </button> |
@@ -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 | * Abstaract Payment Gateway class. |
@@ -138,53 +138,53 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function __construct() { |
140 | 140 | |
141 | - do_action( 'getpaid_before_init_payment_gateway_' . $this->id, $this ); |
|
141 | + do_action('getpaid_before_init_payment_gateway_' . $this->id, $this); |
|
142 | 142 | |
143 | 143 | // Register gateway. |
144 | - add_filter( 'wpinv_payment_gateways', array( $this, 'register_gateway' ) ); |
|
144 | + add_filter('wpinv_payment_gateways', array($this, 'register_gateway')); |
|
145 | 145 | |
146 | - $this->enabled = wpinv_is_gateway_active( $this->id ); |
|
146 | + $this->enabled = wpinv_is_gateway_active($this->id); |
|
147 | 147 | |
148 | 148 | // Add support for various features. |
149 | - foreach ( $this->supports as $feature ) { |
|
150 | - add_filter( "wpinv_{$this->id}_support_{$feature}", '__return_true' ); |
|
151 | - add_filter( "getpaid_{$this->id}_support_{$feature}", '__return_true' ); |
|
152 | - add_filter( "getpaid_{$this->id}_supports_{$feature}", '__return_true' ); |
|
149 | + foreach ($this->supports as $feature) { |
|
150 | + add_filter("wpinv_{$this->id}_support_{$feature}", '__return_true'); |
|
151 | + add_filter("getpaid_{$this->id}_support_{$feature}", '__return_true'); |
|
152 | + add_filter("getpaid_{$this->id}_supports_{$feature}", '__return_true'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | // Invoice addons. |
156 | - if ( $this->supports( 'addons' ) ) { |
|
157 | - add_action( "getpaid_process_{$this->id}_invoice_addons", array( $this, 'process_addons' ), 10, 2 ); |
|
156 | + if ($this->supports('addons')) { |
|
157 | + add_action("getpaid_process_{$this->id}_invoice_addons", array($this, 'process_addons'), 10, 2); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | // Gateway settings. |
161 | - add_filter( "wpinv_gateway_settings_{$this->id}", array( $this, 'admin_settings' ) ); |
|
161 | + add_filter("wpinv_gateway_settings_{$this->id}", array($this, 'admin_settings')); |
|
162 | 162 | |
163 | 163 | // Gateway checkout fields. |
164 | - add_action( "wpinv_{$this->id}_cc_form", array( $this, 'payment_fields' ), 10, 2 ); |
|
164 | + add_action("wpinv_{$this->id}_cc_form", array($this, 'payment_fields'), 10, 2); |
|
165 | 165 | |
166 | 166 | // Process payment. |
167 | - add_action( "getpaid_gateway_{$this->id}", array( $this, 'process_payment' ), 10, 3 ); |
|
167 | + add_action("getpaid_gateway_{$this->id}", array($this, 'process_payment'), 10, 3); |
|
168 | 168 | |
169 | 169 | // Change the checkout button text. |
170 | - if ( ! empty( $this->checkout_button_text ) ) { |
|
171 | - add_filter( "getpaid_gateway_{$this->id}_checkout_button_label", array( $this, 'rename_checkout_button' ) ); |
|
170 | + if (!empty($this->checkout_button_text)) { |
|
171 | + add_filter("getpaid_gateway_{$this->id}_checkout_button_label", array($this, 'rename_checkout_button')); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Check if a gateway is valid for a given currency. |
175 | - add_filter( "getpaid_gateway_{$this->id}_is_valid_for_currency", array( $this, 'validate_currency' ), 10, 2 ); |
|
175 | + add_filter("getpaid_gateway_{$this->id}_is_valid_for_currency", array($this, 'validate_currency'), 10, 2); |
|
176 | 176 | |
177 | 177 | // Generate the transaction url. |
178 | - add_filter( "getpaid_gateway_{$this->id}_transaction_url", array( $this, 'filter_transaction_url' ), 10, 2 ); |
|
178 | + add_filter("getpaid_gateway_{$this->id}_transaction_url", array($this, 'filter_transaction_url'), 10, 2); |
|
179 | 179 | |
180 | 180 | // Generate the subscription url. |
181 | - add_filter( 'getpaid_remote_subscription_profile_url', array( $this, 'generate_subscription_url' ), 10, 2 ); |
|
181 | + add_filter('getpaid_remote_subscription_profile_url', array($this, 'generate_subscription_url'), 10, 2); |
|
182 | 182 | |
183 | 183 | // Confirm payments. |
184 | - add_filter( "wpinv_payment_confirm_{$this->id}", array( $this, 'confirm_payment' ), 10, 2 ); |
|
184 | + add_filter("wpinv_payment_confirm_{$this->id}", array($this, 'confirm_payment'), 10, 2); |
|
185 | 185 | |
186 | 186 | // Verify IPNs. |
187 | - add_action( "wpinv_verify_{$this->id}_ipn", array( $this, 'verify_ipn' ) ); |
|
187 | + add_action("wpinv_verify_{$this->id}_ipn", array($this, 'verify_ipn')); |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @since 1.0.19 |
195 | 195 | * @return bool |
196 | 196 | */ |
197 | - public function is( $gateway ) { |
|
197 | + public function is($gateway) { |
|
198 | 198 | return $gateway == $this->id; |
199 | 199 | } |
200 | 200 | |
@@ -204,23 +204,23 @@ discard block |
||
204 | 204 | * @since 1.0.19 |
205 | 205 | * @return array |
206 | 206 | */ |
207 | - public function get_tokens( $sandbox = null ) { |
|
207 | + public function get_tokens($sandbox = null) { |
|
208 | 208 | |
209 | - if ( is_user_logged_in() && $this->supports( 'tokens' ) && 0 == count( $this->tokens ) ) { |
|
210 | - $tokens = get_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", true ); |
|
209 | + if (is_user_logged_in() && $this->supports('tokens') && 0 == count($this->tokens)) { |
|
210 | + $tokens = get_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", true); |
|
211 | 211 | |
212 | - if ( is_array( $tokens ) ) { |
|
212 | + if (is_array($tokens)) { |
|
213 | 213 | $this->tokens = $tokens; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - if ( ! is_bool( $sandbox ) ) { |
|
217 | + if (!is_bool($sandbox)) { |
|
218 | 218 | return $this->tokens; |
219 | 219 | } |
220 | 220 | |
221 | 221 | // Filter tokens. |
222 | - $args = array( 'type' => $sandbox ? 'sandbox' : 'live' ); |
|
223 | - return wp_list_filter( $this->tokens, $args ); |
|
222 | + $args = array('type' => $sandbox ? 'sandbox' : 'live'); |
|
223 | + return wp_list_filter($this->tokens, $args); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @since 1.0.19 |
231 | 231 | */ |
232 | - public function save_token( $token ) { |
|
232 | + public function save_token($token) { |
|
233 | 233 | |
234 | 234 | $tokens = $this->get_tokens(); |
235 | 235 | $tokens[] = $token; |
236 | 236 | |
237 | - update_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens ); |
|
237 | + update_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens); |
|
238 | 238 | |
239 | 239 | $this->tokens = $tokens; |
240 | 240 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @return string |
247 | 247 | */ |
248 | 248 | public function get_method_title() { |
249 | - return apply_filters( 'getpaid_gateway_method_title', $this->method_title, $this ); |
|
249 | + return apply_filters('getpaid_gateway_method_title', $this->method_title, $this); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @return string |
256 | 256 | */ |
257 | 257 | public function get_method_description() { |
258 | - return apply_filters( 'getpaid_gateway_method_description', $this->method_description, $this ); |
|
258 | + return apply_filters('getpaid_gateway_method_description', $this->method_description, $this); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @param WPInv_Invoice $invoice Invoice object. |
265 | 265 | * @return string |
266 | 266 | */ |
267 | - public function get_return_url( $invoice ) { |
|
267 | + public function get_return_url($invoice) { |
|
268 | 268 | |
269 | 269 | // Payment success url |
270 | 270 | $return_url = add_query_arg( |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | wpinv_get_success_page_uri() |
277 | 277 | ); |
278 | 278 | |
279 | - return apply_filters( 'getpaid_gateway_success_url', $return_url, $invoice, $this ); |
|
279 | + return apply_filters('getpaid_gateway_success_url', $return_url, $invoice, $this); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -285,24 +285,24 @@ discard block |
||
285 | 285 | * @param string $content Success page content. |
286 | 286 | * @return string |
287 | 287 | */ |
288 | - public function confirm_payment( $content ) { |
|
288 | + public function confirm_payment($content) { |
|
289 | 289 | |
290 | 290 | // Retrieve the invoice. |
291 | 291 | $invoice_id = getpaid_get_current_invoice_id(); |
292 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
292 | + $invoice = wpinv_get_invoice($invoice_id); |
|
293 | 293 | |
294 | 294 | // Ensure that it exists and that it is pending payment. |
295 | - if ( empty( $invoice_id ) || ! $invoice->needs_payment() ) { |
|
295 | + if (empty($invoice_id) || !$invoice->needs_payment()) { |
|
296 | 296 | return $content; |
297 | 297 | } |
298 | 298 | |
299 | 299 | // Can the user view this invoice?? |
300 | - if ( ! wpinv_user_can_view_invoice( $invoice ) ) { |
|
300 | + if (!wpinv_user_can_view_invoice($invoice)) { |
|
301 | 301 | return $content; |
302 | 302 | } |
303 | 303 | |
304 | 304 | // Show payment processing indicator. |
305 | - return wpinv_get_template_html( 'wpinv-payment-processing.php', compact( 'invoice' ) ); |
|
305 | + return wpinv_get_template_html('wpinv-payment-processing.php', compact('invoice')); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param GetPaid_Form_Item[] $items |
320 | 320 | * @return WPInv_Invoice |
321 | 321 | */ |
322 | - public function process_addons( $invoice, $items ) { |
|
322 | + public function process_addons($invoice, $items) { |
|
323 | 323 | |
324 | 324 | } |
325 | 325 | |
@@ -330,14 +330,14 @@ discard block |
||
330 | 330 | * @param WPInv_Invoice $invoice Invoice object. |
331 | 331 | * @return string transaction URL, or empty string. |
332 | 332 | */ |
333 | - public function filter_transaction_url( $transaction_url, $invoice ) { |
|
333 | + public function filter_transaction_url($transaction_url, $invoice) { |
|
334 | 334 | |
335 | - $transaction_id = $invoice->get_transaction_id(); |
|
335 | + $transaction_id = $invoice->get_transaction_id(); |
|
336 | 336 | |
337 | - if ( ! empty( $this->view_transaction_url ) && ! empty( $transaction_id ) ) { |
|
338 | - $transaction_url = sprintf( $this->view_transaction_url, $transaction_id ); |
|
339 | - $replace = $this->is_sandbox( $invoice ) ? 'sandbox.' : ''; |
|
340 | - $transaction_url = str_replace( '{sandbox}', $replace, $transaction_url ); |
|
337 | + if (!empty($this->view_transaction_url) && !empty($transaction_id)) { |
|
338 | + $transaction_url = sprintf($this->view_transaction_url, $transaction_id); |
|
339 | + $replace = $this->is_sandbox($invoice) ? 'sandbox.' : ''; |
|
340 | + $transaction_url = str_replace('{sandbox}', $replace, $transaction_url); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | return $transaction_url; |
@@ -350,15 +350,15 @@ discard block |
||
350 | 350 | * @param WPInv_Subscription $subscription Subscription object. |
351 | 351 | * @return string subscription URL, or empty string. |
352 | 352 | */ |
353 | - public function generate_subscription_url( $subscription_url, $subscription ) { |
|
353 | + public function generate_subscription_url($subscription_url, $subscription) { |
|
354 | 354 | |
355 | - $profile_id = $subscription->get_profile_id(); |
|
355 | + $profile_id = $subscription->get_profile_id(); |
|
356 | 356 | |
357 | - if ( $this->id == $subscription->get_gateway() && ! empty( $this->view_subscription_url ) && ! empty( $profile_id ) ) { |
|
357 | + if ($this->id == $subscription->get_gateway() && !empty($this->view_subscription_url) && !empty($profile_id)) { |
|
358 | 358 | |
359 | - $subscription_url = sprintf( $this->view_subscription_url, $profile_id ); |
|
360 | - $replace = $this->is_sandbox( $subscription->get_parent_invoice() ) ? 'sandbox.' : ''; |
|
361 | - $subscription_url = str_replace( '{sandbox}', $replace, $subscription_url ); |
|
359 | + $subscription_url = sprintf($this->view_subscription_url, $profile_id); |
|
360 | + $replace = $this->is_sandbox($subscription->get_parent_invoice()) ? 'sandbox.' : ''; |
|
361 | + $subscription_url = str_replace('{sandbox}', $replace, $subscription_url); |
|
362 | 362 | |
363 | 363 | } |
364 | 364 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * @return bool |
372 | 372 | */ |
373 | 373 | public function is_available() { |
374 | - return ! empty( $this->enabled ); |
|
374 | + return !empty($this->enabled); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @return string |
381 | 381 | */ |
382 | 382 | public function get_title() { |
383 | - return apply_filters( 'getpaid_gateway_title', $this->title, $this ); |
|
383 | + return apply_filters('getpaid_gateway_title', $this->title, $this); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @return string |
390 | 390 | */ |
391 | 391 | public function get_description() { |
392 | - return apply_filters( 'getpaid_gateway_description', $this->description, $this ); |
|
392 | + return apply_filters('getpaid_gateway_description', $this->description, $this); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
402 | 402 | * @return void |
403 | 403 | */ |
404 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
404 | + public function process_payment($invoice, $submission_data, $submission) { |
|
405 | 405 | // Process the payment then either redirect to the success page or the gateway. |
406 | - do_action( 'getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission ); |
|
406 | + do_action('getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | * @param string $reason Refund reason. |
418 | 418 | * @return WP_Error|bool True or false based on success, or a WP_Error object. |
419 | 419 | */ |
420 | - public function process_refund( $invoice, $amount = null, $reason = '' ) { |
|
421 | - return apply_filters( 'getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason ); |
|
420 | + public function process_refund($invoice, $amount = null, $reason = '') { |
|
421 | + return apply_filters('getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | * @param int $invoice_id 0 or invoice id. |
428 | 428 | * @param GetPaid_Payment_Form $form Current payment form. |
429 | 429 | */ |
430 | - public function payment_fields( $invoice_id, $form ) { |
|
431 | - do_action( 'getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form ); |
|
430 | + public function payment_fields($invoice_id, $form) { |
|
431 | + do_action('getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @param array $admin_settings |
438 | 438 | */ |
439 | - public function admin_settings( $admin_settings ) { |
|
439 | + public function admin_settings($admin_settings) { |
|
440 | 440 | return $admin_settings; |
441 | 441 | } |
442 | 442 | |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | * |
446 | 446 | * @param string $option |
447 | 447 | */ |
448 | - public function get_option( $option, $default = false ) { |
|
449 | - return wpinv_get_option( $this->id . '_' . $option, $default ); |
|
448 | + public function get_option($option, $default = false) { |
|
449 | + return wpinv_get_option($this->id . '_' . $option, $default); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | * @return bool True if the gateway supports the feature, false otherwise. |
460 | 460 | * @since 1.0.19 |
461 | 461 | */ |
462 | - public function supports( $feature ) { |
|
463 | - return getpaid_payment_gateway_supports( $this->id, $feature ); |
|
462 | + public function supports($feature) { |
|
463 | + return getpaid_payment_gateway_supports($this->id, $feature); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -468,46 +468,46 @@ discard block |
||
468 | 468 | * |
469 | 469 | * @param bool $save whether or not to display the save button. |
470 | 470 | */ |
471 | - public function get_cc_form( $save = false ) { |
|
471 | + public function get_cc_form($save = false) { |
|
472 | 472 | |
473 | 473 | ob_start(); |
474 | 474 | |
475 | - $id_prefix = esc_attr( uniqid( $this->id ) ); |
|
475 | + $id_prefix = esc_attr(uniqid($this->id)); |
|
476 | 476 | |
477 | 477 | $months = array( |
478 | - '01' => __( 'January', 'invoicing' ), |
|
479 | - '02' => __( 'February', 'invoicing' ), |
|
480 | - '03' => __( 'March', 'invoicing' ), |
|
481 | - '04' => __( 'April', 'invoicing' ), |
|
482 | - '05' => __( 'May', 'invoicing' ), |
|
483 | - '06' => __( 'June', 'invoicing' ), |
|
484 | - '07' => __( 'July', 'invoicing' ), |
|
485 | - '08' => __( 'August', 'invoicing' ), |
|
486 | - '09' => __( 'September', 'invoicing' ), |
|
487 | - '10' => __( 'October', 'invoicing' ), |
|
488 | - '11' => __( 'November', 'invoicing' ), |
|
489 | - '12' => __( 'December', 'invoicing' ), |
|
478 | + '01' => __('January', 'invoicing'), |
|
479 | + '02' => __('February', 'invoicing'), |
|
480 | + '03' => __('March', 'invoicing'), |
|
481 | + '04' => __('April', 'invoicing'), |
|
482 | + '05' => __('May', 'invoicing'), |
|
483 | + '06' => __('June', 'invoicing'), |
|
484 | + '07' => __('July', 'invoicing'), |
|
485 | + '08' => __('August', 'invoicing'), |
|
486 | + '09' => __('September', 'invoicing'), |
|
487 | + '10' => __('October', 'invoicing'), |
|
488 | + '11' => __('November', 'invoicing'), |
|
489 | + '12' => __('December', 'invoicing'), |
|
490 | 490 | ); |
491 | - $months = apply_filters( 'getpaid_cc_months', $months, $this ); |
|
491 | + $months = apply_filters('getpaid_cc_months', $months, $this); |
|
492 | 492 | |
493 | - $year = (int) current_time( 'Y' ); |
|
493 | + $year = (int) current_time('Y'); |
|
494 | 494 | $years = array(); |
495 | 495 | |
496 | - for ( $i = 0; $i <= 10; $i++ ) { |
|
497 | - $years[ $year + $i ] = $year + $i; |
|
496 | + for ($i = 0; $i <= 10; $i++) { |
|
497 | + $years[$year + $i] = $year + $i; |
|
498 | 498 | } |
499 | 499 | |
500 | - $years = apply_filters( 'getpaid_cc_years', $years, $this ); |
|
500 | + $years = apply_filters('getpaid_cc_years', $years, $this); |
|
501 | 501 | |
502 | 502 | ?> |
503 | - <div class="<?php echo esc_attr( $this->id ); ?>-cc-form getpaid-cc-form mt-1"> |
|
503 | + <div class="<?php echo esc_attr($this->id); ?>-cc-form getpaid-cc-form mt-1"> |
|
504 | 504 | <div class="getpaid-cc-card-inner"> |
505 | 505 | <div class="row"> |
506 | 506 | <div class="col-12"> |
507 | 507 | <div class="form-group mb-3"> |
508 | - <label for="<?php echo esc_attr( "$id_prefix-cc-number" ); ?>"><?php esc_html_e( 'Card number', 'invoicing' ); ?></label> |
|
508 | + <label for="<?php echo esc_attr("$id_prefix-cc-number"); ?>"><?php esc_html_e('Card number', 'invoicing'); ?></label> |
|
509 | 509 | <div class="input-group input-group-sm"> |
510 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
510 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
511 | 511 | <div class="input-group-prepend "> |
512 | 512 | <span class="input-group-text"> |
513 | 513 | <i class="fa fa-credit-card"></i> |
@@ -518,30 +518,30 @@ discard block |
||
518 | 518 | <i class="fa fa-credit-card"></i> |
519 | 519 | </span> |
520 | 520 | <?php endif; ?> |
521 | - <input type="text" name="<?php echo esc_attr( $this->id . '[cc_number]' ); ?>" id="<?php echo esc_attr( "$id_prefix-cc-number" ); ?>" class="form-control form-control-sm getpaid-format-card-number" autocomplete="cc-number"> |
|
521 | + <input type="text" name="<?php echo esc_attr($this->id . '[cc_number]'); ?>" id="<?php echo esc_attr("$id_prefix-cc-number"); ?>" class="form-control form-control-sm getpaid-format-card-number" autocomplete="cc-number"> |
|
522 | 522 | </div> |
523 | 523 | </div> |
524 | 524 | </div> |
525 | 525 | <div class="col-12"> |
526 | 526 | <div class="form-group mb-3"> |
527 | - <label><?php esc_html_e( 'Expiration', 'invoicing' ); ?></label> |
|
527 | + <label><?php esc_html_e('Expiration', 'invoicing'); ?></label> |
|
528 | 528 | <div class="form-row row"> |
529 | 529 | <div class="col"> |
530 | - <select class="form-control form-control-sm" autocomplete="cc-exp-month" name="<?php echo esc_attr( $this->id ); ?>[cc_expire_month]"> |
|
531 | - <option disabled selected="selected"><?php esc_html_e( 'MM', 'invoicing' ); ?></option> |
|
530 | + <select class="form-control form-control-sm" autocomplete="cc-exp-month" name="<?php echo esc_attr($this->id); ?>[cc_expire_month]"> |
|
531 | + <option disabled selected="selected"><?php esc_html_e('MM', 'invoicing'); ?></option> |
|
532 | 532 | <?php |
533 | - foreach ( $months as $key => $month ) { |
|
534 | - echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $month ) . '</option>'; |
|
533 | + foreach ($months as $key => $month) { |
|
534 | + echo "<option value='" . esc_attr($key) . "'>" . esc_html($month) . '</option>'; |
|
535 | 535 | } |
536 | 536 | ?> |
537 | 537 | </select> |
538 | 538 | </div> |
539 | 539 | <div class="col"> |
540 | - <select class="form-control form-control-sm" autocomplete="cc-exp-year" name="<?php echo esc_attr( $this->id ); ?>[cc_expire_year]"> |
|
541 | - <option disabled selected="selected"><?php esc_html_e( 'YY', 'invoicing' ); ?></option> |
|
540 | + <select class="form-control form-control-sm" autocomplete="cc-exp-year" name="<?php echo esc_attr($this->id); ?>[cc_expire_year]"> |
|
541 | + <option disabled selected="selected"><?php esc_html_e('YY', 'invoicing'); ?></option> |
|
542 | 542 | <?php |
543 | - foreach ( $years as $key => $year ) { |
|
544 | - echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $year ) . '</option>'; |
|
543 | + foreach ($years as $key => $year) { |
|
544 | + echo "<option value='" . esc_attr($key) . "'>" . esc_html($year) . '</option>'; |
|
545 | 545 | } |
546 | 546 | ?> |
547 | 547 | </select> |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | array( |
556 | 556 | 'name' => $this->id . '[cc_cvv2]', |
557 | 557 | 'id' => "$id_prefix-cc-cvv2", |
558 | - 'label' => __( 'CCV', 'invoicing' ), |
|
558 | + 'label' => __('CCV', 'invoicing'), |
|
559 | 559 | 'label_type' => 'vertical', |
560 | 560 | 'class' => 'form-control-sm', |
561 | 561 | 'extra_attributes' => array( |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | </div> |
570 | 570 | </div> |
571 | 571 | <?php |
572 | - if ( $save ) { |
|
572 | + if ($save) { |
|
573 | 573 | $this->save_payment_method_checkbox(); |
574 | 574 | } |
575 | 575 | ?> |
@@ -586,8 +586,8 @@ discard block |
||
586 | 586 | * |
587 | 587 | * @since 1.0.19 |
588 | 588 | */ |
589 | - public function new_payment_method_entry( $form ) { |
|
590 | - echo "<div class='getpaid-new-payment-method-form' style='display:none;'> " . wp_kses( $form, getpaid_allowed_html() ) . '</div>'; |
|
589 | + public function new_payment_method_entry($form) { |
|
590 | + echo "<div class='getpaid-new-payment-method-form' style='display:none;'> " . wp_kses($form, getpaid_allowed_html()) . '</div>'; |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | /** |
@@ -596,10 +596,10 @@ discard block |
||
596 | 596 | * @since 1.0.19 |
597 | 597 | */ |
598 | 598 | public function saved_payment_methods() { |
599 | - echo '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr( count( $this->get_tokens( $this->is_sandbox() ) ) ) . '">'; |
|
599 | + echo '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr(count($this->get_tokens($this->is_sandbox()))) . '">'; |
|
600 | 600 | |
601 | - foreach ( $this->get_tokens( $this->is_sandbox() ) as $token ) { |
|
602 | - $this->get_saved_payment_method_option_html( $token ); |
|
601 | + foreach ($this->get_tokens($this->is_sandbox()) as $token) { |
|
602 | + $this->get_saved_payment_method_option_html($token); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | $this->get_new_payment_method_option_html(); |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * @param array $token Payment Token. |
615 | 615 | * @return string Generated payment method HTML |
616 | 616 | */ |
617 | - public function get_saved_payment_method_option_html( $token ) { |
|
617 | + public function get_saved_payment_method_option_html($token) { |
|
618 | 618 | |
619 | 619 | printf( |
620 | 620 | '<li class="getpaid-payment-method form-group mb-3"> |
@@ -623,11 +623,11 @@ discard block |
||
623 | 623 | <span>%3$s</span> |
624 | 624 | </label> |
625 | 625 | </li>', |
626 | - esc_attr( $this->id ), |
|
627 | - esc_attr( $token['id'] ), |
|
628 | - esc_html( $token['name'] ), |
|
629 | - checked( empty( $token['default'] ), false, false ), |
|
630 | - empty( $token['currency'] ) ? 'none' : esc_attr( $token['currency'] ) |
|
626 | + esc_attr($this->id), |
|
627 | + esc_attr($token['id']), |
|
628 | + esc_html($token['name']), |
|
629 | + checked(empty($token['default']), false, false), |
|
630 | + empty($token['currency']) ? 'none' : esc_attr($token['currency']) |
|
631 | 631 | ); |
632 | 632 | |
633 | 633 | } |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | */ |
640 | 640 | public function get_new_payment_method_option_html() { |
641 | 641 | |
642 | - $label = apply_filters( 'getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __( 'Use a new payment method', 'invoicing' ), $this ); |
|
642 | + $label = apply_filters('getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __('Use a new payment method', 'invoicing'), $this); |
|
643 | 643 | |
644 | 644 | printf( |
645 | 645 | '<li class="getpaid-new-payment-method"> |
@@ -648,8 +648,8 @@ discard block |
||
648 | 648 | <span>%2$s</span> |
649 | 649 | </label> |
650 | 650 | </li>', |
651 | - esc_attr( $this->id ), |
|
652 | - esc_html( $label ) |
|
651 | + esc_attr($this->id), |
|
652 | + esc_html($label) |
|
653 | 653 | ); |
654 | 654 | |
655 | 655 | } |
@@ -664,10 +664,10 @@ discard block |
||
664 | 664 | aui()->input( |
665 | 665 | array( |
666 | 666 | 'type' => 'checkbox', |
667 | - 'name' => esc_attr( "getpaid-$this->id-new-payment-method" ), |
|
668 | - 'id' => esc_attr( uniqid( $this->id ) ), |
|
667 | + 'name' => esc_attr("getpaid-$this->id-new-payment-method"), |
|
668 | + 'id' => esc_attr(uniqid($this->id)), |
|
669 | 669 | 'required' => false, |
670 | - 'label' => esc_html__( 'Save payment method', 'invoicing' ), |
|
670 | + 'label' => esc_html__('Save payment method', 'invoicing'), |
|
671 | 671 | 'value' => 'true', |
672 | 672 | 'checked' => true, |
673 | 673 | 'wrap_class' => 'getpaid-save-payment-method pt-1 pb-1', |
@@ -682,9 +682,9 @@ discard block |
||
682 | 682 | * |
683 | 683 | * @return array |
684 | 684 | */ |
685 | - public function register_gateway( $gateways ) { |
|
685 | + public function register_gateway($gateways) { |
|
686 | 686 | |
687 | - $gateways[ $this->id ] = array( |
|
687 | + $gateways[$this->id] = array( |
|
688 | 688 | |
689 | 689 | 'admin_label' => $this->method_title, |
690 | 690 | 'checkout_label' => $this->title, |
@@ -702,13 +702,13 @@ discard block |
||
702 | 702 | * @param WPInv_Invoice|null $invoice Invoice object or null. |
703 | 703 | * @return bool |
704 | 704 | */ |
705 | - public function is_sandbox( $invoice = null ) { |
|
705 | + public function is_sandbox($invoice = null) { |
|
706 | 706 | |
707 | - if ( is_a( $invoice, 'WPInv_Invoice' ) && ! $invoice->needs_payment() ) { |
|
707 | + if (is_a($invoice, 'WPInv_Invoice') && !$invoice->needs_payment()) { |
|
708 | 708 | return $invoice->get_mode() === 'test'; |
709 | 709 | } |
710 | 710 | |
711 | - return wpinv_is_test_mode( $this->id ); |
|
711 | + return wpinv_is_test_mode($this->id); |
|
712 | 712 | |
713 | 713 | } |
714 | 714 | |
@@ -726,15 +726,15 @@ discard block |
||
726 | 726 | * |
727 | 727 | * @return bool |
728 | 728 | */ |
729 | - public function validate_currency( $validation, $currency ) { |
|
729 | + public function validate_currency($validation, $currency) { |
|
730 | 730 | |
731 | 731 | // Required currencies. |
732 | - if ( ! empty( $this->currencies ) && ! in_array( $currency, $this->currencies ) ) { |
|
732 | + if (!empty($this->currencies) && !in_array($currency, $this->currencies)) { |
|
733 | 733 | return false; |
734 | 734 | } |
735 | 735 | |
736 | 736 | // Excluded currencies. |
737 | - if ( ! empty( $this->exclude_currencies ) && in_array( $currency, $this->exclude_currencies ) ) { |
|
737 | + if (!empty($this->exclude_currencies) && in_array($currency, $this->exclude_currencies)) { |
|
738 | 738 | return false; |
739 | 739 | } |
740 | 740 | |
@@ -745,13 +745,13 @@ discard block |
||
745 | 745 | * Displays an error |
746 | 746 | * |
747 | 747 | */ |
748 | - public function show_error( $code, $message, $type ) { |
|
748 | + public function show_error($code, $message, $type) { |
|
749 | 749 | |
750 | - if ( is_admin() ) { |
|
751 | - getpaid_admin()->{"show_$type"}( $message ); |
|
750 | + if (is_admin()) { |
|
751 | + getpaid_admin()->{"show_$type"}($message); |
|
752 | 752 | } |
753 | 753 | |
754 | - wpinv_set_error( $code, $message, $type ); |
|
754 | + wpinv_set_error($code, $message, $type); |
|
755 | 755 | |
756 | 756 | } |
757 | 757 |
@@ -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,13 +21,13 @@ 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 | // Nonce field. |
30 | - wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ); |
|
30 | + wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); |
|
31 | 31 | |
32 | 32 | ?> |
33 | 33 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | |
46 | 46 | <div class="bsui" style="margin-top: 1.5rem"> |
47 | 47 | |
48 | - <?php do_action( 'getpaid_invoice_edit_before_viewed_by_customer', $invoice ); ?> |
|
49 | - <?php if ( ! $invoice->is_draft() ) : ?> |
|
48 | + <?php do_action('getpaid_invoice_edit_before_viewed_by_customer', $invoice); ?> |
|
49 | + <?php if (!$invoice->is_draft()) : ?> |
|
50 | 50 | <div class="form-group mb-3"> |
51 | - <strong><?php esc_html_e( 'Viewed by Customer:', 'invoicing' ); ?></strong> |
|
52 | - <?php ( $invoice->get_is_viewed() ) ? esc_html_e( 'Yes', 'invoicing' ) : esc_html_e( 'No', 'invoicing' ); ?> |
|
51 | + <strong><?php esc_html_e('Viewed by Customer:', 'invoicing'); ?></strong> |
|
52 | + <?php ($invoice->get_is_viewed()) ? esc_html_e('Yes', 'invoicing') : esc_html_e('No', 'invoicing'); ?> |
|
53 | 53 | </div> |
54 | 54 | <?php endif; ?> |
55 | 55 | |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | // Date created. |
59 | 59 | $label = sprintf( |
60 | 60 | // translators: %s is the invoice type. |
61 | - __( '%s Date:', 'invoicing' ), |
|
62 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
61 | + __('%s Date:', 'invoicing'), |
|
62 | + ucfirst($invoice->get_invoice_quote_type()) |
|
63 | 63 | ); |
64 | 64 | |
65 | - $info = sprintf( |
|
65 | + $info = sprintf( |
|
66 | 66 | // translators: %s is the invoice type. |
67 | - __( 'The date this %s was created.', 'invoicing' ), |
|
68 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
67 | + __('The date this %s was created.', 'invoicing'), |
|
68 | + strtolower($invoice->get_invoice_quote_type()) |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | aui()->input( |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | 'type' => 'datepicker', |
74 | 74 | 'id' => 'wpinv_date_created', |
75 | 75 | 'name' => 'date_created', |
76 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
76 | + 'label' => $label . getpaid_get_help_tip($info), |
|
77 | 77 | 'label_type' => 'vertical', |
78 | 78 | 'placeholder' => 'YYYY-MM-DD 00:00', |
79 | 79 | 'class' => 'form-control-sm', |
80 | - 'value' => $invoice->get_date_created( 'edit' ), |
|
80 | + 'value' => $invoice->get_date_created('edit'), |
|
81 | 81 | 'extra_attributes' => array( |
82 | 82 | 'data-enable-time' => 'true', |
83 | 83 | 'data-time_24hr' => 'true', |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | 'type' => 'datepicker', |
95 | 95 | 'id' => 'wpinv_date_completed', |
96 | 96 | 'name' => 'wpinv_date_completed', |
97 | - 'label' => __( 'Date Completed:', 'invoicing' ), |
|
97 | + 'label' => __('Date Completed:', 'invoicing'), |
|
98 | 98 | 'label_type' => 'vertical', |
99 | 99 | 'placeholder' => 'YYYY-MM-DD 00:00', |
100 | 100 | 'class' => 'form-control-sm', |
101 | - 'value' => $invoice->get_date_completed( 'edit' ), |
|
101 | + 'value' => $invoice->get_date_completed('edit'), |
|
102 | 102 | 'extra_attributes' => array( |
103 | 103 | 'data-enable-time' => 'true', |
104 | 104 | 'data-time_24hr' => 'true', |
@@ -110,18 +110,18 @@ discard block |
||
110 | 110 | ); |
111 | 111 | |
112 | 112 | // Due date. |
113 | - if ( $invoice->is_type( 'invoice' ) && wpinv_get_option( 'overdue_active' ) && ( ! $invoice->is_paid() || $invoice->is_draft() ) ) { |
|
113 | + if ($invoice->is_type('invoice') && wpinv_get_option('overdue_active') && (!$invoice->is_paid() || $invoice->is_draft())) { |
|
114 | 114 | |
115 | 115 | aui()->input( |
116 | 116 | array( |
117 | 117 | 'type' => 'datepicker', |
118 | 118 | 'id' => 'wpinv_due_date', |
119 | 119 | 'name' => 'wpinv_due_date', |
120 | - 'label' => __( 'Due Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'Leave blank to disable automated reminder emails for this invoice.', 'invoicing' ) ), |
|
120 | + 'label' => __('Due Date:', 'invoicing') . getpaid_get_help_tip(__('Leave blank to disable automated reminder emails for this invoice.', 'invoicing')), |
|
121 | 121 | 'label_type' => 'vertical', |
122 | - 'placeholder' => __( 'No due date', 'invoicing' ), |
|
122 | + 'placeholder' => __('No due date', 'invoicing'), |
|
123 | 123 | 'class' => 'form-control-sm', |
124 | - 'value' => $invoice->get_due_date( 'edit' ), |
|
124 | + 'value' => $invoice->get_due_date('edit'), |
|
125 | 125 | 'extra_attributes' => array( |
126 | 126 | 'data-enable-time' => 'true', |
127 | 127 | 'data-time_24hr' => 'true', |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | - do_action( 'wpinv_meta_box_details_after_due_date', $invoice->get_id() ); |
|
138 | - do_action( 'getpaid_metabox_after_due_date', $invoice ); |
|
137 | + do_action('wpinv_meta_box_details_after_due_date', $invoice->get_id()); |
|
138 | + do_action('getpaid_metabox_after_due_date', $invoice); |
|
139 | 139 | |
140 | 140 | // Status. |
141 | 141 | $label = sprintf( |
142 | 142 | // translators: %s: Invoice type. |
143 | - __( '%s Status:', 'invoicing' ), |
|
144 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
143 | + __('%s Status:', 'invoicing'), |
|
144 | + ucfirst($invoice->get_invoice_quote_type()) |
|
145 | 145 | ); |
146 | 146 | |
147 | - $status = $invoice->get_status( 'edit' ); |
|
147 | + $status = $invoice->get_status('edit'); |
|
148 | 148 | aui()->select( |
149 | 149 | array( |
150 | 150 | 'id' => 'wpinv_status', |
151 | 151 | 'name' => 'wpinv_status', |
152 | 152 | 'label' => $label, |
153 | 153 | 'label_type' => 'vertical', |
154 | - 'placeholder' => __( 'Select Status', 'invoicing' ), |
|
155 | - 'value' => array_key_exists( $status, $invoice->get_all_statuses() ) ? $status : $invoice->get_default_status(), |
|
154 | + 'placeholder' => __('Select Status', 'invoicing'), |
|
155 | + 'value' => array_key_exists($status, $invoice->get_all_statuses()) ? $status : $invoice->get_default_status(), |
|
156 | 156 | 'select2' => true, |
157 | 157 | 'data-allow-clear' => 'false', |
158 | - 'options' => wpinv_get_invoice_statuses( true, false, $invoice ), |
|
158 | + 'options' => wpinv_get_invoice_statuses(true, false, $invoice), |
|
159 | 159 | ), |
160 | 160 | true |
161 | 161 | ); |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | // Invoice number. |
164 | 164 | $label = sprintf( |
165 | 165 | // translators: %s: Invoice type. |
166 | - __( '%s Number:', 'invoicing' ), |
|
167 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
166 | + __('%s Number:', 'invoicing'), |
|
167 | + ucfirst($invoice->get_invoice_quote_type()) |
|
168 | 168 | ); |
169 | 169 | |
170 | - $info = sprintf( |
|
170 | + $info = sprintf( |
|
171 | 171 | // translators: %s: Invoice type. |
172 | - __( 'Each %s number must be unique.', 'invoicing' ), |
|
173 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
172 | + __('Each %s number must be unique.', 'invoicing'), |
|
173 | + strtolower($invoice->get_invoice_quote_type()) |
|
174 | 174 | ); |
175 | 175 | |
176 | 176 | aui()->input( |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | 'type' => 'text', |
179 | 179 | 'id' => 'wpinv_number', |
180 | 180 | 'name' => 'wpinv_number', |
181 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
181 | + 'label' => $label . getpaid_get_help_tip($info), |
|
182 | 182 | 'label_type' => 'vertical', |
183 | - 'placeholder' => __( 'Autogenerate', 'invoicing' ), |
|
183 | + 'placeholder' => __('Autogenerate', 'invoicing'), |
|
184 | 184 | 'class' => 'form-control-sm', |
185 | - 'value' => $invoice->get_number( 'edit' ), |
|
185 | + 'value' => $invoice->get_number('edit'), |
|
186 | 186 | ), |
187 | 187 | true |
188 | 188 | ); |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | 'type' => 'text', |
194 | 194 | 'id' => 'wpinv_cc', |
195 | 195 | 'name' => 'wpinv_cc', |
196 | - 'label' => __( 'Email CC:', 'invoicing' ) . getpaid_get_help_tip( __( 'Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing' ) ), |
|
196 | + 'label' => __('Email CC:', 'invoicing') . getpaid_get_help_tip(__('Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing')), |
|
197 | 197 | 'label_type' => 'vertical', |
198 | - 'placeholder' => __( '[email protected], [email protected]', 'invoicing' ), |
|
198 | + 'placeholder' => __('[email protected], [email protected]', 'invoicing'), |
|
199 | 199 | 'class' => 'form-control-sm', |
200 | - 'value' => $invoice->get_email_cc( 'edit' ), |
|
200 | + 'value' => $invoice->get_email_cc('edit'), |
|
201 | 201 | ), |
202 | 202 | true |
203 | 203 | ); |
204 | 204 | |
205 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
205 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
206 | 206 | |
207 | 207 | // Apply a discount. |
208 | 208 | aui()->input( |
@@ -210,26 +210,26 @@ discard block |
||
210 | 210 | 'type' => 'text', |
211 | 211 | 'id' => 'wpinv_discount_code', |
212 | 212 | 'name' => 'wpinv_discount_code', |
213 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
214 | - 'placeholder' => __( 'Apply Discount', 'invoicing' ), |
|
213 | + 'label' => __('Discount Code:', 'invoicing'), |
|
214 | + 'placeholder' => __('Apply Discount', 'invoicing'), |
|
215 | 215 | 'label_type' => 'vertical', |
216 | 216 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
217 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
217 | + 'value' => $invoice->get_discount_code('edit'), |
|
218 | 218 | ), |
219 | 219 | true |
220 | 220 | ); |
221 | 221 | |
222 | - } elseif ( $invoice->get_discount_code( 'edit' ) ) { |
|
222 | + } elseif ($invoice->get_discount_code('edit')) { |
|
223 | 223 | |
224 | 224 | aui()->input( |
225 | 225 | array( |
226 | 226 | 'type' => 'text', |
227 | 227 | 'id' => 'wpinv_discount_code', |
228 | 228 | 'name' => 'wpinv_discount_code', |
229 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
229 | + 'label' => __('Discount Code:', 'invoicing'), |
|
230 | 230 | 'label_type' => 'vertical', |
231 | 231 | 'class' => 'form-control-sm', |
232 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
232 | + 'value' => $invoice->get_discount_code('edit'), |
|
233 | 233 | 'extra_attributes' => array( |
234 | 234 | 'onclick' => 'this.select();', |
235 | 235 | 'readonly' => 'true', |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | - do_action( 'wpinv_meta_box_details_inner', $invoice->get_id() ); |
|
243 | + do_action('wpinv_meta_box_details_inner', $invoice->get_id()); |
|
244 | 244 | |
245 | 245 | // Disable taxes. |
246 | - if ( wpinv_use_taxes() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { |
|
246 | + if (wpinv_use_taxes() && !($invoice->is_paid() || $invoice->is_refunded())) { |
|
247 | 247 | |
248 | 248 | aui()->input( |
249 | 249 | array( |
250 | 250 | 'id' => 'wpinv_taxable', |
251 | 251 | 'name' => 'disable_taxes', |
252 | 252 | 'type' => 'checkbox', |
253 | - 'label' => __( 'Disable taxes', 'invoicing' ), |
|
253 | + 'label' => __('Disable taxes', 'invoicing'), |
|
254 | 254 | 'value' => '1', |
255 | 255 | 'checked' => (bool) $invoice->get_disable_taxes(), |
256 | 256 | 'class' => 'getpaid-recalculate-prices-on-change', |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | } |
262 | 262 | |
263 | - if ( $invoice->is_type( 'invoice' ) ) { |
|
263 | + if ($invoice->is_type('invoice')) { |
|
264 | 264 | |
265 | 265 | // Send to customer. |
266 | 266 | aui()->input( |
@@ -268,16 +268,16 @@ discard block |
||
268 | 268 | 'id' => 'wpinv_send_to_customer', |
269 | 269 | 'name' => 'send_to_customer', |
270 | 270 | 'type' => 'checkbox', |
271 | - 'label' => __( 'Send invoice to customer after saving', 'invoicing' ), |
|
271 | + 'label' => __('Send invoice to customer after saving', 'invoicing'), |
|
272 | 272 | 'value' => '1', |
273 | - 'checked' => $invoice->is_draft() && (bool) wpinv_get_option( 'email_user_invoice_active', true ), |
|
273 | + 'checked' => $invoice->is_draft() && (bool) wpinv_get_option('email_user_invoice_active', true), |
|
274 | 274 | ), |
275 | 275 | true |
276 | 276 | ); |
277 | 277 | |
278 | 278 | } |
279 | 279 | |
280 | - do_action( 'getpaid_metabox_after_invoice_details', $invoice ); |
|
280 | + do_action('getpaid_metabox_after_invoice_details', $invoice); |
|
281 | 281 | |
282 | 282 | ?> |
283 | 283 |