@@ -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 | |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | -function give_trigger_donation_receipt( $payment_id ) { |
|
26 | +function give_trigger_donation_receipt($payment_id) { |
|
27 | 27 | // Make sure we don't send a purchase receipt while editing a payment |
28 | - if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { |
|
28 | + if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Send email |
33 | - give_email_donation_receipt( $payment_id ); |
|
33 | + give_email_donation_receipt($payment_id); |
|
34 | 34 | } |
35 | 35 | |
36 | -add_action( 'give_complete_purchase', 'give_trigger_donation_receipt', 999, 1 ); |
|
36 | +add_action('give_complete_purchase', 'give_trigger_donation_receipt', 999, 1); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Resend the Email Purchase Receipt. (This can be done from the Payment History page) |
@@ -44,29 +44,29 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return void |
46 | 46 | */ |
47 | -function give_resend_donation_receipt( $data ) { |
|
47 | +function give_resend_donation_receipt($data) { |
|
48 | 48 | |
49 | - $purchase_id = absint( $data['purchase_id'] ); |
|
49 | + $purchase_id = absint($data['purchase_id']); |
|
50 | 50 | |
51 | - if ( empty( $purchase_id ) ) { |
|
51 | + if (empty($purchase_id)) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) { |
|
56 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
55 | + if ( ! current_user_can('edit_give_payments', $purchase_id)) { |
|
56 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
57 | 57 | } |
58 | 58 | |
59 | - give_email_donation_receipt( $purchase_id, false ); |
|
59 | + give_email_donation_receipt($purchase_id, false); |
|
60 | 60 | |
61 | - wp_redirect( add_query_arg( array( |
|
61 | + wp_redirect(add_query_arg(array( |
|
62 | 62 | 'give-message' => 'email_sent', |
63 | 63 | 'give-action' => false, |
64 | 64 | 'purchase_id' => false |
65 | - ) ) ); |
|
65 | + ))); |
|
66 | 66 | exit; |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_email_links', 'give_resend_donation_receipt' ); |
|
69 | +add_action('give_email_links', 'give_resend_donation_receipt'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Trigger the sending of a Test Email |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return void |
79 | 79 | */ |
80 | -function give_send_test_email( $data ) { |
|
81 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) { |
|
80 | +function give_send_test_email($data) { |
|
81 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | give_email_test_donation_receipt(); |
87 | 87 | |
88 | 88 | // Remove the test email query arg |
89 | - wp_redirect( remove_query_arg( 'give_action' ) ); |
|
89 | + wp_redirect(remove_query_arg('give_action')); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | |
93 | -add_action( 'give_send_test_email', 'give_send_test_email' ); |
|
93 | +add_action('give_send_test_email', 'give_send_test_email'); |
@@ -45,22 +45,22 @@ discard block |
||
45 | 45 | * @param string $default_path Default path. Default is empty. |
46 | 46 | */ |
47 | 47 | function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | - extract( $args ); |
|
50 | - } |
|
48 | + if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | + extract( $args ); |
|
50 | + } |
|
51 | 51 | |
52 | - $template_names = array( $template_name . '.php' ); |
|
52 | + $template_names = array( $template_name . '.php' ); |
|
53 | 53 | |
54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
54 | + $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
55 | 55 | |
56 | - if ( ! file_exists( $located ) ) { |
|
56 | + if ( ! file_exists( $located ) ) { |
|
57 | 57 | /* translators: %s: the template */ |
58 | - give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
59 | - return; |
|
60 | - } |
|
58 | + give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
59 | + return; |
|
60 | + } |
|
61 | 61 | |
62 | - // Allow 3rd party plugin filter template file from their plugin. |
|
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
62 | + // Allow 3rd party plugin filter template file from their plugin. |
|
63 | + $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
75 | 75 | * @param array $args Passed arguments. |
76 | 76 | */ |
77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
77 | + do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
78 | 78 | |
79 | - include( $located ); |
|
79 | + include( $located ); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
91 | 91 | * @param array $args Passed arguments. |
92 | 92 | */ |
93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
93 | + do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function give_get_templates_dir() { |
24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function give_get_templates_url() { |
34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
34 | + return GIVE_PLUGIN_URL.'templates'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | * @param string $template_path Template file path. Default is empty. |
45 | 45 | * @param string $default_path Default path. Default is empty. |
46 | 46 | */ |
47 | -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | - extract( $args ); |
|
47 | +function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
48 | + if ( ! empty($args) && is_array($args)) { |
|
49 | + extract($args); |
|
50 | 50 | } |
51 | 51 | |
52 | - $template_names = array( $template_name . '.php' ); |
|
52 | + $template_names = array($template_name.'.php'); |
|
53 | 53 | |
54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
54 | + $located = give_locate_template($template_names, $template_path, $default_path); |
|
55 | 55 | |
56 | - if ( ! file_exists( $located ) ) { |
|
56 | + if ( ! file_exists($located)) { |
|
57 | 57 | /* translators: %s: the template */ |
58 | - give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
58 | + give_output_error(sprintf(__('The %s template was not found.', 'give'), $located), true); |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // Allow 3rd party plugin filter template file from their plugin. |
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
63 | + $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
75 | 75 | * @param array $args Passed arguments. |
76 | 76 | */ |
77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
77 | + do_action('give_before_template_part', $template_name, $template_path, $located, $args); |
|
78 | 78 | |
79 | - include( $located ); |
|
79 | + include($located); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
91 | 91 | * @param array $args Passed arguments. |
92 | 92 | */ |
93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
93 | + do_action('give_after_template_part', $template_name, $template_path, $located, $args); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
109 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Fires in give template part, before the template part is retrieved. |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param string $slug Template part file slug {slug}.php. |
119 | 119 | * @param string $name Template part file name {slug}-{name}.php. |
120 | 120 | */ |
121 | - do_action( "get_template_part_{$slug}", $slug, $name ); |
|
121 | + do_action("get_template_part_{$slug}", $slug, $name); |
|
122 | 122 | |
123 | 123 | // Setup possible parts |
124 | 124 | $templates = array(); |
125 | - if ( isset( $name ) ) { |
|
126 | - $templates[] = $slug . '-' . $name . '.php'; |
|
125 | + if (isset($name)) { |
|
126 | + $templates[] = $slug.'-'.$name.'.php'; |
|
127 | 127 | } |
128 | - $templates[] = $slug . '.php'; |
|
128 | + $templates[] = $slug.'.php'; |
|
129 | 129 | |
130 | 130 | // Allow template parts to be filtered |
131 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
131 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
132 | 132 | |
133 | 133 | // Return the part that is found |
134 | - return give_locate_template( $templates, $load, false ); |
|
134 | + return give_locate_template($templates, $load, false); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -152,37 +152,37 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return string The template filename if one is located. |
154 | 154 | */ |
155 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
155 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
156 | 156 | // No file found yet |
157 | 157 | $located = false; |
158 | 158 | |
159 | 159 | // Try to find a template file |
160 | - foreach ( (array) $template_names as $template_name ) { |
|
160 | + foreach ((array) $template_names as $template_name) { |
|
161 | 161 | |
162 | 162 | // Continue if template is empty |
163 | - if ( empty( $template_name ) ) { |
|
163 | + if (empty($template_name)) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Trim off any slashes from the template name |
168 | - $template_name = ltrim( $template_name, '/' ); |
|
168 | + $template_name = ltrim($template_name, '/'); |
|
169 | 169 | |
170 | 170 | // try locating this template file by looping through the template paths |
171 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
171 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
172 | 172 | |
173 | - if ( file_exists( $template_path . $template_name ) ) { |
|
174 | - $located = $template_path . $template_name; |
|
173 | + if (file_exists($template_path.$template_name)) { |
|
174 | + $located = $template_path.$template_name; |
|
175 | 175 | break; |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if ( $located ) { |
|
179 | + if ($located) { |
|
180 | 180 | break; |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
185 | - load_template( $located, $require_once ); |
|
184 | + if ((true == $load) && ! empty($located)) { |
|
185 | + load_template($located, $require_once); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return $located; |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | $template_dir = give_get_theme_template_dir_name(); |
200 | 200 | |
201 | 201 | $file_paths = array( |
202 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
203 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
202 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
203 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
204 | 204 | 100 => give_get_templates_dir() |
205 | 205 | ); |
206 | 206 | |
207 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
207 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
208 | 208 | |
209 | 209 | // sort the file paths based on priority |
210 | - ksort( $file_paths, SORT_NUMERIC ); |
|
210 | + ksort($file_paths, SORT_NUMERIC); |
|
211 | 211 | |
212 | - return array_map( 'trailingslashit', $file_paths ); |
|
212 | + return array_map('trailingslashit', $file_paths); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return string |
222 | 222 | */ |
223 | 223 | function give_get_theme_template_dir_name() { |
224 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
224 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | * @return void |
232 | 232 | */ |
233 | 233 | function give_version_in_header() { |
234 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
234 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
235 | 235 | } |
236 | 236 | |
237 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
237 | +add_action('wp_head', 'give_version_in_header'); |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Determines if we're currently on the Donations History page. |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | function give_is_donation_history_page() { |
246 | 246 | |
247 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
247 | + $ret = is_page(give_get_option('history_page')); |
|
248 | 248 | |
249 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
249 | + return apply_filters('give_is_donation_history_page', $ret); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -258,25 +258,25 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return array Modified array of classes |
260 | 260 | */ |
261 | -function give_add_body_classes( $class ) { |
|
261 | +function give_add_body_classes($class) { |
|
262 | 262 | $classes = (array) $class; |
263 | 263 | |
264 | - if ( give_is_success_page() ) { |
|
264 | + if (give_is_success_page()) { |
|
265 | 265 | $classes[] = 'give-success'; |
266 | 266 | $classes[] = 'give-page'; |
267 | 267 | } |
268 | 268 | |
269 | - if ( give_is_failed_transaction_page() ) { |
|
269 | + if (give_is_failed_transaction_page()) { |
|
270 | 270 | $classes[] = 'give-failed-transaction'; |
271 | 271 | $classes[] = 'give-page'; |
272 | 272 | } |
273 | 273 | |
274 | - if ( give_is_donation_history_page() ) { |
|
274 | + if (give_is_donation_history_page()) { |
|
275 | 275 | $classes[] = 'give-donation-history'; |
276 | 276 | $classes[] = 'give-page'; |
277 | 277 | } |
278 | 278 | |
279 | - if ( give_is_test_mode() ) { |
|
279 | + if (give_is_test_mode()) { |
|
280 | 280 | $classes[] = 'give-test-mode'; |
281 | 281 | $classes[] = 'give-page'; |
282 | 282 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | //Theme-specific Classes used to prevent conflicts via CSS |
285 | 285 | $current_theme = wp_get_theme(); |
286 | 286 | |
287 | - switch ( $current_theme->template ) { |
|
287 | + switch ($current_theme->template) { |
|
288 | 288 | |
289 | 289 | case 'Divi': |
290 | 290 | $classes[] = 'give-divi'; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | |
299 | 299 | } |
300 | 300 | |
301 | - return array_unique( $classes ); |
|
301 | + return array_unique($classes); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
304 | +add_filter('body_class', 'give_add_body_classes'); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
@@ -317,22 +317,22 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return array |
319 | 319 | */ |
320 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
321 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
320 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
321 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
322 | 322 | return $classes; |
323 | 323 | } |
324 | 324 | |
325 | 325 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
326 | 326 | |
327 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
328 | - unset( $classes[ $key ] ); |
|
327 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
328 | + unset($classes[$key]); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | return $classes; |
332 | 332 | } |
333 | 333 | |
334 | 334 | |
335 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
335 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * Get the placeholder image URL for forms etc |
@@ -342,85 +342,85 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function give_get_placeholder_img_src() { |
344 | 344 | |
345 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
345 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
346 | 346 | |
347 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
347 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
351 | 351 | /** |
352 | 352 | * Global |
353 | 353 | */ |
354 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
354 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
355 | 355 | |
356 | 356 | /** |
357 | 357 | * Output the start of the page wrapper. |
358 | 358 | */ |
359 | 359 | function give_output_content_wrapper() { |
360 | - give_get_template_part( 'global/wrapper-start' ); |
|
360 | + give_get_template_part('global/wrapper-start'); |
|
361 | 361 | } |
362 | 362 | } |
363 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
363 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
364 | 364 | |
365 | 365 | /** |
366 | 366 | * Output the end of the page wrapper. |
367 | 367 | */ |
368 | 368 | function give_output_content_wrapper_end() { |
369 | - give_get_template_part( 'global/wrapper-end' ); |
|
369 | + give_get_template_part('global/wrapper-end'); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Single Give Form |
375 | 375 | */ |
376 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
376 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
377 | 377 | function give_left_sidebar_pre_wrap() { |
378 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
378 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
382 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
383 | 383 | function give_left_sidebar_post_wrap() { |
384 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
384 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
388 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
389 | 389 | function give_get_forms_sidebar() { |
390 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
390 | + give_get_template_part('single-give-form/sidebar'); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
394 | +if ( ! function_exists('give_show_form_images')) { |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Output the product image before the single product summary. |
398 | 398 | */ |
399 | 399 | function give_show_form_images() { |
400 | - $featured_image_option = give_get_option( 'disable_form_featured_img' ); |
|
401 | - if ( $featured_image_option !== 'on' ) { |
|
402 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
400 | + $featured_image_option = give_get_option('disable_form_featured_img'); |
|
401 | + if ($featured_image_option !== 'on') { |
|
402 | + give_get_template_part('single-give-form/featured-image'); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
407 | +if ( ! function_exists('give_template_single_title')) { |
|
408 | 408 | |
409 | 409 | /** |
410 | 410 | * Output the product title. |
411 | 411 | */ |
412 | 412 | function give_template_single_title() { |
413 | - give_get_template_part( 'single-give-form/title' ); |
|
413 | + give_get_template_part('single-give-form/title'); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
417 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
417 | +if ( ! function_exists('give_show_avatars')) { |
|
418 | 418 | |
419 | 419 | /** |
420 | 420 | * Output the product title. |
421 | 421 | */ |
422 | 422 | function give_show_avatars() { |
423 | - echo do_shortcode( '[give_donors_gravatars]' ); |
|
423 | + echo do_shortcode('[give_donors_gravatars]'); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * Conditional Functions |
429 | 429 | */ |
430 | 430 | |
431 | -if ( ! function_exists( 'is_give_form' ) ) { |
|
431 | +if ( ! function_exists('is_give_form')) { |
|
432 | 432 | |
433 | 433 | /** |
434 | 434 | * is_give_form |
@@ -440,11 +440,11 @@ discard block |
||
440 | 440 | * @return bool |
441 | 441 | */ |
442 | 442 | function is_give_form() { |
443 | - return is_singular( array( 'give_form' ) ); |
|
443 | + return is_singular(array('give_form')); |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
447 | -if ( ! function_exists( 'is_give_category' ) ) { |
|
447 | +if ( ! function_exists('is_give_category')) { |
|
448 | 448 | |
449 | 449 | /** |
450 | 450 | * is_give_category |
@@ -459,12 +459,12 @@ discard block |
||
459 | 459 | * |
460 | 460 | * @return bool |
461 | 461 | */ |
462 | - function is_give_category( $term = '' ) { |
|
463 | - return is_tax( 'give_forms_category', $term ); |
|
462 | + function is_give_category($term = '') { |
|
463 | + return is_tax('give_forms_category', $term); |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
467 | -if ( ! function_exists( 'is_give_tag' ) ) { |
|
467 | +if ( ! function_exists('is_give_tag')) { |
|
468 | 468 | |
469 | 469 | /** |
470 | 470 | * is_give_tag |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return bool |
481 | 481 | */ |
482 | - function is_give_tag( $term = '' ) { |
|
483 | - return is_tax( 'give_forms_tag', $term ); |
|
482 | + function is_give_tag($term = '') { |
|
483 | + return is_tax('give_forms_tag', $term); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | -if ( ! function_exists( 'is_give_taxonomy' ) ) { |
|
487 | +if ( ! function_exists('is_give_taxonomy')) { |
|
488 | 488 | |
489 | 489 | /** |
490 | 490 | * is_give_taxonomy |
@@ -496,6 +496,6 @@ discard block |
||
496 | 496 | * @return bool |
497 | 497 | */ |
498 | 498 | function is_give_taxonomy() { |
499 | - return is_tax( get_object_taxonomies( 'give_form' ) ); |
|
499 | + return is_tax(get_object_taxonomies('give_form')); |
|
500 | 500 | } |
501 | 501 | } |
@@ -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 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public function __construct() { |
99 | 99 | |
100 | 100 | // get it started |
101 | - add_action( 'init', array( $this, 'init' ) ); |
|
101 | + add_action('init', array($this, 'init')); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -113,30 +113,30 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function init() { |
115 | 115 | |
116 | - $is_enabled = give_get_option( 'email_access' ); |
|
116 | + $is_enabled = give_get_option('email_access'); |
|
117 | 117 | |
118 | 118 | //Non-logged in users only |
119 | - if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) { |
|
119 | + if (is_user_logged_in() || $is_enabled !== 'on' || is_admin()) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
123 | 123 | //Are db columns setup? |
124 | - $is_setup = give_get_option( 'email_access_installed' ); |
|
125 | - if ( empty( $is_setup ) ) { |
|
124 | + $is_setup = give_get_option('email_access_installed'); |
|
125 | + if (empty($is_setup)) { |
|
126 | 126 | $this->create_columns(); |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Timeouts |
130 | - $this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 ); |
|
131 | - $this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 ); |
|
130 | + $this->verify_throttle = apply_filters('give_nl_verify_throttle', 300); |
|
131 | + $this->token_expiration = apply_filters('give_nl_token_expiration', 7200); |
|
132 | 132 | |
133 | 133 | // Setup login |
134 | 134 | $this->check_for_token(); |
135 | 135 | |
136 | - if ( $this->token_exists ) { |
|
137 | - add_filter( 'give_can_view_receipt', '__return_true' ); |
|
138 | - add_filter( 'give_user_pending_verification', '__return_false' ); |
|
139 | - add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) ); |
|
136 | + if ($this->token_exists) { |
|
137 | + add_filter('give_can_view_receipt', '__return_true'); |
|
138 | + add_filter('give_user_pending_verification', '__return_false'); |
|
139 | + add_filter('give_get_users_purchases_args', array($this, 'users_purchases_args')); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -150,25 +150,25 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return bool |
152 | 152 | */ |
153 | - public function can_send_email( $customer_id ) { |
|
153 | + public function can_send_email($customer_id) { |
|
154 | 154 | /* @var WPDB $wpdb */ |
155 | 155 | global $wpdb; |
156 | 156 | |
157 | 157 | // Prevent multiple emails within X minutes |
158 | - $throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle ); |
|
158 | + $throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle); |
|
159 | 159 | |
160 | 160 | // Does a user row exist? |
161 | 161 | $exists = (int) $wpdb->get_var( |
162 | - $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id ) |
|
162 | + $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id) |
|
163 | 163 | ); |
164 | 164 | |
165 | - if ( 0 < $exists ) { |
|
165 | + if (0 < $exists) { |
|
166 | 166 | $row_id = (int) $wpdb->get_var( |
167 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle ) |
|
167 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle) |
|
168 | 168 | ); |
169 | 169 | |
170 | - if ( $row_id < 1 ) { |
|
171 | - give_set_error( 'give_email_access_attempts_exhausted', esc_html__( 'Please wait a few minutes before requesting a new email access link.', 'give' ) ); |
|
170 | + if ($row_id < 1) { |
|
171 | + give_set_error('give_email_access_attempts_exhausted', esc_html__('Please wait a few minutes before requesting a new email access link.', 'give')); |
|
172 | 172 | |
173 | 173 | return false; |
174 | 174 | } |
@@ -188,34 +188,34 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return void |
190 | 190 | */ |
191 | - public function send_email( $customer_id, $email ) { |
|
191 | + public function send_email($customer_id, $email) { |
|
192 | 192 | |
193 | - $verify_key = wp_generate_password( 20, false ); |
|
193 | + $verify_key = wp_generate_password(20, false); |
|
194 | 194 | |
195 | 195 | // Generate a new verify key |
196 | - $this->set_verify_key( $customer_id, $email, $verify_key ); |
|
196 | + $this->set_verify_key($customer_id, $email, $verify_key); |
|
197 | 197 | |
198 | 198 | // Get the purchase history URL |
199 | - $page_id = give_get_option( 'history_page' ); |
|
199 | + $page_id = give_get_option('history_page'); |
|
200 | 200 | |
201 | - $access_url = add_query_arg( array( |
|
201 | + $access_url = add_query_arg(array( |
|
202 | 202 | 'give_nl' => $verify_key, |
203 | - ), get_permalink( $page_id ) ); |
|
203 | + ), get_permalink($page_id)); |
|
204 | 204 | |
205 | 205 | //Nice subject and message |
206 | - $subject = apply_filters( 'give_email_access_token_subject', sprintf( esc_html__( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) ); |
|
206 | + $subject = apply_filters('give_email_access_token_subject', sprintf(esc_html__('Your Access Link to %s', 'give'), get_bloginfo('name'))); |
|
207 | 207 | |
208 | - $message = esc_html__( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n"; |
|
209 | - $message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . esc_html__( 'Access My Donation Details »', 'give' ) . '</a>' . "\n\n"; |
|
208 | + $message = esc_html__('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n"; |
|
209 | + $message .= '<a href="'.esc_url($access_url).'" target="_blank">'.esc_html__('Access My Donation Details »', 'give').'</a>'."\n\n"; |
|
210 | 210 | $message .= "\n\n"; |
211 | - $message .= esc_html__( 'Sincerely,', 'give' ) . "\n"; |
|
212 | - $message .= get_bloginfo( 'name' ) . "\n"; |
|
211 | + $message .= esc_html__('Sincerely,', 'give')."\n"; |
|
212 | + $message .= get_bloginfo('name')."\n"; |
|
213 | 213 | |
214 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
214 | + $message = apply_filters('give_email_access_token_message', $message); |
|
215 | 215 | |
216 | 216 | // Send the email |
217 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', esc_html__( 'Your Access Link', 'give' ) ) ); |
|
218 | - Give()->emails->send( $email, $subject, $message ); |
|
217 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', esc_html__('Your Access Link', 'give'))); |
|
218 | + Give()->emails->send($email, $subject, $message); |
|
219 | 219 | |
220 | 220 | } |
221 | 221 | |
@@ -229,24 +229,24 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public function check_for_token() { |
231 | 231 | |
232 | - $token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : ''; |
|
232 | + $token = isset($_GET['give_nl']) ? $_GET['give_nl'] : ''; |
|
233 | 233 | |
234 | 234 | // Check for cookie |
235 | - if ( empty( $token ) ) { |
|
236 | - $token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : ''; |
|
235 | + if (empty($token)) { |
|
236 | + $token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : ''; |
|
237 | 237 | } |
238 | 238 | |
239 | - if ( ! empty( $token ) ) { |
|
240 | - if ( ! $this->is_valid_token( $token ) ) { |
|
241 | - if ( ! $this->is_valid_verify_key( $token ) ) { |
|
239 | + if ( ! empty($token)) { |
|
240 | + if ( ! $this->is_valid_token($token)) { |
|
241 | + if ( ! $this->is_valid_verify_key($token)) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | 246 | $this->token_exists = true; |
247 | 247 | // Set cookie |
248 | - $lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time(); |
|
249 | - @setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
248 | + $lifetime = current_time('timestamp') + Give()->session->set_expiration_time(); |
|
249 | + @setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -260,18 +260,18 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return bool |
262 | 262 | */ |
263 | - public function is_valid_token( $token ) { |
|
263 | + public function is_valid_token($token) { |
|
264 | 264 | |
265 | 265 | global $wpdb; |
266 | 266 | |
267 | 267 | // Make sure token isn't expired |
268 | - $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration ); |
|
268 | + $expires = date('Y-m-d H:i:s', time() - $this->token_expiration); |
|
269 | 269 | |
270 | 270 | $email = $wpdb->get_var( |
271 | - $wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires ) |
|
271 | + $wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires) |
|
272 | 272 | ); |
273 | 273 | |
274 | - if ( ! empty( $email ) ) { |
|
274 | + if ( ! empty($email)) { |
|
275 | 275 | $this->token_email = $email; |
276 | 276 | $this->token = $token; |
277 | 277 | |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | //Set error only if email access form isn't being submitted |
282 | - if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) { |
|
283 | - give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', 'Your access token has expired. Please request a new one below:', 'give' ) ); |
|
282 | + if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) { |
|
283 | + give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', 'Your access token has expired. Please request a new one below:', 'give')); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -300,25 +300,25 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @return void |
302 | 302 | */ |
303 | - public function set_verify_key( $customer_id, $email, $verify_key ) { |
|
303 | + public function set_verify_key($customer_id, $email, $verify_key) { |
|
304 | 304 | global $wpdb; |
305 | 305 | |
306 | - $now = date( 'Y-m-d H:i:s' ); |
|
306 | + $now = date('Y-m-d H:i:s'); |
|
307 | 307 | |
308 | 308 | // Insert or update? |
309 | 309 | $row_id = (int) $wpdb->get_var( |
310 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id ) |
|
310 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id) |
|
311 | 311 | ); |
312 | 312 | |
313 | 313 | // Update |
314 | - if ( ! empty( $row_id ) ) { |
|
314 | + if ( ! empty($row_id)) { |
|
315 | 315 | $wpdb->query( |
316 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id ) |
|
316 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id) |
|
317 | 317 | ); |
318 | 318 | } // Insert |
319 | 319 | else { |
320 | 320 | $wpdb->query( |
321 | - $wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now ) |
|
321 | + $wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now) |
|
322 | 322 | ); |
323 | 323 | } |
324 | 324 | } |
@@ -333,21 +333,21 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @return bool |
335 | 335 | */ |
336 | - public function is_valid_verify_key( $token ) { |
|
336 | + public function is_valid_verify_key($token) { |
|
337 | 337 | /* @var WPDB $wpdb */ |
338 | 338 | global $wpdb; |
339 | 339 | |
340 | 340 | // See if the verify_key exists |
341 | 341 | $row = $wpdb->get_row( |
342 | - $wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token ) |
|
342 | + $wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token) |
|
343 | 343 | ); |
344 | 344 | |
345 | - $now = date( 'Y-m-d H:i:s' ); |
|
345 | + $now = date('Y-m-d H:i:s'); |
|
346 | 346 | |
347 | 347 | // Set token |
348 | - if ( ! empty( $row ) ) { |
|
348 | + if ( ! empty($row)) { |
|
349 | 349 | $wpdb->query( |
350 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id ) |
|
350 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id) |
|
351 | 351 | ); |
352 | 352 | |
353 | 353 | $this->token_email = $row->email; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return mixed |
373 | 373 | */ |
374 | - public function users_purchases_args( $args ) { |
|
374 | + public function users_purchases_args($args) { |
|
375 | 375 | $args['user'] = $this->token_email; |
376 | 376 | |
377 | 377 | return $args; |
@@ -392,11 +392,11 @@ discard block |
||
392 | 392 | global $wpdb; |
393 | 393 | |
394 | 394 | //Create columns in customers table |
395 | - $query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" ); |
|
395 | + $query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`"); |
|
396 | 396 | |
397 | 397 | //Columns added properly |
398 | - if ( $query ) { |
|
399 | - give_update_option( 'email_access_installed', 1 ); |
|
398 | + if ($query) { |
|
399 | + give_update_option('email_access_installed', 1); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | } |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
34 | 34 | } |
35 | 35 | |
36 | - if ( empty( $logout_redirect ) ) { |
|
37 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
38 | - } |
|
36 | + if ( empty( $logout_redirect ) ) { |
|
37 | + $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - // Add user_logout action to logout url. |
|
42 | - $logout_redirect = add_query_arg( |
|
43 | - array( |
|
44 | - 'give_action' => 'user_logout', |
|
45 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
46 | - 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
47 | - ), |
|
48 | - home_url('/') |
|
49 | - ); |
|
41 | + // Add user_logout action to logout url. |
|
42 | + $logout_redirect = add_query_arg( |
|
43 | + array( |
|
44 | + 'give_action' => 'user_logout', |
|
45 | + 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
46 | + 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
47 | + ), |
|
48 | + home_url('/') |
|
49 | + ); |
|
50 | 50 | |
51 | 51 | $give_login_redirect = $login_redirect; |
52 | 52 | $give_logout_redirect = $logout_redirect; |
@@ -136,31 +136,31 @@ discard block |
||
136 | 136 | * @return void |
137 | 137 | */ |
138 | 138 | function give_process_user_logout( $data ) { |
139 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
139 | + if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
140 | 140 | |
141 | - // Prevent occurring of any custom action on wp_logout. |
|
142 | - remove_all_actions( 'wp_logout' ); |
|
141 | + // Prevent occurring of any custom action on wp_logout. |
|
142 | + remove_all_actions( 'wp_logout' ); |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Fires before processing user logout. |
146 | 146 | * |
147 | 147 | * @since 1.0 |
148 | 148 | */ |
149 | - do_action( 'give_before_user_logout' ); |
|
149 | + do_action( 'give_before_user_logout' ); |
|
150 | 150 | |
151 | - // Logout user. |
|
152 | - wp_logout(); |
|
151 | + // Logout user. |
|
152 | + wp_logout(); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Fires after processing user logout. |
156 | 156 | * |
157 | 157 | * @since 1.0 |
158 | 158 | */ |
159 | - do_action( 'give_after_user_logout' ); |
|
159 | + do_action( 'give_after_user_logout' ); |
|
160 | 160 | |
161 | - wp_redirect( $data['give_logout_redirect'] ); |
|
162 | - give_die(); |
|
163 | - } |
|
161 | + wp_redirect( $data['give_logout_redirect'] ); |
|
162 | + give_die(); |
|
163 | + } |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | add_action( 'give_user_logout', 'give_process_user_logout' ); |
@@ -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 | |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return string Login form |
28 | 28 | */ |
29 | -function give_login_form( $login_redirect = '', $logout_redirect = '' ) { |
|
30 | - global $give_login_redirect, $give_logout_redirect;; |
|
29 | +function give_login_form($login_redirect = '', $logout_redirect = '') { |
|
30 | + global $give_login_redirect, $give_logout_redirect; ; |
|
31 | 31 | |
32 | - if ( empty( $login_redirect ) ) { |
|
32 | + if (empty($login_redirect)) { |
|
33 | 33 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
34 | 34 | } |
35 | 35 | |
36 | - if ( empty( $logout_redirect ) ) { |
|
37 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
36 | + if (empty($logout_redirect)) { |
|
37 | + $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $logout_redirect = add_query_arg( |
43 | 43 | array( |
44 | 44 | 'give_action' => 'user_logout', |
45 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
46 | - 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
45 | + 'give_logout_nonce' => wp_create_nonce('give-logout-nonce'), |
|
46 | + 'give_logout_redirect' => urlencode($logout_redirect) |
|
47 | 47 | ), |
48 | 48 | home_url('/') |
49 | 49 | ); |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | |
54 | 54 | ob_start(); |
55 | 55 | |
56 | - give_get_template_part( 'shortcode', 'login' ); |
|
56 | + give_get_template_part('shortcode', 'login'); |
|
57 | 57 | |
58 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
58 | + return apply_filters('give_login_form', ob_get_clean()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string Register form |
71 | 71 | */ |
72 | -function give_register_form( $redirect = '' ) { |
|
72 | +function give_register_form($redirect = '') { |
|
73 | 73 | global $give_options, $give_register_redirect; |
74 | 74 | |
75 | - if ( empty( $redirect ) ) { |
|
75 | + if (empty($redirect)) { |
|
76 | 76 | $redirect = give_get_current_page_url(); |
77 | 77 | } |
78 | 78 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | |
81 | 81 | ob_start(); |
82 | 82 | |
83 | - if ( ! is_user_logged_in() ) { |
|
84 | - give_get_template_part( 'shortcode', 'register' ); |
|
83 | + if ( ! is_user_logged_in()) { |
|
84 | + give_get_template_part('shortcode', 'register'); |
|
85 | 85 | } |
86 | 86 | |
87 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
87 | + return apply_filters('give_register_form', ob_get_clean()); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -96,34 +96,34 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return void |
98 | 98 | */ |
99 | -function give_process_login_form( $data ) { |
|
100 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
101 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
102 | - if ( ! $user_data ) { |
|
103 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
99 | +function give_process_login_form($data) { |
|
100 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
101 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
102 | + if ( ! $user_data) { |
|
103 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
104 | 104 | } |
105 | - if ( $user_data ) { |
|
105 | + if ($user_data) { |
|
106 | 106 | $user_ID = $user_data->ID; |
107 | 107 | $user_email = $user_data->user_email; |
108 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) { |
|
109 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
108 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) { |
|
109 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
110 | 110 | } else { |
111 | - give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) ); |
|
111 | + give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give')); |
|
112 | 112 | } |
113 | 113 | } else { |
114 | - give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) ); |
|
114 | + give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give')); |
|
115 | 115 | } |
116 | 116 | // Check for errors and redirect if none present |
117 | 117 | $errors = give_get_errors(); |
118 | - if ( ! $errors ) { |
|
119 | - $redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID ); |
|
120 | - wp_redirect( $redirect ); |
|
118 | + if ( ! $errors) { |
|
119 | + $redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID); |
|
120 | + wp_redirect($redirect); |
|
121 | 121 | give_die(); |
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
126 | +add_action('give_user_login', 'give_process_login_form'); |
|
127 | 127 | |
128 | 128 | |
129 | 129 | /** |
@@ -135,18 +135,18 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_process_user_logout( $data ) { |
|
139 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
138 | +function give_process_user_logout($data) { |
|
139 | + if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) { |
|
140 | 140 | |
141 | 141 | // Prevent occurring of any custom action on wp_logout. |
142 | - remove_all_actions( 'wp_logout' ); |
|
142 | + remove_all_actions('wp_logout'); |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Fires before processing user logout. |
146 | 146 | * |
147 | 147 | * @since 1.0 |
148 | 148 | */ |
149 | - do_action( 'give_before_user_logout' ); |
|
149 | + do_action('give_before_user_logout'); |
|
150 | 150 | |
151 | 151 | // Logout user. |
152 | 152 | wp_logout(); |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @since 1.0 |
158 | 158 | */ |
159 | - do_action( 'give_after_user_logout' ); |
|
159 | + do_action('give_after_user_logout'); |
|
160 | 160 | |
161 | - wp_redirect( $data['give_logout_redirect'] ); |
|
161 | + wp_redirect($data['give_logout_redirect']); |
|
162 | 162 | give_die(); |
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | -add_action( 'give_user_logout', 'give_process_user_logout' ); |
|
166 | +add_action('give_user_logout', 'give_process_user_logout'); |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Log User In |
@@ -176,13 +176,13 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return void |
178 | 178 | */ |
179 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
180 | - if ( $user_id < 1 ) { |
|
179 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
180 | + if ($user_id < 1) { |
|
181 | 181 | return; |
182 | 182 | } |
183 | 183 | |
184 | - wp_set_auth_cookie( $user_id ); |
|
185 | - wp_set_current_user( $user_id, $user_login ); |
|
184 | + wp_set_auth_cookie($user_id); |
|
185 | + wp_set_current_user($user_id, $user_login); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Fires after the user has successfully logged in. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param string $user_login Username. |
193 | 193 | * @param WP_User $$user WP_User object of the logged-in user. |
194 | 194 | */ |
195 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
195 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * Fires after give user has successfully logged in. |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param string $user_login Username. |
204 | 204 | * @param string $user_pass User password. |
205 | 205 | */ |
206 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
206 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @return void |
218 | 218 | */ |
219 | -function give_process_register_form( $data ) { |
|
219 | +function give_process_register_form($data) { |
|
220 | 220 | |
221 | - if ( is_user_logged_in() ) { |
|
221 | + if (is_user_logged_in()) { |
|
222 | 222 | return; |
223 | 223 | } |
224 | 224 | |
225 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
225 | + if (empty($_POST['give_register_submit'])) { |
|
226 | 226 | return; |
227 | 227 | } |
228 | 228 | |
@@ -231,38 +231,38 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @since 1.0 |
233 | 233 | */ |
234 | - do_action( 'give_pre_process_register_form' ); |
|
234 | + do_action('give_pre_process_register_form'); |
|
235 | 235 | |
236 | - if ( empty( $data['give_user_login'] ) ) { |
|
237 | - give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) ); |
|
236 | + if (empty($data['give_user_login'])) { |
|
237 | + give_set_error('empty_username', esc_html__('Invalid username.', 'give')); |
|
238 | 238 | } |
239 | 239 | |
240 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
241 | - give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) ); |
|
240 | + if (username_exists($data['give_user_login'])) { |
|
241 | + give_set_error('username_unavailable', esc_html__('Username already taken.', 'give')); |
|
242 | 242 | } |
243 | 243 | |
244 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
245 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) ); |
|
244 | + if ( ! validate_username($data['give_user_login'])) { |
|
245 | + give_set_error('username_invalid', esc_html__('Invalid username.', 'give')); |
|
246 | 246 | } |
247 | 247 | |
248 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
249 | - give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) ); |
|
248 | + if (email_exists($data['give_user_email'])) { |
|
249 | + give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give')); |
|
250 | 250 | } |
251 | 251 | |
252 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
253 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
252 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
253 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
254 | 254 | } |
255 | 255 | |
256 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
257 | - give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) ); |
|
256 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
257 | + give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give')); |
|
258 | 258 | } |
259 | 259 | |
260 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
261 | - give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) ); |
|
260 | + if (empty($_POST['give_user_pass'])) { |
|
261 | + give_set_error('empty_password', esc_html__('Please enter a password.', 'give')); |
|
262 | 262 | } |
263 | 263 | |
264 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
265 | - give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) ); |
|
264 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
265 | + give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give')); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -270,26 +270,26 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @since 1.0 |
272 | 272 | */ |
273 | - do_action( 'give_process_register_form' ); |
|
273 | + do_action('give_process_register_form'); |
|
274 | 274 | |
275 | 275 | // Check for errors and redirect if none present |
276 | 276 | $errors = give_get_errors(); |
277 | 277 | |
278 | - if ( empty( $errors ) ) { |
|
278 | + if (empty($errors)) { |
|
279 | 279 | |
280 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
280 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
281 | 281 | |
282 | - give_register_and_login_new_user( array( |
|
282 | + give_register_and_login_new_user(array( |
|
283 | 283 | 'user_login' => $data['give_user_login'], |
284 | 284 | 'user_pass' => $data['give_user_pass'], |
285 | 285 | 'user_email' => $data['give_user_email'], |
286 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
287 | - 'role' => get_option( 'default_role' ) |
|
288 | - ) ); |
|
286 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
287 | + 'role' => get_option('default_role') |
|
288 | + )); |
|
289 | 289 | |
290 | - wp_redirect( $redirect ); |
|
290 | + wp_redirect($redirect); |
|
291 | 291 | give_die(); |
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
296 | 295 | \ No newline at end of file |
296 | +add_action('give_user_register', 'give_process_register_form'); |
|
297 | 297 | \ No newline at end of file |
@@ -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 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -add_action( 'give_manual_cc_form', '__return_false' ); |
|
23 | +add_action('give_manual_cc_form', '__return_false'); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Processes the purchase data and uses the Manual Payment gateway to record |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return void |
34 | 34 | */ |
35 | -function give_manual_payment( $purchase_data ) { |
|
35 | +function give_manual_payment($purchase_data) { |
|
36 | 36 | |
37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
38 | - wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
38 | + wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | //Create payment_data array |
42 | 42 | $payment_data = array( |
43 | 43 | 'price' => $purchase_data['price'], |
44 | 44 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
45 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
45 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
46 | 46 | 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
47 | 47 | 'date' => $purchase_data['date'], |
48 | 48 | 'user_email' => $purchase_data['user_email'], |
@@ -52,24 +52,24 @@ discard block |
||
52 | 52 | 'status' => 'pending' |
53 | 53 | ); |
54 | 54 | // Record the pending payment |
55 | - $payment = give_insert_payment( $payment_data ); |
|
55 | + $payment = give_insert_payment($payment_data); |
|
56 | 56 | |
57 | - if ( $payment ) { |
|
58 | - give_update_payment_status( $payment, 'publish' ); |
|
57 | + if ($payment) { |
|
58 | + give_update_payment_status($payment, 'publish'); |
|
59 | 59 | give_send_to_success_page(); |
60 | 60 | } else { |
61 | 61 | give_record_gateway_error( |
62 | - esc_html__( 'Payment Error', 'give' ), |
|
62 | + esc_html__('Payment Error', 'give'), |
|
63 | 63 | sprintf( |
64 | 64 | /* translators: %s: payment data */ |
65 | - esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ), |
|
66 | - json_encode( $payment_data ) |
|
65 | + esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'), |
|
66 | + json_encode($payment_data) |
|
67 | 67 | ), |
68 | 68 | $payment |
69 | 69 | ); |
70 | 70 | // If errors are present, send the user back to the purchase page so they can be corrected |
71 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
71 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | -add_action( 'give_gateway_manual', 'give_manual_payment' ); |
|
75 | +add_action('give_gateway_manual', 'give_manual_payment'); |
@@ -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 | |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | * @global $wp_version |
25 | 25 | * @return void |
26 | 26 | */ |
27 | -function give_install( $network_wide = false ) { |
|
27 | +function give_install($network_wide = false) { |
|
28 | 28 | |
29 | 29 | global $wpdb; |
30 | 30 | |
31 | - if ( is_multisite() && $network_wide ) { |
|
31 | + if (is_multisite() && $network_wide) { |
|
32 | 32 | |
33 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
33 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
34 | 34 | |
35 | - switch_to_blog( $blog_id ); |
|
35 | + switch_to_blog($blog_id); |
|
36 | 36 | give_run_install(); |
37 | 37 | restore_current_blog(); |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
49 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Run the Give Install process |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | give_setup_post_types(); |
63 | 63 | |
64 | 64 | // Clear the permalinks |
65 | - flush_rewrite_rules( false ); |
|
65 | + flush_rewrite_rules(false); |
|
66 | 66 | |
67 | 67 | // Add Upgraded From Option |
68 | - $current_version = get_option( 'give_version' ); |
|
69 | - if ( $current_version ) { |
|
70 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
68 | + $current_version = get_option('give_version'); |
|
69 | + if ($current_version) { |
|
70 | + update_option('give_version_upgraded_from', $current_version); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Setup some default options |
74 | 74 | $options = array(); |
75 | 75 | |
76 | 76 | // Checks if the Success Page option exists AND that the page exists |
77 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
77 | + if ( ! get_post(give_get_option('success_page'))) { |
|
78 | 78 | |
79 | 79 | // Donation Confirmation (Success) Page |
80 | 80 | $success = wp_insert_post( |
81 | 81 | array( |
82 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
82 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
83 | 83 | 'post_content' => '[give_receipt]', |
84 | 84 | 'post_status' => 'publish', |
85 | 85 | 'post_author' => 1, |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // Checks if the Failure Page option exists AND that the page exists |
96 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
96 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
97 | 97 | |
98 | 98 | // Failed Donation Page |
99 | 99 | $failed = wp_insert_post( |
100 | 100 | array( |
101 | - 'post_title' => esc_html__( 'Donation Failed', 'give' ), |
|
102 | - 'post_content' => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ), |
|
101 | + 'post_title' => esc_html__('Donation Failed', 'give'), |
|
102 | + 'post_content' => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'), |
|
103 | 103 | 'post_status' => 'publish', |
104 | 104 | 'post_author' => 1, |
105 | 105 | 'post_type' => 'page', |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | // Checks if the History Page option exists AND that the page exists |
114 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
114 | + if ( ! get_post(give_get_option('history_page'))) { |
|
115 | 115 | // Donation History Page |
116 | 116 | $history = wp_insert_post( |
117 | 117 | array( |
118 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
118 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
119 | 119 | 'post_content' => '[donation_history]', |
120 | 120 | 'post_status' => 'publish', |
121 | 121 | 'post_author' => 1, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency |
131 | - if ( empty( $current_version ) ) { |
|
131 | + if (empty($current_version)) { |
|
132 | 132 | $options['base_country'] = 'US'; |
133 | 133 | $options['test_mode'] = 1; |
134 | 134 | $options['currency'] = 'USD'; |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // Populate some default values |
151 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
152 | - update_option( 'give_version', GIVE_VERSION ); |
|
151 | + update_option('give_settings', array_merge($give_options, $options)); |
|
152 | + update_option('give_version', GIVE_VERSION); |
|
153 | 153 | |
154 | 154 | //Update Version Number |
155 | - if ( $current_version ) { |
|
156 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
155 | + if ($current_version) { |
|
156 | + update_option('give_version_upgraded_from', $current_version); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // Create Give roles |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $roles->add_caps(); |
163 | 163 | |
164 | 164 | $api = new Give_API(); |
165 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
165 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
166 | 166 | |
167 | 167 | // Create the customers databases |
168 | 168 | @Give()->customers->create_table(); |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | Give()->session->use_php_sessions(); |
173 | 173 | |
174 | 174 | // Add a temporary option to note that Give pages have been created |
175 | - set_transient( '_give_installed', $options, 30 ); |
|
175 | + set_transient('_give_installed', $options, 30); |
|
176 | 176 | |
177 | - if ( ! $current_version ) { |
|
177 | + if ( ! $current_version) { |
|
178 | 178 | |
179 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
179 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
180 | 180 | |
181 | 181 | // When new upgrade routines are added, mark them as complete on fresh install |
182 | 182 | $upgrade_routines = array( |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | 'upgrade_give_offline_status' |
186 | 186 | ); |
187 | 187 | |
188 | - foreach ( $upgrade_routines as $upgrade ) { |
|
189 | - give_set_upgrade_complete( $upgrade ); |
|
188 | + foreach ($upgrade_routines as $upgrade) { |
|
189 | + give_set_upgrade_complete($upgrade); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | 193 | // Bail if activating from network, or bulk |
194 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
194 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | 198 | // Add the transient to redirect |
199 | - set_transient( '_give_activation_redirect', true, 30 ); |
|
199 | + set_transient('_give_activation_redirect', true, 30); |
|
200 | 200 | |
201 | 201 | } |
202 | 202 | |
203 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
203 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Network Activated New Site Setup. |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | * @param int $site_id The Site ID. |
217 | 217 | * @param array $meta Blog Meta. |
218 | 218 | */ |
219 | -function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
219 | +function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
220 | 220 | |
221 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
221 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
222 | 222 | |
223 | - switch_to_blog( $blog_id ); |
|
223 | + switch_to_blog($blog_id); |
|
224 | 224 | give_install(); |
225 | 225 | restore_current_blog(); |
226 | 226 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | } |
230 | 230 | |
231 | -add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 ); |
|
231 | +add_action('wpmu_new_blog', 'on_create_blog', 10, 6); |
|
232 | 232 | |
233 | 233 | |
234 | 234 | /** |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return array The tables to drop. |
243 | 243 | */ |
244 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
244 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
245 | 245 | |
246 | - switch_to_blog( $blog_id ); |
|
246 | + switch_to_blog($blog_id); |
|
247 | 247 | $customers_db = new Give_DB_Customers(); |
248 | 248 | $customer_meta_db = new Give_DB_Customer_Meta(); |
249 | 249 | |
250 | - if ( $customers_db->installed() ) { |
|
250 | + if ($customers_db->installed()) { |
|
251 | 251 | $tables[] = $customers_db->table_name; |
252 | 252 | $tables[] = $customer_meta_db->table_name; |
253 | 253 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | } |
259 | 259 | |
260 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
260 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
261 | 261 | |
262 | 262 | /** |
263 | 263 | * Post-installation |
@@ -269,16 +269,16 @@ discard block |
||
269 | 269 | */ |
270 | 270 | function give_after_install() { |
271 | 271 | |
272 | - if ( ! is_admin() ) { |
|
272 | + if ( ! is_admin()) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | - $give_options = get_transient( '_give_installed' ); |
|
277 | - $give_table_check = get_option( '_give_table_check', false ); |
|
276 | + $give_options = get_transient('_give_installed'); |
|
277 | + $give_table_check = get_option('_give_table_check', false); |
|
278 | 278 | |
279 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
279 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
280 | 280 | |
281 | - if ( ! @Give()->customer_meta->installed() ) { |
|
281 | + if ( ! @Give()->customer_meta->installed()) { |
|
282 | 282 | |
283 | 283 | // Create the customer meta database |
284 | 284 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | } |
288 | 288 | |
289 | - if ( ! @Give()->customers->installed() ) { |
|
289 | + if ( ! @Give()->customers->installed()) { |
|
290 | 290 | // Create the customers database |
291 | 291 | // (this ensures it creates it on multisite instances where it is network activated). |
292 | 292 | @Give()->customers->create_table(); |
@@ -298,22 +298,22 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @param array $give_options Give plugin options. |
300 | 300 | */ |
301 | - do_action( 'give_after_install', $give_options ); |
|
301 | + do_action('give_after_install', $give_options); |
|
302 | 302 | } |
303 | 303 | |
304 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
304 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
305 | 305 | |
306 | 306 | } |
307 | 307 | |
308 | 308 | // Delete the transient |
309 | - if ( false !== $give_options ) { |
|
310 | - delete_transient( '_give_installed' ); |
|
309 | + if (false !== $give_options) { |
|
310 | + delete_transient('_give_installed'); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
314 | 314 | } |
315 | 315 | |
316 | -add_action( 'admin_init', 'give_after_install' ); |
|
316 | +add_action('admin_init', 'give_after_install'); |
|
317 | 317 | |
318 | 318 | |
319 | 319 | /** |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | |
329 | 329 | global $wp_roles; |
330 | 330 | |
331 | - if ( ! is_object( $wp_roles ) ) { |
|
331 | + if ( ! is_object($wp_roles)) { |
|
332 | 332 | return; |
333 | 333 | } |
334 | 334 | |
335 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
335 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
336 | 336 | |
337 | 337 | // Create Give plugin roles |
338 | 338 | $roles = new Give_Roles(); |
@@ -343,4 +343,4 @@ discard block |
||
343 | 343 | |
344 | 344 | } |
345 | 345 | |
346 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
347 | 346 | \ No newline at end of file |
347 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
348 | 348 | \ No newline at end of file |
@@ -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 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_get_actions() { |
27 | 27 | |
28 | - $_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null; |
|
28 | + $_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null; |
|
29 | 29 | |
30 | 30 | // Add backward compatibility to give-action param ( $_GET or $_POST ) |
31 | - if( doing_action( 'admin_init' ) && empty( $_get_action ) ) { |
|
32 | - $_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null; |
|
31 | + if (doing_action('admin_init') && empty($_get_action)) { |
|
32 | + $_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null; |
|
33 | 33 | } |
34 | 34 | |
35 | - if ( isset( $_get_action ) ) { |
|
35 | + if (isset($_get_action)) { |
|
36 | 36 | /** |
37 | 37 | * Fires in WordPress init or admin init, when give_action is present in $_GET. |
38 | 38 | * |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param array $_GET Array of HTTP GET variables. |
42 | 42 | */ |
43 | - do_action( "give_{$_get_action}", $_GET ); |
|
43 | + do_action("give_{$_get_action}", $_GET); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | } |
47 | 47 | |
48 | -add_action( 'init', 'give_get_actions' ); |
|
49 | -add_action( 'admin_init', 'give_get_actions' ); |
|
48 | +add_action('init', 'give_get_actions'); |
|
49 | +add_action('admin_init', 'give_get_actions'); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Hooks Give actions, when present in the $_POST superglobal. Every give_action |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function give_post_actions() { |
61 | 61 | |
62 | - $_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null; |
|
62 | + $_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null; |
|
63 | 63 | |
64 | 64 | |
65 | 65 | // Add backward compatibility to give-action param ( $_GET or $_POST ) |
66 | - if( doing_action( 'admin_init' ) && empty( $_post_action ) ) { |
|
67 | - $_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null; |
|
66 | + if (doing_action('admin_init') && empty($_post_action)) { |
|
67 | + $_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null; |
|
68 | 68 | } |
69 | 69 | |
70 | - if ( isset( $_post_action ) ) { |
|
70 | + if (isset($_post_action)) { |
|
71 | 71 | /** |
72 | 72 | * Fires in WordPress init or admin init, when give_action is present in $_POST. |
73 | 73 | * |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @param array $_POST Array of HTTP POST variables. |
77 | 77 | */ |
78 | - do_action( "give_{$_post_action}", $_POST ); |
|
78 | + do_action("give_{$_post_action}", $_POST); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'init', 'give_post_actions' ); |
|
84 | -add_action( 'admin_init', 'give_post_actions' ); |
|
83 | +add_action('init', 'give_post_actions'); |
|
84 | +add_action('admin_init', 'give_post_actions'); |
@@ -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 | /** |
@@ -51,38 +51,38 @@ discard block |
||
51 | 51 | public function admin_menus() { |
52 | 52 | // About Page |
53 | 53 | add_dashboard_page( |
54 | - esc_html__( 'Welcome to Give', 'give' ), |
|
55 | - esc_html__( 'Welcome to Give', 'give' ), |
|
54 | + esc_html__('Welcome to Give', 'give'), |
|
55 | + esc_html__('Welcome to Give', 'give'), |
|
56 | 56 | $this->minimum_capability, |
57 | 57 | 'give-about', |
58 | - array( $this, 'about_screen' ) |
|
58 | + array($this, 'about_screen') |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | // Changelog Page |
62 | 62 | add_dashboard_page( |
63 | - esc_html__( 'Give Changelog', 'give' ), |
|
64 | - esc_html__( 'Give Changelog', 'give' ), |
|
63 | + esc_html__('Give Changelog', 'give'), |
|
64 | + esc_html__('Give Changelog', 'give'), |
|
65 | 65 | $this->minimum_capability, |
66 | 66 | 'give-changelog', |
67 | - array( $this, 'changelog_screen' ) |
|
67 | + array($this, 'changelog_screen') |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | // Getting Started Page |
71 | 71 | add_dashboard_page( |
72 | - esc_html__( 'Getting started with Give', 'give' ), |
|
73 | - esc_html__( 'Getting started with Give', 'give' ), |
|
72 | + esc_html__('Getting started with Give', 'give'), |
|
73 | + esc_html__('Getting started with Give', 'give'), |
|
74 | 74 | $this->minimum_capability, |
75 | 75 | 'give-getting-started', |
76 | - array( $this, 'getting_started_screen' ) |
|
76 | + array($this, 'getting_started_screen') |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | // Credits Page |
80 | 80 | add_dashboard_page( |
81 | - esc_html__( 'The people that build Give', 'give' ), |
|
82 | - esc_html__( 'The people that build Give', 'give' ), |
|
81 | + esc_html__('The people that build Give', 'give'), |
|
82 | + esc_html__('The people that build Give', 'give'), |
|
83 | 83 | $this->minimum_capability, |
84 | 84 | 'give-credits', |
85 | - array( $this, 'credits_screen' ) |
|
85 | + array($this, 'credits_screen') |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 | |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function admin_head() { |
97 | 97 | |
98 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
99 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
100 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
101 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
98 | + remove_submenu_page('index.php', 'give-about'); |
|
99 | + remove_submenu_page('index.php', 'give-changelog'); |
|
100 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
101 | + remove_submenu_page('index.php', 'give-credits'); |
|
102 | 102 | |
103 | 103 | // Badge for welcome page |
104 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
104 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
105 | 105 | |
106 | 106 | ?> |
107 | 107 | <style type="text/css" media="screen"> |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * @return void |
216 | 216 | */ |
217 | 217 | public function tabs() { |
218 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
218 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
219 | 219 | ?> |
220 | 220 | <h2 class="nav-tab-wrapper"> |
221 | - <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
222 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
221 | + <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
222 | + <?php esc_html_e('About Give', 'give'); ?> |
|
223 | 223 | </a> |
224 | - <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
225 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
224 | + <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
225 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
226 | 226 | </a> |
227 | - <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
228 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
227 | + <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
228 | + <?php esc_html_e('Credits', 'give'); ?> |
|
229 | 229 | </a> |
230 | - <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
230 | + <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
232 | 232 | </a> |
233 | 233 | </h2> |
234 | 234 | <?php |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | public function about_screen() { |
245 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
245 | + list($display_version) = explode('-', GIVE_VERSION); |
|
246 | 246 | ?> |
247 | 247 | <div class="wrap about-wrap"> |
248 | 248 | <h1 class="welcome-h1"><?php |
249 | 249 | printf( |
250 | 250 | /* translators: %s: Give version */ |
251 | - esc_html__( 'Welcome to Give %s', 'give' ), |
|
251 | + esc_html__('Welcome to Give %s', 'give'), |
|
252 | 252 | $display_version |
253 | 253 | ); |
254 | 254 | ?></h1> |
@@ -258,19 +258,19 @@ discard block |
||
258 | 258 | <p class="about-text"><?php |
259 | 259 | printf( |
260 | 260 | /* translators: %s: https://givewp.com/documenation/ */ |
261 | - __( '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. </You>We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
262 | - esc_url( 'https://givewp.com/documenation/' ) |
|
261 | + __('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. </You>We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
262 | + esc_url('https://givewp.com/documenation/') |
|
263 | 263 | ); |
264 | 264 | ?></p> |
265 | 265 | |
266 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
266 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
267 | 267 | |
268 | 268 | <?php give_get_newsletter() ?> |
269 | 269 | |
270 | 270 | <div class="give-badge"><?php |
271 | 271 | printf( |
272 | 272 | /* translators: %s: Give version */ |
273 | - esc_html__( 'Version %s', 'give' ), |
|
273 | + esc_html__('Version %s', 'give'), |
|
274 | 274 | $display_version |
275 | 275 | ); |
276 | 276 | ?></div> |
@@ -280,16 +280,16 @@ discard block |
||
280 | 280 | <div class="feature-section clearfix introduction"> |
281 | 281 | |
282 | 282 | <div class="video feature-section-item"> |
283 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
283 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
284 | 284 | </div> |
285 | 285 | |
286 | 286 | <div class="content feature-section-item last-feature"> |
287 | 287 | |
288 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
288 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
289 | 289 | |
290 | - <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> |
|
290 | + <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> |
|
291 | 291 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
292 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
292 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
293 | 293 | <span class="dashicons dashicons-external"></span> |
294 | 294 | </a> |
295 | 295 | |
@@ -302,11 +302,11 @@ discard block |
||
302 | 302 | |
303 | 303 | <div class="content feature-section-item"> |
304 | 304 | |
305 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
305 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
306 | 306 | |
307 | - <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 an 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> |
|
307 | + <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 an 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> |
|
308 | 308 | <a href="https://givewp.com/documentation" target="_blank" class="button-secondary"> |
309 | - <?php esc_html_e( 'View Documentation', 'give' ); ?> |
|
309 | + <?php esc_html_e('View Documentation', 'give'); ?> |
|
310 | 310 | <span class="dashicons dashicons-external"></span> |
311 | 311 | </a> |
312 | 312 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | <div class="content feature-section-item last-feature"> |
316 | 316 | |
317 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
317 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
318 | 318 | |
319 | 319 | </div> |
320 | 320 | |
@@ -334,22 +334,22 @@ discard block |
||
334 | 334 | * @return void |
335 | 335 | */ |
336 | 336 | public function changelog_screen() { |
337 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
337 | + list($display_version) = explode('-', GIVE_VERSION); |
|
338 | 338 | ?> |
339 | 339 | <div class="wrap about-wrap"> |
340 | - <h1><?php esc_html_e( 'Give Changelog', 'give' ); ?></h1> |
|
340 | + <h1><?php esc_html_e('Give Changelog', 'give'); ?></h1> |
|
341 | 341 | |
342 | 342 | <p class="about-text"><?php |
343 | 343 | printf( |
344 | 344 | /* translators: %s: Give version */ |
345 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
345 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
346 | 346 | $display_version |
347 | 347 | ); |
348 | 348 | ?></p> |
349 | 349 | <div class="give-badge"><?php |
350 | 350 | printf( |
351 | 351 | /* translators: %s: Give version */ |
352 | - esc_html__( 'Version %s', 'give' ), |
|
352 | + esc_html__('Version %s', 'give'), |
|
353 | 353 | $display_version |
354 | 354 | ); |
355 | 355 | ?></div> |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | <?php $this->tabs(); ?> |
358 | 358 | |
359 | 359 | <div class="changelog"> |
360 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
360 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
361 | 361 | |
362 | 362 | <div class="feature-section"> |
363 | 363 | <?php echo $this->parse_readme(); ?> |
@@ -365,10 +365,10 @@ discard block |
||
365 | 365 | </div> |
366 | 366 | |
367 | 367 | <div class="return-to-dashboard"> |
368 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
368 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
369 | 369 | 'post_type' => 'give_forms', |
370 | 370 | 'page' => 'give-settings' |
371 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
371 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
372 | 372 | </div> |
373 | 373 | </div> |
374 | 374 | <?php |
@@ -382,45 +382,45 @@ discard block |
||
382 | 382 | * @return void |
383 | 383 | */ |
384 | 384 | public function getting_started_screen() { |
385 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
385 | + list($display_version) = explode('-', GIVE_VERSION); |
|
386 | 386 | ?> |
387 | 387 | <div class="wrap about-wrap get-started"> |
388 | 388 | <h1 class="welcome-h1"><?php |
389 | 389 | printf( |
390 | 390 | /* translators: %s: Give version */ |
391 | - esc_html__( 'Give %s - Getting Started Guide', 'give' ), |
|
391 | + esc_html__('Give %s - Getting Started Guide', 'give'), |
|
392 | 392 | $display_version |
393 | 393 | ); |
394 | 394 | ?></h1> |
395 | 395 | |
396 | 396 | <?php give_social_media_elements() ?> |
397 | 397 | |
398 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
398 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
399 | 399 | |
400 | - <p class="newsletter-intro"><?php esc_html_e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?></p> |
|
400 | + <p class="newsletter-intro"><?php esc_html_e('Don\'t forget to sign up for the newsletter!', 'give'); ?></p> |
|
401 | 401 | |
402 | 402 | <?php give_get_newsletter() ?> |
403 | 403 | |
404 | 404 | <div class="give-badge"><?php |
405 | 405 | printf( |
406 | 406 | /* translators: %s: Give version */ |
407 | - esc_html__( 'Version %s', 'give' ), |
|
407 | + esc_html__('Version %s', 'give'), |
|
408 | 408 | $display_version |
409 | 409 | ); |
410 | 410 | ?></div> |
411 | 411 | |
412 | 412 | <?php $this->tabs(); ?> |
413 | 413 | |
414 | - <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> |
|
414 | + <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> |
|
415 | 415 | |
416 | 416 | <div class="feature-section clearfix"> |
417 | 417 | |
418 | 418 | <div class="content feature-section-item"> |
419 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
419 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
420 | 420 | |
421 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p> |
|
421 | + <p><?php esc_html_e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p> |
|
422 | 422 | |
423 | - <p><?php esc_html_e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p> |
|
423 | + <p><?php esc_html_e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p> |
|
424 | 424 | </div> |
425 | 425 | |
426 | 426 | <div class="content feature-section-item last-feature"> |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | </div> |
438 | 438 | |
439 | 439 | <div class="content feature-section-item last-feature"> |
440 | - <h3><?php esc_html_e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3> |
|
440 | + <h3><?php esc_html_e('STEP 2: Choose Your Levels', 'give'); ?></h3> |
|
441 | 441 | |
442 | - <p><?php esc_html_e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p> |
|
442 | + <p><?php esc_html_e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p> |
|
443 | 443 | </div> |
444 | 444 | |
445 | 445 | </div> |
@@ -448,11 +448,11 @@ discard block |
||
448 | 448 | <div class="feature-section clearfix"> |
449 | 449 | |
450 | 450 | <div class="content feature-section-item add-content"> |
451 | - <h3><?php esc_html_e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3> |
|
451 | + <h3><?php esc_html_e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3> |
|
452 | 452 | |
453 | - <p><?php esc_html_e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p> |
|
453 | + <p><?php esc_html_e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p> |
|
454 | 454 | |
455 | - <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> |
|
455 | + <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> |
|
456 | 456 | </div> |
457 | 457 | |
458 | 458 | <div class="content feature-section-item last-feature"> |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | </div> |
470 | 470 | |
471 | 471 | <div class="content feature-section-item last-feature"> |
472 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
472 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
473 | 473 | |
474 | - <p><?php esc_html_e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p> |
|
474 | + <p><?php esc_html_e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p> |
|
475 | 475 | </div> |
476 | 476 | |
477 | 477 | |
@@ -491,31 +491,31 @@ discard block |
||
491 | 491 | * @return void |
492 | 492 | */ |
493 | 493 | public function credits_screen() { |
494 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
494 | + list($display_version) = explode('-', GIVE_VERSION); |
|
495 | 495 | ?> |
496 | 496 | <div class="wrap about-wrap"> |
497 | 497 | <h1 class="welcome-h1"><?php |
498 | 498 | printf( |
499 | 499 | /* translators: %s: Give version */ |
500 | - esc_html__( 'Give %s - Credits', 'give' ), |
|
500 | + esc_html__('Give %s - Credits', 'give'), |
|
501 | 501 | $display_version |
502 | 502 | ); |
503 | 503 | ?></h1> |
504 | 504 | |
505 | 505 | <?php give_social_media_elements() ?> |
506 | 506 | |
507 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
507 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
508 | 508 | |
509 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
509 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
510 | 510 | |
511 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
511 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
512 | 512 | |
513 | 513 | <?php give_get_newsletter() ?> |
514 | 514 | |
515 | 515 | <div class="give-badge"><?php |
516 | 516 | printf( |
517 | 517 | /* translators: %s: Give version */ |
518 | - esc_html__( 'Version %s', 'give' ), |
|
518 | + esc_html__('Version %s', 'give'), |
|
519 | 519 | $display_version |
520 | 520 | ); |
521 | 521 | ?></div> |
@@ -525,8 +525,8 @@ discard block |
||
525 | 525 | <p class="about-description"><?php |
526 | 526 | printf( |
527 | 527 | /* translators: %s: https://github.com/WordImpress/give */ |
528 | - __( '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' ), |
|
529 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
528 | + __('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'), |
|
529 | + esc_url('https://github.com/WordImpress/give') |
|
530 | 530 | ); |
531 | 531 | ?></p> |
532 | 532 | |
@@ -543,21 +543,21 @@ discard block |
||
543 | 543 | * @return string $readme HTML formatted readme file |
544 | 544 | */ |
545 | 545 | public function parse_readme() { |
546 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
546 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null; |
|
547 | 547 | |
548 | - if ( ! $file ) { |
|
549 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
548 | + if ( ! $file) { |
|
549 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
550 | 550 | } else { |
551 | - $readme = file_get_contents( $file ); |
|
552 | - $readme = nl2br( esc_html( $readme ) ); |
|
553 | - $readme = explode( '== Changelog ==', $readme ); |
|
554 | - $readme = end( $readme ); |
|
555 | - |
|
556 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
557 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
558 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
559 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
560 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
551 | + $readme = file_get_contents($file); |
|
552 | + $readme = nl2br(esc_html($readme)); |
|
553 | + $readme = explode('== Changelog ==', $readme); |
|
554 | + $readme = end($readme); |
|
555 | + |
|
556 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
557 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
558 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
559 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
560 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | return $readme; |
@@ -574,24 +574,24 @@ discard block |
||
574 | 574 | public function contributors() { |
575 | 575 | $contributors = $this->get_contributors(); |
576 | 576 | |
577 | - if ( empty( $contributors ) ) { |
|
577 | + if (empty($contributors)) { |
|
578 | 578 | return ''; |
579 | 579 | } |
580 | 580 | |
581 | 581 | $contributor_list = '<ul class="wp-people-group">'; |
582 | 582 | |
583 | - foreach ( $contributors as $contributor ) { |
|
583 | + foreach ($contributors as $contributor) { |
|
584 | 584 | $contributor_list .= '<li class="wp-person">'; |
585 | 585 | $contributor_list .= sprintf( |
586 | 586 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
587 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
588 | - esc_url( $contributor->avatar_url ), |
|
589 | - esc_attr( $contributor->login ) |
|
587 | + esc_url('https://github.com/'.$contributor->login), |
|
588 | + esc_url($contributor->avatar_url), |
|
589 | + esc_attr($contributor->login) |
|
590 | 590 | ); |
591 | 591 | $contributor_list .= sprintf( |
592 | 592 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
593 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
594 | - esc_html( $contributor->login ) |
|
593 | + esc_url('https://github.com/'.$contributor->login), |
|
594 | + esc_html($contributor->login) |
|
595 | 595 | ); |
596 | 596 | $contributor_list .= '</li>'; |
597 | 597 | } |
@@ -609,25 +609,25 @@ discard block |
||
609 | 609 | * @return array $contributors List of contributors |
610 | 610 | */ |
611 | 611 | public function get_contributors() { |
612 | - $contributors = get_transient( 'give_contributors' ); |
|
612 | + $contributors = get_transient('give_contributors'); |
|
613 | 613 | |
614 | - if ( false !== $contributors ) { |
|
614 | + if (false !== $contributors) { |
|
615 | 615 | return $contributors; |
616 | 616 | } |
617 | 617 | |
618 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
618 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
619 | 619 | |
620 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
620 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
621 | 621 | return array(); |
622 | 622 | } |
623 | 623 | |
624 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
624 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
625 | 625 | |
626 | - if ( ! is_array( $contributors ) ) { |
|
626 | + if ( ! is_array($contributors)) { |
|
627 | 627 | return array(); |
628 | 628 | } |
629 | 629 | |
630 | - set_transient( 'give_contributors', $contributors, 3600 ); |
|
630 | + set_transient('give_contributors', $contributors, 3600); |
|
631 | 631 | |
632 | 632 | return $contributors; |
633 | 633 | } |
@@ -646,24 +646,24 @@ discard block |
||
646 | 646 | |
647 | 647 | |
648 | 648 | // Bail if no activation redirect |
649 | - if ( ! get_transient( '_give_activation_redirect' ) ) { |
|
649 | + if ( ! get_transient('_give_activation_redirect')) { |
|
650 | 650 | return; |
651 | 651 | } |
652 | 652 | |
653 | 653 | // Delete the redirect transient |
654 | - delete_transient( '_give_activation_redirect' ); |
|
654 | + delete_transient('_give_activation_redirect'); |
|
655 | 655 | |
656 | 656 | // Bail if activating from network, or bulk |
657 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
657 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
658 | 658 | return; |
659 | 659 | } |
660 | 660 | |
661 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
661 | + $upgrade = get_option('give_version_upgraded_from'); |
|
662 | 662 | |
663 | - if ( ! $upgrade ) { // First time install |
|
664 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
663 | + if ( ! $upgrade) { // First time install |
|
664 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
665 | 665 | exit; |
666 | - } elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings |
|
666 | + } elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings |
|
667 | 667 | |
668 | 668 | } else { // Welcome is NOT disabled in settings |
669 | 669 | wp_safe_redirect(admin_url('index.php?page=give-about')); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // Retrieve the payment ID |
38 | 38 | $payment_id = absint( $data['give_payment_id'] ); |
39 | 39 | |
40 | - /* @var Give_Payment $payment */ |
|
40 | + /* @var Give_Payment $payment */ |
|
41 | 41 | $payment = new Give_Payment( $payment_id ); |
42 | 42 | |
43 | 43 | // Retrieve existing payment meta |
@@ -160,23 +160,23 @@ discard block |
||
160 | 160 | |
161 | 161 | if ( 'publish' == $status ) { |
162 | 162 | |
163 | - // Reduce previous user donation count and amount. |
|
164 | - $previous_customer->decrease_purchase_count(); |
|
165 | - $previous_customer->decrease_value( $curr_total ); |
|
163 | + // Reduce previous user donation count and amount. |
|
164 | + $previous_customer->decrease_purchase_count(); |
|
165 | + $previous_customer->decrease_value( $curr_total ); |
|
166 | 166 | |
167 | - // If donation was completed adjust stats of new customers. |
|
168 | - $customer->increase_purchase_count(); |
|
167 | + // If donation was completed adjust stats of new customers. |
|
168 | + $customer->increase_purchase_count(); |
|
169 | 169 | $customer->increase_value( $new_total ); |
170 | 170 | } |
171 | 171 | |
172 | 172 | $payment->customer_id = $customer->id; |
173 | 173 | } else{ |
174 | 174 | |
175 | - if( 'publish' === $status ){ |
|
176 | - // Update user donation stat. |
|
177 | - $customer->update_donation_value( $curr_total, $new_total ); |
|
178 | - } |
|
179 | - } |
|
175 | + if( 'publish' === $status ){ |
|
176 | + // Update user donation stat. |
|
177 | + $customer->update_donation_value( $curr_total, $new_total ); |
|
178 | + } |
|
179 | + } |
|
180 | 180 | |
181 | 181 | // Set new meta values |
182 | 182 | $payment->user_id = $customer->user_id; |
@@ -217,76 +217,76 @@ discard block |
||
217 | 217 | |
218 | 218 | $payment->save(); |
219 | 219 | |
220 | - // Get new give form ID. |
|
221 | - $new_form_id = absint( $data['forms'] ); |
|
222 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
220 | + // Get new give form ID. |
|
221 | + $new_form_id = absint( $data['forms'] ); |
|
222 | + $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
223 | 223 | |
224 | - // We are adding payment transfer code in last to remove any conflict with above functionality. |
|
225 | - // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
|
226 | - /* Check if user want to transfer current payment to new give form id. */ |
|
227 | - if( $new_form_id != $current_form_id ) { |
|
224 | + // We are adding payment transfer code in last to remove any conflict with above functionality. |
|
225 | + // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
|
226 | + /* Check if user want to transfer current payment to new give form id. */ |
|
227 | + if( $new_form_id != $current_form_id ) { |
|
228 | 228 | |
229 | - // Get new give form title. |
|
230 | - $new_form_title = get_the_title( $new_form_id ); |
|
229 | + // Get new give form title. |
|
230 | + $new_form_title = get_the_title( $new_form_id ); |
|
231 | 231 | |
232 | - // Update new give form data in payment data. |
|
233 | - $payment_meta = $payment->get_meta(); |
|
234 | - $payment_meta['form_title'] = $new_form_title; |
|
235 | - $payment_meta['form_id'] = $new_form_id; |
|
232 | + // Update new give form data in payment data. |
|
233 | + $payment_meta = $payment->get_meta(); |
|
234 | + $payment_meta['form_title'] = $new_form_title; |
|
235 | + $payment_meta['form_id'] = $new_form_id; |
|
236 | 236 | |
237 | - // Update price id post meta data for set donation form. |
|
238 | - if( ! give_has_variable_prices( $new_form_id ) ) { |
|
239 | - $payment_meta['price_id'] = ''; |
|
240 | - } |
|
237 | + // Update price id post meta data for set donation form. |
|
238 | + if( ! give_has_variable_prices( $new_form_id ) ) { |
|
239 | + $payment_meta['price_id'] = ''; |
|
240 | + } |
|
241 | 241 | |
242 | - // Update payment give form meta data. |
|
243 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
244 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
245 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
242 | + // Update payment give form meta data. |
|
243 | + $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
244 | + $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
245 | + $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
246 | 246 | |
247 | - // Update price id payment metadata. |
|
248 | - if( ! give_has_variable_prices( $new_form_id ) ) { |
|
249 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
250 | - } |
|
247 | + // Update price id payment metadata. |
|
248 | + if( ! give_has_variable_prices( $new_form_id ) ) { |
|
249 | + $payment->update_meta( '_give_payment_price_id', '' ); |
|
250 | + } |
|
251 | 251 | |
252 | 252 | |
253 | - // If donation was completed, adjust stats of forms |
|
254 | - if ( 'publish' == $status ) { |
|
253 | + // If donation was completed, adjust stats of forms |
|
254 | + if ( 'publish' == $status ) { |
|
255 | 255 | |
256 | - // Decrease sale of old give form. For other payment status |
|
257 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
258 | - $current_form->decrease_sales(); |
|
259 | - $current_form->decrease_earnings( $curr_total ); |
|
256 | + // Decrease sale of old give form. For other payment status |
|
257 | + $current_form = new Give_Donate_Form( $current_form_id ); |
|
258 | + $current_form->decrease_sales(); |
|
259 | + $current_form->decrease_earnings( $curr_total ); |
|
260 | 260 | |
261 | - // Increase sale of new give form. |
|
262 | - $new_form = new Give_Donate_Form($new_form_id); |
|
263 | - $new_form->increase_sales(); |
|
264 | - $new_form->increase_earnings($new_total); |
|
265 | - } |
|
261 | + // Increase sale of new give form. |
|
262 | + $new_form = new Give_Donate_Form($new_form_id); |
|
263 | + $new_form->increase_sales(); |
|
264 | + $new_form->increase_earnings($new_total); |
|
265 | + } |
|
266 | 266 | |
267 | - // Re setup payment to update new meta value in object. |
|
268 | - $payment->update_payment_setup( $payment->ID ); |
|
269 | - } |
|
267 | + // Re setup payment to update new meta value in object. |
|
268 | + $payment->update_payment_setup( $payment->ID ); |
|
269 | + } |
|
270 | 270 | |
271 | - // Update price id if current form is variable form. |
|
272 | - if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) { |
|
271 | + // Update price id if current form is variable form. |
|
272 | + if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) { |
|
273 | 273 | |
274 | - // Get payment meta data. |
|
275 | - $payment_meta = $payment->get_meta(); |
|
274 | + // Get payment meta data. |
|
275 | + $payment_meta = $payment->get_meta(); |
|
276 | 276 | |
277 | - // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ). |
|
278 | - $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : ''; |
|
277 | + // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ). |
|
278 | + $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : ''; |
|
279 | 279 | |
280 | - // Update payment meta data. |
|
281 | - $payment_meta['price_id'] = $data['give-variable-price']; |
|
280 | + // Update payment meta data. |
|
281 | + $payment_meta['price_id'] = $data['give-variable-price']; |
|
282 | 282 | |
283 | - // Update payment give form meta data. |
|
284 | - $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] ); |
|
285 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
283 | + // Update payment give form meta data. |
|
284 | + $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] ); |
|
285 | + $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
286 | 286 | |
287 | - // Re setup payment to update new meta value in object. |
|
288 | - $payment->update_payment_setup( $payment->ID ); |
|
289 | - } |
|
287 | + // Re setup payment to update new meta value in object. |
|
288 | + $payment->update_payment_setup( $payment->ID ); |
|
289 | + } |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Fires after updating edited donation. |
@@ -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 | |
@@ -26,52 +26,52 @@ discard block |
||
26 | 26 | * @return void |
27 | 27 | * |
28 | 28 | */ |
29 | -function give_update_payment_details( $data ) { |
|
29 | +function give_update_payment_details($data) { |
|
30 | 30 | |
31 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
32 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
31 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
32 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
33 | 33 | } |
34 | 34 | |
35 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
35 | + check_admin_referer('give_update_payment_details_nonce'); |
|
36 | 36 | |
37 | 37 | // Retrieve the payment ID |
38 | - $payment_id = absint( $data['give_payment_id'] ); |
|
38 | + $payment_id = absint($data['give_payment_id']); |
|
39 | 39 | |
40 | 40 | /* @var Give_Payment $payment */ |
41 | - $payment = new Give_Payment( $payment_id ); |
|
41 | + $payment = new Give_Payment($payment_id); |
|
42 | 42 | |
43 | 43 | // Retrieve existing payment meta |
44 | 44 | $meta = $payment->get_meta(); |
45 | 45 | $user_info = $payment->user_info; |
46 | 46 | |
47 | 47 | $status = $data['give-payment-status']; |
48 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
49 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
48 | + $date = sanitize_text_field($data['give-payment-date']); |
|
49 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
50 | 50 | |
51 | 51 | // Restrict to our high and low |
52 | - if ( $hour > 23 ) { |
|
52 | + if ($hour > 23) { |
|
53 | 53 | $hour = 23; |
54 | - } elseif ( $hour < 0 ) { |
|
54 | + } elseif ($hour < 0) { |
|
55 | 55 | $hour = 00; |
56 | 56 | } |
57 | 57 | |
58 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
58 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
59 | 59 | |
60 | 60 | // Restrict to our high and low |
61 | - if ( $minute > 59 ) { |
|
61 | + if ($minute > 59) { |
|
62 | 62 | $minute = 59; |
63 | - } elseif ( $minute < 0 ) { |
|
63 | + } elseif ($minute < 0) { |
|
64 | 64 | $minute = 00; |
65 | 65 | } |
66 | 66 | |
67 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
67 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
68 | 68 | |
69 | - $curr_total = give_sanitize_amount( $payment->total ); |
|
70 | - $new_total = give_sanitize_amount( $data['give-payment-total'] ); |
|
71 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
69 | + $curr_total = give_sanitize_amount($payment->total); |
|
70 | + $new_total = give_sanitize_amount($data['give-payment-total']); |
|
71 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
72 | 72 | |
73 | - $curr_customer_id = sanitize_text_field( $data['give-current-customer'] ); |
|
74 | - $new_customer_id = sanitize_text_field( $data['customer-id'] ); |
|
73 | + $curr_customer_id = sanitize_text_field($data['give-current-customer']); |
|
74 | + $new_customer_id = sanitize_text_field($data['customer-id']); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Fires before updating edited donation. |
@@ -80,62 +80,62 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param int $payment_id The ID of the payment. |
82 | 82 | */ |
83 | - do_action( 'give_update_edited_purchase', $payment_id ); |
|
83 | + do_action('give_update_edited_purchase', $payment_id); |
|
84 | 84 | |
85 | 85 | $payment->date = $date; |
86 | 86 | $updated = $payment->save(); |
87 | 87 | |
88 | - if ( 0 === $updated ) { |
|
89 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
88 | + if (0 === $updated) { |
|
89 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
93 | 93 | $customer_changed = false; |
94 | 94 | |
95 | - if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) { |
|
95 | + if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') { |
|
96 | 96 | |
97 | - $email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : ''; |
|
98 | - $names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : ''; |
|
97 | + $email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : ''; |
|
98 | + $names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : ''; |
|
99 | 99 | |
100 | - if ( empty( $email ) || empty( $names ) ) { |
|
101 | - wp_die( esc_html__( 'New Customers require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
100 | + if (empty($email) || empty($names)) { |
|
101 | + wp_die(esc_html__('New Customers require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
102 | 102 | } |
103 | 103 | |
104 | - $customer = new Give_Customer( $email ); |
|
105 | - if ( empty( $customer->id ) ) { |
|
106 | - $customer_data = array( 'name' => $names, 'email' => $email ); |
|
107 | - $user_id = email_exists( $email ); |
|
108 | - if ( false !== $user_id ) { |
|
104 | + $customer = new Give_Customer($email); |
|
105 | + if (empty($customer->id)) { |
|
106 | + $customer_data = array('name' => $names, 'email' => $email); |
|
107 | + $user_id = email_exists($email); |
|
108 | + if (false !== $user_id) { |
|
109 | 109 | $customer_data['user_id'] = $user_id; |
110 | 110 | } |
111 | 111 | |
112 | - if ( ! $customer->create( $customer_data ) ) { |
|
112 | + if ( ! $customer->create($customer_data)) { |
|
113 | 113 | // Failed to crete the new donor, assume the previous donor |
114 | 114 | $customer_changed = false; |
115 | - $customer = new Give_Customer( $curr_customer_id ); |
|
116 | - give_set_error( 'give-payment-new-customer-fail', esc_html__( 'Error creating new donor.', 'give' ) ); |
|
115 | + $customer = new Give_Customer($curr_customer_id); |
|
116 | + give_set_error('give-payment-new-customer-fail', esc_html__('Error creating new donor.', 'give')); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | 120 | $new_customer_id = $customer->id; |
121 | 121 | |
122 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
122 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
123 | 123 | |
124 | 124 | $customer_changed = true; |
125 | 125 | |
126 | - } elseif ( $curr_customer_id !== $new_customer_id ) { |
|
126 | + } elseif ($curr_customer_id !== $new_customer_id) { |
|
127 | 127 | |
128 | - $customer = new Give_Customer( $new_customer_id ); |
|
128 | + $customer = new Give_Customer($new_customer_id); |
|
129 | 129 | $email = $customer->email; |
130 | 130 | $names = $customer->name; |
131 | 131 | |
132 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
132 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
133 | 133 | |
134 | 134 | $customer_changed = true; |
135 | 135 | |
136 | 136 | } else { |
137 | 137 | |
138 | - $customer = new Give_Customer( $curr_customer_id ); |
|
138 | + $customer = new Give_Customer($curr_customer_id); |
|
139 | 139 | $email = $customer->email; |
140 | 140 | $names = $customer->name; |
141 | 141 | |
@@ -143,38 +143,38 @@ discard block |
||
143 | 143 | |
144 | 144 | |
145 | 145 | // Setup first and last name from input values |
146 | - $names = explode( ' ', $names ); |
|
147 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
146 | + $names = explode(' ', $names); |
|
147 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
148 | 148 | $last_name = ''; |
149 | - if ( ! empty( $names[1] ) ) { |
|
150 | - unset( $names[0] ); |
|
151 | - $last_name = implode( ' ', $names ); |
|
149 | + if ( ! empty($names[1])) { |
|
150 | + unset($names[0]); |
|
151 | + $last_name = implode(' ', $names); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | - if ( $customer_changed ) { |
|
155 | + if ($customer_changed) { |
|
156 | 156 | |
157 | 157 | // Remove the stats and payment from the previous customer and attach it to the new customer |
158 | - $previous_customer->remove_payment( $payment_id, false ); |
|
159 | - $customer->attach_payment( $payment_id, false ); |
|
158 | + $previous_customer->remove_payment($payment_id, false); |
|
159 | + $customer->attach_payment($payment_id, false); |
|
160 | 160 | |
161 | - if ( 'publish' == $status ) { |
|
161 | + if ('publish' == $status) { |
|
162 | 162 | |
163 | 163 | // Reduce previous user donation count and amount. |
164 | 164 | $previous_customer->decrease_purchase_count(); |
165 | - $previous_customer->decrease_value( $curr_total ); |
|
165 | + $previous_customer->decrease_value($curr_total); |
|
166 | 166 | |
167 | 167 | // If donation was completed adjust stats of new customers. |
168 | 168 | $customer->increase_purchase_count(); |
169 | - $customer->increase_value( $new_total ); |
|
169 | + $customer->increase_value($new_total); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | $payment->customer_id = $customer->id; |
173 | - } else{ |
|
173 | + } else { |
|
174 | 174 | |
175 | - if( 'publish' === $status ){ |
|
175 | + if ('publish' === $status) { |
|
176 | 176 | // Update user donation stat. |
177 | - $customer->update_donation_value( $curr_total, $new_total ); |
|
177 | + $customer->update_donation_value($curr_total, $new_total); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
@@ -188,10 +188,10 @@ discard block |
||
188 | 188 | |
189 | 189 | |
190 | 190 | // Check for payment notes |
191 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
191 | + if ( ! empty($data['give-payment-note'])) { |
|
192 | 192 | |
193 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
194 | - give_insert_payment_note( $payment_id, $note ); |
|
193 | + $note = wp_kses($data['give-payment-note'], array()); |
|
194 | + give_insert_payment_note($payment_id, $note); |
|
195 | 195 | |
196 | 196 | } |
197 | 197 | |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | $payment->status = $status; |
200 | 200 | |
201 | 201 | // Adjust total store earnings if the payment total has been changed |
202 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
202 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
203 | 203 | |
204 | - if ( $new_total > $curr_total ) { |
|
204 | + if ($new_total > $curr_total) { |
|
205 | 205 | // Increase if our new total is higher |
206 | 206 | $difference = $new_total - $curr_total; |
207 | - give_increase_total_earnings( $difference ); |
|
207 | + give_increase_total_earnings($difference); |
|
208 | 208 | |
209 | - } elseif ( $curr_total > $new_total ) { |
|
209 | + } elseif ($curr_total > $new_total) { |
|
210 | 210 | // Decrease if our new total is lower |
211 | 211 | $difference = $curr_total - $new_total; |
212 | - give_decrease_total_earnings( $difference ); |
|
212 | + give_decrease_total_earnings($difference); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | $payment->save(); |
219 | 219 | |
220 | 220 | // Get new give form ID. |
221 | - $new_form_id = absint( $data['forms'] ); |
|
222 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
221 | + $new_form_id = absint($data['forms']); |
|
222 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
223 | 223 | |
224 | 224 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
225 | 225 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
226 | 226 | /* Check if user want to transfer current payment to new give form id. */ |
227 | - if( $new_form_id != $current_form_id ) { |
|
227 | + if ($new_form_id != $current_form_id) { |
|
228 | 228 | |
229 | 229 | // Get new give form title. |
230 | - $new_form_title = get_the_title( $new_form_id ); |
|
230 | + $new_form_title = get_the_title($new_form_id); |
|
231 | 231 | |
232 | 232 | // Update new give form data in payment data. |
233 | 233 | $payment_meta = $payment->get_meta(); |
@@ -235,28 +235,28 @@ discard block |
||
235 | 235 | $payment_meta['form_id'] = $new_form_id; |
236 | 236 | |
237 | 237 | // Update price id post meta data for set donation form. |
238 | - if( ! give_has_variable_prices( $new_form_id ) ) { |
|
238 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
239 | 239 | $payment_meta['price_id'] = ''; |
240 | 240 | } |
241 | 241 | |
242 | 242 | // Update payment give form meta data. |
243 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
244 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
245 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
243 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
244 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
245 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
246 | 246 | |
247 | 247 | // Update price id payment metadata. |
248 | - if( ! give_has_variable_prices( $new_form_id ) ) { |
|
249 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
248 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
249 | + $payment->update_meta('_give_payment_price_id', ''); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
253 | 253 | // If donation was completed, adjust stats of forms |
254 | - if ( 'publish' == $status ) { |
|
254 | + if ('publish' == $status) { |
|
255 | 255 | |
256 | 256 | // Decrease sale of old give form. For other payment status |
257 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
257 | + $current_form = new Give_Donate_Form($current_form_id); |
|
258 | 258 | $current_form->decrease_sales(); |
259 | - $current_form->decrease_earnings( $curr_total ); |
|
259 | + $current_form->decrease_earnings($curr_total); |
|
260 | 260 | |
261 | 261 | // Increase sale of new give form. |
262 | 262 | $new_form = new Give_Donate_Form($new_form_id); |
@@ -265,27 +265,27 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | // Re setup payment to update new meta value in object. |
268 | - $payment->update_payment_setup( $payment->ID ); |
|
268 | + $payment->update_payment_setup($payment->ID); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | // Update price id if current form is variable form. |
272 | - if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) { |
|
272 | + if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) { |
|
273 | 273 | |
274 | 274 | // Get payment meta data. |
275 | 275 | $payment_meta = $payment->get_meta(); |
276 | 276 | |
277 | 277 | // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ). |
278 | - $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : ''; |
|
278 | + $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : ''; |
|
279 | 279 | |
280 | 280 | // Update payment meta data. |
281 | 281 | $payment_meta['price_id'] = $data['give-variable-price']; |
282 | 282 | |
283 | 283 | // Update payment give form meta data. |
284 | - $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] ); |
|
285 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
284 | + $payment->update_meta('_give_payment_price_id', $data['give-variable-price']); |
|
285 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
286 | 286 | |
287 | 287 | // Re setup payment to update new meta value in object. |
288 | - $payment->update_payment_setup( $payment->ID ); |
|
288 | + $payment->update_payment_setup($payment->ID); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -295,13 +295,13 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @param int $payment_id The ID of the payment. |
297 | 297 | */ |
298 | - do_action( 'give_updated_edited_purchase', $payment_id ); |
|
298 | + do_action('give_updated_edited_purchase', $payment_id); |
|
299 | 299 | |
300 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
300 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id)); |
|
301 | 301 | exit; |
302 | 302 | } |
303 | 303 | |
304 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
304 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * Trigger a Donation Deletion |
@@ -312,48 +312,48 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return void |
314 | 314 | */ |
315 | -function give_trigger_purchase_delete( $data ) { |
|
316 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_payment_nonce' ) ) { |
|
315 | +function give_trigger_purchase_delete($data) { |
|
316 | + if (wp_verify_nonce($data['_wpnonce'], 'give_payment_nonce')) { |
|
317 | 317 | |
318 | - $payment_id = absint( $data['purchase_id'] ); |
|
318 | + $payment_id = absint($data['purchase_id']); |
|
319 | 319 | |
320 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
321 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
320 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
321 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
322 | 322 | } |
323 | 323 | |
324 | - give_delete_purchase( $payment_id ); |
|
325 | - wp_redirect( admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted' ) ); |
|
324 | + give_delete_purchase($payment_id); |
|
325 | + wp_redirect(admin_url('/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted')); |
|
326 | 326 | give_die(); |
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
330 | -add_action( 'give_delete_payment', 'give_trigger_purchase_delete' ); |
|
330 | +add_action('give_delete_payment', 'give_trigger_purchase_delete'); |
|
331 | 331 | |
332 | 332 | /** |
333 | 333 | * AJAX Store Donation Note |
334 | 334 | */ |
335 | 335 | function give_ajax_store_payment_note() { |
336 | 336 | |
337 | - $payment_id = absint( $_POST['payment_id'] ); |
|
338 | - $note = wp_kses( $_POST['note'], array() ); |
|
337 | + $payment_id = absint($_POST['payment_id']); |
|
338 | + $note = wp_kses($_POST['note'], array()); |
|
339 | 339 | |
340 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
341 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
340 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
341 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
342 | 342 | } |
343 | 343 | |
344 | - if ( empty( $payment_id ) ) { |
|
345 | - die( '-1' ); |
|
344 | + if (empty($payment_id)) { |
|
345 | + die('-1'); |
|
346 | 346 | } |
347 | 347 | |
348 | - if ( empty( $note ) ) { |
|
349 | - die( '-1' ); |
|
348 | + if (empty($note)) { |
|
349 | + die('-1'); |
|
350 | 350 | } |
351 | 351 | |
352 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
353 | - die( give_get_payment_note_html( $note_id ) ); |
|
352 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
353 | + die(give_get_payment_note_html($note_id)); |
|
354 | 354 | } |
355 | 355 | |
356 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
356 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Triggers a payment note deletion without ajax |
@@ -364,24 +364,24 @@ discard block |
||
364 | 364 | * |
365 | 365 | * @return void |
366 | 366 | */ |
367 | -function give_trigger_payment_note_deletion( $data ) { |
|
367 | +function give_trigger_payment_note_deletion($data) { |
|
368 | 368 | |
369 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
369 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
370 | 370 | return; |
371 | 371 | } |
372 | 372 | |
373 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
374 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
373 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
374 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
375 | 375 | } |
376 | 376 | |
377 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
377 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id='.absint($data['payment_id'])); |
|
378 | 378 | |
379 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
379 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
380 | 380 | |
381 | - wp_redirect( $edit_order_url ); |
|
381 | + wp_redirect($edit_order_url); |
|
382 | 382 | } |
383 | 383 | |
384 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
384 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
385 | 385 | |
386 | 386 | /** |
387 | 387 | * Delete a payment note deletion with ajax |
@@ -392,16 +392,16 @@ discard block |
||
392 | 392 | */ |
393 | 393 | function give_ajax_delete_payment_note() { |
394 | 394 | |
395 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
396 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
395 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
396 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
397 | 397 | } |
398 | 398 | |
399 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
400 | - die( '1' ); |
|
399 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
400 | + die('1'); |
|
401 | 401 | } else { |
402 | - die( '-1' ); |
|
402 | + die('-1'); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | } |
406 | 406 | |
407 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
408 | 407 | \ No newline at end of file |
408 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
|
409 | 409 | \ No newline at end of file |