@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Gateways' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Gateways')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Gateways. |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'gateways'; |
30 | - $this->label = esc_html__( 'Payment Gateways', 'give' ); |
|
30 | + $this->label = esc_html__('Payment Gateways', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'gateways-settings'; |
33 | 33 | |
34 | 34 | parent::__construct(); |
35 | 35 | |
36 | 36 | // Do not use main form for this tab. |
37 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
38 | - add_action( 'give_admin_field_enabled_gateways', array( $this, 'render_enabled_gateways' ), 10, 2 ); |
|
37 | + if (give_get_current_setting_tab() === $this->id) { |
|
38 | + add_action('give_admin_field_enabled_gateways', array($this, 'render_enabled_gateways'), 10, 2); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $settings = array(); |
50 | 50 | $current_section = give_get_current_setting_section(); |
51 | 51 | |
52 | - switch ( $current_section ) { |
|
52 | + switch ($current_section) { |
|
53 | 53 | case 'paypal-standard': |
54 | 54 | $settings = array( |
55 | 55 | // Section 2: PayPal Standard. |
@@ -58,55 +58,55 @@ discard block |
||
58 | 58 | 'id' => 'give_title_gateway_settings_2', |
59 | 59 | ), |
60 | 60 | array( |
61 | - 'name' => __( 'PayPal Email', 'give' ), |
|
62 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
61 | + 'name' => __('PayPal Email', 'give'), |
|
62 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
63 | 63 | 'id' => 'paypal_email', |
64 | 64 | 'type' => 'email', |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
68 | - 'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ), |
|
67 | + 'name' => __('PayPal Page Style', 'give'), |
|
68 | + 'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'), |
|
69 | 69 | 'id' => 'paypal_page_style', |
70 | 70 | 'type' => 'text', |
71 | 71 | ), |
72 | 72 | array( |
73 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
74 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
73 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
74 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
75 | 75 | 'id' => 'paypal_button_type', |
76 | 76 | 'type' => 'radio_inline', |
77 | 77 | 'options' => array( |
78 | - 'donation' => __( 'Donation', 'give' ), |
|
79 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
78 | + 'donation' => __('Donation', 'give'), |
|
79 | + 'standard' => __('Standard Transaction', 'give') |
|
80 | 80 | ), |
81 | 81 | 'default' => 'donation', |
82 | 82 | ), |
83 | 83 | array( |
84 | - 'name' => __( 'Billing Details', 'give' ), |
|
85 | - 'desc' => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ), |
|
84 | + 'name' => __('Billing Details', 'give'), |
|
85 | + 'desc' => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'), |
|
86 | 86 | 'id' => 'paypal_standard_billing_details', |
87 | 87 | 'type' => 'radio_inline', |
88 | 88 | 'default' => 'disabled', |
89 | 89 | 'options' => array( |
90 | - 'enabled' => __( 'Enabled', 'give' ), |
|
91 | - 'disabled' => __( 'Disabled', 'give' ), |
|
90 | + 'enabled' => __('Enabled', 'give'), |
|
91 | + 'disabled' => __('Disabled', 'give'), |
|
92 | 92 | ) |
93 | 93 | ), |
94 | 94 | array( |
95 | - 'name' => __( 'PayPal IPN Verification', 'give' ), |
|
96 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
95 | + 'name' => __('PayPal IPN Verification', 'give'), |
|
96 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
97 | 97 | 'id' => 'paypal_verification', |
98 | 98 | 'type' => 'radio_inline', |
99 | 99 | 'default' => 'enabled', |
100 | 100 | 'options' => array( |
101 | - 'enabled' => __( 'Enabled', 'give' ), |
|
102 | - 'disabled' => __( 'Disabled', 'give' ), |
|
101 | + 'enabled' => __('Enabled', 'give'), |
|
102 | + 'disabled' => __('Disabled', 'give'), |
|
103 | 103 | ) |
104 | 104 | ), |
105 | 105 | array( |
106 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
106 | + 'name' => __('PayPal Standard Gateway Settings Docs Link', 'give'), |
|
107 | 107 | 'id' => 'paypal_standard_gateway_settings_docs_link', |
108 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
109 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
108 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'), |
|
109 | + 'title' => __('PayPal Standard Gateway Settings', 'give'), |
|
110 | 110 | 'type' => 'give_docs_link', |
111 | 111 | ), |
112 | 112 | array( |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | 'id' => 'give_title_gateway_settings_3', |
125 | 125 | ), |
126 | 126 | array( |
127 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
128 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
127 | + 'name' => __('Collect Billing Details', 'give'), |
|
128 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
129 | 129 | 'id' => 'give_offline_donation_enable_billing_fields', |
130 | 130 | 'type' => 'radio_inline', |
131 | 131 | 'default' => 'disabled', |
132 | 132 | 'options' => array( |
133 | - 'enabled' => __( 'Enabled', 'give' ), |
|
134 | - 'disabled' => __( 'Disabled', 'give' ) |
|
133 | + 'enabled' => __('Enabled', 'give'), |
|
134 | + 'disabled' => __('Disabled', 'give') |
|
135 | 135 | ) |
136 | 136 | ), |
137 | 137 | array( |
138 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
139 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
138 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
139 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
140 | 140 | 'id' => 'global_offline_donation_content', |
141 | 141 | 'default' => give_get_default_offline_donation_content(), |
142 | 142 | 'type' => 'wysiwyg', |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | ) |
146 | 146 | ), |
147 | 147 | array( |
148 | - 'name' => esc_html__( 'Offline Donations Settings Docs Link', 'give' ), |
|
148 | + 'name' => esc_html__('Offline Donations Settings Docs Link', 'give'), |
|
149 | 149 | 'id' => 'offline_gateway_settings_docs_link', |
150 | - 'url' => esc_url( 'http://docs.givewp.com/offlinegateway' ), |
|
151 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
150 | + 'url' => esc_url('http://docs.givewp.com/offlinegateway'), |
|
151 | + 'title' => __('Offline Gateway Settings', 'give'), |
|
152 | 152 | 'type' => 'give_docs_link', |
153 | 153 | ), |
154 | 154 | array( |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | 'type' => 'title' |
167 | 167 | ), |
168 | 168 | array( |
169 | - 'name' => __( 'Test Mode', 'give' ), |
|
170 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
169 | + 'name' => __('Test Mode', 'give'), |
|
170 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
171 | 171 | 'id' => 'test_mode', |
172 | 172 | 'type' => 'radio_inline', |
173 | 173 | 'default' => 'disabled', |
174 | 174 | 'options' => array( |
175 | - 'enabled' => __( 'Enabled', 'give' ), |
|
176 | - 'disabled' => __( 'Disabled', 'give' ), |
|
175 | + 'enabled' => __('Enabled', 'give'), |
|
176 | + 'disabled' => __('Disabled', 'give'), |
|
177 | 177 | ) |
178 | 178 | ), |
179 | 179 | array( |
180 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
181 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
180 | + 'name' => __('Enabled Gateways', 'give'), |
|
181 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
182 | 182 | 'id' => 'gateways', |
183 | 183 | 'type' => 'enabled_gateways' |
184 | 184 | ), |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * This setting will not render on admin setting screen but help internal code to recognize "gateways_label" setting and add them to give setting when save. |
191 | 191 | */ |
192 | 192 | array( |
193 | - 'name' => __( 'Gateways Label', 'give' ), |
|
193 | + 'name' => __('Gateways Label', 'give'), |
|
194 | 194 | 'desc' => '', |
195 | 195 | 'id' => 'gateways_label', |
196 | 196 | 'type' => 'gateways_label_hidden' |
@@ -203,17 +203,17 @@ discard block |
||
203 | 203 | * This setting will not render on admin setting screen but help internal code to recognize "default_gateway" setting and add them to give setting when save. |
204 | 204 | */ |
205 | 205 | array( |
206 | - 'name' => __( 'Default Gateway', 'give' ), |
|
207 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
206 | + 'name' => __('Default Gateway', 'give'), |
|
207 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
208 | 208 | 'id' => 'default_gateway', |
209 | 209 | 'type' => 'default_gateway_hidden' |
210 | 210 | ), |
211 | 211 | |
212 | 212 | array( |
213 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
213 | + 'name' => __('Gateways Docs Link', 'give'), |
|
214 | 214 | 'id' => 'gateway_settings_docs_link', |
215 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
216 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
215 | + 'url' => esc_url('http://docs.givewp.com/settings-gateways'), |
|
216 | + 'title' => __('Gateway Settings', 'give'), |
|
217 | 217 | 'type' => 'give_docs_link', |
218 | 218 | ), |
219 | 219 | array( |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * Filter the payment gateways settings. |
229 | 229 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
230 | 230 | */ |
231 | - $settings = apply_filters( 'give_settings_gateways', $settings ); |
|
231 | + $settings = apply_filters('give_settings_gateways', $settings); |
|
232 | 232 | |
233 | 233 | /** |
234 | 234 | * Filter the settings. |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @param array $settings |
239 | 239 | */ |
240 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
240 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
241 | 241 | |
242 | 242 | // Output. |
243 | 243 | return $settings; |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function get_sections() { |
253 | 253 | $sections = array( |
254 | - 'gateways-settings' => __( 'Gateways', 'give' ), |
|
255 | - 'paypal-standard' => __( 'PayPal Standard', 'give' ), |
|
256 | - 'offline-donations' => __( 'Offline Donations', 'give' ) |
|
254 | + 'gateways-settings' => __('Gateways', 'give'), |
|
255 | + 'paypal-standard' => __('PayPal Standard', 'give'), |
|
256 | + 'offline-donations' => __('Offline Donations', 'give') |
|
257 | 257 | ); |
258 | 258 | |
259 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
259 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @param $field |
270 | 270 | * @param $settings |
271 | 271 | */ |
272 | - public function render_enabled_gateways( $field, $settings ) { |
|
272 | + public function render_enabled_gateways($field, $settings) { |
|
273 | 273 | $id = $field['id']; |
274 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
275 | - $gateways_label = give_get_option( 'gateways_label', array() ); |
|
276 | - $default_gateway = give_get_option( 'default_gateway', current( array_keys( $gateways ) ) ); |
|
274 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
275 | + $gateways_label = give_get_option('gateways_label', array()); |
|
276 | + $default_gateway = give_get_option('default_gateway', current(array_keys($gateways))); |
|
277 | 277 | |
278 | 278 | ob_start(); |
279 | 279 | |
@@ -288,51 +288,51 @@ discard block |
||
288 | 288 | <span>%3$s</span> |
289 | 289 | <span>%4$s</span> |
290 | 290 | ', |
291 | - __( 'Gateway', 'give' ), |
|
292 | - __( 'Label', 'give' ), |
|
293 | - __( 'Default', 'give' ), |
|
294 | - __( 'Enabled', 'give' ) |
|
291 | + __('Gateway', 'give'), |
|
292 | + __('Label', 'give'), |
|
293 | + __('Default', 'give'), |
|
294 | + __('Enabled', 'give') |
|
295 | 295 | ); |
296 | 296 | echo '</div>'; |
297 | 297 | |
298 | 298 | echo '<ul class="give-checklist-fields give-payment-gatways-list">'; |
299 | - foreach ( $gateways as $key => $option ) : |
|
299 | + foreach ($gateways as $key => $option) : |
|
300 | 300 | $enabled = null; |
301 | - if ( is_array( $settings ) && array_key_exists( $key, $settings ) ) { |
|
301 | + if (is_array($settings) && array_key_exists($key, $settings)) { |
|
302 | 302 | $enabled = '1'; |
303 | 303 | } |
304 | 304 | |
305 | 305 | echo '<li>'; |
306 | - printf( '<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>' ); |
|
307 | - printf( '<span class="admin-label">%s</span>', esc_html( $option['admin_label'] ) ); |
|
306 | + printf('<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>'); |
|
307 | + printf('<span class="admin-label">%s</span>', esc_html($option['admin_label'])); |
|
308 | 308 | |
309 | 309 | $label = ''; |
310 | - if ( ! empty( $gateways_label[ $key ] ) ) { |
|
311 | - $label = $gateways_label[ $key ]; |
|
310 | + if ( ! empty($gateways_label[$key])) { |
|
311 | + $label = $gateways_label[$key]; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | printf( |
315 | 315 | '<input class="checkout-label" type="text" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" placeholder="%4$s"/>', |
316 | 316 | 'gateways_label', |
317 | - esc_attr( $key ), |
|
318 | - esc_html( $label ), |
|
319 | - esc_html( $option['checkout_label'] ) |
|
317 | + esc_attr($key), |
|
318 | + esc_html($label), |
|
319 | + esc_html($option['checkout_label']) |
|
320 | 320 | ); |
321 | 321 | |
322 | 322 | printf( |
323 | 323 | '<input class="gateways-radio" type="radio" name="%1$s" value="%2$s" %3$s %4$s>', |
324 | 324 | 'default_gateway', |
325 | 325 | $key, |
326 | - checked( $key, $default_gateway, false ), |
|
327 | - disabled( NULL, $enabled, false ) |
|
326 | + checked($key, $default_gateway, false), |
|
327 | + disabled(NULL, $enabled, false) |
|
328 | 328 | ); |
329 | 329 | |
330 | 330 | printf( |
331 | 331 | '<input class="gateways-checkbox" name="%1$s[%2$s]" id="%1$s[%2$s]" type="checkbox" value="1" %3$s data-payment-gateway="%4$s"/>', |
332 | - esc_attr( $id ), |
|
333 | - esc_attr( $key ), |
|
334 | - checked( '1', $enabled, false ), |
|
335 | - esc_html( $option['admin_label'] ) |
|
332 | + esc_attr($id), |
|
333 | + esc_attr($key), |
|
334 | + checked('1', $enabled, false), |
|
335 | + esc_html($option['admin_label']) |
|
336 | 336 | ); |
337 | 337 | echo '</li>'; |
338 | 338 | endforeach; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function admin_menus() { |
52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
53 | 53 | |
54 | 54 | // About Page |
55 | 55 | add_dashboard_page( |
56 | 56 | /* translators: %s: Give version */ |
57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
58 | + esc_html__('Welcome to Give', 'give'), |
|
59 | 59 | $this->minimum_capability, |
60 | 60 | 'give-about', |
61 | - array( $this, 'about_screen' ) |
|
61 | + array($this, 'about_screen') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Changelog Page |
65 | 65 | add_dashboard_page( |
66 | - esc_html__( 'Give Changelog', 'give' ), |
|
67 | - esc_html__( 'Give Changelog', 'give' ), |
|
66 | + esc_html__('Give Changelog', 'give'), |
|
67 | + esc_html__('Give Changelog', 'give'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'give-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Getting Started Page |
74 | 74 | add_dashboard_page( |
75 | 75 | /* translators: %s: Give version */ |
76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
77 | + esc_html__('Getting started with Give', 'give'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'give-getting-started', |
80 | - array( $this, 'getting_started_screen' ) |
|
80 | + array($this, 'getting_started_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Credits Page |
84 | 84 | add_dashboard_page( |
85 | 85 | /* translators: %s: Give version */ |
86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
87 | - esc_html__( 'The people that build Give', 'give' ), |
|
86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
87 | + esc_html__('The people that build Give', 'give'), |
|
88 | 88 | $this->minimum_capability, |
89 | 89 | 'give-credits', |
90 | - array( $this, 'credits_screen' ) |
|
90 | + array($this, 'credits_screen') |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function admin_head() { |
102 | 102 | |
103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
103 | + remove_submenu_page('index.php', 'give-about'); |
|
104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
106 | + remove_submenu_page('index.php', 'give-credits'); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | * @return void |
116 | 116 | */ |
117 | 117 | public function tabs() { |
118 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
118 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
119 | 119 | ?> |
120 | 120 | <h2 class="nav-tab-wrapper"> |
121 | 121 | <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" |
122 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
123 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
122 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
123 | + <?php esc_html_e('About Give', 'give'); ?> |
|
124 | 124 | </a> |
125 | 125 | <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" |
126 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
127 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
126 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
127 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
128 | 128 | </a> |
129 | 129 | <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" |
130 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
131 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
130 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
131 | + <?php esc_html_e('Credits', 'give'); ?> |
|
132 | 132 | </a> |
133 | 133 | <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" |
134 | - href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
135 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
134 | + href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
135 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
136 | 136 | </a> |
137 | 137 | </h2> |
138 | 138 | <?php |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | public function about_screen() { |
149 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
149 | + list($display_version) = explode('-', GIVE_VERSION); |
|
150 | 150 | ?> |
151 | 151 | <div class="wrap about-wrap"> |
152 | 152 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | <p class="about-text"><?php |
156 | 156 | printf( |
157 | 157 | /* translators: %s: http://docs.givewp.com/docs */ |
158 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
159 | - esc_url( 'http://docs.givewp.com/docs' ) |
|
158 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
159 | + esc_url('http://docs.givewp.com/docs') |
|
160 | 160 | ); |
161 | 161 | ?></p> |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <div class="give-badge"><?php |
166 | 166 | printf( |
167 | 167 | /* translators: %s: Give version */ |
168 | - esc_html__( 'Version %s', 'give' ), |
|
168 | + esc_html__('Version %s', 'give'), |
|
169 | 169 | $display_version |
170 | 170 | ); |
171 | 171 | ?></div> |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | <div class="feature-section clearfix introduction"> |
176 | 176 | |
177 | 177 | <div class="video feature-section-item"> |
178 | - <img src="<?php echo GIVE_PLUGIN_URL . 'assets/dist/images/give-logo-photo-mashup.png' ?>" |
|
179 | - alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
178 | + <img src="<?php echo GIVE_PLUGIN_URL.'assets/dist/images/give-logo-photo-mashup.png' ?>" |
|
179 | + alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
180 | 180 | </div> |
181 | 181 | |
182 | 182 | <div class="content feature-section-item last-feature"> |
183 | 183 | |
184 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
184 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
185 | 185 | |
186 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
186 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
187 | 187 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
188 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
188 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
189 | 189 | <span class="dashicons dashicons-external"></span> |
190 | 190 | </a> |
191 | 191 | |
@@ -198,25 +198,25 @@ discard block |
||
198 | 198 | |
199 | 199 | <div class="content feature-section-item"> |
200 | 200 | |
201 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
201 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
202 | 202 | |
203 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
203 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
204 | 204 | |
205 | 205 | <h4>Find Out More:</h4> |
206 | 206 | <ul class="ul-disc"> |
207 | 207 | <li><a href="https://givewp.com/" |
208 | - target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li> |
|
208 | + target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li> |
|
209 | 209 | <li><a href="https://givewp.com/features/" |
210 | - target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li> |
|
210 | + target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li> |
|
211 | 211 | <li><a href="https://givewp.com/documentation/" |
212 | - target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li> |
|
212 | + target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li> |
|
213 | 213 | </ul> |
214 | 214 | |
215 | 215 | </div> |
216 | 216 | |
217 | 217 | <div class="content feature-section-item last-feature"> |
218 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/dist/images/admin/give-form-mockup.png' ?>" |
|
219 | - alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
218 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/dist/images/admin/give-form-mockup.png' ?>" |
|
219 | + alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
220 | 220 | </div> |
221 | 221 | |
222 | 222 | </div> |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @return void |
236 | 236 | */ |
237 | 237 | public function changelog_screen() { |
238 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
238 | + list($display_version) = explode('-', GIVE_VERSION); |
|
239 | 239 | ?> |
240 | 240 | <div class="wrap about-wrap"> |
241 | 241 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | <p class="about-text"><?php |
244 | 244 | printf( |
245 | 245 | /* translators: %s: Give version */ |
246 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
246 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
247 | 247 | $display_version |
248 | 248 | ); |
249 | 249 | ?></p> |
250 | 250 | <div class="give-badge"><?php |
251 | 251 | printf( |
252 | 252 | /* translators: %s: Give version */ |
253 | - esc_html__( 'Version %s', 'give' ), |
|
253 | + esc_html__('Version %s', 'give'), |
|
254 | 254 | $display_version |
255 | 255 | ); |
256 | 256 | ?></div> |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | <?php $this->tabs(); ?> |
259 | 259 | |
260 | 260 | <div class="changelog"> |
261 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
261 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
262 | 262 | |
263 | 263 | <div class="feature-section"> |
264 | 264 | <?php echo $this->parse_readme(); ?> |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | </div> |
267 | 267 | |
268 | 268 | <div class="return-to-dashboard"> |
269 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
269 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
270 | 270 | 'post_type' => 'give_forms', |
271 | 271 | 'page' => 'give-settings' |
272 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
272 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
273 | 273 | </div> |
274 | 274 | </div> |
275 | 275 | <?php |
@@ -283,36 +283,36 @@ discard block |
||
283 | 283 | * @return void |
284 | 284 | */ |
285 | 285 | public function getting_started_screen() { |
286 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
286 | + list($display_version) = explode('-', GIVE_VERSION); |
|
287 | 287 | ?> |
288 | 288 | <div class="wrap about-wrap get-started"> |
289 | 289 | |
290 | 290 | <?php $this->get_welcome_header() ?> |
291 | 291 | |
292 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
292 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
293 | 293 | |
294 | 294 | <?php give_get_newsletter(); ?> |
295 | 295 | |
296 | 296 | <div class="give-badge"><?php |
297 | 297 | printf( |
298 | 298 | /* translators: %s: Give version */ |
299 | - esc_html__( 'Version %s', 'give' ), |
|
299 | + esc_html__('Version %s', 'give'), |
|
300 | 300 | $display_version |
301 | 301 | ); |
302 | 302 | ?></div> |
303 | 303 | |
304 | 304 | <?php $this->tabs(); ?> |
305 | 305 | |
306 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
306 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
307 | 307 | |
308 | 308 | <div class="feature-section clearfix"> |
309 | 309 | |
310 | 310 | <div class="content feature-section-item"> |
311 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
311 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
312 | 312 | |
313 | - <p><?php esc_html_e( 'Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p> |
|
313 | + <p><?php esc_html_e('Give is driven by its powerful donation form building features. However, it is much more than just a "donation form." From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p> |
|
314 | 314 | |
315 | - <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give' ); ?></p> |
|
315 | + <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form."', 'give'); ?></p> |
|
316 | 316 | </div> |
317 | 317 | |
318 | 318 | <div class="content feature-section-item last-feature"> |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | </div> |
330 | 330 | |
331 | 331 | <div class="content feature-section-item last-feature"> |
332 | - <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3> |
|
332 | + <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3> |
|
333 | 333 | |
334 | - <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p> |
|
334 | + <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p> |
|
335 | 335 | </div> |
336 | 336 | |
337 | 337 | </div> |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | <div class="feature-section clearfix"> |
341 | 341 | |
342 | 342 | <div class="content feature-section-item add-content"> |
343 | - <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3> |
|
343 | + <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3> |
|
344 | 344 | |
345 | - <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p> |
|
345 | + <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p> |
|
346 | 346 | |
347 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
347 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
348 | 348 | </div> |
349 | 349 | |
350 | 350 | <div class="content feature-section-item last-feature"> |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | </div> |
362 | 362 | |
363 | 363 | <div class="content feature-section-item last-feature"> |
364 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
364 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
365 | 365 | |
366 | - <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p> |
|
366 | + <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p> |
|
367 | 367 | </div> |
368 | 368 | |
369 | 369 | |
@@ -383,20 +383,20 @@ discard block |
||
383 | 383 | * @return void |
384 | 384 | */ |
385 | 385 | public function credits_screen() { |
386 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
386 | + list($display_version) = explode('-', GIVE_VERSION); |
|
387 | 387 | ?> |
388 | 388 | <div class="wrap about-wrap"> |
389 | 389 | |
390 | 390 | <?php $this->get_welcome_header() ?> |
391 | 391 | |
392 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
392 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
393 | 393 | |
394 | 394 | <?php give_get_newsletter(); ?> |
395 | 395 | |
396 | 396 | <div class="give-badge"><?php |
397 | 397 | printf( |
398 | 398 | /* translators: %s: Give version */ |
399 | - esc_html__( 'Version %s', 'give' ), |
|
399 | + esc_html__('Version %s', 'give'), |
|
400 | 400 | $display_version |
401 | 401 | ); |
402 | 402 | ?></div> |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | <p class="about-description"><?php |
407 | 407 | printf( |
408 | 408 | /* translators: %s: https://github.com/WordImpress/give */ |
409 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
410 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
409 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
410 | + esc_url('https://github.com/WordImpress/give') |
|
411 | 411 | ); |
412 | 412 | ?></p> |
413 | 413 | |
@@ -424,21 +424,21 @@ discard block |
||
424 | 424 | * @return string $readme HTML formatted readme file |
425 | 425 | */ |
426 | 426 | public function parse_readme() { |
427 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
427 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
428 | 428 | |
429 | - if ( ! $file ) { |
|
430 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
429 | + if ( ! $file) { |
|
430 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
431 | 431 | } else { |
432 | - $readme = file_get_contents( $file ); |
|
433 | - $readme = nl2br( esc_html( $readme ) ); |
|
434 | - $readme = explode( '== Changelog ==', $readme ); |
|
435 | - $readme = end( $readme ); |
|
436 | - |
|
437 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
438 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
439 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
440 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
441 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
432 | + $readme = file_get_contents($file); |
|
433 | + $readme = nl2br(esc_html($readme)); |
|
434 | + $readme = explode('== Changelog ==', $readme); |
|
435 | + $readme = end($readme); |
|
436 | + |
|
437 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
438 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
439 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
440 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
441 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | return $readme; |
@@ -455,24 +455,24 @@ discard block |
||
455 | 455 | public function contributors() { |
456 | 456 | $contributors = $this->get_contributors(); |
457 | 457 | |
458 | - if ( empty( $contributors ) ) { |
|
458 | + if (empty($contributors)) { |
|
459 | 459 | return ''; |
460 | 460 | } |
461 | 461 | |
462 | 462 | $contributor_list = '<ul class="wp-people-group">'; |
463 | 463 | |
464 | - foreach ( $contributors as $contributor ) { |
|
464 | + foreach ($contributors as $contributor) { |
|
465 | 465 | $contributor_list .= '<li class="wp-person">'; |
466 | 466 | $contributor_list .= sprintf( |
467 | 467 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
468 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
469 | - esc_url( $contributor->avatar_url ), |
|
470 | - esc_attr( $contributor->login ) |
|
468 | + esc_url('https://github.com/'.$contributor->login), |
|
469 | + esc_url($contributor->avatar_url), |
|
470 | + esc_attr($contributor->login) |
|
471 | 471 | ); |
472 | 472 | $contributor_list .= sprintf( |
473 | 473 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
474 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
475 | - esc_html( $contributor->login ) |
|
474 | + esc_url('https://github.com/'.$contributor->login), |
|
475 | + esc_html($contributor->login) |
|
476 | 476 | ); |
477 | 477 | $contributor_list .= '</li>'; |
478 | 478 | } |
@@ -490,25 +490,25 @@ discard block |
||
490 | 490 | * @return array $contributors List of contributors |
491 | 491 | */ |
492 | 492 | public function get_contributors() { |
493 | - $contributors = Give_Cache::get( 'give_contributors', true ); |
|
493 | + $contributors = Give_Cache::get('give_contributors', true); |
|
494 | 494 | |
495 | - if ( false !== $contributors ) { |
|
495 | + if (false !== $contributors) { |
|
496 | 496 | return $contributors; |
497 | 497 | } |
498 | 498 | |
499 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
499 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
500 | 500 | |
501 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
501 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
502 | 502 | return array(); |
503 | 503 | } |
504 | 504 | |
505 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
505 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
506 | 506 | |
507 | - if ( ! is_array( $contributors ) ) { |
|
507 | + if ( ! is_array($contributors)) { |
|
508 | 508 | return array(); |
509 | 509 | } |
510 | 510 | |
511 | - Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true ); |
|
511 | + Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true); |
|
512 | 512 | |
513 | 513 | return $contributors; |
514 | 514 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | public function get_welcome_header() { |
522 | 522 | // Badge for welcome page |
523 | - $badge_url = GIVE_PLUGIN_URL . 'assets/dist/images/give-badge.png'; |
|
523 | + $badge_url = GIVE_PLUGIN_URL.'assets/dist/images/give-badge.png'; |
|
524 | 524 | ?> |
525 | 525 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
526 | 526 | <?php $this->social_media_elements(); ?> |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
614 | 614 | printf( |
615 | 615 | /* translators: %s: Give twitter user @givewp */ |
616 | - esc_html_e( 'Follow %s', 'give' ), |
|
616 | + esc_html_e('Follow %s', 'give'), |
|
617 | 617 | '@givewp' |
618 | 618 | ); |
619 | 619 | ?></a> |
@@ -647,27 +647,27 @@ discard block |
||
647 | 647 | public function welcome() { |
648 | 648 | |
649 | 649 | // Bail if no activation redirect |
650 | - if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) { |
|
650 | + if ( ! Give_Cache::get('_give_activation_redirect', true) || wp_doing_ajax()) { |
|
651 | 651 | return; |
652 | 652 | } |
653 | 653 | |
654 | 654 | // Delete the redirect transient |
655 | - Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) ); |
|
655 | + Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect')); |
|
656 | 656 | |
657 | 657 | // Bail if activating from network, or bulk |
658 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
658 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
659 | 659 | return; |
660 | 660 | } |
661 | 661 | |
662 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
662 | + $upgrade = get_option('give_version_upgraded_from'); |
|
663 | 663 | |
664 | - if ( ! $upgrade ) { // First time install |
|
665 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
664 | + if ( ! $upgrade) { // First time install |
|
665 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
666 | 666 | exit; |
667 | - } elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings |
|
667 | + } elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings |
|
668 | 668 | |
669 | 669 | } else { // Welcome is NOT disabled in settings |
670 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
670 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
671 | 671 | exit; |
672 | 672 | } |
673 | 673 | } |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * @access public |
37 | 37 | */ |
38 | 38 | public function __construct() { |
39 | - parent::__construct( array( |
|
40 | - 'singular' => __( 'Give Email Notification', 'give' ), |
|
41 | - 'plural' => __( 'Give Email Notifications', 'give' ), |
|
42 | - ) ); |
|
39 | + parent::__construct(array( |
|
40 | + 'singular' => __('Give Email Notification', 'give'), |
|
41 | + 'plural' => __('Give Email Notifications', 'give'), |
|
42 | + )); |
|
43 | 43 | |
44 | 44 | $this->email_notifications = Give_Email_Notifications::get_instance(); |
45 | 45 | } |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @since 2.0 |
61 | 61 | */ |
62 | - return apply_filters( 'give_email_notification_setting_columns', array( |
|
63 | - 'cb' => __( 'Email Status', 'give' ), |
|
64 | - 'name' => __( 'Email', 'give' ), |
|
65 | - 'email_type' => __( 'Content Type', 'give' ), |
|
66 | - 'recipient' => __( 'Recipient(s)', 'give' ), |
|
67 | - 'setting' => __( 'Edit Email', 'give' ), |
|
68 | - ) ); |
|
62 | + return apply_filters('give_email_notification_setting_columns', array( |
|
63 | + 'cb' => __('Email Status', 'give'), |
|
64 | + 'name' => __('Email', 'give'), |
|
65 | + 'email_type' => __('Content Type', 'give'), |
|
66 | + 'recipient' => __('Recipient(s)', 'give'), |
|
67 | + 'setting' => __('Edit Email', 'give'), |
|
68 | + )); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - public function column_name( $email ) { |
|
82 | - $edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ); |
|
83 | - $actions = $this->get_row_actions( $email ); |
|
81 | + public function column_name($email) { |
|
82 | + $edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])); |
|
83 | + $actions = $this->get_row_actions($email); |
|
84 | 84 | |
85 | 85 | ob_start(); |
86 | 86 | ?> |
87 | 87 | <a class="row-title" href="<?php echo $edit_url; ?>"><?php echo $email->config['label']; ?></a> |
88 | 88 | |
89 | - <?php if ( $desc = $email->config['description'] ) : ?> |
|
90 | - <?php echo Give()->tooltips->render_help( esc_attr( $desc ) ); ?> |
|
89 | + <?php if ($desc = $email->config['description']) : ?> |
|
90 | + <?php echo Give()->tooltips->render_help(esc_attr($desc)); ?> |
|
91 | 91 | <?php endif; ?> |
92 | 92 | |
93 | - <?php echo $this->row_actions( $actions ); ?> |
|
93 | + <?php echo $this->row_actions($actions); ?> |
|
94 | 94 | <?php |
95 | 95 | return ob_get_clean(); |
96 | 96 | } |
@@ -105,18 +105,18 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function column_recipient( $email ) { |
|
108 | + public function column_recipient($email) { |
|
109 | 109 | ob_start(); |
110 | 110 | |
111 | - if( Give_Email_Notification_Util::has_recipient_field( $email ) ) { |
|
111 | + if (Give_Email_Notification_Util::has_recipient_field($email)) { |
|
112 | 112 | $recipients = $email->get_recipient(); |
113 | - if ( is_array( $recipients ) ) { |
|
114 | - $recipients = implode( '<br>', $recipients ); |
|
113 | + if (is_array($recipients)) { |
|
114 | + $recipients = implode('<br>', $recipients); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | echo $recipients; |
118 | 118 | |
119 | - } elseif ( ! empty( $email->config['recipient_group_name'] ) ) { |
|
119 | + } elseif ( ! empty($email->config['recipient_group_name'])) { |
|
120 | 120 | echo $email->config['recipient_group_name']; |
121 | 121 | } |
122 | 122 | |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return string |
135 | 135 | */ |
136 | - public function column_cb( $email ) { |
|
136 | + public function column_cb($email) { |
|
137 | 137 | $notification_status = $email->get_notification_status(); |
138 | - $user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable( $email ); |
|
139 | - $icon_classes = Give_Email_Notification_Util::is_email_notification_active( $email ) |
|
138 | + $user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable($email); |
|
139 | + $icon_classes = Give_Email_Notification_Util::is_email_notification_active($email) |
|
140 | 140 | ? 'dashicons dashicons-yes' |
141 | 141 | : 'dashicons dashicons-no-alt'; |
142 | 142 | $attributes = array( |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | 'data-edit' => $user_can_edit_status, |
147 | 147 | ); |
148 | 148 | |
149 | - if ( ! $user_can_edit_status ) { |
|
150 | - $icon_classes = 'dashicons dashicons-lock'; |
|
149 | + if ( ! $user_can_edit_status) { |
|
150 | + $icon_classes = 'dashicons dashicons-lock'; |
|
151 | 151 | |
152 | - $attributes['data-notice'] = esc_attr( $email->config['notices']['non-notification-status-editable'] ); |
|
152 | + $attributes['data-notice'] = esc_attr($email->config['notices']['non-notification-status-editable']); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $html = sprintf( |
156 | 156 | '<span %1$s><i class="%2$s"></i></span></span><span class="spinner"></span>', |
157 | - give_get_attribute_str( $attributes ), |
|
157 | + give_get_attribute_str($attributes), |
|
158 | 158 | $icon_classes |
159 | 159 | ); |
160 | 160 | |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public function column_email_type( Give_Email_Notification $email ) { |
|
175 | + public function column_email_type(Give_Email_Notification $email) { |
|
176 | 176 | $email_content_type_label = apply_filters( |
177 | 177 | "give_email_list_render_{$email->config['id']}_email_content_type", |
178 | - Give_Email_Notification_Util::get_formatted_email_type( $email->config['content_type'] ), |
|
178 | + Give_Email_Notification_Util::get_formatted_email_type($email->config['content_type']), |
|
179 | 179 | |
180 | 180 | ); |
181 | 181 | |
@@ -192,15 +192,15 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return string |
194 | 194 | */ |
195 | - public function column_setting( Give_Email_Notification $email ) { |
|
196 | - return Give()->tooltips->render_link( array( |
|
197 | - 'label' => __( 'Edit', 'give' ) . " {$email->config['label']}", |
|
195 | + public function column_setting(Give_Email_Notification $email) { |
|
196 | + return Give()->tooltips->render_link(array( |
|
197 | + 'label' => __('Edit', 'give')." {$email->config['label']}", |
|
198 | 198 | 'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>', |
199 | - 'link' => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ), |
|
199 | + 'link' => esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])), |
|
200 | 200 | 'attributes' => array( |
201 | 201 | 'class' => 'button button-small', |
202 | 202 | ), |
203 | - ) ); |
|
203 | + )); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @return array |
216 | 216 | */ |
217 | - private function get_row_actions( $email ) { |
|
218 | - $edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ); |
|
217 | + private function get_row_actions($email) { |
|
218 | + $edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])); |
|
219 | 219 | |
220 | 220 | /** |
221 | 221 | * Filter the row actions |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $row_actions = apply_filters( |
228 | 228 | 'give_email_notification_row_actions', |
229 | 229 | array( |
230 | - 'edit' => "<a href=\"{$edit_url}\">" . __( 'Edit', 'give' ) . '</a>', |
|
230 | + 'edit' => "<a href=\"{$edit_url}\">".__('Edit', 'give').'</a>', |
|
231 | 231 | ), |
232 | 232 | |
233 | 233 | ); |
@@ -248,22 +248,22 @@ discard block |
||
248 | 248 | $hidden = array(); |
249 | 249 | $email_notifications = array(); |
250 | 250 | $sortable = $this->get_sortable_columns(); |
251 | - $this->_column_headers = array( $columns, $hidden, $sortable, $this->get_primary_column_name() ); |
|
251 | + $this->_column_headers = array($columns, $hidden, $sortable, $this->get_primary_column_name()); |
|
252 | 252 | |
253 | 253 | // Set email notifications. |
254 | 254 | /* @var Give_Email_Notification $email_notification */ |
255 | - foreach ( $this->email_notifications->get_email_notifications() as $email_notification ) { |
|
256 | - if ( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email_notification ) ) { |
|
255 | + foreach ($this->email_notifications->get_email_notifications() as $email_notification) { |
|
256 | + if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email_notification)) { |
|
257 | 257 | $email_notifications[] = $email_notification; |
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - $totalItems = count( $email_notifications ); |
|
261 | + $totalItems = count($email_notifications); |
|
262 | 262 | $this->items = $email_notifications; |
263 | - $this->set_pagination_args( array( |
|
263 | + $this->set_pagination_args(array( |
|
264 | 264 | 'total_items' => $totalItems, |
265 | 265 | 'per_page' => $this->per_page, |
266 | - ) ); |
|
266 | + )); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @access public |
274 | 274 | */ |
275 | 275 | public function no_items() { |
276 | - _e( 'No give email notification found.', 'give' ); |
|
276 | + _e('No give email notification found.', 'give'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -21,30 +21,30 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return array |
23 | 23 | */ |
24 | - public static function get_setting_fields( Give_Email_Notification $email, $form_id = null ) { |
|
25 | - $setting_fields = self::get_default_setting_fields( $email, $form_id ); |
|
24 | + public static function get_setting_fields(Give_Email_Notification $email, $form_id = null) { |
|
25 | + $setting_fields = self::get_default_setting_fields($email, $form_id); |
|
26 | 26 | |
27 | 27 | // Recipient field. |
28 | - $setting_fields[] = self::get_recipient_setting_field( $email, $form_id, Give_Email_Notification_Util::has_recipient_field( $email ) ); |
|
28 | + $setting_fields[] = self::get_recipient_setting_field($email, $form_id, Give_Email_Notification_Util::has_recipient_field($email)); |
|
29 | 29 | |
30 | 30 | // Add extra setting field. |
31 | - if ( $extra_setting_field = $email->get_extra_setting_fields( $form_id ) ) { |
|
32 | - $setting_fields = array_merge( $setting_fields, $extra_setting_field ); |
|
31 | + if ($extra_setting_field = $email->get_extra_setting_fields($form_id)) { |
|
32 | + $setting_fields = array_merge($setting_fields, $extra_setting_field); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Preview field. |
36 | - if ( Give_Email_Notification_Util::has_preview( $email ) ) { |
|
37 | - $setting_fields[] = self::get_preview_setting_field( $email, $form_id ); |
|
36 | + if (Give_Email_Notification_Util::has_preview($email)) { |
|
37 | + $setting_fields[] = self::get_preview_setting_field($email, $form_id); |
|
38 | 38 | } |
39 | 39 | |
40 | - $setting_fields = self::add_section_end( $email, $setting_fields ); |
|
40 | + $setting_fields = self::add_section_end($email, $setting_fields); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Filter the email notification settings. |
44 | 44 | * |
45 | 45 | * @since 2.0 |
46 | 46 | */ |
47 | - return apply_filters( 'give_email_notification_setting_fields', $setting_fields, $email, $form_id ); |
|
47 | + return apply_filters('give_email_notification_setting_fields', $setting_fields, $email, $form_id); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return bool |
60 | 60 | */ |
61 | - public static function has_section_end( $setting ) { |
|
62 | - $last_field = end( $setting ); |
|
61 | + public static function has_section_end($setting) { |
|
62 | + $last_field = end($setting); |
|
63 | 63 | $has_section_end = false; |
64 | 64 | |
65 | - if ( 'sectionend' === $last_field['type'] ) { |
|
65 | + if ('sectionend' === $last_field['type']) { |
|
66 | 66 | $has_section_end = true; |
67 | 67 | } |
68 | 68 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public static function get_section_start( Give_Email_Notification $email, $form_id = null ) { |
|
83 | + public static function get_section_start(Give_Email_Notification $email, $form_id = null) { |
|
84 | 84 | // Add section end field. |
85 | 85 | $setting = array( |
86 | 86 | 'id' => "give_title_email_settings_{$email->config['id']}", |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public static function add_section_end( Give_Email_Notification $email, $setting ) { |
|
106 | - if ( ! self::has_section_end( $setting ) ) { |
|
105 | + public static function add_section_end(Give_Email_Notification $email, $setting) { |
|
106 | + if ( ! self::has_section_end($setting)) { |
|
107 | 107 | // Add section end field. |
108 | 108 | $setting[] = array( |
109 | 109 | 'id' => "give_title_email_settings_{$email->config['id']}", |
@@ -125,26 +125,26 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return array |
127 | 127 | */ |
128 | - public static function get_default_setting_fields( Give_Email_Notification $email, $form_id = null ) { |
|
129 | - $settings[] = self::get_section_start( $email, $form_id ); |
|
130 | - $settings[] = self::get_notification_status_field( $email, $form_id ); |
|
128 | + public static function get_default_setting_fields(Give_Email_Notification $email, $form_id = null) { |
|
129 | + $settings[] = self::get_section_start($email, $form_id); |
|
130 | + $settings[] = self::get_notification_status_field($email, $form_id); |
|
131 | 131 | |
132 | - if ( ! Give_Email_Notification_Util::is_notification_status_editable( $email ) ) { |
|
133 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
132 | + if ( ! Give_Email_Notification_Util::is_notification_status_editable($email)) { |
|
133 | + if ($form_id || give_is_add_new_form_page()) { |
|
134 | 134 | // Do not allow admin to disable notification on perform basis. |
135 | - unset( $settings[1]['options']['disabled'] ); |
|
135 | + unset($settings[1]['options']['disabled']); |
|
136 | 136 | } else { |
137 | 137 | // Do not allow admin to edit notification status globally. |
138 | - unset( $settings[1] ); |
|
138 | + unset($settings[1]); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - $settings[] = self::get_email_subject_field( $email, $form_id ); |
|
143 | - $settings[] = self::get_email_header_field( $email, $form_id ); |
|
144 | - $settings[] = self::get_email_message_field( $email, $form_id ); |
|
142 | + $settings[] = self::get_email_subject_field($email, $form_id); |
|
143 | + $settings[] = self::get_email_header_field($email, $form_id); |
|
144 | + $settings[] = self::get_email_message_field($email, $form_id); |
|
145 | 145 | |
146 | - if ( Give_Email_Notification_Util::is_content_type_editable( $email ) ) { |
|
147 | - $settings[] = self::get_email_content_type_field( $email, $form_id ); |
|
146 | + if (Give_Email_Notification_Util::is_content_type_editable($email)) { |
|
147 | + $settings[] = self::get_email_content_type_field($email, $form_id); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | return $settings; |
@@ -161,31 +161,31 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return array |
163 | 163 | */ |
164 | - public static function get_notification_status_field( Give_Email_Notification $email, $form_id = null ) { |
|
164 | + public static function get_notification_status_field(Give_Email_Notification $email, $form_id = null) { |
|
165 | 165 | $option = array( |
166 | - 'enabled' => __( 'Enabled', 'give' ), |
|
167 | - 'disabled' => __( 'Disabled', 'give' ), |
|
166 | + 'enabled' => __('Enabled', 'give'), |
|
167 | + 'disabled' => __('Disabled', 'give'), |
|
168 | 168 | ); |
169 | 169 | |
170 | 170 | $default_value = $email->get_notification_status(); |
171 | 171 | |
172 | 172 | // Add global options. |
173 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
173 | + if ($form_id || give_is_add_new_form_page()) { |
|
174 | 174 | $option = array( |
175 | - 'global' => __( 'Global Options' ), |
|
176 | - 'enabled' => __( 'Customize', 'give' ), |
|
177 | - 'disabled' => __( 'Disabled', 'give' ), |
|
175 | + 'global' => __('Global Options'), |
|
176 | + 'enabled' => __('Customize', 'give'), |
|
177 | + 'disabled' => __('Disabled', 'give'), |
|
178 | 178 | ); |
179 | 179 | |
180 | 180 | $default_value = 'global'; |
181 | 181 | } |
182 | 182 | |
183 | - $description = isset( $_GET['page'] ) && 'give-settings' === $_GET['page'] ? __( 'Choose whether you want this email enabled or not.', 'give' ) : sprintf( __( 'Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails' ) ); |
|
183 | + $description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf(__('Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give'), admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails')); |
|
184 | 184 | |
185 | 185 | return array( |
186 | - 'name' => esc_html__( 'Notification', 'give' ), |
|
186 | + 'name' => esc_html__('Notification', 'give'), |
|
187 | 187 | 'desc' => $description, |
188 | - 'id' => self::get_prefix( $email, $form_id ) . 'notification', |
|
188 | + 'id' => self::get_prefix($email, $form_id).'notification', |
|
189 | 189 | 'type' => 'radio_inline', |
190 | 190 | 'default' => $default_value, |
191 | 191 | 'options' => $option, |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return array |
206 | 206 | */ |
207 | - public static function get_email_subject_field( Give_Email_Notification $email, $form_id = null ) { |
|
207 | + public static function get_email_subject_field(Give_Email_Notification $email, $form_id = null) { |
|
208 | 208 | return array( |
209 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_subject', |
|
210 | - 'name' => esc_html__( 'Email Subject', 'give' ), |
|
211 | - 'desc' => esc_html__( 'Enter the email subject line.', 'give' ), |
|
209 | + 'id' => self::get_prefix($email, $form_id).'email_subject', |
|
210 | + 'name' => esc_html__('Email Subject', 'give'), |
|
211 | + 'desc' => esc_html__('Enter the email subject line.', 'give'), |
|
212 | 212 | 'default' => $email->config['default_email_subject'], |
213 | 213 | 'type' => 'text', |
214 | 214 | ); |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return array |
226 | 226 | */ |
227 | - public static function get_email_header_field( Give_Email_Notification $email, $form_id = null ) { |
|
227 | + public static function get_email_header_field(Give_Email_Notification $email, $form_id = null) { |
|
228 | 228 | return array( |
229 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_header', |
|
230 | - 'name' => esc_html__( 'Email Header', 'give' ), |
|
231 | - 'desc' => esc_html__( 'Enter the email header that appears at the top of the email.', 'give' ), |
|
229 | + 'id' => self::get_prefix($email, $form_id).'email_header', |
|
230 | + 'name' => esc_html__('Email Header', 'give'), |
|
231 | + 'desc' => esc_html__('Enter the email header that appears at the top of the email.', 'give'), |
|
232 | 232 | 'default' => $email->config['default_email_header'], |
233 | 233 | 'type' => 'text', |
234 | 234 | ); |
@@ -245,28 +245,28 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @return array |
247 | 247 | */ |
248 | - public static function get_email_message_field( Give_Email_Notification $email, $form_id = null ) { |
|
249 | - $desc = esc_html__( 'Enter the email message.', 'give' ); |
|
248 | + public static function get_email_message_field(Give_Email_Notification $email, $form_id = null) { |
|
249 | + $desc = esc_html__('Enter the email message.', 'give'); |
|
250 | 250 | |
251 | - if ( $email_tag_list = $email->get_allowed_email_tags( true ) ) { |
|
251 | + if ($email_tag_list = $email->get_allowed_email_tags(true)) { |
|
252 | 252 | $desc = sprintf( |
253 | 253 | '%1$s <br> %2$s: %3$s %4$s', |
254 | - __( 'The email that is sent to users after completing a successful donation. HTML is accepted.', 'give' ), |
|
255 | - __( 'Available template tags', 'give' ), |
|
254 | + __('The email that is sent to users after completing a successful donation. HTML is accepted.', 'give'), |
|
255 | + __('Available template tags', 'give'), |
|
256 | 256 | $email_tag_list, |
257 | 257 | sprintf( |
258 | 258 | '<br><a href="%1$s" target="_blank">%2$s</a> %3$s', |
259 | - esc_url( 'http://docs.givewp.com/meta-email-tags' ), |
|
260 | - __( 'See our documentation', 'give' ), |
|
261 | - __( 'for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give' ) |
|
259 | + esc_url('http://docs.givewp.com/meta-email-tags'), |
|
260 | + __('See our documentation', 'give'), |
|
261 | + __('for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give') |
|
262 | 262 | ) |
263 | 263 | ); |
264 | 264 | |
265 | 265 | } |
266 | 266 | |
267 | 267 | return array( |
268 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_message', |
|
269 | - 'name' => esc_html__( 'Email message', 'give' ), |
|
268 | + 'id' => self::get_prefix($email, $form_id).'email_message', |
|
269 | + 'name' => esc_html__('Email message', 'give'), |
|
270 | 270 | 'desc' => $desc, |
271 | 271 | 'type' => 'wysiwyg', |
272 | 272 | 'default' => $email->config['default_email_message'], |
@@ -284,15 +284,15 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return array |
286 | 286 | */ |
287 | - public static function get_email_content_type_field( Give_Email_Notification $email, $form_id = null ) { |
|
287 | + public static function get_email_content_type_field(Give_Email_Notification $email, $form_id = null) { |
|
288 | 288 | return array( |
289 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_content_type', |
|
290 | - 'name' => esc_html__( 'Email Content Type', 'give' ), |
|
291 | - 'desc' => __( 'Choose email type.', 'give' ), |
|
289 | + 'id' => self::get_prefix($email, $form_id).'email_content_type', |
|
290 | + 'name' => esc_html__('Email Content Type', 'give'), |
|
291 | + 'desc' => __('Choose email type.', 'give'), |
|
292 | 292 | 'type' => 'select', |
293 | 293 | 'options' => array( |
294 | - 'text/html' => Give_Email_Notification_Util::get_formatted_email_type( 'text/html' ), |
|
295 | - 'text/plain' => Give_Email_Notification_Util::get_formatted_email_type( 'text/plain' ), |
|
294 | + 'text/html' => Give_Email_Notification_Util::get_formatted_email_type('text/html'), |
|
295 | + 'text/plain' => Give_Email_Notification_Util::get_formatted_email_type('text/plain'), |
|
296 | 296 | ), |
297 | 297 | 'default' => $email->config['content_type'], |
298 | 298 | ); |
@@ -312,29 +312,29 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return array |
314 | 314 | */ |
315 | - public static function get_recipient_setting_field( Give_Email_Notification $email, $form_id = null, $edit_recipient = true ) { |
|
315 | + public static function get_recipient_setting_field(Give_Email_Notification $email, $form_id = null, $edit_recipient = true) { |
|
316 | 316 | $recipient = array( |
317 | - 'id' => self::get_prefix( $email, $form_id ) . 'recipient', |
|
318 | - 'name' => esc_html__( 'Email Recipients', 'give' ), |
|
319 | - 'desc' => __( 'Enter the email address(es) that should receive a notification.', 'give' ), |
|
317 | + 'id' => self::get_prefix($email, $form_id).'recipient', |
|
318 | + 'name' => esc_html__('Email Recipients', 'give'), |
|
319 | + 'desc' => __('Enter the email address(es) that should receive a notification.', 'give'), |
|
320 | 320 | 'type' => 'email', |
321 | - 'default' => get_bloginfo( 'admin_email' ), |
|
321 | + 'default' => get_bloginfo('admin_email'), |
|
322 | 322 | 'repeat' => true, |
323 | - 'repeat_btn_title' => esc_html__( 'Add Recipient', 'give' ), |
|
323 | + 'repeat_btn_title' => esc_html__('Add Recipient', 'give'), |
|
324 | 324 | ); |
325 | 325 | |
326 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
327 | - $recipient['name'] = __( 'Email', 'give' ); |
|
326 | + if ($form_id || give_is_add_new_form_page()) { |
|
327 | + $recipient['name'] = __('Email', 'give'); |
|
328 | 328 | $recipient['default'] = ''; |
329 | 329 | $recipient['id'] = 'email'; |
330 | - $recipient['desc'] = __( 'Enter the email address that should receive a notification.', 'give' ); |
|
330 | + $recipient['desc'] = __('Enter the email address that should receive a notification.', 'give'); |
|
331 | 331 | |
332 | 332 | $recipient = array( |
333 | - 'id' => self::get_prefix( $email, $form_id ) . 'recipient', |
|
333 | + 'id' => self::get_prefix($email, $form_id).'recipient', |
|
334 | 334 | 'type' => 'group', |
335 | 335 | 'options' => array( |
336 | - 'add_button' => __( 'Add Email', 'give' ), |
|
337 | - 'header_title' => __( 'Email Recipient', 'give' ), |
|
336 | + 'add_button' => __('Add Email', 'give'), |
|
337 | + 'header_title' => __('Email Recipient', 'give'), |
|
338 | 338 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
339 | 339 | ), |
340 | 340 | 'fields' => array( |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | |
346 | 346 | // Disable field if email donor has recipient field. |
347 | 347 | // @see https://github.com/WordImpress/Give/issues/2657 |
348 | - if ( ! $edit_recipient ) { |
|
349 | - if ( 'group' == $recipient['type'] ) { |
|
350 | - $recipient = current( $recipient['fields'] ); |
|
348 | + if ( ! $edit_recipient) { |
|
349 | + if ('group' == $recipient['type']) { |
|
350 | + $recipient = current($recipient['fields']); |
|
351 | 351 | $recipient['type'] = 'text'; |
352 | 352 | } |
353 | 353 | |
354 | 354 | $recipient['attributes']['disabled'] = 'disabled'; |
355 | 355 | $recipient['value'] = $recipient['default'] = '{donor_email}'; |
356 | 356 | $recipient['repeat'] = false; |
357 | - $recipient['desc'] = __( 'This email is automatically sent to the donor and the recipient cannot be customized.', 'give' ); |
|
357 | + $recipient['desc'] = __('This email is automatically sent to the donor and the recipient cannot be customized.', 'give'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | return $recipient; |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return array |
373 | 373 | */ |
374 | - public static function get_preview_setting_field( Give_Email_Notification $email, $form_id = null ) { |
|
374 | + public static function get_preview_setting_field(Give_Email_Notification $email, $form_id = null) { |
|
375 | 375 | return array( |
376 | - 'name' => __( 'Preview Email', 'give' ), |
|
377 | - 'desc' => __( 'Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.', |
|
378 | - 'give' ), |
|
379 | - 'id' => self::get_prefix( $email, $form_id ) . 'preview_buttons', |
|
376 | + 'name' => __('Preview Email', 'give'), |
|
377 | + 'desc' => __('Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.', |
|
378 | + 'give'), |
|
379 | + 'id' => self::get_prefix($email, $form_id).'preview_buttons', |
|
380 | 380 | 'type' => 'email_preview_buttons', |
381 | 381 | ); |
382 | 382 | } |
@@ -393,10 +393,10 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return string |
395 | 395 | */ |
396 | - public static function get_prefix( Give_Email_Notification $email, $form_id = null ) { |
|
396 | + public static function get_prefix(Give_Email_Notification $email, $form_id = null) { |
|
397 | 397 | $meta_key = "{$email->config['id']}_"; |
398 | 398 | |
399 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
399 | + if ($form_id || give_is_add_new_form_page()) { |
|
400 | 400 | $meta_key = "_give_{$email->config['id']}_"; |
401 | 401 | } |
402 | 402 |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | // Sanity check - ensure form has pass all condition to show goal. |
10 | 10 | if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) ) |
11 | - || empty( $form->ID ) |
|
12 | - || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) ) |
|
13 | - || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) { |
|
11 | + || empty( $form->ID ) |
|
12 | + || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) ) |
|
13 | + || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) { |
|
14 | 14 | return false; |
15 | 15 | } |
16 | 16 | |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */ |
98 | 98 | __( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) ); |
99 | 99 | |
100 | - elseif ( 'percentage' === $goal_format ) : |
|
100 | + elseif ( 'percentage' === $goal_format ) : |
|
101 | 101 | |
102 | 102 | echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */ |
103 | 103 | __( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) ); |
104 | 104 | |
105 | - elseif ( 'donation' === $goal_format ) : |
|
105 | + elseif ( 'donation' === $goal_format ) : |
|
106 | 106 | |
107 | 107 | echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */ |
108 | 108 | _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal ); |
109 | 109 | |
110 | - elseif ( 'donors' === $goal_format ) : |
|
110 | + elseif ( 'donors' === $goal_format ) : |
|
111 | 111 | |
112 | 112 | echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */ |
113 | 113 | _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal ); |
@@ -3,46 +3,46 @@ discard block |
||
3 | 3 | * This template is used to display the goal with [give_goal] |
4 | 4 | */ |
5 | 5 | |
6 | -$form = new Give_Donate_Form( $form_id ); |
|
7 | -$goal_option = give_get_meta( $form->ID, '_give_goal_option', true ); |
|
6 | +$form = new Give_Donate_Form($form_id); |
|
7 | +$goal_option = give_get_meta($form->ID, '_give_goal_option', true); |
|
8 | 8 | |
9 | 9 | // Sanity check - ensure form has pass all condition to show goal. |
10 | -if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) ) |
|
11 | - || empty( $form->ID ) |
|
12 | - || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) ) |
|
13 | - || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) { |
|
10 | +if ((isset($args['show_goal']) && ! filter_var($args['show_goal'], FILTER_VALIDATE_BOOLEAN)) |
|
11 | + || empty($form->ID) |
|
12 | + || (is_singular('give_forms') && ! give_is_setting_enabled($goal_option)) |
|
13 | + || ! give_is_setting_enabled($goal_option) || 0 === $form->goal) { |
|
14 | 14 | return false; |
15 | 15 | } |
16 | 16 | |
17 | -$goal_format = give_get_form_goal_format( $form_id ); |
|
18 | -$price = give_get_meta( $form_id, '_give_set_price', true ); |
|
19 | -$color = give_get_meta( $form_id, '_give_goal_color', true ); |
|
20 | -$show_text = isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
21 | -$show_bar = isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
22 | -$goal_progress_stats = give_goal_progress_stats( $form ); |
|
17 | +$goal_format = give_get_form_goal_format($form_id); |
|
18 | +$price = give_get_meta($form_id, '_give_set_price', true); |
|
19 | +$color = give_get_meta($form_id, '_give_goal_color', true); |
|
20 | +$show_text = isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
21 | +$show_bar = isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
22 | +$goal_progress_stats = give_goal_progress_stats($form); |
|
23 | 23 | |
24 | 24 | $income = $goal_progress_stats['raw_actual']; |
25 | 25 | $goal = $goal_progress_stats['raw_goal']; |
26 | 26 | |
27 | -switch ( $goal_format ) { |
|
27 | +switch ($goal_format) { |
|
28 | 28 | |
29 | 29 | case 'donation': |
30 | - $progress = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0; |
|
30 | + $progress = $goal ? round(($income / $goal) * 100, 2) : 0; |
|
31 | 31 | $progress_bar_value = $income >= $goal ? 100 : $progress; |
32 | 32 | break; |
33 | 33 | |
34 | 34 | case 'donors': |
35 | - $progress_bar_value = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0; |
|
35 | + $progress_bar_value = $goal ? round(($income / $goal) * 100, 2) : 0; |
|
36 | 36 | $progress = $progress_bar_value; |
37 | 37 | break; |
38 | 38 | |
39 | 39 | case 'percentage': |
40 | - $progress = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0; |
|
40 | + $progress = $goal ? round(($income / $goal) * 100, 2) : 0; |
|
41 | 41 | $progress_bar_value = $income >= $goal ? 100 : $progress; |
42 | 42 | break; |
43 | 43 | |
44 | 44 | default: |
45 | - $progress = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0; |
|
45 | + $progress = $goal ? round(($income / $goal) * 100, 2) : 0; |
|
46 | 46 | $progress_bar_value = $income >= $goal ? 100 : $progress; |
47 | 47 | break; |
48 | 48 | |
@@ -53,64 +53,64 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @since 1.8.8 |
55 | 55 | */ |
56 | -$progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form_id, $form ); |
|
56 | +$progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form_id, $form); |
|
57 | 57 | ?> |
58 | 58 | <div class="give-goal-progress"> |
59 | - <?php if ( ! empty( $show_text ) ) : ?> |
|
59 | + <?php if ( ! empty($show_text)) : ?> |
|
60 | 60 | <div class="raised"> |
61 | 61 | <?php |
62 | - if ( 'amount' === $goal_format ) : |
|
62 | + if ('amount' === $goal_format) : |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Filter the give currency. |
66 | 66 | * |
67 | 67 | * @since 1.8.17 |
68 | 68 | */ |
69 | - $form_currency = apply_filters( 'give_goal_form_currency', give_get_currency( $form_id ), $form_id ); |
|
69 | + $form_currency = apply_filters('give_goal_form_currency', give_get_currency($form_id), $form_id); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Filter the income formatting arguments. |
73 | 73 | * |
74 | 74 | * @since 1.8.17 |
75 | 75 | */ |
76 | - $income_format_args = apply_filters( 'give_goal_income_format_args', array( |
|
76 | + $income_format_args = apply_filters('give_goal_income_format_args', array( |
|
77 | 77 | 'sanitize' => false, |
78 | 78 | 'currency' => $form_currency, |
79 | 79 | 'decimal' => false, |
80 | - ), $form_id ); |
|
80 | + ), $form_id); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Filter the goal formatting arguments. |
84 | 84 | * |
85 | 85 | * @since 1.8.17 |
86 | 86 | */ |
87 | - $goal_format_args = apply_filters( 'give_goal_amount_format_args', array( |
|
87 | + $goal_format_args = apply_filters('give_goal_amount_format_args', array( |
|
88 | 88 | 'sanitize' => false, |
89 | 89 | 'currency' => $form_currency, |
90 | 90 | 'decimal' => false, |
91 | - ), $form_id ); |
|
91 | + ), $form_id); |
|
92 | 92 | |
93 | 93 | // Get formatted amount. |
94 | - $income = give_human_format_large_amount( give_format_amount( $income, $income_format_args ), array( 'currency' => $form_currency ) ); |
|
95 | - $goal = give_human_format_large_amount( give_format_amount( $goal, $goal_format_args ), array( 'currency' => $form_currency ) ); |
|
94 | + $income = give_human_format_large_amount(give_format_amount($income, $income_format_args), array('currency' => $form_currency)); |
|
95 | + $goal = give_human_format_large_amount(give_format_amount($goal, $goal_format_args), array('currency' => $form_currency)); |
|
96 | 96 | |
97 | 97 | echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */ |
98 | - __( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) ); |
|
98 | + __('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give'), give_currency_filter($income, array('form_id' => $form_id)), give_currency_filter($goal, array('form_id' => $form_id)) ); |
|
99 | 99 | |
100 | - elseif ( 'percentage' === $goal_format ) : |
|
100 | + elseif ('percentage' === $goal_format) : |
|
101 | 101 | |
102 | 102 | echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */ |
103 | - __( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) ); |
|
103 | + __('<span class="give-percentage">%s%%</span> funded', 'give'), round($progress) ); |
|
104 | 104 | |
105 | - elseif ( 'donation' === $goal_format ) : |
|
105 | + elseif ('donation' === $goal_format) : |
|
106 | 106 | |
107 | 107 | echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */ |
108 | - _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal ); |
|
108 | + _n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give'), $income, $goal ); |
|
109 | 109 | |
110 | - elseif ( 'donors' === $goal_format ) : |
|
110 | + elseif ('donors' === $goal_format) : |
|
111 | 111 | |
112 | 112 | echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */ |
113 | - _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal ); |
|
113 | + _n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give'), $income, $goal ); |
|
114 | 114 | |
115 | 115 | endif; |
116 | 116 | ?> |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | <?php endif; ?> |
119 | 119 | |
120 | 120 | |
121 | - <?php if ( ! empty( $show_bar ) ) : ?> |
|
121 | + <?php if ( ! empty($show_bar)) : ?> |
|
122 | 122 | <div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" |
123 | - aria-valuenow="<?php echo esc_attr( $progress_bar_value ); ?>"> |
|
124 | - <span style="width: <?php echo esc_attr( $progress_bar_value ); ?>%;<?php if ( ! empty( $color ) ) { |
|
125 | - echo 'background-color:' . $color; |
|
123 | + aria-valuenow="<?php echo esc_attr($progress_bar_value); ?>"> |
|
124 | + <span style="width: <?php echo esc_attr($progress_bar_value); ?>%;<?php if ( ! empty($color)) { |
|
125 | + echo 'background-color:'.$color; |
|
126 | 126 | } ?>"></span> |
127 | 127 | </div><!-- /.give-progress-bar --> |
128 | 128 | <?php endif; ?> |
@@ -9,17 +9,17 @@ discard block |
||
9 | 9 | global $give_access_form_outputted; |
10 | 10 | |
11 | 11 | // Only output the form once. |
12 | -if ( $give_access_form_outputted ) { |
|
12 | +if ($give_access_form_outputted) { |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | -$recaptcha_key = give_get_option( 'recaptcha_key' ); |
|
17 | -$recaptcha_secret = give_get_option( 'recaptcha_secret' ); |
|
16 | +$recaptcha_key = give_get_option('recaptcha_key'); |
|
17 | +$recaptcha_secret = give_get_option('recaptcha_secret'); |
|
18 | 18 | |
19 | -$enable_recaptcha = ( give_is_setting_enabled( give_get_option( 'enable_recaptcha' ) ) ) && ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ? true : false; |
|
19 | +$enable_recaptcha = (give_is_setting_enabled(give_get_option('enable_recaptcha'))) && ! empty($recaptcha_key) && ! empty($recaptcha_secret) ? true : false; |
|
20 | 20 | |
21 | 21 | // Email already sent? |
22 | -if ( isset( $_POST['email-access-sent'] ) ) { |
|
22 | +if (isset($_POST['email-access-sent'])) { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Filter to modify access mail send notice |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return string $message Send notice message for email access. |
32 | 32 | */ |
33 | - $message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) ); |
|
33 | + $message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give')); |
|
34 | 34 | |
35 | 35 | Give()->notices->print_frontend_notice( |
36 | 36 | $message, |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ); |
40 | 40 | |
41 | 41 | return; |
42 | -} elseif ( isset( $_POST['email-access-exhausted'] ) ) { |
|
42 | +} elseif (isset($_POST['email-access-exhausted'])) { |
|
43 | 43 | |
44 | 44 | $value = Give()->email_access->verify_throttle / 60; |
45 | 45 | |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | $message = (string) apply_filters( |
57 | 57 | 'give_email_access_requests_exceed_notice', |
58 | 58 | sprintf( |
59 | - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ), |
|
60 | - sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value ) |
|
59 | + __('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'), |
|
60 | + sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value) |
|
61 | 61 | ), |
62 | 62 | $value |
63 | 63 | ); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @since 1.8.17 |
80 | 80 | */ |
81 | -do_action( 'give_email_access_form_login' ); |
|
81 | +do_action('give_email_access_form_login'); |
|
82 | 82 | |
83 | 83 | // Print any other messages & errors. |
84 | 84 | Give()->notices->render_frontend_notices(); |
@@ -97,20 +97,20 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return string $message email access welcome message |
99 | 99 | */ |
100 | - echo esc_html( apply_filters( 'give_email_access_welcome_message', __( 'Please verify your email to access your donation history.', 'give' ) ) ); |
|
100 | + echo esc_html(apply_filters('give_email_access_welcome_message', __('Please verify your email to access your donation history.', 'give'))); |
|
101 | 101 | ?> |
102 | 102 | </p> |
103 | 103 | |
104 | - <label for="give-email"><?php esc_attr_e( 'Donation Email:', 'give' ); ?></label> |
|
104 | + <label for="give-email"><?php esc_attr_e('Donation Email:', 'give'); ?></label> |
|
105 | 105 | <input id="give-email" type="email" name="give_email" value="" |
106 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"/> |
|
107 | - <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'give' ); ?>"/> |
|
106 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"/> |
|
107 | + <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('give'); ?>"/> |
|
108 | 108 | <input type="hidden" name="give_action" value="email_access_form_login"/> |
109 | 109 | <input type="hidden" name="give_access_page" value="<?php the_ID(); ?>"/> |
110 | 110 | |
111 | 111 | <?php |
112 | 112 | // Enable reCAPTCHA? |
113 | - if ( $enable_recaptcha ) : |
|
113 | + if ($enable_recaptcha) : |
|
114 | 114 | ?> |
115 | 115 | <script> |
116 | 116 | // IP verify for reCAPTCHA. |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | <input type="hidden" name="give_ip" class="give_ip" value=""/> |
129 | 129 | <?php endif; ?> |
130 | 130 | |
131 | - <input type="submit" class="give-submit" value="<?php esc_attr_e( 'Verify Email', 'give' ); ?>"/> |
|
131 | + <input type="submit" class="give-submit" value="<?php esc_attr_e('Verify Email', 'give'); ?>"/> |
|
132 | 132 | </form> |
133 | 133 | </div> |
134 | 134 | <?php |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @throws ReflectionException Exception Handling. |
26 | 26 | * |
27 | - * @return mixed |
|
27 | + * @return false|null |
|
28 | 28 | */ |
29 | 29 | function give_process_donation_form() { |
30 | 30 | |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | * |
1320 | 1320 | * @param array $valid_data List of Valid Data. |
1321 | 1321 | * |
1322 | - * @return bool |
|
1322 | + * @return boolean|null |
|
1323 | 1323 | */ |
1324 | 1324 | function give_validate_donation_amount( $valid_data ) { |
1325 | 1325 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | function give_process_donation_form() { |
30 | 30 | |
31 | 31 | // Sanitize Posted Data. |
32 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, CSRF ok. |
|
32 | + $post_data = give_clean($_POST); // WPCS: input var ok, CSRF ok. |
|
33 | 33 | |
34 | 34 | // Check whether the form submitted via AJAX or not. |
35 | - $is_ajax = isset( $post_data['give_ajax'] ); |
|
35 | + $is_ajax = isset($post_data['give_ajax']); |
|
36 | 36 | |
37 | 37 | // Verify donation form nonce. |
38 | - if ( ! give_verify_donation_form_nonce( $post_data['give-form-hash'], $post_data['give-form-id'] ) ) { |
|
39 | - if ( $is_ajax ) { |
|
38 | + if ( ! give_verify_donation_form_nonce($post_data['give-form-hash'], $post_data['give-form-id'])) { |
|
39 | + if ($is_ajax) { |
|
40 | 40 | /** |
41 | 41 | * Fires when AJAX sends back errors from the donation form. |
42 | 42 | * |
43 | 43 | * @since 1.0 |
44 | 44 | */ |
45 | - do_action( 'give_ajax_donation_errors' ); |
|
45 | + do_action('give_ajax_donation_errors'); |
|
46 | 46 | give_die(); |
47 | 47 | } else { |
48 | 48 | give_send_back_to_checkout(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @since 1.0 |
56 | 56 | */ |
57 | - do_action( 'give_pre_process_donation' ); |
|
57 | + do_action('give_pre_process_donation'); |
|
58 | 58 | |
59 | 59 | // Validate the form $_POST data. |
60 | 60 | $valid_data = give_donation_form_validate_fields(); |
@@ -70,24 +70,24 @@ discard block |
||
70 | 70 | * @param array $deprecated Deprecated Since 2.0.2. Use $_POST instead. |
71 | 71 | */ |
72 | 72 | $deprecated = $post_data; |
73 | - do_action( 'give_checkout_error_checks', $valid_data, $deprecated ); |
|
73 | + do_action('give_checkout_error_checks', $valid_data, $deprecated); |
|
74 | 74 | |
75 | 75 | // Process the login form. |
76 | - if ( isset( $post_data['give_login_submit'] ) ) { |
|
76 | + if (isset($post_data['give_login_submit'])) { |
|
77 | 77 | give_process_form_login(); |
78 | 78 | } |
79 | 79 | |
80 | 80 | // Validate the user. |
81 | - $user = give_get_donation_form_user( $valid_data ); |
|
81 | + $user = give_get_donation_form_user($valid_data); |
|
82 | 82 | |
83 | - if ( false === $valid_data || give_get_errors() || ! $user ) { |
|
84 | - if ( $is_ajax ) { |
|
83 | + if (false === $valid_data || give_get_errors() || ! $user) { |
|
84 | + if ($is_ajax) { |
|
85 | 85 | /** |
86 | 86 | * Fires when AJAX sends back errors from the donation form. |
87 | 87 | * |
88 | 88 | * @since 1.0 |
89 | 89 | */ |
90 | - do_action( 'give_ajax_donation_errors' ); |
|
90 | + do_action('give_ajax_donation_errors'); |
|
91 | 91 | give_die(); |
92 | 92 | } else { |
93 | 93 | return false; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | // If AJAX send back success to proceed with form submission. |
98 | - if ( $is_ajax ) { |
|
98 | + if ($is_ajax) { |
|
99 | 99 | echo 'success'; |
100 | 100 | give_die(); |
101 | 101 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 2.2.0 |
107 | 107 | */ |
108 | - do_action( 'give_process_donation_after_validation' ); |
|
108 | + do_action('give_process_donation_after_validation'); |
|
109 | 109 | |
110 | 110 | // Setup user information. |
111 | 111 | $user_info = array( |
@@ -117,23 +117,22 @@ discard block |
||
117 | 117 | 'address' => $user['address'], |
118 | 118 | ); |
119 | 119 | |
120 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
120 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
121 | 121 | |
122 | 122 | // Donation form ID. |
123 | - $form_id = isset( $post_data['give-form-id'] ) ? absint( $post_data['give-form-id'] ) : 0; |
|
123 | + $form_id = isset($post_data['give-form-id']) ? absint($post_data['give-form-id']) : 0; |
|
124 | 124 | |
125 | - $price = isset( $post_data['give-amount'] ) ? |
|
126 | - (float) apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => give_get_currency( $form_id ) ) ) ) : |
|
127 | - '0.00'; |
|
128 | - $purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); |
|
125 | + $price = isset($post_data['give-amount']) ? |
|
126 | + (float) apply_filters('give_donation_total', give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => give_get_currency($form_id)))) : '0.00'; |
|
127 | + $purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); |
|
129 | 128 | |
130 | 129 | // Setup donation information. |
131 | 130 | $donation_data = array( |
132 | 131 | 'price' => $price, |
133 | 132 | 'purchase_key' => $purchase_key, |
134 | 133 | 'user_email' => $user['user_email'], |
135 | - 'date' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ), |
|
136 | - 'user_info' => stripslashes_deep( $user_info ), |
|
134 | + 'date' => date('Y-m-d H:i:s', current_time('timestamp')), |
|
135 | + 'user_info' => stripslashes_deep($user_info), |
|
137 | 136 | 'post_data' => $post_data, |
138 | 137 | 'gateway' => $valid_data['gateway'], |
139 | 138 | 'card_info' => $valid_data['cc_info'], |
@@ -153,10 +152,10 @@ discard block |
||
153 | 152 | * @param array $user_info Array containing basic user information. |
154 | 153 | * @param bool|array $valid_data Validate fields. |
155 | 154 | */ |
156 | - do_action( 'give_checkout_before_gateway', $post_data, $user_info, $valid_data ); |
|
155 | + do_action('give_checkout_before_gateway', $post_data, $user_info, $valid_data); |
|
157 | 156 | |
158 | 157 | // Sanity check for price. |
159 | - if ( ! $donation_data['price'] ) { |
|
158 | + if ( ! $donation_data['price']) { |
|
160 | 159 | // Revert to manual. |
161 | 160 | $donation_data['gateway'] = 'manual'; |
162 | 161 | $_POST['give-gateway'] = 'manual'; |
@@ -167,26 +166,26 @@ discard block |
||
167 | 166 | * |
168 | 167 | * @since 1.7 |
169 | 168 | */ |
170 | - $donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data ); |
|
169 | + $donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data); |
|
171 | 170 | |
172 | 171 | // Setup the data we're storing in the donation session. |
173 | 172 | $session_data = $donation_data; |
174 | 173 | |
175 | 174 | // Make sure credit card numbers are never stored in sessions. |
176 | - unset( $session_data['card_info']['card_number'] ); |
|
177 | - unset( $session_data['post_data']['card_number'] ); |
|
175 | + unset($session_data['card_info']['card_number']); |
|
176 | + unset($session_data['post_data']['card_number']); |
|
178 | 177 | |
179 | 178 | // Used for showing data to non logged-in users after donation, and for other plugins needing donation data. |
180 | - give_set_purchase_session( $session_data ); |
|
179 | + give_set_purchase_session($session_data); |
|
181 | 180 | |
182 | 181 | // Send info to the gateway for payment processing. |
183 | - give_send_to_gateway( $donation_data['gateway'], $donation_data ); |
|
182 | + give_send_to_gateway($donation_data['gateway'], $donation_data); |
|
184 | 183 | give_die(); |
185 | 184 | } |
186 | 185 | |
187 | -add_action( 'give_purchase', 'give_process_donation_form' ); |
|
188 | -add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' ); |
|
189 | -add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' ); |
|
186 | +add_action('give_purchase', 'give_process_donation_form'); |
|
187 | +add_action('wp_ajax_give_process_donation', 'give_process_donation_form'); |
|
188 | +add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form'); |
|
190 | 189 | |
191 | 190 | /** |
192 | 191 | * Verify that when a logged in user makes a donation that the email address used doesn't belong to a different customer. |
@@ -197,27 +196,27 @@ discard block |
||
197 | 196 | * |
198 | 197 | * @return void |
199 | 198 | */ |
200 | -function give_check_logged_in_user_for_existing_email( $valid_data ) { |
|
199 | +function give_check_logged_in_user_for_existing_email($valid_data) { |
|
201 | 200 | |
202 | 201 | // Verify that the email address belongs to this customer. |
203 | - if ( is_user_logged_in() ) { |
|
202 | + if (is_user_logged_in()) { |
|
204 | 203 | |
205 | 204 | $submitted_email = $valid_data['logged_in_user']['user_email']; |
206 | - $donor = new Give_Donor( get_current_user_id(), true ); |
|
205 | + $donor = new Give_Donor(get_current_user_id(), true); |
|
207 | 206 | |
208 | 207 | // If this email address is not registered with this customer, see if it belongs to any other customer. |
209 | 208 | if ( |
210 | 209 | $submitted_email !== $donor->email |
211 | - && ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails, true ) ) |
|
210 | + && (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails, true)) |
|
212 | 211 | ) { |
213 | - $found_donor = new Give_Donor( $submitted_email ); |
|
212 | + $found_donor = new Give_Donor($submitted_email); |
|
214 | 213 | |
215 | - if ( $found_donor->id > 0 ) { |
|
214 | + if ($found_donor->id > 0) { |
|
216 | 215 | give_set_error( |
217 | 216 | 'give-customer-email-exists', |
218 | 217 | sprintf( |
219 | 218 | /* translators: 1. Donor Email, 2. Submitted Email */ |
220 | - __( 'You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give' ), |
|
219 | + __('You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give'), |
|
221 | 220 | $donor->email, |
222 | 221 | $submitted_email |
223 | 222 | ) |
@@ -227,7 +226,7 @@ discard block |
||
227 | 226 | } |
228 | 227 | } |
229 | 228 | |
230 | -add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1 ); |
|
229 | +add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1); |
|
231 | 230 | |
232 | 231 | /** |
233 | 232 | * Process the checkout login form |
@@ -239,49 +238,49 @@ discard block |
||
239 | 238 | */ |
240 | 239 | function give_process_form_login() { |
241 | 240 | |
242 | - $is_ajax = ! empty( $_POST['give_ajax'] ) ? give_clean( $_POST['give_ajax'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok. |
|
241 | + $is_ajax = ! empty($_POST['give_ajax']) ? give_clean($_POST['give_ajax']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok. |
|
243 | 242 | $referrer = wp_get_referer(); |
244 | 243 | $user_data = give_donation_form_validate_user_login(); |
245 | 244 | |
246 | - if ( give_get_errors() || $user_data['user_id'] < 1 ) { |
|
247 | - if ( $is_ajax ) { |
|
245 | + if (give_get_errors() || $user_data['user_id'] < 1) { |
|
246 | + if ($is_ajax) { |
|
248 | 247 | /** |
249 | 248 | * Fires when AJAX sends back errors from the donation form. |
250 | 249 | * |
251 | 250 | * @since 1.0 |
252 | 251 | */ |
253 | 252 | ob_start(); |
254 | - do_action( 'give_ajax_donation_errors' ); |
|
253 | + do_action('give_ajax_donation_errors'); |
|
255 | 254 | $message = ob_get_contents(); |
256 | 255 | ob_end_clean(); |
257 | - wp_send_json_error( $message ); |
|
256 | + wp_send_json_error($message); |
|
258 | 257 | } else { |
259 | - wp_safe_redirect( $referrer ); |
|
258 | + wp_safe_redirect($referrer); |
|
260 | 259 | exit; |
261 | 260 | } |
262 | 261 | } |
263 | 262 | |
264 | - give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] ); |
|
263 | + give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']); |
|
265 | 264 | |
266 | - if ( $is_ajax ) { |
|
265 | + if ($is_ajax) { |
|
267 | 266 | $message = Give()->notices->print_frontend_notice( |
268 | 267 | sprintf( |
269 | 268 | /* translators: %s: user first name */ |
270 | - esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ), |
|
271 | - ( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login'] |
|
269 | + esc_html__('Welcome %s! You have successfully logged into your account.', 'give'), |
|
270 | + ( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login'] |
|
272 | 271 | ), |
273 | 272 | false, |
274 | 273 | 'success' |
275 | 274 | ); |
276 | 275 | |
277 | - wp_send_json_success( $message ); |
|
276 | + wp_send_json_success($message); |
|
278 | 277 | } else { |
279 | - wp_safe_redirect( $referrer ); |
|
278 | + wp_safe_redirect($referrer); |
|
280 | 279 | } |
281 | 280 | } |
282 | 281 | |
283 | -add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' ); |
|
284 | -add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' ); |
|
282 | +add_action('wp_ajax_give_process_donation_login', 'give_process_form_login'); |
|
283 | +add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login'); |
|
285 | 284 | |
286 | 285 | /** |
287 | 286 | * Donation Form Validate Fields. |
@@ -293,49 +292,49 @@ discard block |
||
293 | 292 | */ |
294 | 293 | function give_donation_form_validate_fields() { |
295 | 294 | |
296 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
295 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
297 | 296 | |
298 | 297 | // Validate Honeypot First. |
299 | - if ( ! empty( $post_data['give-honeypot'] ) ) { |
|
300 | - give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) ); |
|
298 | + if ( ! empty($post_data['give-honeypot'])) { |
|
299 | + give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give')); |
|
301 | 300 | } |
302 | 301 | |
303 | 302 | // Check spam detect. |
304 | 303 | if ( |
305 | - isset( $post_data['action'] ) && |
|
306 | - give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) ) && |
|
304 | + isset($post_data['action']) && |
|
305 | + give_is_setting_enabled(give_get_option('akismet_spam_protection')) && |
|
307 | 306 | give_is_spam_donation() |
308 | 307 | ) { |
309 | - give_set_error( 'spam_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) ); |
|
308 | + give_set_error('spam_donation', __('This donation has been flagged as spam. Please try again.', 'give')); |
|
310 | 309 | } |
311 | 310 | |
312 | 311 | // Start an array to collect valid data. |
313 | 312 | $valid_data = array( |
314 | 313 | 'gateway' => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here). |
315 | - 'need_new_user' => false, // New user flag. |
|
316 | - 'need_user_login' => false, // Login user flag. |
|
317 | - 'logged_user_data' => array(), // Logged user collected data. |
|
318 | - 'new_user_data' => array(), // New user collected data. |
|
319 | - 'login_user_data' => array(), // Login user collected data. |
|
320 | - 'guest_user_data' => array(), // Guest user collected data. |
|
314 | + 'need_new_user' => false, // New user flag. |
|
315 | + 'need_user_login' => false, // Login user flag. |
|
316 | + 'logged_user_data' => array(), // Logged user collected data. |
|
317 | + 'new_user_data' => array(), // New user collected data. |
|
318 | + 'login_user_data' => array(), // Login user collected data. |
|
319 | + 'guest_user_data' => array(), // Guest user collected data. |
|
321 | 320 | 'cc_info' => give_donation_form_validate_cc(), // Credit card info. |
322 | 321 | ); |
323 | 322 | |
324 | - $form_id = intval( $post_data['give-form-id'] ); |
|
323 | + $form_id = intval($post_data['give-form-id']); |
|
325 | 324 | |
326 | 325 | // Validate agree to terms. |
327 | - if ( give_is_terms_enabled( $form_id ) ) { |
|
326 | + if (give_is_terms_enabled($form_id)) { |
|
328 | 327 | give_donation_form_validate_agree_to_terms(); |
329 | 328 | } |
330 | 329 | |
331 | - if ( is_user_logged_in() ) { |
|
330 | + if (is_user_logged_in()) { |
|
332 | 331 | |
333 | 332 | // Collect logged in user data. |
334 | 333 | $valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user(); |
335 | 334 | } elseif ( |
336 | - isset( $post_data['give-purchase-var'] ) && |
|
335 | + isset($post_data['give-purchase-var']) && |
|
337 | 336 | 'needs-to-register' === $post_data['give-purchase-var'] && |
338 | - ! empty( $post_data['give_create_account'] ) |
|
337 | + ! empty($post_data['give_create_account']) |
|
339 | 338 | ) { |
340 | 339 | |
341 | 340 | // Set new user registration as required. |
@@ -344,7 +343,7 @@ discard block |
||
344 | 343 | // Validate new user data. |
345 | 344 | $valid_data['new_user_data'] = give_donation_form_validate_new_user(); |
346 | 345 | } elseif ( |
347 | - isset( $post_data['give-purchase-var'] ) && |
|
346 | + isset($post_data['give-purchase-var']) && |
|
348 | 347 | 'needs-to-login' === $post_data['give-purchase-var'] |
349 | 348 | ) { |
350 | 349 | |
@@ -373,14 +372,14 @@ discard block |
||
373 | 372 | function give_is_spam_donation() { |
374 | 373 | $spam = false; |
375 | 374 | |
376 | - $user_agent = (string) isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : ''; |
|
375 | + $user_agent = (string) isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; |
|
377 | 376 | |
378 | - if ( strlen( $user_agent ) < 2 ) { |
|
377 | + if (strlen($user_agent) < 2) { |
|
379 | 378 | $spam = true; |
380 | 379 | } |
381 | 380 | |
382 | 381 | // Allow developer to customized Akismet spam detect API call and it's response. |
383 | - return apply_filters( 'give_spam', $spam ); |
|
382 | + return apply_filters('give_spam', $spam); |
|
384 | 383 | } |
385 | 384 | |
386 | 385 | /** |
@@ -395,33 +394,33 @@ discard block |
||
395 | 394 | */ |
396 | 395 | function give_donation_form_validate_gateway() { |
397 | 396 | |
398 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
399 | - $form_id = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0; |
|
400 | - $amount = ! empty( $post_data['give-amount'] ) ? give_maybe_sanitize_amount( $post_data['give-amount'] ) : 0; |
|
401 | - $gateway = ! empty( $post_data['give-gateway'] ) ? $post_data['give-gateway'] : 0; |
|
397 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
398 | + $form_id = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0; |
|
399 | + $amount = ! empty($post_data['give-amount']) ? give_maybe_sanitize_amount($post_data['give-amount']) : 0; |
|
400 | + $gateway = ! empty($post_data['give-gateway']) ? $post_data['give-gateway'] : 0; |
|
402 | 401 | |
403 | 402 | // Bailout, if payment gateway is not submitted with donation form data. |
404 | - if ( empty( $gateway ) ) { |
|
403 | + if (empty($gateway)) { |
|
405 | 404 | |
406 | - give_set_error( 'empty_gateway', __( 'The donation form will process with a valid payment gateway.', 'give' ) ); |
|
405 | + give_set_error('empty_gateway', __('The donation form will process with a valid payment gateway.', 'give')); |
|
407 | 406 | |
408 | - } elseif ( ! give_is_gateway_active( $gateway ) ) { |
|
407 | + } elseif ( ! give_is_gateway_active($gateway)) { |
|
409 | 408 | |
410 | - give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) ); |
|
409 | + give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give')); |
|
411 | 410 | |
412 | - } elseif ( empty( $amount ) ) { |
|
411 | + } elseif (empty($amount)) { |
|
413 | 412 | |
414 | - give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) ); |
|
413 | + give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give')); |
|
415 | 414 | |
416 | - } elseif ( ! give_verify_minimum_price( 'minimum' ) ) { |
|
415 | + } elseif ( ! give_verify_minimum_price('minimum')) { |
|
417 | 416 | |
418 | 417 | give_set_error( |
419 | 418 | 'invalid_donation_minimum', |
420 | 419 | sprintf( |
421 | 420 | /* translators: %s: minimum donation amount */ |
422 | - __( 'This form has a minimum donation amount of %s.', 'give' ), |
|
421 | + __('This form has a minimum donation amount of %s.', 'give'), |
|
423 | 422 | give_currency_filter( |
424 | - give_format_amount( give_get_form_minimum_price( $form_id ), |
|
423 | + give_format_amount(give_get_form_minimum_price($form_id), |
|
425 | 424 | array( |
426 | 425 | 'sanitize' => false, |
427 | 426 | ) |
@@ -429,15 +428,15 @@ discard block |
||
429 | 428 | ) |
430 | 429 | ) |
431 | 430 | ); |
432 | - } elseif ( ! give_verify_minimum_price( 'maximum' ) ) { |
|
431 | + } elseif ( ! give_verify_minimum_price('maximum')) { |
|
433 | 432 | |
434 | 433 | give_set_error( |
435 | 434 | 'invalid_donation_maximum', |
436 | 435 | sprintf( |
437 | 436 | /* translators: %s: Maximum donation amount */ |
438 | - __( 'This form has a maximum donation amount of %s.', 'give' ), |
|
437 | + __('This form has a maximum donation amount of %s.', 'give'), |
|
439 | 438 | give_currency_filter( |
440 | - give_format_amount( give_get_form_maximum_price( $form_id ), |
|
439 | + give_format_amount(give_get_form_maximum_price($form_id), |
|
441 | 440 | array( |
442 | 441 | 'sanitize' => false, |
443 | 442 | ) |
@@ -463,33 +462,33 @@ discard block |
||
463 | 462 | * |
464 | 463 | * @return bool |
465 | 464 | */ |
466 | -function give_verify_minimum_price( $amount_range = 'minimum' ) { |
|
465 | +function give_verify_minimum_price($amount_range = 'minimum') { |
|
467 | 466 | |
468 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
469 | - $form_id = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0; |
|
470 | - $amount = ! empty( $post_data['give-amount'] ) ? give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => give_get_currency( $form_id ) ) ) : 0; |
|
471 | - $price_id = isset( $post_data['give-price-id'] ) ? absint( $post_data['give-price-id'] ) : ''; |
|
467 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
468 | + $form_id = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0; |
|
469 | + $amount = ! empty($post_data['give-amount']) ? give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => give_get_currency($form_id))) : 0; |
|
470 | + $price_id = isset($post_data['give-price-id']) ? absint($post_data['give-price-id']) : ''; |
|
472 | 471 | |
473 | - $variable_prices = give_has_variable_prices( $form_id ); |
|
474 | - $price_ids = array_map( 'absint', give_get_variable_price_ids( $form_id ) ); |
|
472 | + $variable_prices = give_has_variable_prices($form_id); |
|
473 | + $price_ids = array_map('absint', give_get_variable_price_ids($form_id)); |
|
475 | 474 | $verified_stat = false; |
476 | 475 | |
477 | - if ( $variable_prices && in_array( $price_id, $price_ids, true ) ) { |
|
476 | + if ($variable_prices && in_array($price_id, $price_ids, true)) { |
|
478 | 477 | |
479 | - $price_level_amount = give_get_price_option_amount( $form_id, $price_id ); |
|
478 | + $price_level_amount = give_get_price_option_amount($form_id, $price_id); |
|
480 | 479 | |
481 | - if ( $price_level_amount == $amount ) { |
|
480 | + if ($price_level_amount == $amount) { |
|
482 | 481 | $verified_stat = true; |
483 | 482 | } |
484 | 483 | } |
485 | 484 | |
486 | - if ( ! $verified_stat ) { |
|
487 | - switch ( $amount_range ) { |
|
485 | + if ( ! $verified_stat) { |
|
486 | + switch ($amount_range) { |
|
488 | 487 | case 'minimum' : |
489 | - $verified_stat = ( give_get_form_minimum_price( $form_id ) > $amount ) ? false : true; |
|
488 | + $verified_stat = (give_get_form_minimum_price($form_id) > $amount) ? false : true; |
|
490 | 489 | break; |
491 | 490 | case 'maximum' : |
492 | - $verified_stat = ( give_get_form_maximum_price( $form_id ) < $amount ) ? false : true; |
|
491 | + $verified_stat = (give_get_form_maximum_price($form_id) < $amount) ? false : true; |
|
493 | 492 | break; |
494 | 493 | } |
495 | 494 | } |
@@ -503,7 +502,7 @@ discard block |
||
503 | 502 | * @param string $amount_range Type of the amount. |
504 | 503 | * @param integer $form_id Give Donation Form ID. |
505 | 504 | */ |
506 | - return apply_filters( 'give_verify_minimum_maximum_price', $verified_stat, $amount_range, $form_id ); |
|
505 | + return apply_filters('give_verify_minimum_maximum_price', $verified_stat, $amount_range, $form_id); |
|
507 | 506 | } |
508 | 507 | |
509 | 508 | /** |
@@ -516,13 +515,13 @@ discard block |
||
516 | 515 | */ |
517 | 516 | function give_donation_form_validate_agree_to_terms() { |
518 | 517 | |
519 | - $agree_to_terms = ! empty( $_POST['give_agree_to_terms'] ) ? give_clean( $_POST['give_agree_to_terms'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok. |
|
518 | + $agree_to_terms = ! empty($_POST['give_agree_to_terms']) ? give_clean($_POST['give_agree_to_terms']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok. |
|
520 | 519 | |
521 | 520 | // Proceed only, if donor agreed to terms. |
522 | - if ( ! $agree_to_terms ) { |
|
521 | + if ( ! $agree_to_terms) { |
|
523 | 522 | |
524 | 523 | // User did not agree. |
525 | - give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) ); |
|
524 | + give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give'))); |
|
526 | 525 | } |
527 | 526 | } |
528 | 527 | |
@@ -536,92 +535,92 @@ discard block |
||
536 | 535 | * |
537 | 536 | * @return array |
538 | 537 | */ |
539 | -function give_get_required_fields( $form_id ) { |
|
538 | +function give_get_required_fields($form_id) { |
|
540 | 539 | |
541 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
540 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
542 | 541 | |
543 | 542 | $required_fields = array( |
544 | 543 | 'give_email' => array( |
545 | 544 | 'error_id' => 'invalid_email', |
546 | - 'error_message' => __( 'Please enter a valid email address.', 'give' ), |
|
545 | + 'error_message' => __('Please enter a valid email address.', 'give'), |
|
547 | 546 | ), |
548 | 547 | 'give_first' => array( |
549 | 548 | 'error_id' => 'invalid_first_name', |
550 | - 'error_message' => __( 'Please enter your first name.', 'give' ), |
|
549 | + 'error_message' => __('Please enter your first name.', 'give'), |
|
551 | 550 | ), |
552 | 551 | ); |
553 | 552 | |
554 | - $name_title_prefix = give_is_name_title_prefix_required( $form_id ); |
|
555 | - if ( $name_title_prefix ) { |
|
553 | + $name_title_prefix = give_is_name_title_prefix_required($form_id); |
|
554 | + if ($name_title_prefix) { |
|
556 | 555 | $required_fields['give_title'] = array( |
557 | 556 | 'error_id' => 'invalid_title', |
558 | - 'error_message' => __( 'Please enter your title.', 'give' ), |
|
557 | + 'error_message' => __('Please enter your title.', 'give'), |
|
559 | 558 | ); |
560 | 559 | } |
561 | 560 | |
562 | - $require_address = give_require_billing_address( $payment_mode ); |
|
561 | + $require_address = give_require_billing_address($payment_mode); |
|
563 | 562 | |
564 | - if ( $require_address ) { |
|
565 | - $required_fields['card_address'] = array( |
|
563 | + if ($require_address) { |
|
564 | + $required_fields['card_address'] = array( |
|
566 | 565 | 'error_id' => 'invalid_card_address', |
567 | - 'error_message' => __( 'Please enter your primary billing address.', 'give' ), |
|
566 | + 'error_message' => __('Please enter your primary billing address.', 'give'), |
|
568 | 567 | ); |
569 | - $required_fields['card_zip'] = array( |
|
568 | + $required_fields['card_zip'] = array( |
|
570 | 569 | 'error_id' => 'invalid_zip_code', |
571 | - 'error_message' => __( 'Please enter your zip / postal code.', 'give' ), |
|
570 | + 'error_message' => __('Please enter your zip / postal code.', 'give'), |
|
572 | 571 | ); |
573 | - $required_fields['card_city'] = array( |
|
572 | + $required_fields['card_city'] = array( |
|
574 | 573 | 'error_id' => 'invalid_city', |
575 | - 'error_message' => __( 'Please enter your billing city.', 'give' ), |
|
574 | + 'error_message' => __('Please enter your billing city.', 'give'), |
|
576 | 575 | ); |
577 | 576 | $required_fields['billing_country'] = array( |
578 | 577 | 'error_id' => 'invalid_country', |
579 | - 'error_message' => __( 'Please select your billing country.', 'give' ), |
|
578 | + 'error_message' => __('Please select your billing country.', 'give'), |
|
580 | 579 | ); |
581 | 580 | |
582 | 581 | |
583 | 582 | $required_fields['card_state'] = array( |
584 | 583 | 'error_id' => 'invalid_state', |
585 | - 'error_message' => __( 'Please enter billing state / province / County.', 'give' ), |
|
584 | + 'error_message' => __('Please enter billing state / province / County.', 'give'), |
|
586 | 585 | ); |
587 | 586 | |
588 | - $country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok. |
|
587 | + $country = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok. |
|
589 | 588 | |
590 | 589 | // Check if billing country already exists. |
591 | - if ( $country ) { |
|
590 | + if ($country) { |
|
592 | 591 | |
593 | 592 | // Get the country list that does not required any states init. |
594 | 593 | $states_country = give_states_not_required_country_list(); |
595 | 594 | |
596 | 595 | // Check if states is empty or not. |
597 | - if ( array_key_exists( $country, $states_country ) ) { |
|
596 | + if (array_key_exists($country, $states_country)) { |
|
598 | 597 | // If states is empty remove the required fields of state in billing cart. |
599 | - unset( $required_fields['card_state'] ); |
|
598 | + unset($required_fields['card_state']); |
|
600 | 599 | } |
601 | 600 | } |
602 | 601 | } // End if(). |
603 | 602 | |
604 | - if ( give_is_company_field_enabled( $form_id ) ) { |
|
605 | - $form_option = give_get_meta( $form_id, '_give_company_field', true ); |
|
606 | - $global_setting = give_get_option( 'company_field' ); |
|
603 | + if (give_is_company_field_enabled($form_id)) { |
|
604 | + $form_option = give_get_meta($form_id, '_give_company_field', true); |
|
605 | + $global_setting = give_get_option('company_field'); |
|
607 | 606 | |
608 | 607 | $is_company_field_required = false; |
609 | 608 | |
610 | - if ( ! empty( $form_option ) && give_is_setting_enabled( $form_option, array( 'required' ) ) ) { |
|
609 | + if ( ! empty($form_option) && give_is_setting_enabled($form_option, array('required'))) { |
|
611 | 610 | $is_company_field_required = true; |
612 | 611 | |
613 | - } elseif ( 'global' === $form_option && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) { |
|
612 | + } elseif ('global' === $form_option && give_is_setting_enabled($global_setting, array('required'))) { |
|
614 | 613 | $is_company_field_required = true; |
615 | 614 | |
616 | - } elseif ( empty( $form_option ) && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) { |
|
615 | + } elseif (empty($form_option) && give_is_setting_enabled($global_setting, array('required'))) { |
|
617 | 616 | $is_company_field_required = true; |
618 | 617 | |
619 | 618 | } |
620 | 619 | |
621 | - if ( $is_company_field_required ) { |
|
620 | + if ($is_company_field_required) { |
|
622 | 621 | $required_fields['give_company_name'] = array( |
623 | 622 | 'error_id' => 'invalid_company', |
624 | - 'error_message' => __( 'Please enter Company Name.', 'give' ), |
|
623 | + 'error_message' => __('Please enter Company Name.', 'give'), |
|
625 | 624 | ); |
626 | 625 | } |
627 | 626 | } |
@@ -631,7 +630,7 @@ discard block |
||
631 | 630 | * |
632 | 631 | * @since 1.7 |
633 | 632 | */ |
634 | - $required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id ); |
|
633 | + $required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id); |
|
635 | 634 | |
636 | 635 | return $required_fields; |
637 | 636 | |
@@ -646,17 +645,17 @@ discard block |
||
646 | 645 | * |
647 | 646 | * @return bool |
648 | 647 | */ |
649 | -function give_require_billing_address( $payment_mode ) { |
|
648 | +function give_require_billing_address($payment_mode) { |
|
650 | 649 | |
651 | 650 | $return = false; |
652 | - $billing_country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok. |
|
651 | + $billing_country = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok. |
|
653 | 652 | |
654 | - if ( $billing_country || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) { |
|
653 | + if ($billing_country || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) { |
|
655 | 654 | $return = true; |
656 | 655 | } |
657 | 656 | |
658 | 657 | // Let payment gateways and other extensions determine if address fields should be required. |
659 | - return apply_filters( 'give_require_billing_address', $return ); |
|
658 | + return apply_filters('give_require_billing_address', $return); |
|
660 | 659 | |
661 | 660 | } |
662 | 661 | |
@@ -670,47 +669,47 @@ discard block |
||
670 | 669 | */ |
671 | 670 | function give_donation_form_validate_logged_in_user() { |
672 | 671 | |
673 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
672 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
674 | 673 | $user_id = get_current_user_id(); |
675 | - $form_id = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0; |
|
674 | + $form_id = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0; |
|
676 | 675 | |
677 | 676 | // Start empty array to collect valid user data. |
678 | 677 | $valid_user_data = array( |
679 | 678 | |
680 | 679 | // Assume there will be errors. |
681 | - 'user_id' => - 1, |
|
680 | + 'user_id' => -1, |
|
682 | 681 | ); |
683 | 682 | |
684 | 683 | // Proceed on;y, if valid $user_id found. |
685 | - if ( $user_id > 0 ) { |
|
684 | + if ($user_id > 0) { |
|
686 | 685 | |
687 | 686 | // Get the logged in user data. |
688 | - $user_data = get_userdata( $user_id ); |
|
687 | + $user_data = get_userdata($user_id); |
|
689 | 688 | |
690 | 689 | // Validate Required Form Fields. |
691 | - give_validate_required_form_fields( $form_id ); |
|
690 | + give_validate_required_form_fields($form_id); |
|
692 | 691 | |
693 | 692 | // Verify data. |
694 | - if ( is_object( $user_data ) && $user_data->ID > 0 ) { |
|
693 | + if (is_object($user_data) && $user_data->ID > 0) { |
|
695 | 694 | |
696 | 695 | // Collected logged in user data. |
697 | 696 | $valid_user_data = array( |
698 | 697 | 'user_id' => $user_id, |
699 | - 'user_email' => ! empty( $post_data['give_email'] ) ? sanitize_email( $post_data['give_email'] ) : $user_data->user_email, |
|
700 | - 'user_first' => ! empty( $post_data['give_first'] ) ? $post_data['give_first'] : $user_data->first_name, |
|
701 | - 'user_last' => ! empty( $post_data['give_last'] ) ? $post_data['give_last'] : $user_data->last_name, |
|
698 | + 'user_email' => ! empty($post_data['give_email']) ? sanitize_email($post_data['give_email']) : $user_data->user_email, |
|
699 | + 'user_first' => ! empty($post_data['give_first']) ? $post_data['give_first'] : $user_data->first_name, |
|
700 | + 'user_last' => ! empty($post_data['give_last']) ? $post_data['give_last'] : $user_data->last_name, |
|
702 | 701 | ); |
703 | 702 | |
704 | 703 | // Validate essential form fields. |
705 | - give_donation_form_validate_name_fields( $post_data ); |
|
704 | + give_donation_form_validate_name_fields($post_data); |
|
706 | 705 | |
707 | - if ( ! is_email( $valid_user_data['user_email'] ) ) { |
|
708 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
706 | + if ( ! is_email($valid_user_data['user_email'])) { |
|
707 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
709 | 708 | } |
710 | 709 | } else { |
711 | 710 | |
712 | 711 | // Set invalid user information error. |
713 | - give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) ); |
|
712 | + give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give')); |
|
714 | 713 | } |
715 | 714 | } |
716 | 715 | |
@@ -731,7 +730,7 @@ discard block |
||
731 | 730 | $auto_generated_password = wp_generate_password(); |
732 | 731 | $default_user_data = array( |
733 | 732 | 'give-form-id' => '', |
734 | - 'user_id' => - 1, // Assume there will be errors. |
|
733 | + 'user_id' => -1, // Assume there will be errors. |
|
735 | 734 | 'user_first' => '', |
736 | 735 | 'user_last' => '', |
737 | 736 | 'give_user_login' => false, |
@@ -741,26 +740,26 @@ discard block |
||
741 | 740 | ); |
742 | 741 | |
743 | 742 | // Get data. |
744 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
745 | - $user_data = wp_parse_args( $post_data, $default_user_data ); |
|
743 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
744 | + $user_data = wp_parse_args($post_data, $default_user_data); |
|
746 | 745 | |
747 | - $form_id = absint( $user_data['give-form-id'] ); |
|
748 | - $nonce = ! empty( $post_data['give-form-user-register-hash'] ) ? $post_data['give-form-user-register-hash'] : ''; |
|
746 | + $form_id = absint($user_data['give-form-id']); |
|
747 | + $nonce = ! empty($post_data['give-form-user-register-hash']) ? $post_data['give-form-user-register-hash'] : ''; |
|
749 | 748 | |
750 | 749 | // Validate user creation nonce. |
751 | - if ( ! wp_verify_nonce( $nonce, "give_form_create_user_nonce_{$form_id}" ) ) { |
|
752 | - give_set_error( 'invalid_nonce', __( 'Nonce verification has failed.', 'give' ) ); |
|
750 | + if ( ! wp_verify_nonce($nonce, "give_form_create_user_nonce_{$form_id}")) { |
|
751 | + give_set_error('invalid_nonce', __('Nonce verification has failed.', 'give')); |
|
753 | 752 | } |
754 | 753 | |
755 | 754 | $registering_new_user = false; |
756 | 755 | |
757 | - give_donation_form_validate_name_fields( $user_data ); |
|
756 | + give_donation_form_validate_name_fields($user_data); |
|
758 | 757 | |
759 | 758 | // Start an empty array to collect valid user data. |
760 | 759 | $valid_user_data = array( |
761 | 760 | |
762 | 761 | // Assume there will be errors. |
763 | - 'user_id' => - 1, |
|
762 | + 'user_id' => -1, |
|
764 | 763 | |
765 | 764 | // Get first name. |
766 | 765 | 'user_first' => $user_data['give_first'], |
@@ -773,13 +772,13 @@ discard block |
||
773 | 772 | ); |
774 | 773 | |
775 | 774 | // Validate Required Form Fields. |
776 | - give_validate_required_form_fields( $form_id ); |
|
775 | + give_validate_required_form_fields($form_id); |
|
777 | 776 | |
778 | 777 | // Set Email as Username. |
779 | 778 | $valid_user_data['user_login'] = $user_data['give_email']; |
780 | 779 | |
781 | 780 | // Check if we have an email to verify. |
782 | - if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) { |
|
781 | + if (give_validate_user_email($user_data['give_email'], $registering_new_user)) { |
|
783 | 782 | $valid_user_data['user_email'] = $user_data['give_email']; |
784 | 783 | } |
785 | 784 | |
@@ -796,47 +795,47 @@ discard block |
||
796 | 795 | */ |
797 | 796 | function give_donation_form_validate_user_login() { |
798 | 797 | |
799 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
798 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
800 | 799 | |
801 | 800 | // Start an array to collect valid user data. |
802 | 801 | $valid_user_data = array( |
803 | 802 | |
804 | 803 | // Assume there will be errors. |
805 | - 'user_id' => - 1, |
|
804 | + 'user_id' => -1, |
|
806 | 805 | ); |
807 | 806 | |
808 | 807 | // Bailout, if Username is empty. |
809 | - if ( empty( $post_data['give_user_login'] ) ) { |
|
810 | - give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) ); |
|
808 | + if (empty($post_data['give_user_login'])) { |
|
809 | + give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give')); |
|
811 | 810 | |
812 | 811 | return $valid_user_data; |
813 | 812 | } |
814 | 813 | |
815 | 814 | // Get the user by login. |
816 | - $user_data = get_user_by( 'login', strip_tags( $post_data['give_user_login'] ) ); |
|
815 | + $user_data = get_user_by('login', strip_tags($post_data['give_user_login'])); |
|
817 | 816 | |
818 | 817 | // Check if user exists. |
819 | - if ( $user_data ) { |
|
818 | + if ($user_data) { |
|
820 | 819 | |
821 | 820 | // Get password. |
822 | - $user_pass = ! empty( $post_data['give_user_pass'] ) ? $post_data['give_user_pass'] : false; |
|
821 | + $user_pass = ! empty($post_data['give_user_pass']) ? $post_data['give_user_pass'] : false; |
|
823 | 822 | |
824 | 823 | // Check user_pass. |
825 | - if ( $user_pass ) { |
|
824 | + if ($user_pass) { |
|
826 | 825 | |
827 | 826 | // Check if password is valid. |
828 | - if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) { |
|
827 | + if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) { |
|
829 | 828 | |
830 | - $current_page_url = site_url() . '/' . get_page_uri(); |
|
829 | + $current_page_url = site_url().'/'.get_page_uri(); |
|
831 | 830 | |
832 | 831 | // Incorrect password. |
833 | 832 | give_set_error( |
834 | 833 | 'password_incorrect', |
835 | 834 | sprintf( |
836 | 835 | '%1$s <a href="%2$s">%3$s</a>', |
837 | - __( 'The password you entered is incorrect.', 'give' ), |
|
838 | - wp_lostpassword_url( $current_page_url ), |
|
839 | - __( 'Reset Password', 'give' ) |
|
836 | + __('The password you entered is incorrect.', 'give'), |
|
837 | + wp_lostpassword_url($current_page_url), |
|
838 | + __('Reset Password', 'give') |
|
840 | 839 | ) |
841 | 840 | ); |
842 | 841 | |
@@ -854,11 +853,11 @@ discard block |
||
854 | 853 | } |
855 | 854 | } else { |
856 | 855 | // Empty password. |
857 | - give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) ); |
|
856 | + give_set_error('password_empty', __('Enter a password.', 'give')); |
|
858 | 857 | } |
859 | 858 | } else { |
860 | 859 | // No username. |
861 | - give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) ); |
|
860 | + give_set_error('username_incorrect', __('The username you entered does not exist.', 'give')); |
|
862 | 861 | } // End if(). |
863 | 862 | |
864 | 863 | return $valid_user_data; |
@@ -874,8 +873,8 @@ discard block |
||
874 | 873 | */ |
875 | 874 | function give_donation_form_validate_guest_user() { |
876 | 875 | |
877 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
878 | - $form_id = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0; |
|
876 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
877 | + $form_id = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0; |
|
879 | 878 | |
880 | 879 | // Start an array to collect valid user data. |
881 | 880 | $valid_user_data = array( |
@@ -884,22 +883,22 @@ discard block |
||
884 | 883 | ); |
885 | 884 | |
886 | 885 | // Validate name fields. |
887 | - give_donation_form_validate_name_fields( $post_data ); |
|
886 | + give_donation_form_validate_name_fields($post_data); |
|
888 | 887 | |
889 | 888 | // Validate Required Form Fields. |
890 | - give_validate_required_form_fields( $form_id ); |
|
889 | + give_validate_required_form_fields($form_id); |
|
891 | 890 | |
892 | 891 | // Get the guest email. |
893 | - $guest_email = ! empty( $post_data['give_email'] ) ? $post_data['give_email'] : false; |
|
892 | + $guest_email = ! empty($post_data['give_email']) ? $post_data['give_email'] : false; |
|
894 | 893 | |
895 | 894 | // Check email. |
896 | - if ( $guest_email && strlen( $guest_email ) > 0 ) { |
|
895 | + if ($guest_email && strlen($guest_email) > 0) { |
|
897 | 896 | |
898 | 897 | // Validate email. |
899 | - if ( ! is_email( $guest_email ) ) { |
|
898 | + if ( ! is_email($guest_email)) { |
|
900 | 899 | |
901 | 900 | // Invalid email. |
902 | - give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) ); |
|
901 | + give_set_error('email_invalid', __('Invalid email.', 'give')); |
|
903 | 902 | |
904 | 903 | } else { |
905 | 904 | |
@@ -907,15 +906,15 @@ discard block |
||
907 | 906 | $valid_user_data['user_email'] = $guest_email; |
908 | 907 | |
909 | 908 | // Get user_id from donor if exist. |
910 | - $donor = new Give_Donor( $guest_email ); |
|
909 | + $donor = new Give_Donor($guest_email); |
|
911 | 910 | |
912 | - if ( $donor->id && $donor->user_id ) { |
|
911 | + if ($donor->id && $donor->user_id) { |
|
913 | 912 | $valid_user_data['user_id'] = $donor->user_id; |
914 | 913 | } |
915 | 914 | } |
916 | 915 | } else { |
917 | 916 | // No email. |
918 | - give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) ); |
|
917 | + give_set_error('email_empty', __('Enter an email.', 'give')); |
|
919 | 918 | } |
920 | 919 | |
921 | 920 | return $valid_user_data; |
@@ -931,36 +930,36 @@ discard block |
||
931 | 930 | * |
932 | 931 | * @return integer |
933 | 932 | */ |
934 | -function give_register_and_login_new_user( $user_data = array() ) { |
|
933 | +function give_register_and_login_new_user($user_data = array()) { |
|
935 | 934 | // Verify the array. |
936 | - if ( empty( $user_data ) ) { |
|
937 | - return - 1; |
|
935 | + if (empty($user_data)) { |
|
936 | + return -1; |
|
938 | 937 | } |
939 | 938 | |
940 | - if ( give_get_errors() ) { |
|
941 | - return - 1; |
|
939 | + if (give_get_errors()) { |
|
940 | + return -1; |
|
942 | 941 | } |
943 | 942 | |
944 | - $user_args = apply_filters( 'give_insert_user_args', array( |
|
945 | - 'user_login' => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '', |
|
946 | - 'user_pass' => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '', |
|
947 | - 'user_email' => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '', |
|
948 | - 'first_name' => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '', |
|
949 | - 'last_name' => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '', |
|
950 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
951 | - 'role' => give_get_option( 'donor_default_user_role', 'give_donor' ), |
|
952 | - ), $user_data ); |
|
943 | + $user_args = apply_filters('give_insert_user_args', array( |
|
944 | + 'user_login' => isset($user_data['user_login']) ? $user_data['user_login'] : '', |
|
945 | + 'user_pass' => isset($user_data['user_pass']) ? $user_data['user_pass'] : '', |
|
946 | + 'user_email' => isset($user_data['user_email']) ? $user_data['user_email'] : '', |
|
947 | + 'first_name' => isset($user_data['user_first']) ? $user_data['user_first'] : '', |
|
948 | + 'last_name' => isset($user_data['user_last']) ? $user_data['user_last'] : '', |
|
949 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
950 | + 'role' => give_get_option('donor_default_user_role', 'give_donor'), |
|
951 | + ), $user_data); |
|
953 | 952 | |
954 | 953 | // Insert new user. |
955 | - $user_id = wp_insert_user( $user_args ); |
|
954 | + $user_id = wp_insert_user($user_args); |
|
956 | 955 | |
957 | 956 | // Validate inserted user. |
958 | - if ( is_wp_error( $user_id ) ) { |
|
959 | - return - 1; |
|
957 | + if (is_wp_error($user_id)) { |
|
958 | + return -1; |
|
960 | 959 | } |
961 | 960 | |
962 | 961 | // Allow themes and plugins to filter the user data. |
963 | - $user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args ); |
|
962 | + $user_data = apply_filters('give_insert_user_data', $user_data, $user_args); |
|
964 | 963 | |
965 | 964 | /** |
966 | 965 | * Fires after inserting user. |
@@ -970,7 +969,7 @@ discard block |
||
970 | 969 | * @param int $user_id User id. |
971 | 970 | * @param array $user_data Array containing user data. |
972 | 971 | */ |
973 | - do_action( 'give_insert_user', $user_id, $user_data ); |
|
972 | + do_action('give_insert_user', $user_id, $user_data); |
|
974 | 973 | |
975 | 974 | /** |
976 | 975 | * Filter allow user to alter if user when to login or not when user is register for the first time. |
@@ -979,9 +978,9 @@ discard block |
||
979 | 978 | * |
980 | 979 | * return bool True if login with registration and False if only want to register. |
981 | 980 | */ |
982 | - if ( true === (bool) apply_filters( 'give_log_user_in_on_register', true ) ) { |
|
981 | + if (true === (bool) apply_filters('give_log_user_in_on_register', true)) { |
|
983 | 982 | // Login new user. |
984 | - give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] ); |
|
983 | + give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']); |
|
985 | 984 | } |
986 | 985 | |
987 | 986 | // Return user id. |
@@ -998,33 +997,33 @@ discard block |
||
998 | 997 | * |
999 | 998 | * @return array|bool |
1000 | 999 | */ |
1001 | -function give_get_donation_form_user( $valid_data = array() ) { |
|
1000 | +function give_get_donation_form_user($valid_data = array()) { |
|
1002 | 1001 | |
1003 | 1002 | // Initialize user. |
1004 | 1003 | $user = false; |
1005 | - $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; |
|
1006 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
1004 | + $is_ajax = defined('DOING_AJAX') && DOING_AJAX; |
|
1005 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
1007 | 1006 | |
1008 | - if ( $is_ajax ) { |
|
1007 | + if ($is_ajax) { |
|
1009 | 1008 | |
1010 | 1009 | // Do not create or login the user during the ajax submission (check for errors only). |
1011 | 1010 | return true; |
1012 | - } elseif ( is_user_logged_in() ) { |
|
1011 | + } elseif (is_user_logged_in()) { |
|
1013 | 1012 | |
1014 | 1013 | // Set the valid user as the logged in collected data. |
1015 | 1014 | $user = $valid_data['logged_in_user']; |
1016 | - } elseif ( true === $valid_data['need_new_user'] || true === $valid_data['need_user_login'] ) { |
|
1015 | + } elseif (true === $valid_data['need_new_user'] || true === $valid_data['need_user_login']) { |
|
1017 | 1016 | |
1018 | 1017 | // New user registration. |
1019 | - if ( true === $valid_data['need_new_user'] ) { |
|
1018 | + if (true === $valid_data['need_new_user']) { |
|
1020 | 1019 | |
1021 | 1020 | // Set user. |
1022 | 1021 | $user = $valid_data['new_user_data']; |
1023 | 1022 | |
1024 | 1023 | // Register and login new user. |
1025 | - $user['user_id'] = give_register_and_login_new_user( $user ); |
|
1024 | + $user['user_id'] = give_register_and_login_new_user($user); |
|
1026 | 1025 | |
1027 | - } elseif ( true === $valid_data['need_user_login'] && ! $is_ajax ) { |
|
1026 | + } elseif (true === $valid_data['need_user_login'] && ! $is_ajax) { |
|
1028 | 1027 | |
1029 | 1028 | /** |
1030 | 1029 | * The login form is now processed in the give_process_donation_login() function. |
@@ -1036,47 +1035,47 @@ discard block |
||
1036 | 1035 | $user = $valid_data['login_user_data']; |
1037 | 1036 | |
1038 | 1037 | // Login user. |
1039 | - give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] ); |
|
1038 | + give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']); |
|
1040 | 1039 | } |
1041 | 1040 | } // End if(). |
1042 | 1041 | |
1043 | 1042 | // Check guest checkout. |
1044 | - if ( false === $user && false === give_logged_in_only( $post_data['give-form-id'] ) ) { |
|
1043 | + if (false === $user && false === give_logged_in_only($post_data['give-form-id'])) { |
|
1045 | 1044 | |
1046 | 1045 | // Set user. |
1047 | 1046 | $user = $valid_data['guest_user_data']; |
1048 | 1047 | } |
1049 | 1048 | |
1050 | 1049 | // Verify we have an user. |
1051 | - if ( false === $user || empty( $user ) ) { |
|
1050 | + if (false === $user || empty($user)) { |
|
1052 | 1051 | return false; |
1053 | 1052 | } |
1054 | 1053 | |
1055 | 1054 | // Get user first name. |
1056 | - if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) { |
|
1057 | - $user['user_first'] = isset( $post_data['give_first'] ) ? strip_tags( trim( $post_data['give_first'] ) ) : ''; |
|
1055 | + if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) { |
|
1056 | + $user['user_first'] = isset($post_data['give_first']) ? strip_tags(trim($post_data['give_first'])) : ''; |
|
1058 | 1057 | } |
1059 | 1058 | |
1060 | 1059 | // Get user last name. |
1061 | - if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) { |
|
1062 | - $user['user_last'] = isset( $post_data['give_last'] ) ? strip_tags( trim( $post_data['give_last'] ) ) : ''; |
|
1060 | + if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) { |
|
1061 | + $user['user_last'] = isset($post_data['give_last']) ? strip_tags(trim($post_data['give_last'])) : ''; |
|
1063 | 1062 | } |
1064 | 1063 | |
1065 | 1064 | // Add Title Prefix to user information. |
1066 | - if ( empty( $user['user_title'] ) || strlen( trim( $user['user_title'] ) ) < 1 ) { |
|
1067 | - $user['user_title'] = ! empty( $post_data['give_title'] ) ? strip_tags( trim( $post_data['give_title'] ) ) : ''; |
|
1065 | + if (empty($user['user_title']) || strlen(trim($user['user_title'])) < 1) { |
|
1066 | + $user['user_title'] = ! empty($post_data['give_title']) ? strip_tags(trim($post_data['give_title'])) : ''; |
|
1068 | 1067 | } |
1069 | 1068 | |
1070 | 1069 | // Get the user's billing address details. |
1071 | 1070 | $user['address'] = array(); |
1072 | - $user['address']['line1'] = ! empty( $post_data['card_address'] ) ? $post_data['card_address'] : false; |
|
1073 | - $user['address']['line2'] = ! empty( $post_data['card_address_2'] ) ? $post_data['card_address_2'] : false; |
|
1074 | - $user['address']['city'] = ! empty( $post_data['card_city'] ) ? $post_data['card_city'] : false; |
|
1075 | - $user['address']['state'] = ! empty( $post_data['card_state'] ) ? $post_data['card_state'] : false; |
|
1076 | - $user['address']['zip'] = ! empty( $post_data['card_zip'] ) ? $post_data['card_zip'] : false; |
|
1077 | - $user['address']['country'] = ! empty( $post_data['billing_country'] ) ? $post_data['billing_country'] : false; |
|
1078 | - |
|
1079 | - if ( empty( $user['address']['country'] ) ) { |
|
1071 | + $user['address']['line1'] = ! empty($post_data['card_address']) ? $post_data['card_address'] : false; |
|
1072 | + $user['address']['line2'] = ! empty($post_data['card_address_2']) ? $post_data['card_address_2'] : false; |
|
1073 | + $user['address']['city'] = ! empty($post_data['card_city']) ? $post_data['card_city'] : false; |
|
1074 | + $user['address']['state'] = ! empty($post_data['card_state']) ? $post_data['card_state'] : false; |
|
1075 | + $user['address']['zip'] = ! empty($post_data['card_zip']) ? $post_data['card_zip'] : false; |
|
1076 | + $user['address']['country'] = ! empty($post_data['billing_country']) ? $post_data['billing_country'] : false; |
|
1077 | + |
|
1078 | + if (empty($user['address']['country'])) { |
|
1080 | 1079 | $user['address'] = false; |
1081 | 1080 | } // End if(). |
1082 | 1081 | |
@@ -1097,16 +1096,16 @@ discard block |
||
1097 | 1096 | $card_data = give_get_donation_cc_info(); |
1098 | 1097 | |
1099 | 1098 | // Validate the card zip. |
1100 | - if ( ! empty( $card_data['card_zip'] ) ) { |
|
1101 | - if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) { |
|
1102 | - give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) ); |
|
1099 | + if ( ! empty($card_data['card_zip'])) { |
|
1100 | + if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) { |
|
1101 | + give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give')); |
|
1103 | 1102 | } |
1104 | 1103 | } |
1105 | 1104 | |
1106 | 1105 | // Ensure no spaces. |
1107 | - if ( ! empty( $card_data['card_number'] ) ) { |
|
1108 | - $card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs. |
|
1109 | - $card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces. |
|
1106 | + if ( ! empty($card_data['card_number'])) { |
|
1107 | + $card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs. |
|
1108 | + $card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces. |
|
1110 | 1109 | } |
1111 | 1110 | |
1112 | 1111 | // This should validate card numbers at some point too. |
@@ -1124,20 +1123,20 @@ discard block |
||
1124 | 1123 | function give_get_donation_cc_info() { |
1125 | 1124 | |
1126 | 1125 | // Sanitize the values submitted with donation form. |
1127 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
1126 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
1128 | 1127 | |
1129 | 1128 | $cc_info = array(); |
1130 | - $cc_info['card_name'] = ! empty( $post_data['card_name'] ) ? $post_data['card_name'] : ''; |
|
1131 | - $cc_info['card_number'] = ! empty( $post_data['card_number'] ) ? $post_data['card_number'] : ''; |
|
1132 | - $cc_info['card_cvc'] = ! empty( $post_data['card_cvc'] ) ? $post_data['card_cvc'] : ''; |
|
1133 | - $cc_info['card_exp_month'] = ! empty( $post_data['card_exp_month'] ) ? $post_data['card_exp_month'] : ''; |
|
1134 | - $cc_info['card_exp_year'] = ! empty( $post_data['card_exp_year'] ) ? $post_data['card_exp_year'] : ''; |
|
1135 | - $cc_info['card_address'] = ! empty( $post_data['card_address'] ) ? $post_data['card_address'] : ''; |
|
1136 | - $cc_info['card_address_2'] = ! empty( $post_data['card_address_2'] ) ? $post_data['card_address_2'] : ''; |
|
1137 | - $cc_info['card_city'] = ! empty( $post_data['card_city'] ) ? $post_data['card_city'] : ''; |
|
1138 | - $cc_info['card_state'] = ! empty( $post_data['card_state'] ) ? $post_data['card_state'] : ''; |
|
1139 | - $cc_info['card_country'] = ! empty( $post_data['billing_country'] ) ? $post_data['billing_country'] : ''; |
|
1140 | - $cc_info['card_zip'] = ! empty( $post_data['card_zip'] ) ? $post_data['card_zip'] : ''; |
|
1129 | + $cc_info['card_name'] = ! empty($post_data['card_name']) ? $post_data['card_name'] : ''; |
|
1130 | + $cc_info['card_number'] = ! empty($post_data['card_number']) ? $post_data['card_number'] : ''; |
|
1131 | + $cc_info['card_cvc'] = ! empty($post_data['card_cvc']) ? $post_data['card_cvc'] : ''; |
|
1132 | + $cc_info['card_exp_month'] = ! empty($post_data['card_exp_month']) ? $post_data['card_exp_month'] : ''; |
|
1133 | + $cc_info['card_exp_year'] = ! empty($post_data['card_exp_year']) ? $post_data['card_exp_year'] : ''; |
|
1134 | + $cc_info['card_address'] = ! empty($post_data['card_address']) ? $post_data['card_address'] : ''; |
|
1135 | + $cc_info['card_address_2'] = ! empty($post_data['card_address_2']) ? $post_data['card_address_2'] : ''; |
|
1136 | + $cc_info['card_city'] = ! empty($post_data['card_city']) ? $post_data['card_city'] : ''; |
|
1137 | + $cc_info['card_state'] = ! empty($post_data['card_state']) ? $post_data['card_state'] : ''; |
|
1138 | + $cc_info['card_country'] = ! empty($post_data['billing_country']) ? $post_data['billing_country'] : ''; |
|
1139 | + $cc_info['card_zip'] = ! empty($post_data['card_zip']) ? $post_data['card_zip'] : ''; |
|
1141 | 1140 | |
1142 | 1141 | // Return cc info. |
1143 | 1142 | return $cc_info; |
@@ -1153,14 +1152,14 @@ discard block |
||
1153 | 1152 | * |
1154 | 1153 | * @return bool|mixed |
1155 | 1154 | */ |
1156 | -function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) { |
|
1155 | +function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') { |
|
1157 | 1156 | $ret = false; |
1158 | 1157 | |
1159 | - if ( empty( $zip ) || empty( $country_code ) ) { |
|
1158 | + if (empty($zip) || empty($country_code)) { |
|
1160 | 1159 | return $ret; |
1161 | 1160 | } |
1162 | 1161 | |
1163 | - $country_code = strtoupper( $country_code ); |
|
1162 | + $country_code = strtoupper($country_code); |
|
1164 | 1163 | |
1165 | 1164 | $zip_regex = array( |
1166 | 1165 | 'AD' => 'AD\d{3}', |
@@ -1320,11 +1319,11 @@ discard block |
||
1320 | 1319 | 'ZM' => '\d{5}', |
1321 | 1320 | ); |
1322 | 1321 | |
1323 | - if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) { |
|
1322 | + if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) { |
|
1324 | 1323 | $ret = true; |
1325 | 1324 | } |
1326 | 1325 | |
1327 | - return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code ); |
|
1326 | + return apply_filters('give_is_zip_valid', $ret, $zip, $country_code); |
|
1328 | 1327 | } |
1329 | 1328 | |
1330 | 1329 | /** |
@@ -1336,60 +1335,60 @@ discard block |
||
1336 | 1335 | * |
1337 | 1336 | * @return bool |
1338 | 1337 | */ |
1339 | -function give_validate_donation_amount( $valid_data ) { |
|
1338 | +function give_validate_donation_amount($valid_data) { |
|
1340 | 1339 | |
1341 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
1340 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
1342 | 1341 | |
1343 | 1342 | /* @var Give_Donate_Form $form */ |
1344 | - $form = new Give_Donate_Form( $post_data['give-form-id'] ); |
|
1343 | + $form = new Give_Donate_Form($post_data['give-form-id']); |
|
1345 | 1344 | |
1346 | 1345 | // Get the form currency. |
1347 | - $form_currency = give_get_currency( $post_data['give-form-id'] ); |
|
1346 | + $form_currency = give_get_currency($post_data['give-form-id']); |
|
1348 | 1347 | |
1349 | 1348 | $donation_level_matched = false; |
1350 | 1349 | |
1351 | - if ( $form->is_set_type_donation_form() ) { |
|
1350 | + if ($form->is_set_type_donation_form()) { |
|
1352 | 1351 | |
1353 | 1352 | // Sanitize donation amount. |
1354 | - $post_data['give-amount'] = give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => $form_currency ) ); |
|
1353 | + $post_data['give-amount'] = give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => $form_currency)); |
|
1355 | 1354 | |
1356 | 1355 | // Backward compatibility. |
1357 | - if ( $form->is_custom_price( $post_data['give-amount'] ) ) { |
|
1356 | + if ($form->is_custom_price($post_data['give-amount'])) { |
|
1358 | 1357 | $post_data['give-price-id'] = 'custom'; |
1359 | 1358 | } |
1360 | 1359 | |
1361 | 1360 | $donation_level_matched = true; |
1362 | 1361 | |
1363 | - } elseif ( $form->is_multi_type_donation_form() ) { |
|
1362 | + } elseif ($form->is_multi_type_donation_form()) { |
|
1364 | 1363 | |
1365 | 1364 | $variable_prices = $form->get_prices(); |
1366 | 1365 | |
1367 | 1366 | // Bailout. |
1368 | - if ( ! $variable_prices ) { |
|
1367 | + if ( ! $variable_prices) { |
|
1369 | 1368 | return false; |
1370 | 1369 | } |
1371 | 1370 | |
1372 | 1371 | // Sanitize donation amount. |
1373 | - $post_data['give-amount'] = give_maybe_sanitize_amount( $post_data['give-amount'], array( 'currency' => $form_currency ) ); |
|
1374 | - $variable_price_option_amount = give_maybe_sanitize_amount( give_get_price_option_amount( $post_data['give-form-id'], $post_data['give-price-id'] ), array( 'currency' => $form_currency ) ); |
|
1372 | + $post_data['give-amount'] = give_maybe_sanitize_amount($post_data['give-amount'], array('currency' => $form_currency)); |
|
1373 | + $variable_price_option_amount = give_maybe_sanitize_amount(give_get_price_option_amount($post_data['give-form-id'], $post_data['give-price-id']), array('currency' => $form_currency)); |
|
1375 | 1374 | $new_price_id = ''; |
1376 | 1375 | |
1377 | - if ( $post_data['give-amount'] === $variable_price_option_amount ) { |
|
1376 | + if ($post_data['give-amount'] === $variable_price_option_amount) { |
|
1378 | 1377 | return true; |
1379 | 1378 | } |
1380 | 1379 | |
1381 | - if ( $form->is_custom_price( $post_data['give-amount'] ) ) { |
|
1380 | + if ($form->is_custom_price($post_data['give-amount'])) { |
|
1382 | 1381 | $new_price_id = 'custom'; |
1383 | 1382 | } else { |
1384 | 1383 | |
1385 | 1384 | // Find correct donation level from all donation levels. |
1386 | - foreach ( $variable_prices as $variable_price ) { |
|
1385 | + foreach ($variable_prices as $variable_price) { |
|
1387 | 1386 | |
1388 | 1387 | // Sanitize level amount. |
1389 | - $variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] ); |
|
1388 | + $variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']); |
|
1390 | 1389 | |
1391 | 1390 | // Set first match donation level ID. |
1392 | - if ( $post_data['give-amount'] === $variable_price['_give_amount'] ) { |
|
1391 | + if ($post_data['give-amount'] === $variable_price['_give_amount']) { |
|
1393 | 1392 | $new_price_id = $variable_price['_give_id']['level_id']; |
1394 | 1393 | break; |
1395 | 1394 | } |
@@ -1398,26 +1397,26 @@ discard block |
||
1398 | 1397 | |
1399 | 1398 | // If donation amount is not find in donation levels then check if form has custom donation feature enable or not. |
1400 | 1399 | // If yes then set price id to custom if amount is greater then custom minimum amount (if any). |
1401 | - if ( $post_data['give-price-id'] === $new_price_id ) { |
|
1400 | + if ($post_data['give-price-id'] === $new_price_id) { |
|
1402 | 1401 | $donation_level_matched = true; |
1403 | 1402 | } |
1404 | 1403 | } // End if(). |
1405 | 1404 | |
1406 | - if ( ! $donation_level_matched ) { |
|
1405 | + if ( ! $donation_level_matched) { |
|
1407 | 1406 | give_set_error( |
1408 | 1407 | 'invalid_donation_amount', |
1409 | 1408 | sprintf( |
1410 | 1409 | /* translators: %s: invalid donation amount */ |
1411 | - __( 'Donation amount %s is invalid.', 'give' ), |
|
1410 | + __('Donation amount %s is invalid.', 'give'), |
|
1412 | 1411 | give_currency_filter( |
1413 | - give_format_amount( $post_data['give-amount'], array( 'sanitize' => false, ) ) |
|
1412 | + give_format_amount($post_data['give-amount'], array('sanitize' => false,)) |
|
1414 | 1413 | ) |
1415 | 1414 | ) |
1416 | 1415 | ); |
1417 | 1416 | } |
1418 | 1417 | } |
1419 | 1418 | |
1420 | -add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 1 ); |
|
1419 | +add_action('give_checkout_error_checks', 'give_validate_donation_amount', 10, 1); |
|
1421 | 1420 | |
1422 | 1421 | /** |
1423 | 1422 | * Validate Required Form Fields. |
@@ -1426,20 +1425,20 @@ discard block |
||
1426 | 1425 | * |
1427 | 1426 | * @since 2.0 |
1428 | 1427 | */ |
1429 | -function give_validate_required_form_fields( $form_id ) { |
|
1428 | +function give_validate_required_form_fields($form_id) { |
|
1430 | 1429 | |
1431 | 1430 | // Sanitize values submitted with donation form. |
1432 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
1431 | + $post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
1433 | 1432 | |
1434 | 1433 | // Loop through required fields and show error messages. |
1435 | - foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) { |
|
1434 | + foreach (give_get_required_fields($form_id) as $field_name => $value) { |
|
1436 | 1435 | |
1437 | 1436 | // Clean Up Data of the input fields. |
1438 | - $field_value = $post_data[ $field_name ]; |
|
1437 | + $field_value = $post_data[$field_name]; |
|
1439 | 1438 | |
1440 | 1439 | // Check whether the required field is empty, then show the error message. |
1441 | - if ( in_array( $value, give_get_required_fields( $form_id ), true ) && empty( $field_value ) ) { |
|
1442 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
1440 | + if (in_array($value, give_get_required_fields($form_id), true) && empty($field_value)) { |
|
1441 | + give_set_error($value['error_id'], $value['error_message']); |
|
1443 | 1442 | } |
1444 | 1443 | } |
1445 | 1444 | } |
@@ -1453,12 +1452,12 @@ discard block |
||
1453 | 1452 | * |
1454 | 1453 | * @return void |
1455 | 1454 | */ |
1456 | -function give_donation_form_validate_name_fields( $post_data ) { |
|
1455 | +function give_donation_form_validate_name_fields($post_data) { |
|
1457 | 1456 | |
1458 | - $is_alpha_first_name = ( ! is_email( $post_data['give_first'] ) && ! preg_match( '~[0-9]~', $post_data['give_first'] ) ); |
|
1459 | - $is_alpha_last_name = ( ! is_email( $post_data['give_last'] ) && ! preg_match( '~[0-9]~', $post_data['give_last'] ) ); |
|
1457 | + $is_alpha_first_name = ( ! is_email($post_data['give_first']) && ! preg_match('~[0-9]~', $post_data['give_first'])); |
|
1458 | + $is_alpha_last_name = ( ! is_email($post_data['give_last']) && ! preg_match('~[0-9]~', $post_data['give_last'])); |
|
1460 | 1459 | |
1461 | - if ( ! $is_alpha_first_name || ( ! empty( $post_data['give_last'] ) && ! $is_alpha_last_name ) ) { |
|
1462 | - give_set_error( 'invalid_name', esc_html__( 'The First Name and Last Name fields cannot contain an email address or numbers.', 'give' ) ); |
|
1460 | + if ( ! $is_alpha_first_name || ( ! empty($post_data['give_last']) && ! $is_alpha_last_name)) { |
|
1461 | + give_set_error('invalid_name', esc_html__('The First Name and Last Name fields cannot contain an email address or numbers.', 'give')); |
|
1463 | 1462 | } |
1464 | 1463 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
9 | 9 | * @since 2.1.4 |
10 | 10 | */ |
11 | -class Give_Readme_Parser{ |
|
11 | +class Give_Readme_Parser { |
|
12 | 12 | /** |
13 | 13 | * Readme file url |
14 | 14 | * |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param string $file_url |
34 | 34 | */ |
35 | - function __construct( $file_url ) { |
|
35 | + function __construct($file_url) { |
|
36 | 36 | $this->file_url = $file_url; |
37 | - $this->file_content = wp_remote_retrieve_body( wp_remote_get( $this->file_url ) ); |
|
37 | + $this->file_content = wp_remote_retrieve_body(wp_remote_get($this->file_url)); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function requires_at_least() { |
49 | 49 | // Regex to extract Give core minimum version from the readme.txt file. |
50 | - preg_match('|Requires Give:(.*)|i', $this->file_content, $_requires_at_least ); |
|
50 | + preg_match('|Requires Give:(.*)|i', $this->file_content, $_requires_at_least); |
|
51 | 51 | |
52 | - if( is_array( $_requires_at_least ) && 1 < count( $_requires_at_least ) ) { |
|
53 | - $_requires_at_least = trim( $_requires_at_least[1] ); |
|
54 | - }else{ |
|
52 | + if (is_array($_requires_at_least) && 1 < count($_requires_at_least)) { |
|
53 | + $_requires_at_least = trim($_requires_at_least[1]); |
|
54 | + } else { |
|
55 | 55 | $_requires_at_least = null; |
56 | 56 | } |
57 | 57 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | if( is_array( $_requires_at_least ) && 1 < count( $_requires_at_least ) ) { |
53 | 53 | $_requires_at_least = trim( $_requires_at_least[1] ); |
54 | - }else{ |
|
54 | + } else{ |
|
55 | 55 | $_requires_at_least = null; |
56 | 56 | } |
57 | 57 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string $message Fully formatted message |
44 | 44 | */ |
45 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
46 | - return give_do_email_tags( $message, $payment_id ); |
|
45 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
46 | + return give_do_email_tags($message, $payment_id); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -57,45 +57,45 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return string $message Fully formatted message |
59 | 59 | */ |
60 | -function give_email_preview_template_tags( $message ) { |
|
60 | +function give_email_preview_template_tags($message) { |
|
61 | 61 | |
62 | - $price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) ); |
|
62 | + $price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false))); |
|
63 | 63 | |
64 | 64 | $gateway = 'PayPal'; |
65 | 65 | |
66 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
66 | + $receipt_id = strtolower(md5(uniqid())); |
|
67 | 67 | |
68 | - $payment_id = rand( 1, 100 ); |
|
69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id ), give_get_history_page_uri() ) ); |
|
68 | + $payment_id = rand(1, 100); |
|
69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id), give_get_history_page_uri())); |
|
70 | 70 | |
71 | 71 | $receipt_link = sprintf( |
72 | 72 | '<a href="%1$s">%2$s</a>', |
73 | 73 | $receipt_link_url, |
74 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
74 | + esc_html__('View the receipt in your browser »', 'give') |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | // Set user. |
78 | 78 | $user = wp_get_current_user(); |
79 | 79 | |
80 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
81 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
82 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
83 | - $message = str_replace( '{user_email}', $user->user_email, $message ); |
|
84 | - $message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message ); |
|
85 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
86 | - $message = str_replace( '{amount}', $price, $message ); |
|
87 | - $message = str_replace( '{price}', $price, $message ); |
|
88 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
89 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
90 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
91 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
92 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
93 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
94 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
95 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
96 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
97 | - |
|
98 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
80 | + $message = str_replace('{name}', $user->display_name, $message); |
|
81 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
82 | + $message = str_replace('{username}', $user->user_login, $message); |
|
83 | + $message = str_replace('{user_email}', $user->user_email, $message); |
|
84 | + $message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message); |
|
85 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
86 | + $message = str_replace('{amount}', $price, $message); |
|
87 | + $message = str_replace('{price}', $price, $message); |
|
88 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
89 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
90 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
91 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
92 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
93 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
94 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
95 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
96 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
97 | + |
|
98 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return array |
113 | 113 | */ |
114 | -function give_email_preview_buttons_callback( $field ) { |
|
115 | - $field_id = str_replace( '_preview_buttons', '', $field['id'] ); |
|
114 | +function give_email_preview_buttons_callback($field) { |
|
115 | + $field_id = str_replace('_preview_buttons', '', $field['id']); |
|
116 | 116 | |
117 | 117 | ob_start(); |
118 | 118 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | '<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>', |
121 | 121 | wp_nonce_url( |
122 | 122 | add_query_arg( |
123 | - array( 'give_action' => 'preview_email', 'email_type' => $field_id ), |
|
123 | + array('give_action' => 'preview_email', 'email_type' => $field_id), |
|
124 | 124 | home_url() |
125 | 125 | ), 'give-preview-email' |
126 | 126 | ), |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | echo sprintf( |
131 | 131 | ' <a href="%1$s" aria-label="%2$s" class="button-secondary">%3$s</a>', |
132 | 132 | wp_nonce_url( |
133 | - add_query_arg( array( |
|
133 | + add_query_arg(array( |
|
134 | 134 | 'give_action' => 'send_preview_email', |
135 | 135 | 'email_type' => $field_id, |
136 | 136 | 'give-messages[]' => 'sent-test-email', |
137 | - ) ), 'give-send-preview-email' ), |
|
138 | - esc_attr__( 'Send Test Email.', 'give' ), |
|
139 | - esc_html__( 'Send Test Email', 'give' ) |
|
137 | + )), 'give-send-preview-email' ), |
|
138 | + esc_attr__('Send Test Email.', 'give'), |
|
139 | + esc_html__('Send Test Email', 'give') |
|
140 | 140 | ); |
141 | 141 | |
142 | 142 | echo ob_get_clean(); |
@@ -155,34 +155,34 @@ discard block |
||
155 | 155 | |
156 | 156 | //Payment receipt switcher |
157 | 157 | $payment_count = give_count_payments()->publish; |
158 | - $payment_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' ); |
|
158 | + $payment_id = give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id'); |
|
159 | 159 | |
160 | - if ( $payment_count <= 0 ) { |
|
160 | + if ($payment_count <= 0) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
164 | 164 | //Get payments. |
165 | - $donations = new Give_Payments_Query( array( |
|
165 | + $donations = new Give_Payments_Query(array( |
|
166 | 166 | 'number' => 100, |
167 | 167 | 'output' => '', |
168 | 168 | 'fields' => 'ids' |
169 | - ) ); |
|
169 | + )); |
|
170 | 170 | $donations = $donations->get_payments(); |
171 | - $options = array(); |
|
171 | + $options = array(); |
|
172 | 172 | |
173 | 173 | // Default option. |
174 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
174 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
175 | 175 | |
176 | 176 | //Provide nice human readable options. |
177 | - if ( $donations ) { |
|
178 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
179 | - foreach ( $donations as $donation_id ) { |
|
177 | + if ($donations) { |
|
178 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
179 | + foreach ($donations as $donation_id) { |
|
180 | 180 | |
181 | - $options[ $donation_id ] = sprintf( |
|
181 | + $options[$donation_id] = sprintf( |
|
182 | 182 | '#%1$s - %2$s - %3$s', |
183 | 183 | $donation_id, |
184 | - give_get_donation_donor_email( $donation_id ), |
|
185 | - get_the_title( $donation_id ) |
|
184 | + give_get_donation_donor_email($donation_id), |
|
185 | + get_the_title($donation_id) |
|
186 | 186 | ); |
187 | 187 | } |
188 | 188 | } |
@@ -191,27 +191,27 @@ discard block |
||
191 | 191 | $transaction_header = '<div style="margin:0;padding:10px 0;width:100%;background-color:#FFF;border-bottom:1px solid #eee; text-align:center;">'; |
192 | 192 | |
193 | 193 | // Remove payment id query param if set from request url. |
194 | - $request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] ); |
|
194 | + $request_url_data = wp_parse_url($_SERVER['REQUEST_URI']); |
|
195 | 195 | $query = $request_url_data['query']; |
196 | - $query = remove_query_arg( array( 'preview_id' ), $query ); |
|
196 | + $query = remove_query_arg(array('preview_id'), $query); |
|
197 | 197 | |
198 | - $request_url = home_url( '/?' . str_replace( '', '', $query ) ); |
|
198 | + $request_url = home_url('/?'.str_replace('', '', $query)); |
|
199 | 199 | |
200 | 200 | $transaction_header .= '<script> |
201 | 201 | function change_preview(){ |
202 | 202 | var transactions = document.getElementById("give_preview_email_payment_id"); |
203 | 203 | var selected_trans = transactions.options[transactions.selectedIndex]; |
204 | 204 | if (selected_trans){ |
205 | - var url_string = "' . $request_url . '&preview_id=" + selected_trans.value; |
|
205 | + var url_string = "' . $request_url.'&preview_id=" + selected_trans.value; |
|
206 | 206 | window.location = url_string; |
207 | 207 | } |
208 | 208 | } |
209 | 209 | </script>'; |
210 | 210 | |
211 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
211 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
212 | 212 | |
213 | 213 | //The select field with 100 latest transactions |
214 | - $transaction_header .= Give()->html->select( array( |
|
214 | + $transaction_header .= Give()->html->select(array( |
|
215 | 215 | 'name' => 'preview_email_payment_id', |
216 | 216 | 'selected' => $payment_id, |
217 | 217 | 'id' => 'give_preview_email_payment_id', |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | 'select_atts' => 'onchange="change_preview()"', |
222 | 222 | 'show_option_all' => false, |
223 | 223 | 'show_option_none' => false, |
224 | - ) ); |
|
224 | + )); |
|
225 | 225 | |
226 | 226 | //Closing tag |
227 | 227 | $transaction_header .= '</div>'; |
228 | 228 | |
229 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
229 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
230 | 230 | |
231 | 231 | } |