@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function getLocations() |
37 | 37 | { |
38 | 38 | if ($this->matchesCakeVersion('>=', '3.0.0')) { |
39 | - $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/'; |
|
39 | + $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/'; |
|
40 | 40 | } |
41 | 41 | return $this->locations; |
42 | 42 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | protected function matchesCakeVersion($matcher, $version) |
52 | 52 | { |
53 | 53 | $repositoryManager = $this->composer->getRepositoryManager(); |
54 | - if (! $repositoryManager) { |
|
54 | + if (!$repositoryManager) { |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | class OxidInstaller extends BaseInstaller |
7 | 7 | { |
8 | - const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/'; |
|
8 | + const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/'; |
|
9 | 9 | |
10 | 10 | protected $locations = array( |
11 | 11 | 'module' => 'modules/{$name}/', |
@@ -13,47 +13,47 @@ discard block |
||
13 | 13 | 'out' => 'out/{$name}/', |
14 | 14 | ); |
15 | 15 | |
16 | - /** |
|
17 | - * getInstallPath |
|
18 | - * |
|
19 | - * @param PackageInterface $package |
|
20 | - * @param string $frameworkType |
|
21 | - * @return string |
|
22 | - */ |
|
23 | - public function getInstallPath(PackageInterface $package, $frameworkType = '') |
|
24 | - { |
|
25 | - $installPath = parent::getInstallPath($package, $frameworkType); |
|
26 | - $type = $this->package->getType(); |
|
27 | - if ($type === 'oxid-module') { |
|
28 | - $this->prepareVendorDirectory($installPath); |
|
29 | - } |
|
30 | - return $installPath; |
|
31 | - } |
|
16 | + /** |
|
17 | + * getInstallPath |
|
18 | + * |
|
19 | + * @param PackageInterface $package |
|
20 | + * @param string $frameworkType |
|
21 | + * @return string |
|
22 | + */ |
|
23 | + public function getInstallPath(PackageInterface $package, $frameworkType = '') |
|
24 | + { |
|
25 | + $installPath = parent::getInstallPath($package, $frameworkType); |
|
26 | + $type = $this->package->getType(); |
|
27 | + if ($type === 'oxid-module') { |
|
28 | + $this->prepareVendorDirectory($installPath); |
|
29 | + } |
|
30 | + return $installPath; |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * prepareVendorDirectory |
|
35 | - * |
|
36 | - * Makes sure there is a vendormetadata.php file inside |
|
37 | - * the vendor folder if there is a vendor folder. |
|
38 | - * |
|
39 | - * @param string $installPath |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - protected function prepareVendorDirectory($installPath) |
|
43 | - { |
|
44 | - $matches = ''; |
|
45 | - $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches); |
|
46 | - if (!$hasVendorDirectory) { |
|
47 | - return; |
|
48 | - } |
|
33 | + /** |
|
34 | + * prepareVendorDirectory |
|
35 | + * |
|
36 | + * Makes sure there is a vendormetadata.php file inside |
|
37 | + * the vendor folder if there is a vendor folder. |
|
38 | + * |
|
39 | + * @param string $installPath |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + protected function prepareVendorDirectory($installPath) |
|
43 | + { |
|
44 | + $matches = ''; |
|
45 | + $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches); |
|
46 | + if (!$hasVendorDirectory) { |
|
47 | + return; |
|
48 | + } |
|
49 | 49 | |
50 | - $vendorDirectory = $matches['vendor']; |
|
51 | - $vendorPath = getcwd() . '/modules/' . $vendorDirectory; |
|
52 | - if (!file_exists($vendorPath)) { |
|
53 | - mkdir($vendorPath, 0755, true); |
|
54 | - } |
|
50 | + $vendorDirectory = $matches['vendor']; |
|
51 | + $vendorPath = getcwd() . '/modules/' . $vendorDirectory; |
|
52 | + if (!file_exists($vendorPath)) { |
|
53 | + mkdir($vendorPath, 0755, true); |
|
54 | + } |
|
55 | 55 | |
56 | - $vendorMetaDataPath = $vendorPath . '/vendormetadata.php'; |
|
57 | - touch($vendorMetaDataPath); |
|
58 | - } |
|
56 | + $vendorMetaDataPath = $vendorPath . '/vendormetadata.php'; |
|
57 | + touch($vendorMetaDataPath); |
|
58 | + } |
|
59 | 59 | } |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
36 | 36 | |
37 | - if ( current_user_can( 'manage_options' ) ) { |
|
38 | - return 'manage_options'; |
|
39 | - }; |
|
37 | + if ( current_user_can( 'manage_options' ) ) { |
|
38 | + return 'manage_options'; |
|
39 | + }; |
|
40 | 40 | |
41 | - return $capalibilty; |
|
41 | + return $capalibilty; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | // Prepare user values. |
63 | 63 | $prefix = preg_replace( '/\s+/', '', $prefix ); |
64 | 64 | $prefix = empty( $prefix ) ? $email : $prefix; |
65 | - $args = array( |
|
66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
67 | - 'user_pass' => wp_generate_password(), |
|
68 | - 'user_email' => $email, |
|
65 | + $args = array( |
|
66 | + 'user_login' => wpinv_generate_user_name( $prefix ), |
|
67 | + 'user_pass' => wp_generate_password(), |
|
68 | + 'user_email' => $email, |
|
69 | 69 | 'role' => 'subscriber', |
70 | 70 | ); |
71 | 71 | |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | function wpinv_generate_user_name( $prefix = '' ) { |
83 | 83 | |
84 | 84 | // If prefix is an email, retrieve the part before the email. |
85 | - $prefix = strtok( $prefix, '@' ); |
|
85 | + $prefix = strtok( $prefix, '@' ); |
|
86 | 86 | $prefix = trim( $prefix, '.' ); |
87 | 87 | |
88 | - // Sanitize the username. |
|
89 | - $prefix = sanitize_user( $prefix, true ); |
|
88 | + // Sanitize the username. |
|
89 | + $prefix = sanitize_user( $prefix, true ); |
|
90 | 90 | |
91 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
92 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
93 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
94 | - } |
|
91 | + $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
92 | + if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
93 | + $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | $username = $prefix; |
97 | 97 | $postfix = 2; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GetPaid |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Generates a users select dropdown. |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @param array $args |
17 | 17 | * @see wp_dropdown_users |
18 | 18 | */ |
19 | -function wpinv_dropdown_users( $args = '' ) { |
|
19 | +function wpinv_dropdown_users($args = '') { |
|
20 | 20 | |
21 | - if ( is_array( $args ) && ! empty( $args['show'] ) && 'display_name_with_email' == $args['show'] ) { |
|
21 | + if (is_array($args) && !empty($args['show']) && 'display_name_with_email' == $args['show']) { |
|
22 | 22 | $args['show'] = 'display_name_with_login'; |
23 | 23 | } |
24 | 24 | |
25 | - return wp_dropdown_users( $args ); |
|
25 | + return wp_dropdown_users($args); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * @return string capability to check against |
33 | 33 | * @param string $capalibilty Optional. The alternative capability to check against. |
34 | 34 | */ |
35 | -function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
|
35 | +function wpinv_get_capability($capalibilty = 'manage_invoicing') { |
|
36 | 36 | |
37 | - if ( current_user_can( 'manage_options' ) ) { |
|
37 | + if (current_user_can('manage_options')) { |
|
38 | 38 | return 'manage_options'; |
39 | 39 | }; |
40 | 40 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return bool |
49 | 49 | */ |
50 | 50 | function wpinv_current_user_can_manage_invoicing() { |
51 | - return current_user_can( wpinv_get_capability() ); |
|
51 | + return current_user_can(wpinv_get_capability()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | * @since 1.0.19 |
58 | 58 | * @return int|WP_Error |
59 | 59 | */ |
60 | -function wpinv_create_user( $email, $prefix = '' ) { |
|
60 | +function wpinv_create_user($email, $prefix = '') { |
|
61 | 61 | |
62 | 62 | // Prepare user values. |
63 | - $prefix = preg_replace( '/\s+/', '', $prefix ); |
|
64 | - $prefix = empty( $prefix ) ? $email : $prefix; |
|
65 | - $args = array( |
|
66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
63 | + $prefix = preg_replace('/\s+/', '', $prefix); |
|
64 | + $prefix = empty($prefix) ? $email : $prefix; |
|
65 | + $args = array( |
|
66 | + 'user_login' => wpinv_generate_user_name($prefix), |
|
67 | 67 | 'user_pass' => wp_generate_password(), |
68 | 68 | 'user_email' => $email, |
69 | 69 | 'role' => 'subscriber', |
70 | 70 | ); |
71 | 71 | |
72 | - return wp_insert_user( $args ); |
|
72 | + return wp_insert_user($args); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
@@ -79,26 +79,26 @@ discard block |
||
79 | 79 | * @since 1.0.19 |
80 | 80 | * @return bool|WP_User |
81 | 81 | */ |
82 | -function wpinv_generate_user_name( $prefix = '' ) { |
|
82 | +function wpinv_generate_user_name($prefix = '') { |
|
83 | 83 | |
84 | 84 | // If prefix is an email, retrieve the part before the email. |
85 | - $prefix = strtok( $prefix, '@' ); |
|
86 | - $prefix = trim( $prefix, '.' ); |
|
85 | + $prefix = strtok($prefix, '@'); |
|
86 | + $prefix = trim($prefix, '.'); |
|
87 | 87 | |
88 | 88 | // Sanitize the username. |
89 | - $prefix = sanitize_user( $prefix, true ); |
|
89 | + $prefix = sanitize_user($prefix, true); |
|
90 | 90 | |
91 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
92 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
93 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
91 | + $illegal_logins = (array) apply_filters('illegal_user_logins', array()); |
|
92 | + if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) { |
|
93 | + $prefix = 'gtp_' . zeroise(wp_rand(0, 9999), 4); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $username = $prefix; |
97 | 97 | $postfix = 2; |
98 | 98 | |
99 | - while ( username_exists( $username ) ) { |
|
99 | + while (username_exists($username)) { |
|
100 | 100 | $username = $prefix + $postfix; |
101 | - $postfix ++; |
|
101 | + $postfix++; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | return $username; |
@@ -115,31 +115,31 @@ discard block |
||
115 | 115 | $tabs = array( |
116 | 116 | |
117 | 117 | 'gp-invoices' => array( |
118 | - 'label' => __( 'Invoices', 'invoicing' ), // Name of the tab. |
|
118 | + 'label' => __('Invoices', 'invoicing'), // Name of the tab. |
|
119 | 119 | 'content' => '[wpinv_history]', // Content of the tab. Or specify "callback" to provide a callback instead. |
120 | 120 | 'icon' => 'fas fa-file-invoice', // Shown on some profile plugins. |
121 | 121 | ), |
122 | 122 | |
123 | 123 | 'gp-subscriptions' => array( |
124 | - 'label' => __( 'Subscriptions', 'invoicing' ), |
|
124 | + 'label' => __('Subscriptions', 'invoicing'), |
|
125 | 125 | 'content' => '[wpinv_subscriptions]', |
126 | 126 | 'icon' => 'fas fa-redo', |
127 | 127 | ), |
128 | 128 | |
129 | 129 | 'gp-edit-address' => array( |
130 | - 'label' => __( 'Billing Address', 'invoicing' ), |
|
130 | + 'label' => __('Billing Address', 'invoicing'), |
|
131 | 131 | 'callback' => 'getpaid_display_address_edit_tab', |
132 | 132 | 'icon' => 'fas fa-credit-card', |
133 | 133 | ), |
134 | 134 | |
135 | 135 | ); |
136 | 136 | |
137 | - $tabs = apply_filters( 'getpaid_user_content_tabs', $tabs ); |
|
137 | + $tabs = apply_filters('getpaid_user_content_tabs', $tabs); |
|
138 | 138 | |
139 | 139 | // Make sure address editing is last on the list. |
140 | - if ( isset( $tabs['gp-edit-address'] ) ) { |
|
140 | + if (isset($tabs['gp-edit-address'])) { |
|
141 | 141 | $address = $tabs['gp-edit-address']; |
142 | - unset( $tabs['gp-edit-address'] ); |
|
142 | + unset($tabs['gp-edit-address']); |
|
143 | 143 | $tabs['gp-edit-address'] = $address; |
144 | 144 | } |
145 | 145 | |
@@ -153,19 +153,19 @@ discard block |
||
153 | 153 | * @param array $tab |
154 | 154 | * @return array |
155 | 155 | */ |
156 | -function getpaid_prepare_user_content_tab( $tab ) { |
|
156 | +function getpaid_prepare_user_content_tab($tab) { |
|
157 | 157 | |
158 | - if ( ! empty( $tab['callback'] ) ) { |
|
159 | - return call_user_func( $tab['callback'] ); |
|
158 | + if (!empty($tab['callback'])) { |
|
159 | + return call_user_func($tab['callback']); |
|
160 | 160 | } |
161 | 161 | |
162 | - if ( ! empty( $tab['content'] ) ) { |
|
163 | - return convert_smilies( capital_P_dangit( wp_filter_content_tags( do_shortcode( shortcode_unautop( wpautop( wptexturize( do_blocks( $tab['content'] ) ) ) ) ) ) ) ); |
|
162 | + if (!empty($tab['content'])) { |
|
163 | + return convert_smilies(capital_P_dangit(wp_filter_content_tags(do_shortcode(shortcode_unautop(wpautop(wptexturize(do_blocks($tab['content'])))))))); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $notice = aui()->alert( |
167 | 167 | array( |
168 | - 'content' => __( 'This tab has no content or content callback.', 'invoicing' ), |
|
168 | + 'content' => __('This tab has no content or content callback.', 'invoicing'), |
|
169 | 169 | 'type' => 'error', |
170 | 170 | ) |
171 | 171 | ); |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | * @param string $default |
182 | 182 | * @return array |
183 | 183 | */ |
184 | -function getpaid_get_tab_url( $tab, $default ) { |
|
184 | +function getpaid_get_tab_url($tab, $default) { |
|
185 | 185 | global $getpaid_tab_url; |
186 | 186 | |
187 | - if ( empty( $getpaid_tab_url ) ) { |
|
187 | + if (empty($getpaid_tab_url)) { |
|
188 | 188 | return $default; |
189 | 189 | } |
190 | 190 | |
191 | - return sprintf( $getpaid_tab_url, $tab ); |
|
191 | + return sprintf($getpaid_tab_url, $tab); |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
@@ -208,19 +208,19 @@ discard block |
||
208 | 208 | |
209 | 209 | <?php |
210 | 210 | |
211 | - foreach ( getpaid_user_address_fields() as $key => $label ) { |
|
211 | + foreach (getpaid_user_address_fields() as $key => $label) { |
|
212 | 212 | |
213 | 213 | // Display the country. |
214 | - if ( 'country' == $key ) { |
|
214 | + if ('country' == $key) { |
|
215 | 215 | |
216 | 216 | echo aui()->select( |
217 | 217 | array( |
218 | 218 | 'options' => wpinv_get_country_list(), |
219 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
220 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
221 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
219 | + 'name' => 'getpaid_address[' . esc_attr($key) . ']', |
|
220 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
221 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
222 | 222 | 'placeholder' => $label, |
223 | - 'label' => wp_kses_post( $label ), |
|
223 | + 'label' => wp_kses_post($label), |
|
224 | 224 | 'label_type' => 'vertical', |
225 | 225 | 'class' => 'getpaid-address-field', |
226 | 226 | ) |
@@ -229,30 +229,30 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | // Display the state. |
232 | - else if ( 'state' == $key ) { |
|
232 | + else if ('state' == $key) { |
|
233 | 233 | |
234 | - echo getpaid_get_states_select_markup ( |
|
235 | - getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
236 | - getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
234 | + echo getpaid_get_states_select_markup( |
|
235 | + getpaid_get_user_address_field(get_current_user_id(), 'country'), |
|
236 | + getpaid_get_user_address_field(get_current_user_id(), 'state'), |
|
237 | 237 | $label, |
238 | 238 | $label, |
239 | 239 | '', |
240 | 240 | false, |
241 | 241 | '', |
242 | - 'getpaid_address[' . esc_attr( $key ) . ']' |
|
242 | + 'getpaid_address[' . esc_attr($key) . ']' |
|
243 | 243 | ); |
244 | 244 | |
245 | 245 | } else { |
246 | 246 | |
247 | 247 | echo aui()->input( |
248 | 248 | array( |
249 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
250 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
249 | + 'name' => 'getpaid_address[' . esc_attr($key) . ']', |
|
250 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
251 | 251 | 'placeholder' => $label, |
252 | - 'label' => wp_kses_post( $label ), |
|
252 | + 'label' => wp_kses_post($label), |
|
253 | 253 | 'label_type' => 'vertical', |
254 | 254 | 'type' => 'text', |
255 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
255 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
256 | 256 | 'class' => 'getpaid-address-field', |
257 | 257 | ) |
258 | 258 | ); |
@@ -261,21 +261,21 @@ discard block |
||
261 | 261 | |
262 | 262 | } |
263 | 263 | |
264 | - do_action( 'getpaid_display_address_edit_tab' ); |
|
264 | + do_action('getpaid_display_address_edit_tab'); |
|
265 | 265 | |
266 | 266 | echo aui()->input( |
267 | 267 | array( |
268 | 268 | 'name' => 'getpaid_profile_edit_submit_button', |
269 | 269 | 'id' => 'getpaid_profile_edit_submit_button', |
270 | - 'value' => __( 'Save Address', 'invoicing' ), |
|
271 | - 'help_text' => __( 'New invoices will use this address as the billing address.', 'invoicing' ), |
|
270 | + 'value' => __('Save Address', 'invoicing'), |
|
271 | + 'help_text' => __('New invoices will use this address as the billing address.', 'invoicing'), |
|
272 | 272 | 'type' => 'submit', |
273 | 273 | 'class' => 'btn btn-primary btn-block submit-button', |
274 | 274 | ) |
275 | 275 | ); |
276 | 276 | |
277 | - wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); |
|
278 | - getpaid_hidden_field( 'getpaid-action', 'edit_billing_details' ); |
|
277 | + wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); |
|
278 | + getpaid_hidden_field('getpaid-action', 'edit_billing_details'); |
|
279 | 279 | ?> |
280 | 280 | |
281 | 281 | </form> |
@@ -292,27 +292,27 @@ discard block |
||
292 | 292 | * @since 2.1.4 |
293 | 293 | * @param array $data |
294 | 294 | */ |
295 | -function getpaid_save_address_edit_tab( $data ) { |
|
295 | +function getpaid_save_address_edit_tab($data) { |
|
296 | 296 | |
297 | - if ( empty( $data['getpaid_address'] ) || ! is_array( $data['getpaid_address'] ) ) { |
|
297 | + if (empty($data['getpaid_address']) || !is_array($data['getpaid_address'])) { |
|
298 | 298 | return; |
299 | 299 | } |
300 | 300 | |
301 | 301 | $data = $data['getpaid_address']; |
302 | 302 | $user_id = get_current_user_id(); |
303 | 303 | |
304 | - foreach ( array_keys( getpaid_user_address_fields() ) as $field ) { |
|
304 | + foreach (array_keys(getpaid_user_address_fields()) as $field) { |
|
305 | 305 | |
306 | - if ( isset( $data[ $field ] ) ) { |
|
307 | - $value = sanitize_text_field( $data[ $field ] ); |
|
308 | - update_user_meta( $user_id, '_wpinv_' . $field, $value ); |
|
306 | + if (isset($data[$field])) { |
|
307 | + $value = sanitize_text_field($data[$field]); |
|
308 | + update_user_meta($user_id, '_wpinv_' . $field, $value); |
|
309 | 309 | } |
310 | 310 | |
311 | - wpinv_set_error( 'address_updated', __( 'Your billing address has been updated', 'invoicing' ), 'success'); |
|
311 | + wpinv_set_error('address_updated', __('Your billing address has been updated', 'invoicing'), 'success'); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | } |
315 | -add_action( 'getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab' ); |
|
315 | +add_action('getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab'); |
|
316 | 316 | |
317 | 317 | |
318 | 318 | /* |
@@ -330,27 +330,27 @@ discard block |
||
330 | 330 | * @param array $tabs |
331 | 331 | * @return array |
332 | 332 | */ |
333 | -function getpaid_filter_userswp_account_tabs( $tabs ) { |
|
333 | +function getpaid_filter_userswp_account_tabs($tabs) { |
|
334 | 334 | |
335 | 335 | // Abort if the integration is inactive. |
336 | - if ( ! getpaid_is_userswp_integration_active() ) { |
|
336 | + if (!getpaid_is_userswp_integration_active()) { |
|
337 | 337 | return $tabs; |
338 | 338 | } |
339 | 339 | |
340 | - $new_tabs = array(); |
|
340 | + $new_tabs = array(); |
|
341 | 341 | |
342 | - foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) { |
|
342 | + foreach (getpaid_get_user_content_tabs() as $slug => $tab) { |
|
343 | 343 | |
344 | - $new_tabs[ $slug ] = array( |
|
345 | - 'title' => $tab[ 'label'], |
|
346 | - 'icon' => $tab[ 'icon'], |
|
344 | + $new_tabs[$slug] = array( |
|
345 | + 'title' => $tab['label'], |
|
346 | + 'icon' => $tab['icon'], |
|
347 | 347 | ); |
348 | 348 | |
349 | 349 | } |
350 | 350 | |
351 | - return array_merge( $tabs, $new_tabs ); |
|
351 | + return array_merge($tabs, $new_tabs); |
|
352 | 352 | } |
353 | -add_filter( 'uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs' ); |
|
353 | +add_filter('uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs'); |
|
354 | 354 | |
355 | 355 | /** |
356 | 356 | * Display our UsersWP account tabs. |
@@ -359,18 +359,18 @@ discard block |
||
359 | 359 | * @param array $tabs |
360 | 360 | * @return array |
361 | 361 | */ |
362 | -function getpaid_display_userswp_account_tabs( $tab ) { |
|
362 | +function getpaid_display_userswp_account_tabs($tab) { |
|
363 | 363 | global $getpaid_tab_url; |
364 | 364 | |
365 | 365 | $our_tabs = getpaid_get_user_content_tabs(); |
366 | 366 | |
367 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
368 | - $getpaid_tab_url = add_query_arg( 'type', '%s', uwp_get_account_page_url() ); |
|
369 | - echo getpaid_prepare_user_content_tab( $our_tabs[ $tab ] ); |
|
367 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
368 | + $getpaid_tab_url = add_query_arg('type', '%s', uwp_get_account_page_url()); |
|
369 | + echo getpaid_prepare_user_content_tab($our_tabs[$tab]); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | } |
373 | -add_action( 'uwp_account_form_display', 'getpaid_display_userswp_account_tabs' ); |
|
373 | +add_action('uwp_account_form_display', 'getpaid_display_userswp_account_tabs'); |
|
374 | 374 | |
375 | 375 | |
376 | 376 | /** |
@@ -381,17 +381,17 @@ discard block |
||
381 | 381 | * @param string $tab Current tab. |
382 | 382 | * @return string Title. |
383 | 383 | */ |
384 | -function getpaid_filter_userswp_account_title( $title, $tab ) { |
|
384 | +function getpaid_filter_userswp_account_title($title, $tab) { |
|
385 | 385 | |
386 | - $our_tabs = getpaid_get_user_content_tabs(); |
|
386 | + $our_tabs = getpaid_get_user_content_tabs(); |
|
387 | 387 | |
388 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
389 | - return $our_tabs[ $tab ]['label']; |
|
388 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
389 | + return $our_tabs[$tab]['label']; |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | return $title; |
393 | 393 | } |
394 | -add_filter( 'uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2 ); |
|
394 | +add_filter('uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2); |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Registers the UsersWP integration settings. |
@@ -400,26 +400,26 @@ discard block |
||
400 | 400 | * @param array $settings An array of integration settings. |
401 | 401 | * @return array |
402 | 402 | */ |
403 | -function getpaid_register_userswp_settings( $settings ) { |
|
403 | +function getpaid_register_userswp_settings($settings) { |
|
404 | 404 | |
405 | - if ( defined( 'USERSWP_PLUGIN_FILE' ) ) { |
|
405 | + if (defined('USERSWP_PLUGIN_FILE')) { |
|
406 | 406 | |
407 | 407 | $settings[] = array( |
408 | 408 | |
409 | 409 | 'id' => 'userswp', |
410 | - 'label' => __( 'UsersWP', 'invoicing' ), |
|
410 | + 'label' => __('UsersWP', 'invoicing'), |
|
411 | 411 | 'settings' => array( |
412 | 412 | |
413 | 413 | 'userswp_settings' => array( |
414 | 414 | 'id' => 'userswp_settings', |
415 | - 'name' => '<h3>' . __( 'UsersWP', 'invoicing' ) . '</h3>', |
|
415 | + 'name' => '<h3>' . __('UsersWP', 'invoicing') . '</h3>', |
|
416 | 416 | 'type' => 'header', |
417 | 417 | ), |
418 | 418 | |
419 | 419 | 'enable_userswp' => array( |
420 | 420 | 'id' => 'enable_userswp', |
421 | - 'name' => __( 'Enable Integration', 'invoicing' ), |
|
422 | - 'desc' => __( 'Display GetPaid items on UsersWP account page.', 'invoicing' ), |
|
421 | + 'name' => __('Enable Integration', 'invoicing'), |
|
422 | + 'desc' => __('Display GetPaid items on UsersWP account page.', 'invoicing'), |
|
423 | 423 | 'type' => 'checkbox', |
424 | 424 | 'std' => 1, |
425 | 425 | ) |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | |
433 | 433 | return $settings; |
434 | 434 | } |
435 | -add_filter( 'getpaid_integration_settings', 'getpaid_register_userswp_settings' ); |
|
435 | +add_filter('getpaid_integration_settings', 'getpaid_register_userswp_settings'); |
|
436 | 436 | |
437 | 437 | /** |
438 | 438 | * Ovewrites the invoices history page to UsersWP. |
@@ -440,18 +440,18 @@ discard block |
||
440 | 440 | * @since 2.3.1 |
441 | 441 | * @return bool |
442 | 442 | */ |
443 | -function getpaid_userswp_overwrite_invoice_history_page( $url, $post_type ) { |
|
443 | +function getpaid_userswp_overwrite_invoice_history_page($url, $post_type) { |
|
444 | 444 | |
445 | 445 | $our_tabs = getpaid_get_user_content_tabs(); |
446 | 446 | $tab = "gp-{$post_type}s"; |
447 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
448 | - return add_query_arg( 'type', $tab, uwp_get_account_page_url() ); |
|
447 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
448 | + return add_query_arg('type', $tab, uwp_get_account_page_url()); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | return $url; |
452 | 452 | |
453 | 453 | } |
454 | -add_filter( 'wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2 ); |
|
454 | +add_filter('wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2); |
|
455 | 455 | |
456 | 456 | /** |
457 | 457 | * Checks if the integration is enabled. |
@@ -460,8 +460,8 @@ discard block |
||
460 | 460 | * @return bool |
461 | 461 | */ |
462 | 462 | function getpaid_is_userswp_integration_active() { |
463 | - $enabled = wpinv_get_option( 'enable_userswp', 1 ); |
|
464 | - return defined( 'USERSWP_PLUGIN_FILE' ) && ! empty( $enabled ); |
|
463 | + $enabled = wpinv_get_option('enable_userswp', 1); |
|
464 | + return defined('USERSWP_PLUGIN_FILE') && !empty($enabled); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /* |
@@ -479,26 +479,26 @@ discard block |
||
479 | 479 | * @param array $settings An array of integration settings. |
480 | 480 | * @return array |
481 | 481 | */ |
482 | -function getpaid_register_buddypress_settings( $settings ) { |
|
482 | +function getpaid_register_buddypress_settings($settings) { |
|
483 | 483 | |
484 | - if ( class_exists( 'BuddyPress' ) ) { |
|
484 | + if (class_exists('BuddyPress')) { |
|
485 | 485 | |
486 | 486 | $settings[] = array( |
487 | 487 | |
488 | 488 | 'id' => 'buddypress', |
489 | - 'label' => __( 'BuddyPress', 'invoicing' ), |
|
489 | + 'label' => __('BuddyPress', 'invoicing'), |
|
490 | 490 | 'settings' => array( |
491 | 491 | |
492 | 492 | 'buddypress_settings' => array( |
493 | 493 | 'id' => 'buddypress_settings', |
494 | - 'name' => '<h3>' . __( 'BuddyPress', 'invoicing' ) . '</h3>', |
|
494 | + 'name' => '<h3>' . __('BuddyPress', 'invoicing') . '</h3>', |
|
495 | 495 | 'type' => 'header', |
496 | 496 | ), |
497 | 497 | |
498 | 498 | 'enable_buddypress' => array( |
499 | 499 | 'id' => 'enable_buddypress', |
500 | - 'name' => __( 'Enable Integration', 'invoicing' ), |
|
501 | - 'desc' => __( 'Display GetPaid items on BuddyPress account pages.', 'invoicing' ), |
|
500 | + 'name' => __('Enable Integration', 'invoicing'), |
|
501 | + 'desc' => __('Display GetPaid items on BuddyPress account pages.', 'invoicing'), |
|
502 | 502 | 'type' => 'checkbox', |
503 | 503 | 'std' => 1, |
504 | 504 | ) |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | |
512 | 512 | return $settings; |
513 | 513 | } |
514 | -add_filter( 'getpaid_integration_settings', 'getpaid_register_buddypress_settings' ); |
|
514 | +add_filter('getpaid_integration_settings', 'getpaid_register_buddypress_settings'); |
|
515 | 515 | |
516 | 516 | /** |
517 | 517 | * Checks if the integration is enabled. |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | * @return bool |
521 | 521 | */ |
522 | 522 | function getpaid_is_buddypress_integration_active() { |
523 | - $enabled = wpinv_get_option( 'enable_buddypress', 1 ); |
|
524 | - return class_exists( 'BuddyPress' ) && ! empty( $enabled ); |
|
523 | + $enabled = wpinv_get_option('enable_buddypress', 1); |
|
524 | + return class_exists('BuddyPress') && !empty($enabled); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | /** |
@@ -532,10 +532,10 @@ discard block |
||
532 | 532 | */ |
533 | 533 | function getpaid_setup_buddypress_integration() { |
534 | 534 | |
535 | - if ( getpaid_is_buddypress_integration_active() ) { |
|
536 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php' ); |
|
535 | + if (getpaid_is_buddypress_integration_active()) { |
|
536 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php'); |
|
537 | 537 | buddypress()->getpaid = new BP_GetPaid_Component(); |
538 | 538 | } |
539 | 539 | |
540 | 540 | } |
541 | -add_action( 'bp_setup_components', 'getpaid_setup_buddypress_integration' ); |
|
541 | +add_action('bp_setup_components', 'getpaid_setup_buddypress_integration'); |
@@ -13,30 +13,30 @@ discard block |
||
13 | 13 | class GetPaid_Bank_Transfer_Gateway extends GetPaid_Payment_Gateway { |
14 | 14 | |
15 | 15 | /** |
16 | - * Payment method id. |
|
17 | - * |
|
18 | - * @var string |
|
19 | - */ |
|
16 | + * Payment method id. |
|
17 | + * |
|
18 | + * @var string |
|
19 | + */ |
|
20 | 20 | public $id = 'bank_transfer'; |
21 | 21 | |
22 | - /** |
|
23 | - * An array of features that this gateway supports. |
|
24 | - * |
|
25 | - * @var array |
|
26 | - */ |
|
27 | - protected $supports = array( 'addons' ); |
|
22 | + /** |
|
23 | + * An array of features that this gateway supports. |
|
24 | + * |
|
25 | + * @var array |
|
26 | + */ |
|
27 | + protected $supports = array( 'addons' ); |
|
28 | 28 | |
29 | 29 | /** |
30 | - * Payment method order. |
|
31 | - * |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - public $order = 8; |
|
30 | + * Payment method order. |
|
31 | + * |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + public $order = 8; |
|
35 | 35 | |
36 | 36 | /** |
37 | - * Class constructor. |
|
38 | - */ |
|
39 | - public function __construct() { |
|
37 | + * Class constructor. |
|
38 | + */ |
|
39 | + public function __construct() { |
|
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | 42 | $this->title = __( 'Direct bank transfer', 'invoicing' ); |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | $this->checkout_button_text = __( 'Proceed', 'invoicing' ); |
45 | 45 | $this->instructions = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) ); |
46 | 46 | |
47 | - add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) ); |
|
48 | - add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 ); |
|
49 | - add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 ); |
|
50 | - add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 ); |
|
47 | + add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) ); |
|
48 | + add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 ); |
|
49 | + add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 ); |
|
50 | + add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 ); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | - * Process Payment. |
|
56 | - * |
|
57 | - * |
|
58 | - * @param WPInv_Invoice $invoice Invoice. |
|
59 | - * @param array $submission_data Posted checkout fields. |
|
60 | - * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
|
61 | - * @return array |
|
62 | - */ |
|
63 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
55 | + * Process Payment. |
|
56 | + * |
|
57 | + * |
|
58 | + * @param WPInv_Invoice $invoice Invoice. |
|
59 | + * @param array $submission_data Posted checkout fields. |
|
60 | + * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
|
61 | + * @return array |
|
62 | + */ |
|
63 | + public function process_payment( $invoice, $submission_data, $submission ) { |
|
64 | 64 | |
65 | 65 | // Add a transaction id. |
66 | 66 | $invoice->set_transaction_id( $invoice->generate_key('trans_') ); |
@@ -81,66 +81,66 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | - * Output for the order received page. |
|
85 | - * |
|
86 | - * @param WPInv_Invoice $invoice Invoice. |
|
87 | - */ |
|
88 | - public function thankyou_page( $invoice ) { |
|
84 | + * Output for the order received page. |
|
85 | + * |
|
86 | + * @param WPInv_Invoice $invoice Invoice. |
|
87 | + */ |
|
88 | + public function thankyou_page( $invoice ) { |
|
89 | 89 | |
90 | 90 | if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
91 | 91 | |
92 | - echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL; |
|
92 | + echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL; |
|
93 | 93 | |
94 | 94 | if ( ! empty( $this->instructions ) ) { |
95 | 95 | echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) ); |
96 | - } |
|
96 | + } |
|
97 | 97 | |
98 | - $this->bank_details( $invoice ); |
|
98 | + $this->bank_details( $invoice ); |
|
99 | 99 | |
100 | - echo '</div>'; |
|
100 | + echo '</div>'; |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | 106 | /** |
107 | - * Add content to the WPI emails. |
|
108 | - * |
|
109 | - * @param WPInv_Invoice $invoice Invoice. |
|
110 | - * @param string $email_type Email format: plain text or HTML. |
|
111 | - * @param bool $sent_to_admin Sent to admin. |
|
112 | - */ |
|
113 | - public function email_instructions( $invoice, $email_type, $sent_to_admin ) { |
|
107 | + * Add content to the WPI emails. |
|
108 | + * |
|
109 | + * @param WPInv_Invoice $invoice Invoice. |
|
110 | + * @param string $email_type Email format: plain text or HTML. |
|
111 | + * @param bool $sent_to_admin Sent to admin. |
|
112 | + */ |
|
113 | + public function email_instructions( $invoice, $email_type, $sent_to_admin ) { |
|
114 | 114 | |
115 | - if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
115 | + if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
116 | 116 | |
117 | - echo '<div class="wpi-email-row getpaid-bank-transfer-details">'; |
|
117 | + echo '<div class="wpi-email-row getpaid-bank-transfer-details">'; |
|
118 | 118 | |
119 | - if ( $this->instructions ) { |
|
120 | - echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL ); |
|
119 | + if ( $this->instructions ) { |
|
120 | + echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL ); |
|
121 | 121 | } |
122 | 122 | |
123 | - $this->bank_details( $invoice ); |
|
123 | + $this->bank_details( $invoice ); |
|
124 | 124 | |
125 | - echo '</div>'; |
|
125 | + echo '</div>'; |
|
126 | 126 | |
127 | - } |
|
127 | + } |
|
128 | 128 | |
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | - * Get bank details and place into a list format. |
|
133 | - * |
|
134 | - * @param WPInv_Invoice $invoice Invoice. |
|
135 | - */ |
|
136 | - protected function bank_details( $invoice ) { |
|
132 | + * Get bank details and place into a list format. |
|
133 | + * |
|
134 | + * @param WPInv_Invoice $invoice Invoice. |
|
135 | + */ |
|
136 | + protected function bank_details( $invoice ) { |
|
137 | 137 | |
138 | - // Get the invoice country and country $locale. |
|
139 | - $country = $invoice->get_country(); |
|
140 | - $locale = $this->get_country_locale(); |
|
138 | + // Get the invoice country and country $locale. |
|
139 | + $country = $invoice->get_country(); |
|
140 | + $locale = $this->get_country_locale(); |
|
141 | 141 | |
142 | - // Get sortcode label in the $locale array and use appropriate one. |
|
143 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
142 | + // Get sortcode label in the $locale array and use appropriate one. |
|
143 | + $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
144 | 144 | |
145 | 145 | $bank_fields = array( |
146 | 146 | 'ac_name' => __( 'Account Name', 'invoicing' ), |
@@ -169,144 +169,144 @@ discard block |
||
169 | 169 | return; |
170 | 170 | } |
171 | 171 | |
172 | - echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL; |
|
172 | + echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL; |
|
173 | 173 | |
174 | - echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL; |
|
174 | + echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL; |
|
175 | 175 | |
176 | - foreach ( $bank_info as $key => $data ) { |
|
176 | + foreach ( $bank_info as $key => $data ) { |
|
177 | 177 | |
178 | - $key = sanitize_html_class( $key ); |
|
179 | - $label = wp_kses_post( $data['label'] ); |
|
180 | - $value = wp_kses_post( wptexturize( $data['value'] ) ); |
|
178 | + $key = sanitize_html_class( $key ); |
|
179 | + $label = wp_kses_post( $data['label'] ); |
|
180 | + $value = wp_kses_post( wptexturize( $data['value'] ) ); |
|
181 | 181 | |
182 | - echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL; |
|
183 | - } |
|
182 | + echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL; |
|
183 | + } |
|
184 | 184 | |
185 | - echo '</table>'; |
|
185 | + echo '</table>'; |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | - * Get country locale if localized. |
|
191 | - * |
|
192 | - * @return array |
|
193 | - */ |
|
194 | - public function get_country_locale() { |
|
195 | - |
|
196 | - if ( empty( $this->locale ) ) { |
|
197 | - |
|
198 | - // Locale information to be used - only those that are not 'Sort Code'. |
|
199 | - $this->locale = apply_filters( |
|
200 | - 'getpaid_get_bank_transfer_locale', |
|
201 | - array( |
|
202 | - 'AU' => array( |
|
203 | - 'sortcode' => array( |
|
204 | - 'label' => __( 'BSB', 'invoicing' ), |
|
205 | - ), |
|
206 | - ), |
|
207 | - 'CA' => array( |
|
208 | - 'sortcode' => array( |
|
209 | - 'label' => __( 'Bank transit number', 'invoicing' ), |
|
210 | - ), |
|
211 | - ), |
|
212 | - 'IN' => array( |
|
213 | - 'sortcode' => array( |
|
214 | - 'label' => __( 'IFSC', 'invoicing' ), |
|
215 | - ), |
|
216 | - ), |
|
217 | - 'IT' => array( |
|
218 | - 'sortcode' => array( |
|
219 | - 'label' => __( 'Branch sort', 'invoicing' ), |
|
220 | - ), |
|
221 | - ), |
|
222 | - 'NZ' => array( |
|
223 | - 'sortcode' => array( |
|
224 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
225 | - ), |
|
226 | - ), |
|
227 | - 'SE' => array( |
|
228 | - 'sortcode' => array( |
|
229 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
230 | - ), |
|
231 | - ), |
|
232 | - 'US' => array( |
|
233 | - 'sortcode' => array( |
|
234 | - 'label' => __( 'Routing number', 'invoicing' ), |
|
235 | - ), |
|
236 | - ), |
|
237 | - 'ZA' => array( |
|
238 | - 'sortcode' => array( |
|
239 | - 'label' => __( 'Branch code', 'invoicing' ), |
|
240 | - ), |
|
241 | - ), |
|
242 | - ) |
|
243 | - ); |
|
244 | - |
|
245 | - } |
|
246 | - |
|
247 | - return $this->locale; |
|
248 | - |
|
249 | - } |
|
250 | - |
|
251 | - /** |
|
252 | - * Filters the gateway settings. |
|
253 | - * |
|
254 | - * @param array $admin_settings |
|
255 | - */ |
|
256 | - public function admin_settings( $admin_settings ) { |
|
190 | + * Get country locale if localized. |
|
191 | + * |
|
192 | + * @return array |
|
193 | + */ |
|
194 | + public function get_country_locale() { |
|
195 | + |
|
196 | + if ( empty( $this->locale ) ) { |
|
197 | + |
|
198 | + // Locale information to be used - only those that are not 'Sort Code'. |
|
199 | + $this->locale = apply_filters( |
|
200 | + 'getpaid_get_bank_transfer_locale', |
|
201 | + array( |
|
202 | + 'AU' => array( |
|
203 | + 'sortcode' => array( |
|
204 | + 'label' => __( 'BSB', 'invoicing' ), |
|
205 | + ), |
|
206 | + ), |
|
207 | + 'CA' => array( |
|
208 | + 'sortcode' => array( |
|
209 | + 'label' => __( 'Bank transit number', 'invoicing' ), |
|
210 | + ), |
|
211 | + ), |
|
212 | + 'IN' => array( |
|
213 | + 'sortcode' => array( |
|
214 | + 'label' => __( 'IFSC', 'invoicing' ), |
|
215 | + ), |
|
216 | + ), |
|
217 | + 'IT' => array( |
|
218 | + 'sortcode' => array( |
|
219 | + 'label' => __( 'Branch sort', 'invoicing' ), |
|
220 | + ), |
|
221 | + ), |
|
222 | + 'NZ' => array( |
|
223 | + 'sortcode' => array( |
|
224 | + 'label' => __( 'Bank code', 'invoicing' ), |
|
225 | + ), |
|
226 | + ), |
|
227 | + 'SE' => array( |
|
228 | + 'sortcode' => array( |
|
229 | + 'label' => __( 'Bank code', 'invoicing' ), |
|
230 | + ), |
|
231 | + ), |
|
232 | + 'US' => array( |
|
233 | + 'sortcode' => array( |
|
234 | + 'label' => __( 'Routing number', 'invoicing' ), |
|
235 | + ), |
|
236 | + ), |
|
237 | + 'ZA' => array( |
|
238 | + 'sortcode' => array( |
|
239 | + 'label' => __( 'Branch code', 'invoicing' ), |
|
240 | + ), |
|
241 | + ), |
|
242 | + ) |
|
243 | + ); |
|
244 | + |
|
245 | + } |
|
246 | + |
|
247 | + return $this->locale; |
|
248 | + |
|
249 | + } |
|
250 | + |
|
251 | + /** |
|
252 | + * Filters the gateway settings. |
|
253 | + * |
|
254 | + * @param array $admin_settings |
|
255 | + */ |
|
256 | + public function admin_settings( $admin_settings ) { |
|
257 | 257 | |
258 | 258 | $admin_settings['bank_transfer_desc']['std'] = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ); |
259 | - $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' ); |
|
259 | + $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' ); |
|
260 | 260 | |
261 | - $locale = $this->get_country_locale(); |
|
261 | + $locale = $this->get_country_locale(); |
|
262 | 262 | |
263 | - // Get sortcode label in the $locale array and use appropriate one. |
|
264 | - $country = wpinv_default_billing_country(); |
|
265 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
263 | + // Get sortcode label in the $locale array and use appropriate one. |
|
264 | + $country = wpinv_default_billing_country(); |
|
265 | + $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
266 | 266 | |
267 | - $admin_settings['bank_transfer_ac_name'] = array( |
|
267 | + $admin_settings['bank_transfer_ac_name'] = array( |
|
268 | 268 | 'type' => 'text', |
269 | 269 | 'id' => 'bank_transfer_ac_name', |
270 | 270 | 'name' => __( 'Account Name', 'invoicing' ), |
271 | - ); |
|
271 | + ); |
|
272 | 272 | |
273 | - $admin_settings['bank_transfer_ac_no'] = array( |
|
273 | + $admin_settings['bank_transfer_ac_no'] = array( |
|
274 | 274 | 'type' => 'text', |
275 | 275 | 'id' => 'bank_transfer_ac_no', |
276 | 276 | 'name' => __( 'Account Number', 'invoicing' ), |
277 | - ); |
|
277 | + ); |
|
278 | 278 | |
279 | - $admin_settings['bank_transfer_bank_name'] = array( |
|
279 | + $admin_settings['bank_transfer_bank_name'] = array( |
|
280 | 280 | 'type' => 'text', |
281 | 281 | 'id' => 'bank_transfer_bank_name', |
282 | 282 | 'name' => __( 'Bank Name', 'invoicing' ), |
283 | - ); |
|
283 | + ); |
|
284 | 284 | |
285 | - $admin_settings['bank_transfer_ifsc'] = array( |
|
285 | + $admin_settings['bank_transfer_ifsc'] = array( |
|
286 | 286 | 'type' => 'text', |
287 | 287 | 'id' => 'bank_transfer_ifsc', |
288 | 288 | 'name' => __( 'IFSC Code', 'invoicing' ), |
289 | - ); |
|
289 | + ); |
|
290 | 290 | |
291 | - $admin_settings['bank_transfer_iban'] = array( |
|
291 | + $admin_settings['bank_transfer_iban'] = array( |
|
292 | 292 | 'type' => 'text', |
293 | 293 | 'id' => 'bank_transfer_iban', |
294 | 294 | 'name' => __( 'IBAN', 'invoicing' ), |
295 | - ); |
|
295 | + ); |
|
296 | 296 | |
297 | - $admin_settings['bank_transfer_bic'] = array( |
|
297 | + $admin_settings['bank_transfer_bic'] = array( |
|
298 | 298 | 'type' => 'text', |
299 | 299 | 'id' => 'bank_transfer_bic', |
300 | 300 | 'name' => __( 'BIC/Swift Code', 'invoicing' ), |
301 | - ); |
|
301 | + ); |
|
302 | 302 | |
303 | - $admin_settings['bank_transfer_sort_code'] = array( |
|
304 | - 'type' => 'text', |
|
305 | - 'id' => 'bank_transfer_sort_code', |
|
306 | - 'name' => $sortcode, |
|
307 | - ); |
|
303 | + $admin_settings['bank_transfer_sort_code'] = array( |
|
304 | + 'type' => 'text', |
|
305 | + 'id' => 'bank_transfer_sort_code', |
|
306 | + 'name' => $sortcode, |
|
307 | + ); |
|
308 | 308 | |
309 | - $admin_settings['bank_transfer_info'] = array( |
|
309 | + $admin_settings['bank_transfer_info'] = array( |
|
310 | 310 | 'id' => 'bank_transfer_info', |
311 | 311 | 'name' => __( 'Instructions', 'invoicing' ), |
312 | 312 | 'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ), |
@@ -316,17 +316,17 @@ discard block |
||
316 | 316 | 'rows' => 5 |
317 | 317 | ); |
318 | 318 | |
319 | - return $admin_settings; |
|
320 | - } |
|
319 | + return $admin_settings; |
|
320 | + } |
|
321 | 321 | |
322 | - /** |
|
323 | - * Processes invoice addons. |
|
324 | - * |
|
325 | - * @param WPInv_Invoice $invoice |
|
326 | - * @param GetPaid_Form_Item[] $items |
|
327 | - * @return WPInv_Invoice |
|
328 | - */ |
|
329 | - public function process_addons( $invoice, $items ) { |
|
322 | + /** |
|
323 | + * Processes invoice addons. |
|
324 | + * |
|
325 | + * @param WPInv_Invoice $invoice |
|
326 | + * @param GetPaid_Form_Item[] $items |
|
327 | + * @return WPInv_Invoice |
|
328 | + */ |
|
329 | + public function process_addons( $invoice, $items ) { |
|
330 | 330 | |
331 | 331 | foreach ( $items as $item ) { |
332 | 332 | $invoice->add_item( $item ); |
@@ -334,6 +334,6 @@ discard block |
||
334 | 334 | |
335 | 335 | $invoice->recalculate_total(); |
336 | 336 | $invoice->save(); |
337 | - } |
|
337 | + } |
|
338 | 338 | |
339 | 339 | } |
@@ -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 | * Bank transfer Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $supports = array( 'addons' ); |
|
27 | + protected $supports = array('addons'); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Payment method order. |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | public function __construct() { |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | - $this->title = __( 'Direct bank transfer', 'invoicing' ); |
|
43 | - $this->method_title = __( 'Bank transfer', 'invoicing' ); |
|
44 | - $this->checkout_button_text = __( 'Proceed', 'invoicing' ); |
|
45 | - $this->instructions = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) ); |
|
42 | + $this->title = __('Direct bank transfer', 'invoicing'); |
|
43 | + $this->method_title = __('Bank transfer', 'invoicing'); |
|
44 | + $this->checkout_button_text = __('Proceed', 'invoicing'); |
|
45 | + $this->instructions = apply_filters('wpinv_bank_instructions', $this->get_option('info')); |
|
46 | 46 | |
47 | - add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) ); |
|
48 | - add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 ); |
|
49 | - add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 ); |
|
50 | - add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 ); |
|
47 | + add_action('wpinv_receipt_end', array($this, 'thankyou_page')); |
|
48 | + add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40); |
|
49 | + add_action('wpinv_pdf_content_billing', array($this, 'thankyou_page'), 11); |
|
50 | + add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
61 | 61 | * @return array |
62 | 62 | */ |
63 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
63 | + public function process_payment($invoice, $submission_data, $submission) { |
|
64 | 64 | |
65 | 65 | // Add a transaction id. |
66 | - $invoice->set_transaction_id( $invoice->generate_key('trans_') ); |
|
66 | + $invoice->set_transaction_id($invoice->generate_key('trans_')); |
|
67 | 67 | |
68 | 68 | // Set it as pending payment. |
69 | - if ( ! $invoice->needs_payment() ) { |
|
69 | + if (!$invoice->needs_payment()) { |
|
70 | 70 | $invoice->mark_paid(); |
71 | - } else if ( ! $invoice->is_paid() ) { |
|
72 | - $invoice->set_status( 'wpi-onhold' ); |
|
71 | + } else if (!$invoice->is_paid()) { |
|
72 | + $invoice->set_status('wpi-onhold'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // Save it. |
76 | 76 | $invoice->save(); |
77 | 77 | |
78 | 78 | // Send to the success page. |
79 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
79 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param WPInv_Invoice $invoice Invoice. |
87 | 87 | */ |
88 | - public function thankyou_page( $invoice ) { |
|
88 | + public function thankyou_page($invoice) { |
|
89 | 89 | |
90 | - if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
90 | + if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) { |
|
91 | 91 | |
92 | 92 | echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL; |
93 | 93 | |
94 | - if ( ! empty( $this->instructions ) ) { |
|
95 | - echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) ); |
|
94 | + if (!empty($this->instructions)) { |
|
95 | + echo wp_kses_post(wpautop(wptexturize($this->instructions))); |
|
96 | 96 | } |
97 | 97 | |
98 | - $this->bank_details( $invoice ); |
|
98 | + $this->bank_details($invoice); |
|
99 | 99 | |
100 | 100 | echo '</div>'; |
101 | 101 | |
@@ -110,17 +110,17 @@ discard block |
||
110 | 110 | * @param string $email_type Email format: plain text or HTML. |
111 | 111 | * @param bool $sent_to_admin Sent to admin. |
112 | 112 | */ |
113 | - public function email_instructions( $invoice, $email_type, $sent_to_admin ) { |
|
113 | + public function email_instructions($invoice, $email_type, $sent_to_admin) { |
|
114 | 114 | |
115 | - if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
115 | + if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) { |
|
116 | 116 | |
117 | 117 | echo '<div class="wpi-email-row getpaid-bank-transfer-details">'; |
118 | 118 | |
119 | - if ( $this->instructions ) { |
|
120 | - echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL ); |
|
119 | + if ($this->instructions) { |
|
120 | + echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL); |
|
121 | 121 | } |
122 | 122 | |
123 | - $this->bank_details( $invoice ); |
|
123 | + $this->bank_details($invoice); |
|
124 | 124 | |
125 | 125 | echo '</div>'; |
126 | 126 | |
@@ -133,51 +133,51 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @param WPInv_Invoice $invoice Invoice. |
135 | 135 | */ |
136 | - protected function bank_details( $invoice ) { |
|
136 | + protected function bank_details($invoice) { |
|
137 | 137 | |
138 | 138 | // Get the invoice country and country $locale. |
139 | 139 | $country = $invoice->get_country(); |
140 | 140 | $locale = $this->get_country_locale(); |
141 | 141 | |
142 | 142 | // Get sortcode label in the $locale array and use appropriate one. |
143 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
143 | + $sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing'); |
|
144 | 144 | |
145 | 145 | $bank_fields = array( |
146 | - 'ac_name' => __( 'Account Name', 'invoicing' ), |
|
147 | - 'ac_no' => __( 'Account Number', 'invoicing' ), |
|
148 | - 'bank_name' => __( 'Bank Name', 'invoicing' ), |
|
149 | - 'ifsc' => __( 'IFSC code', 'invoicing' ), |
|
150 | - 'iban' => __( 'IBAN', 'invoicing' ), |
|
151 | - 'bic' => __( 'BIC/Swift code', 'invoicing' ), |
|
146 | + 'ac_name' => __('Account Name', 'invoicing'), |
|
147 | + 'ac_no' => __('Account Number', 'invoicing'), |
|
148 | + 'bank_name' => __('Bank Name', 'invoicing'), |
|
149 | + 'ifsc' => __('IFSC code', 'invoicing'), |
|
150 | + 'iban' => __('IBAN', 'invoicing'), |
|
151 | + 'bic' => __('BIC/Swift code', 'invoicing'), |
|
152 | 152 | 'sort_code' => $sortcode, |
153 | 153 | ); |
154 | 154 | |
155 | 155 | $bank_info = array(); |
156 | 156 | |
157 | - foreach ( $bank_fields as $field => $label ) { |
|
158 | - $value = $this->get_option( $field ); |
|
157 | + foreach ($bank_fields as $field => $label) { |
|
158 | + $value = $this->get_option($field); |
|
159 | 159 | |
160 | - if ( ! empty( $value ) ) { |
|
161 | - $bank_info[$field] = array( 'label' => $label, 'value' => $value ); |
|
160 | + if (!empty($value)) { |
|
161 | + $bank_info[$field] = array('label' => $label, 'value' => $value); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | } |
165 | 165 | |
166 | - $bank_info = apply_filters( 'wpinv_bank_info', $bank_info ); |
|
166 | + $bank_info = apply_filters('wpinv_bank_info', $bank_info); |
|
167 | 167 | |
168 | - if ( empty( $bank_info ) ) { |
|
168 | + if (empty($bank_info)) { |
|
169 | 169 | return; |
170 | 170 | } |
171 | 171 | |
172 | - echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL; |
|
172 | + echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing')) . '</h3>' . PHP_EOL; |
|
173 | 173 | |
174 | 174 | echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL; |
175 | 175 | |
176 | - foreach ( $bank_info as $key => $data ) { |
|
176 | + foreach ($bank_info as $key => $data) { |
|
177 | 177 | |
178 | - $key = sanitize_html_class( $key ); |
|
179 | - $label = wp_kses_post( $data['label'] ); |
|
180 | - $value = wp_kses_post( wptexturize( $data['value'] ) ); |
|
178 | + $key = sanitize_html_class($key); |
|
179 | + $label = wp_kses_post($data['label']); |
|
180 | + $value = wp_kses_post(wptexturize($data['value'])); |
|
181 | 181 | |
182 | 182 | echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL; |
183 | 183 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function get_country_locale() { |
195 | 195 | |
196 | - if ( empty( $this->locale ) ) { |
|
196 | + if (empty($this->locale)) { |
|
197 | 197 | |
198 | 198 | // Locale information to be used - only those that are not 'Sort Code'. |
199 | 199 | $this->locale = apply_filters( |
@@ -201,42 +201,42 @@ discard block |
||
201 | 201 | array( |
202 | 202 | 'AU' => array( |
203 | 203 | 'sortcode' => array( |
204 | - 'label' => __( 'BSB', 'invoicing' ), |
|
204 | + 'label' => __('BSB', 'invoicing'), |
|
205 | 205 | ), |
206 | 206 | ), |
207 | 207 | 'CA' => array( |
208 | 208 | 'sortcode' => array( |
209 | - 'label' => __( 'Bank transit number', 'invoicing' ), |
|
209 | + 'label' => __('Bank transit number', 'invoicing'), |
|
210 | 210 | ), |
211 | 211 | ), |
212 | 212 | 'IN' => array( |
213 | 213 | 'sortcode' => array( |
214 | - 'label' => __( 'IFSC', 'invoicing' ), |
|
214 | + 'label' => __('IFSC', 'invoicing'), |
|
215 | 215 | ), |
216 | 216 | ), |
217 | 217 | 'IT' => array( |
218 | 218 | 'sortcode' => array( |
219 | - 'label' => __( 'Branch sort', 'invoicing' ), |
|
219 | + 'label' => __('Branch sort', 'invoicing'), |
|
220 | 220 | ), |
221 | 221 | ), |
222 | 222 | 'NZ' => array( |
223 | 223 | 'sortcode' => array( |
224 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
224 | + 'label' => __('Bank code', 'invoicing'), |
|
225 | 225 | ), |
226 | 226 | ), |
227 | 227 | 'SE' => array( |
228 | 228 | 'sortcode' => array( |
229 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
229 | + 'label' => __('Bank code', 'invoicing'), |
|
230 | 230 | ), |
231 | 231 | ), |
232 | 232 | 'US' => array( |
233 | 233 | 'sortcode' => array( |
234 | - 'label' => __( 'Routing number', 'invoicing' ), |
|
234 | + 'label' => __('Routing number', 'invoicing'), |
|
235 | 235 | ), |
236 | 236 | ), |
237 | 237 | 'ZA' => array( |
238 | 238 | 'sortcode' => array( |
239 | - 'label' => __( 'Branch code', 'invoicing' ), |
|
239 | + 'label' => __('Branch code', 'invoicing'), |
|
240 | 240 | ), |
241 | 241 | ), |
242 | 242 | ) |
@@ -253,51 +253,51 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @param array $admin_settings |
255 | 255 | */ |
256 | - public function admin_settings( $admin_settings ) { |
|
256 | + public function admin_settings($admin_settings) { |
|
257 | 257 | |
258 | - $admin_settings['bank_transfer_desc']['std'] = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ); |
|
259 | - $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' ); |
|
258 | + $admin_settings['bank_transfer_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'); |
|
259 | + $admin_settings['bank_transfer_active']['desc'] = __('Enable bank transfer', 'invoicing'); |
|
260 | 260 | |
261 | - $locale = $this->get_country_locale(); |
|
261 | + $locale = $this->get_country_locale(); |
|
262 | 262 | |
263 | 263 | // Get sortcode label in the $locale array and use appropriate one. |
264 | 264 | $country = wpinv_default_billing_country(); |
265 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
265 | + $sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing'); |
|
266 | 266 | |
267 | 267 | $admin_settings['bank_transfer_ac_name'] = array( |
268 | 268 | 'type' => 'text', |
269 | 269 | 'id' => 'bank_transfer_ac_name', |
270 | - 'name' => __( 'Account Name', 'invoicing' ), |
|
270 | + 'name' => __('Account Name', 'invoicing'), |
|
271 | 271 | ); |
272 | 272 | |
273 | 273 | $admin_settings['bank_transfer_ac_no'] = array( |
274 | 274 | 'type' => 'text', |
275 | 275 | 'id' => 'bank_transfer_ac_no', |
276 | - 'name' => __( 'Account Number', 'invoicing' ), |
|
276 | + 'name' => __('Account Number', 'invoicing'), |
|
277 | 277 | ); |
278 | 278 | |
279 | 279 | $admin_settings['bank_transfer_bank_name'] = array( |
280 | 280 | 'type' => 'text', |
281 | 281 | 'id' => 'bank_transfer_bank_name', |
282 | - 'name' => __( 'Bank Name', 'invoicing' ), |
|
282 | + 'name' => __('Bank Name', 'invoicing'), |
|
283 | 283 | ); |
284 | 284 | |
285 | 285 | $admin_settings['bank_transfer_ifsc'] = array( |
286 | 286 | 'type' => 'text', |
287 | 287 | 'id' => 'bank_transfer_ifsc', |
288 | - 'name' => __( 'IFSC Code', 'invoicing' ), |
|
288 | + 'name' => __('IFSC Code', 'invoicing'), |
|
289 | 289 | ); |
290 | 290 | |
291 | 291 | $admin_settings['bank_transfer_iban'] = array( |
292 | 292 | 'type' => 'text', |
293 | 293 | 'id' => 'bank_transfer_iban', |
294 | - 'name' => __( 'IBAN', 'invoicing' ), |
|
294 | + 'name' => __('IBAN', 'invoicing'), |
|
295 | 295 | ); |
296 | 296 | |
297 | 297 | $admin_settings['bank_transfer_bic'] = array( |
298 | 298 | 'type' => 'text', |
299 | 299 | 'id' => 'bank_transfer_bic', |
300 | - 'name' => __( 'BIC/Swift Code', 'invoicing' ), |
|
300 | + 'name' => __('BIC/Swift Code', 'invoicing'), |
|
301 | 301 | ); |
302 | 302 | |
303 | 303 | $admin_settings['bank_transfer_sort_code'] = array( |
@@ -308,10 +308,10 @@ discard block |
||
308 | 308 | |
309 | 309 | $admin_settings['bank_transfer_info'] = array( |
310 | 310 | 'id' => 'bank_transfer_info', |
311 | - 'name' => __( 'Instructions', 'invoicing' ), |
|
312 | - 'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ), |
|
311 | + 'name' => __('Instructions', 'invoicing'), |
|
312 | + 'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'), |
|
313 | 313 | 'type' => 'textarea', |
314 | - 'std' => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ), |
|
314 | + 'std' => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'), |
|
315 | 315 | 'cols' => 50, |
316 | 316 | 'rows' => 5 |
317 | 317 | ); |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | * @param GetPaid_Form_Item[] $items |
327 | 327 | * @return WPInv_Invoice |
328 | 328 | */ |
329 | - public function process_addons( $invoice, $items ) { |
|
329 | + public function process_addons($invoice, $items) { |
|
330 | 330 | |
331 | - foreach ( $items as $item ) { |
|
332 | - $invoice->add_item( $item ); |
|
331 | + foreach ($items as $item) { |
|
332 | + $invoice->add_item($item); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | $invoice->recalculate_total(); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | <div class="modal-dialog modal-dialog-centered modal-lg" role="checkout" style="max-width: 650px;"> |
17 | 17 | <div class="modal-content"> |
18 | 18 | <div class="modal-body"> |
19 | - <button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="<?php esc_attr__( 'Close', 'invoicing' ); ?>"> |
|
19 | + <button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="<?php esc_attr__('Close', 'invoicing'); ?>"> |
|
20 | 20 | <i class="fa fa-times" aria-hidden="true"></i> |
21 | 21 | </button> |
22 | 22 | <div class="modal-body-wrapper"></div> |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Prepare the company name. |
13 | -$company_name = wpinv_get_option( 'vat_company_name' ); |
|
13 | +$company_name = wpinv_get_option('vat_company_name'); |
|
14 | 14 | |
15 | -if ( empty( $company_name ) ) { |
|
15 | +if (empty($company_name)) { |
|
16 | 16 | $company_name = wpinv_get_business_name(); |
17 | 17 | } |
18 | 18 | |
19 | 19 | // Prepare the VAT number. |
20 | -$vat_number = wpinv_get_option( 'vat_number' ); |
|
20 | +$vat_number = wpinv_get_option('vat_number'); |
|
21 | 21 | |
22 | 22 | ?> |
23 | 23 | <div class="getpaid-company-address form-group"> |
@@ -25,36 +25,36 @@ discard block |
||
25 | 25 | <div class="row"> |
26 | 26 | |
27 | 27 | <div class="invoice-company-address-label col-2"> |
28 | - <strong><?php _e( 'From:', 'invoicing' ) ?></strong> |
|
28 | + <strong><?php _e('From:', 'invoicing') ?></strong> |
|
29 | 29 | </div> |
30 | 30 | |
31 | 31 | <div class="invoice-company-address-value col-10"> |
32 | 32 | |
33 | - <?php do_action( 'getpaid_company_address_top' ); ?> |
|
33 | + <?php do_action('getpaid_company_address_top'); ?> |
|
34 | 34 | |
35 | 35 | <div class="name"> |
36 | - <a target="_blank" class="text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>"> |
|
37 | - <?php echo esc_html( $company_name ); ?> |
|
36 | + <a target="_blank" class="text-dark" href="<?php echo esc_url(wpinv_get_business_website()); ?>"> |
|
37 | + <?php echo esc_html($company_name); ?> |
|
38 | 38 | </a> |
39 | 39 | </div> |
40 | 40 | |
41 | - <?php if ( $address = wpinv_get_business_address() ) { ?> |
|
42 | - <?php echo $address;?> |
|
41 | + <?php if ($address = wpinv_get_business_address()) { ?> |
|
42 | + <?php echo $address; ?> |
|
43 | 43 | <?php } ?> |
44 | 44 | |
45 | - <?php if ( $email_from = wpinv_mail_get_from_address() ) { ?> |
|
45 | + <?php if ($email_from = wpinv_mail_get_from_address()) { ?> |
|
46 | 46 | <div class="email_from"> |
47 | - <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), $email_from );?> |
|
47 | + <?php echo wp_sprintf(__('Email: %s', 'invoicing'), $email_from); ?> |
|
48 | 48 | </div> |
49 | 49 | <?php } ?> |
50 | 50 | |
51 | - <?php if ( ! empty( $vat_number ) ) { ?> |
|
51 | + <?php if (!empty($vat_number)) { ?> |
|
52 | 52 | <div class="email_from"> |
53 | - <?php echo wp_sprintf( __( 'VAT Number: %s', 'invoicing' ), sanitize_text_field( $vat_number ) );?> |
|
53 | + <?php echo wp_sprintf(__('VAT Number: %s', 'invoicing'), sanitize_text_field($vat_number)); ?> |
|
54 | 54 | </div> |
55 | 55 | <?php } ?> |
56 | 56 | |
57 | - <?php do_action( 'getpaid_company_address_bottom' ); ?> |
|
57 | + <?php do_action('getpaid_company_address_bottom'); ?> |
|
58 | 58 | |
59 | 59 | </div> |
60 | 60 |
@@ -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(); |
@@ -21,41 +21,41 @@ discard block |
||
21 | 21 | |
22 | 22 | |
23 | 23 | <div class="invoice-billing-address-label col-2"> |
24 | - <strong><?php _e( 'To:', 'invoicing' ) ?></strong> |
|
24 | + <strong><?php _e('To:', 'invoicing') ?></strong> |
|
25 | 25 | </div> |
26 | 26 | |
27 | 27 | |
28 | 28 | <div class="invoice-billing-address-value col-10"> |
29 | 29 | |
30 | - <?php do_action( 'getpaid_billing_address_top' ); ?> |
|
30 | + <?php do_action('getpaid_billing_address_top'); ?> |
|
31 | 31 | |
32 | - <?php if ( ! empty( $address_row ) ) : ?> |
|
32 | + <?php if (!empty($address_row)) : ?> |
|
33 | 33 | <div class="billing-address"> |
34 | 34 | <?php echo $address_row; ?> |
35 | 35 | </div> |
36 | 36 | <?php endif; ?> |
37 | 37 | |
38 | 38 | |
39 | - <?php if ( ! empty( $phone ) ) : ?> |
|
39 | + <?php if (!empty($phone)) : ?> |
|
40 | 40 | <div class="billing-phone"> |
41 | - <?php echo wp_sprintf( __( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?> |
|
41 | + <?php echo wp_sprintf(__('Phone: %s', 'invoicing'), esc_html($phone)); ?> |
|
42 | 42 | </div> |
43 | 43 | <?php endif; ?> |
44 | 44 | |
45 | 45 | |
46 | - <?php if ( ! empty( $email ) ) : ?> |
|
46 | + <?php if (!empty($email)) : ?> |
|
47 | 47 | <div class="billing-email"> |
48 | - <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email ) ); ?> |
|
48 | + <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email)); ?> |
|
49 | 49 | </div> |
50 | 50 | <?php endif; ?> |
51 | 51 | |
52 | - <?php if ( ! empty( $vat_number ) ) : ?> |
|
52 | + <?php if (!empty($vat_number)) : ?> |
|
53 | 53 | <div class="vat-number"> |
54 | - <?php echo wp_sprintf( __( 'Vat Number: %s', 'invoicing' ), sanitize_text_field( $vat_number ) ); ?> |
|
54 | + <?php echo wp_sprintf(__('Vat Number: %s', 'invoicing'), sanitize_text_field($vat_number)); ?> |
|
55 | 55 | </div> |
56 | 56 | <?php endif; ?> |
57 | 57 | |
58 | - <?php do_action( 'getpaid_billing_address_bottom' ); ?> |
|
58 | + <?php do_action('getpaid_billing_address_bottom'); ?> |
|
59 | 59 | |
60 | 60 | </div> |
61 | 61 |
@@ -24,64 +24,64 @@ discard block |
||
24 | 24 | |
25 | 25 | <?php |
26 | 26 | |
27 | - // Fires before printing a line item column. |
|
28 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
27 | + // Fires before printing a line item column. |
|
28 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
29 | 29 | |
30 | - // Item name. |
|
31 | - if ( 'name' == $key ) { |
|
30 | + // Item name. |
|
31 | + if ( 'name' == $key ) { |
|
32 | 32 | |
33 | - // Display the name. |
|
34 | - echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>'; |
|
33 | + // Display the name. |
|
34 | + echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>'; |
|
35 | 35 | |
36 | - // And an optional description. |
|
36 | + // And an optional description. |
|
37 | 37 | $description = $item->get_description(); |
38 | 38 | |
39 | 39 | if ( ! empty( $description ) ) { |
40 | 40 | $description = wp_kses_post( $description ); |
41 | 41 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | - // Price help text. |
|
44 | + // Price help text. |
|
45 | 45 | $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
46 | 46 | if ( $description ) { |
47 | 47 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - // Item price. |
|
53 | - if ( 'price' == $key ) { |
|
52 | + // Item price. |
|
53 | + if ( 'price' == $key ) { |
|
54 | 54 | |
55 | - // Set the currency position. |
|
56 | - $position = wpinv_currency_position(); |
|
55 | + // Set the currency position. |
|
56 | + $position = wpinv_currency_position(); |
|
57 | 57 | |
58 | - if ( $position == 'left_space' ) { |
|
59 | - $position = 'left'; |
|
60 | - } |
|
58 | + if ( $position == 'left_space' ) { |
|
59 | + $position = 'left'; |
|
60 | + } |
|
61 | 61 | |
62 | - if ( $position == 'right_space' ) { |
|
63 | - $position = 'right'; |
|
64 | - } |
|
62 | + if ( $position == 'right_space' ) { |
|
63 | + $position = 'right'; |
|
64 | + } |
|
65 | 65 | |
66 | - if ( $item->user_can_set_their_price() ) { |
|
67 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
68 | - $minimum = (float) $item->get_minimum_price(); |
|
69 | - $validate_minimum = ''; |
|
70 | - $class = ''; |
|
71 | - $data_minimum = ''; |
|
66 | + if ( $item->user_can_set_their_price() ) { |
|
67 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
68 | + $minimum = (float) $item->get_minimum_price(); |
|
69 | + $validate_minimum = ''; |
|
70 | + $class = ''; |
|
71 | + $data_minimum = ''; |
|
72 | 72 | |
73 | - if ( $minimum > 0 ) { |
|
74 | - $validate_minimum = sprintf( |
|
75 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
76 | - sanitize_text_field( wpinv_price( $minimum, $currency ) ) |
|
77 | - ); |
|
73 | + if ( $minimum > 0 ) { |
|
74 | + $validate_minimum = sprintf( |
|
75 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
76 | + sanitize_text_field( wpinv_price( $minimum, $currency ) ) |
|
77 | + ); |
|
78 | 78 | |
79 | - $class = 'getpaid-validate-minimum-amount'; |
|
79 | + $class = 'getpaid-validate-minimum-amount'; |
|
80 | 80 | |
81 | - $data_minimum = "data-minimum-amount='$minimum'"; |
|
82 | - } |
|
81 | + $data_minimum = "data-minimum-amount='$minimum'"; |
|
82 | + } |
|
83 | 83 | |
84 | - ?> |
|
84 | + ?> |
|
85 | 85 | <div class="input-group input-group-sm"> |
86 | 86 | <?php if( 'left' == $position ) : ?> |
87 | 87 | <div class="input-group-prepend"> |
@@ -105,37 +105,37 @@ discard block |
||
105 | 105 | </div> |
106 | 106 | |
107 | 107 | <?php |
108 | - } else { |
|
109 | - echo wpinv_price( $item->get_price(), $currency ); |
|
110 | - ?> |
|
108 | + } else { |
|
109 | + echo wpinv_price( $item->get_price(), $currency ); |
|
110 | + ?> |
|
111 | 111 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
112 | 112 | <?php |
113 | - } |
|
114 | - } |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | - // Item quantity. |
|
117 | - if ( 'quantity' == $key ) { |
|
116 | + // Item quantity. |
|
117 | + if ( 'quantity' == $key ) { |
|
118 | 118 | |
119 | - if ( $item->allows_quantities() ) { |
|
120 | - ?> |
|
119 | + if ( $item->allows_quantities() ) { |
|
120 | + ?> |
|
121 | 121 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity(); ?>' min='1' required> |
122 | 122 | <?php |
123 | - } else { |
|
124 | - echo (float) $item->get_quantity(); |
|
125 | - echo ' '; |
|
126 | - ?> |
|
123 | + } else { |
|
124 | + echo (float) $item->get_quantity(); |
|
125 | + echo ' '; |
|
126 | + ?> |
|
127 | 127 | <input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'> |
128 | 128 | <?php |
129 | - } |
|
130 | - } |
|
129 | + } |
|
130 | + } |
|
131 | 131 | |
132 | - // Item sub total. |
|
133 | - if ( 'subtotal' == $key ) { |
|
134 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
135 | - } |
|
132 | + // Item sub total. |
|
133 | + if ( 'subtotal' == $key ) { |
|
134 | + echo wpinv_price( $item->get_sub_total(), $currency ); |
|
135 | + } |
|
136 | 136 | |
137 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
138 | - ?> |
|
137 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
138 | + ?> |
|
139 | 139 | |
140 | 140 | </div> |
141 | 141 |
@@ -7,116 +7,116 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -do_action( 'getpaid_before_payment_form_cart_item', $form, $item ); |
|
12 | +do_action('getpaid_before_payment_form_cart_item', $form, $item); |
|
13 | 13 | |
14 | 14 | $currency = $form->get_currency(); |
15 | 15 | |
16 | 16 | ?> |
17 | -<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'> |
|
17 | +<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'> |
|
18 | 18 | |
19 | 19 | <div class="form-row needs-validation"> |
20 | 20 | |
21 | - <?php foreach ( array_keys( $columns ) as $key ) : ?> |
|
21 | + <?php foreach (array_keys($columns) as $key) : ?> |
|
22 | 22 | |
23 | - <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo $item->get_id(); ?>"> |
|
23 | + <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo $item->get_id(); ?>"> |
|
24 | 24 | |
25 | 25 | <?php |
26 | 26 | |
27 | 27 | // Fires before printing a line item column. |
28 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
28 | + do_action("getpaid_form_cart_item_before_$key", $item, $form); |
|
29 | 29 | |
30 | 30 | // Item name. |
31 | - if ( 'name' == $key ) { |
|
31 | + if ('name' == $key) { |
|
32 | 32 | |
33 | 33 | // Display the name. |
34 | - echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>'; |
|
34 | + echo '<div class="mb-1">' . sanitize_text_field($item->get_name()) . '</div>'; |
|
35 | 35 | |
36 | 36 | // And an optional description. |
37 | 37 | $description = $item->get_description(); |
38 | 38 | |
39 | - if ( ! empty( $description ) ) { |
|
40 | - $description = wp_kses_post( $description ); |
|
39 | + if (!empty($description)) { |
|
40 | + $description = wp_kses_post($description); |
|
41 | 41 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
42 | 42 | } |
43 | 43 | |
44 | 44 | // Price help text. |
45 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
46 | - if ( $description ) { |
|
45 | + $description = getpaid_item_recurring_price_help_text($item, $currency); |
|
46 | + if ($description) { |
|
47 | 47 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
48 | 48 | } |
49 | 49 | |
50 | 50 | } |
51 | 51 | |
52 | 52 | // Item price. |
53 | - if ( 'price' == $key ) { |
|
53 | + if ('price' == $key) { |
|
54 | 54 | |
55 | 55 | // Set the currency position. |
56 | 56 | $position = wpinv_currency_position(); |
57 | 57 | |
58 | - if ( $position == 'left_space' ) { |
|
58 | + if ($position == 'left_space') { |
|
59 | 59 | $position = 'left'; |
60 | 60 | } |
61 | 61 | |
62 | - if ( $position == 'right_space' ) { |
|
62 | + if ($position == 'right_space') { |
|
63 | 63 | $position = 'right'; |
64 | 64 | } |
65 | 65 | |
66 | - if ( $item->user_can_set_their_price() ) { |
|
67 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
66 | + if ($item->user_can_set_their_price()) { |
|
67 | + $price = max((float) $item->get_price(), (float) $item->get_minimum_price()); |
|
68 | 68 | $minimum = (float) $item->get_minimum_price(); |
69 | 69 | $validate_minimum = ''; |
70 | 70 | $class = ''; |
71 | 71 | $data_minimum = ''; |
72 | 72 | |
73 | - if ( $minimum > 0 ) { |
|
73 | + if ($minimum > 0) { |
|
74 | 74 | $validate_minimum = sprintf( |
75 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
76 | - sanitize_text_field( wpinv_price( $minimum, $currency ) ) |
|
75 | + esc_attr__('The minimum allowed amount is %s', 'invoicing'), |
|
76 | + sanitize_text_field(wpinv_price($minimum, $currency)) |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | $class = 'getpaid-validate-minimum-amount'; |
80 | 80 | |
81 | - $data_minimum = "data-minimum-amount='$minimum'"; |
|
81 | + $data_minimum = "data-minimum-amount='$minimum'"; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | ?> |
85 | 85 | <div class="input-group input-group-sm"> |
86 | - <?php if( 'left' == $position ) : ?> |
|
86 | + <?php if ('left' == $position) : ?> |
|
87 | 87 | <div class="input-group-prepend"> |
88 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
88 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
89 | 89 | </div> |
90 | 90 | <?php endif; ?> |
91 | 91 | |
92 | - <input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo $price; ?>" placeholder="<?php echo esc_attr( $item->get_minimum_price() ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
92 | + <input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo $price; ?>" placeholder="<?php echo esc_attr($item->get_minimum_price()); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
93 | 93 | |
94 | - <?php if ( ! empty( $validate_minimum ) ) : ?> |
|
94 | + <?php if (!empty($validate_minimum)) : ?> |
|
95 | 95 | <div class="invalid-tooltip"> |
96 | 96 | <?php echo $validate_minimum; ?> |
97 | 97 | </div> |
98 | 98 | <?php endif; ?> |
99 | 99 | |
100 | - <?php if( 'left' != $position ) : ?> |
|
100 | + <?php if ('left' != $position) : ?> |
|
101 | 101 | <div class="input-group-append"> |
102 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
102 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
103 | 103 | </div> |
104 | 104 | <?php endif; ?> |
105 | 105 | </div> |
106 | 106 | |
107 | 107 | <?php |
108 | 108 | } else { |
109 | - echo wpinv_price( $item->get_price(), $currency ); |
|
109 | + echo wpinv_price($item->get_price(), $currency); |
|
110 | 110 | ?> |
111 | - <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
|
111 | + <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'> |
|
112 | 112 | <?php |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // Item quantity. |
117 | - if ( 'quantity' == $key ) { |
|
117 | + if ('quantity' == $key) { |
|
118 | 118 | |
119 | - if ( $item->allows_quantities() ) { |
|
119 | + if ($item->allows_quantities()) { |
|
120 | 120 | ?> |
121 | 121 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity(); ?>' min='1' required> |
122 | 122 | <?php |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | // Item sub total. |
133 | - if ( 'subtotal' == $key ) { |
|
134 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
133 | + if ('subtotal' == $key) { |
|
134 | + echo wpinv_price($item->get_sub_total(), $currency); |
|
135 | 135 | } |
136 | 136 | |
137 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
137 | + do_action("getpaid_payment_form_cart_item_$key", $item, $form); |
|
138 | 138 | ?> |
139 | 139 | |
140 | 140 | </div> |
@@ -145,4 +145,4 @@ discard block |
||
145 | 145 | |
146 | 146 | </div> |
147 | 147 | <?php |
148 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
148 | +do_action('getpaid_payment_form_cart_item', $form, $item); |