@@ -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 | |
@@ -62,51 +62,51 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return bool If the gravatar exists or not |
64 | 64 | */ |
65 | - public function validate_gravatar( $id_or_email ) { |
|
65 | + public function validate_gravatar($id_or_email) { |
|
66 | 66 | //id or email code borrowed from wp-includes/pluggable.php |
67 | 67 | $email = ''; |
68 | - if ( is_numeric( $id_or_email ) ) { |
|
68 | + if (is_numeric($id_or_email)) { |
|
69 | 69 | $id = (int) $id_or_email; |
70 | - $user = get_userdata( $id ); |
|
71 | - if ( $user ) { |
|
70 | + $user = get_userdata($id); |
|
71 | + if ($user) { |
|
72 | 72 | $email = $user->user_email; |
73 | 73 | } |
74 | - } elseif ( is_object( $id_or_email ) ) { |
|
74 | + } elseif (is_object($id_or_email)) { |
|
75 | 75 | // No avatar for pingbacks or trackbacks |
76 | - $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); |
|
77 | - if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) { |
|
76 | + $allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment')); |
|
77 | + if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! empty( $id_or_email->user_id ) ) { |
|
81 | + if ( ! empty($id_or_email->user_id)) { |
|
82 | 82 | $id = (int) $id_or_email->user_id; |
83 | - $user = get_userdata( $id ); |
|
84 | - if ( $user ) { |
|
83 | + $user = get_userdata($id); |
|
84 | + if ($user) { |
|
85 | 85 | $email = $user->user_email; |
86 | 86 | } |
87 | - } elseif ( ! empty( $id_or_email->comment_author_email ) ) { |
|
87 | + } elseif ( ! empty($id_or_email->comment_author_email)) { |
|
88 | 88 | $email = $id_or_email->comment_author_email; |
89 | 89 | } |
90 | 90 | } else { |
91 | 91 | $email = $id_or_email; |
92 | 92 | } |
93 | 93 | |
94 | - $hashkey = md5( strtolower( trim( $email ) ) ); |
|
95 | - $uri = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404'; |
|
94 | + $hashkey = md5(strtolower(trim($email))); |
|
95 | + $uri = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404'; |
|
96 | 96 | |
97 | - $data = Give_Cache::get_group( $hashkey ); |
|
97 | + $data = Give_Cache::get_group($hashkey); |
|
98 | 98 | |
99 | - if ( is_null( $data ) ) { |
|
100 | - $response = wp_remote_head( $uri ); |
|
101 | - if ( is_wp_error( $response ) ) { |
|
99 | + if (is_null($data)) { |
|
100 | + $response = wp_remote_head($uri); |
|
101 | + if (is_wp_error($response)) { |
|
102 | 102 | $data = 'not200'; |
103 | 103 | } else { |
104 | 104 | $data = $response['response']['code']; |
105 | 105 | } |
106 | - Give_Cache::set_group( $hashkey, $data, $group = '', $expire = 60 * 5 ); |
|
106 | + Give_Cache::set_group($hashkey, $data, $group = '', $expire = 60 * 5); |
|
107 | 107 | |
108 | 108 | } |
109 | - if ( $data == '200' ) { |
|
109 | + if ($data == '200') { |
|
110 | 110 | return true; |
111 | 111 | } else { |
112 | 112 | return false; |
@@ -123,15 +123,15 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return array IDs if logs, false otherwise |
125 | 125 | */ |
126 | - public function get_log_ids( $form_id = '' ) { |
|
126 | + public function get_log_ids($form_id = '') { |
|
127 | 127 | // get log for this form |
128 | - $logs = Give()->logs->get_logs( $form_id ); |
|
128 | + $logs = Give()->logs->get_logs($form_id); |
|
129 | 129 | |
130 | - if ( $logs ) { |
|
130 | + if ($logs) { |
|
131 | 131 | $log_ids = array(); |
132 | 132 | |
133 | 133 | // make an array with all the donor IDs |
134 | - foreach ( $logs as $log ) { |
|
134 | + foreach ($logs as $log) { |
|
135 | 135 | $log_ids[] = $log->ID; |
136 | 136 | } |
137 | 137 | |
@@ -152,51 +152,51 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return mixed |
154 | 154 | */ |
155 | - public function get_payment_ids( $form_id = '' ) { |
|
155 | + public function get_payment_ids($form_id = '') { |
|
156 | 156 | |
157 | 157 | $give_options = give_get_settings(); |
158 | 158 | |
159 | - $log_ids = $this->get_log_ids( $form_id ); |
|
159 | + $log_ids = $this->get_log_ids($form_id); |
|
160 | 160 | |
161 | - if ( $log_ids ) { |
|
161 | + if ($log_ids) { |
|
162 | 162 | |
163 | 163 | $payment_ids = array(); |
164 | 164 | |
165 | - foreach ( $log_ids as $id ) { |
|
165 | + foreach ($log_ids as $id) { |
|
166 | 166 | // get the payment ID for each corresponding log ID |
167 | - $payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true ); |
|
167 | + $payment_ids[] = give_get_meta($id, '_give_log_payment_id', true); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | // remove donors who have donated more than once so we can have unique avatars |
171 | 171 | $unique_emails = array(); |
172 | 172 | |
173 | - foreach ( $payment_ids as $key => $id ) { |
|
173 | + foreach ($payment_ids as $key => $id) { |
|
174 | 174 | |
175 | - $email = give_get_meta( $id, '_give_payment_donor_email', true ); |
|
175 | + $email = give_get_meta($id, '_give_payment_donor_email', true); |
|
176 | 176 | |
177 | - if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) { |
|
178 | - if ( ! $this->validate_gravatar( $email ) ) { |
|
177 | + if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) { |
|
178 | + if ( ! $this->validate_gravatar($email)) { |
|
179 | 179 | continue; |
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
183 | - $unique_emails[ $id ] = give_get_meta( $id, '_give_payment_donor_email', true ); |
|
183 | + $unique_emails[$id] = give_get_meta($id, '_give_payment_donor_email', true); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
187 | 187 | $unique_ids = array(); |
188 | 188 | |
189 | 189 | // strip duplicate emails |
190 | - $unique_emails = array_unique( $unique_emails ); |
|
190 | + $unique_emails = array_unique($unique_emails); |
|
191 | 191 | |
192 | 192 | // convert the unique IDs back into simple array |
193 | - foreach ( $unique_emails as $id => $email ) { |
|
193 | + foreach ($unique_emails as $id => $email) { |
|
194 | 194 | $unique_ids[] = $id; |
195 | 195 | } |
196 | 196 | |
197 | 197 | // randomize the payment IDs if enabled |
198 | - if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) { |
|
199 | - shuffle( $unique_ids ); |
|
198 | + if (isset($give_options['give_donors_gravatars_random_gravatars'])) { |
|
199 | + shuffle($unique_ids); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // return our unique IDs |
@@ -217,22 +217,22 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return string |
219 | 219 | */ |
220 | - public function gravatars( $form_id = false, $title = '' ) { |
|
220 | + public function gravatars($form_id = false, $title = '') { |
|
221 | 221 | |
222 | 222 | // unique $payment_ids |
223 | - $payment_ids = $this->get_payment_ids( $form_id ); |
|
223 | + $payment_ids = $this->get_payment_ids($form_id); |
|
224 | 224 | |
225 | 225 | $give_options = give_get_settings(); |
226 | 226 | |
227 | 227 | // return if no ID |
228 | - if ( ! $form_id ) { |
|
228 | + if ( ! $form_id) { |
|
229 | 229 | return; |
230 | 230 | } |
231 | 231 | |
232 | 232 | // minimum amount of donations before showing gravatars |
233 | 233 | // if the number of items in array is not greater or equal to the number specified, then exit |
234 | - if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) { |
|
235 | - if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) { |
|
234 | + if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) { |
|
235 | + if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) { |
|
236 | 236 | return; |
237 | 237 | } |
238 | 238 | } |
@@ -243,28 +243,28 @@ discard block |
||
243 | 243 | echo '<div id="give-purchase-gravatars">'; |
244 | 244 | |
245 | 245 | |
246 | - if ( isset ( $title ) ) { |
|
246 | + if (isset ($title)) { |
|
247 | 247 | |
248 | - if ( $title ) { |
|
249 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' ); |
|
250 | - } elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) { |
|
251 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' ); |
|
248 | + if ($title) { |
|
249 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>'); |
|
250 | + } elseif (isset($give_options['give_donors_gravatars_heading'])) { |
|
251 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>'); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | } |
255 | 255 | echo '<ul class="give-purchase-gravatars-list">'; |
256 | 256 | $i = 0; |
257 | 257 | |
258 | - if ( $payment_ids ) { |
|
259 | - foreach ( $payment_ids as $id ) { |
|
258 | + if ($payment_ids) { |
|
259 | + foreach ($payment_ids as $id) { |
|
260 | 260 | |
261 | 261 | // Give saves a blank option even when the control is turned off, hence the extra check |
262 | - if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) { |
|
262 | + if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) { |
|
263 | 263 | continue; |
264 | 264 | } |
265 | 265 | |
266 | 266 | // get the payment meta |
267 | - $payment_meta = give_get_meta( $id, '_give_payment_meta', true ); |
|
267 | + $payment_meta = give_get_meta($id, '_give_payment_meta', true); |
|
268 | 268 | |
269 | 269 | $user_info = $payment_meta['user_info']; |
270 | 270 | |
@@ -272,21 +272,21 @@ discard block |
||
272 | 272 | $name = $user_info['first_name']; |
273 | 273 | |
274 | 274 | // get donor's email |
275 | - $email = give_get_meta( $id, '_give_payment_donor_email', true ); |
|
275 | + $email = give_get_meta($id, '_give_payment_donor_email', true); |
|
276 | 276 | |
277 | 277 | // set gravatar size and provide filter |
278 | - $size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : ''; |
|
278 | + $size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : ''; |
|
279 | 279 | |
280 | 280 | // default image |
281 | - $default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false ); |
|
281 | + $default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false); |
|
282 | 282 | |
283 | 283 | // assemble output |
284 | 284 | $output .= '<li>'; |
285 | 285 | |
286 | - $output .= get_avatar( $email, $size, $default_image, $name ); |
|
286 | + $output .= get_avatar($email, $size, $default_image, $name); |
|
287 | 287 | $output .= '</li>'; |
288 | 288 | |
289 | - $i ++; |
|
289 | + $i++; |
|
290 | 290 | |
291 | 291 | } // end foreach |
292 | 292 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | echo '</ul>'; |
296 | 296 | echo '</div>'; |
297 | 297 | |
298 | - return apply_filters( 'give_donors_gravatars', ob_get_clean() ); |
|
298 | + return apply_filters('give_donors_gravatars', ob_get_clean()); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @return void |
308 | 308 | */ |
309 | 309 | public function register_widget() { |
310 | - register_widget( 'Give_Donors_Gravatars_Widget' ); |
|
310 | + register_widget('Give_Donors_Gravatars_Widget'); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -321,19 +321,19 @@ discard block |
||
321 | 321 | * |
322 | 322 | * @return string |
323 | 323 | */ |
324 | - public function shortcode( $atts, $content = null ) { |
|
324 | + public function shortcode($atts, $content = null) { |
|
325 | 325 | |
326 | - $atts = shortcode_atts( array( |
|
326 | + $atts = shortcode_atts(array( |
|
327 | 327 | 'id' => '', |
328 | 328 | 'title' => '' |
329 | - ), $atts, 'give_donors_gravatars' ); |
|
329 | + ), $atts, 'give_donors_gravatars'); |
|
330 | 330 | |
331 | 331 | // if no ID is passed on single give_forms pages, get the correct ID |
332 | - if ( is_singular( 'give_forms' ) ) { |
|
332 | + if (is_singular('give_forms')) { |
|
333 | 333 | $id = get_the_ID(); |
334 | 334 | } |
335 | 335 | |
336 | - $content = $this->gravatars( $atts['id'], $atts['title'] ); |
|
336 | + $content = $this->gravatars($atts['id'], $atts['title']); |
|
337 | 337 | |
338 | 338 | return $content; |
339 | 339 | |
@@ -349,56 +349,56 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @return array Gravatar settings. |
351 | 351 | */ |
352 | - public function settings( $settings ) { |
|
352 | + public function settings($settings) { |
|
353 | 353 | |
354 | 354 | $give_gravatar_settings = array( |
355 | 355 | array( |
356 | - 'name' => esc_html__( 'Donator Gravatars', 'give' ), |
|
356 | + 'name' => esc_html__('Donator Gravatars', 'give'), |
|
357 | 357 | 'desc' => '<hr>', |
358 | 358 | 'id' => 'give_title', |
359 | 359 | 'type' => 'give_title' |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => esc_html__( 'Heading', 'give' ), |
|
363 | - 'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ), |
|
362 | + 'name' => esc_html__('Heading', 'give'), |
|
363 | + 'desc' => esc_html__('The heading to display above the Gravatars.', 'give'), |
|
364 | 364 | 'type' => 'text', |
365 | 365 | 'id' => 'give_donors_gravatars_heading' |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => esc_html__( 'Gravatar Size', 'give' ), |
|
369 | - 'desc' => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ), |
|
368 | + 'name' => esc_html__('Gravatar Size', 'give'), |
|
369 | + 'desc' => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'), |
|
370 | 370 | 'type' => 'text_small', |
371 | 371 | 'id' => 'give_donors_gravatars_gravatar_size', |
372 | 372 | 'default' => '64' |
373 | 373 | ), |
374 | 374 | array( |
375 | - 'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ), |
|
376 | - 'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), |
|
375 | + 'name' => esc_html__('Minimum Unique Donations Required', 'give'), |
|
376 | + 'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), |
|
377 | 377 | 'type' => 'text_small', |
378 | 378 | 'id' => 'give_donors_gravatars_min_purchases_required', |
379 | 379 | ), |
380 | 380 | array( |
381 | - 'name' => esc_html__( 'Maximum Gravatars To Show', 'give' ), |
|
382 | - 'desc' => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ), |
|
381 | + 'name' => esc_html__('Maximum Gravatars To Show', 'give'), |
|
382 | + 'desc' => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'), |
|
383 | 383 | 'type' => 'text', |
384 | 384 | 'id' => 'give_donors_gravatars_maximum_number', |
385 | 385 | 'default' => '20', |
386 | 386 | ), |
387 | 387 | array( |
388 | - 'name' => esc_html__( 'Gravatar Visibility', 'give' ), |
|
389 | - 'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ), |
|
388 | + 'name' => esc_html__('Gravatar Visibility', 'give'), |
|
389 | + 'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'), |
|
390 | 390 | 'id' => 'give_donors_gravatars_has_gravatar_account', |
391 | 391 | 'type' => 'checkbox', |
392 | 392 | ), |
393 | 393 | array( |
394 | - 'name' => esc_html__( 'Randomize Gravatars', 'give' ), |
|
395 | - 'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ), |
|
394 | + 'name' => esc_html__('Randomize Gravatars', 'give'), |
|
395 | + 'desc' => esc_html__('Randomize the Gravatars.', 'give'), |
|
396 | 396 | 'id' => 'give_donors_gravatars_random_gravatars', |
397 | 397 | 'type' => 'checkbox', |
398 | 398 | ), |
399 | 399 | ); |
400 | 400 | |
401 | - return array_merge( $settings, $give_gravatar_settings ); |
|
401 | + return array_merge($settings, $give_gravatar_settings); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | // widget settings |
425 | 425 | $widget_ops = array( |
426 | 426 | 'classname' => 'give-donors-gravatars', |
427 | - 'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ), |
|
427 | + 'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'), |
|
428 | 428 | ); |
429 | 429 | |
430 | 430 | // widget control settings |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | // create the widget |
438 | 438 | parent::__construct( |
439 | 439 | 'give_donors_gravatars_widget', |
440 | - esc_html__( 'Give Donors Gravatars', 'give' ), |
|
440 | + esc_html__('Give Donors Gravatars', 'give'), |
|
441 | 441 | $widget_ops, |
442 | 442 | $control_ops |
443 | 443 | ); |
@@ -457,29 +457,29 @@ discard block |
||
457 | 457 | * |
458 | 458 | * @return void |
459 | 459 | */ |
460 | - public function widget( $args, $instance ) { |
|
460 | + public function widget($args, $instance) { |
|
461 | 461 | |
462 | 462 | //@TODO: Don't extract it!!! |
463 | - extract( $args ); |
|
463 | + extract($args); |
|
464 | 464 | |
465 | - if ( ! is_singular( 'give_forms' ) ) { |
|
465 | + if ( ! is_singular('give_forms')) { |
|
466 | 466 | return; |
467 | 467 | } |
468 | 468 | |
469 | 469 | // Variables from widget settings |
470 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
470 | + $title = apply_filters('widget_title', $instance['title']); |
|
471 | 471 | |
472 | 472 | // Used by themes. Opens the widget |
473 | 473 | echo $before_widget; |
474 | 474 | |
475 | 475 | // Display the widget title |
476 | - if ( $title ) { |
|
477 | - echo $before_title . $title . $after_title; |
|
476 | + if ($title) { |
|
477 | + echo $before_title.$title.$after_title; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | $gravatars = new Give_Donors_Gravatars(); |
481 | 481 | |
482 | - echo $gravatars->gravatars( get_the_ID(), null ); // remove title |
|
482 | + echo $gravatars->gravatars(get_the_ID(), null); // remove title |
|
483 | 483 | |
484 | 484 | // Used by themes. Closes the widget |
485 | 485 | echo $after_widget; |
@@ -499,11 +499,11 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @return array Updated settings to save. |
501 | 501 | */ |
502 | - public function update( $new_instance, $old_instance ) { |
|
502 | + public function update($new_instance, $old_instance) { |
|
503 | 503 | |
504 | 504 | $instance = $old_instance; |
505 | 505 | |
506 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
506 | + $instance['title'] = strip_tags($new_instance['title']); |
|
507 | 507 | |
508 | 508 | return $instance; |
509 | 509 | |
@@ -521,19 +521,19 @@ discard block |
||
521 | 521 | * |
522 | 522 | * @return void |
523 | 523 | */ |
524 | - public function form( $instance ) { |
|
524 | + public function form($instance) { |
|
525 | 525 | |
526 | 526 | // Set up some default widget settings. |
527 | 527 | $defaults = array( |
528 | 528 | 'title' => '', |
529 | 529 | ); |
530 | 530 | |
531 | - $instance = wp_parse_args( (array) $instance, $defaults ); ?> |
|
531 | + $instance = wp_parse_args((array) $instance, $defaults); ?> |
|
532 | 532 | |
533 | 533 | <!-- Title --> |
534 | 534 | <p> |
535 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label> |
|
536 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
535 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label> |
|
536 | + <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
537 | 537 | </p> |
538 | 538 | |
539 | 539 | <?php |
@@ -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 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return static |
52 | 52 | */ |
53 | 53 | public static function get_instance() { |
54 | - if ( null === static::$instance ) { |
|
54 | + if (null === static::$instance) { |
|
55 | 55 | self::$instance = new static(); |
56 | 56 | self::$instance->setup(); |
57 | 57 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @since 1.8.13 |
67 | 67 | */ |
68 | 68 | private function setup() { |
69 | - add_filter( 'cron_schedules', array( self::$instance, '__add_schedules' ) ); |
|
70 | - add_action( 'wp', array( self::$instance, '__schedule_events' ) ); |
|
69 | + add_filter('cron_schedules', array(self::$instance, '__add_schedules')); |
|
70 | + add_action('wp', array(self::$instance, '__schedule_events')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array An array of non-default cron schedules. |
82 | 82 | */ |
83 | - public function __add_schedules( $schedules = array() ) { |
|
83 | + public function __add_schedules($schedules = array()) { |
|
84 | 84 | // Adds once weekly to the existing schedules. |
85 | 85 | $schedules['weekly'] = array( |
86 | 86 | 'interval' => 604800, |
87 | - 'display' => __( 'Once Weekly', 'give' ), |
|
87 | + 'display' => __('Once Weekly', 'give'), |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $schedules; |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * @return void |
113 | 113 | */ |
114 | 114 | private function weekly_events() { |
115 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
116 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
115 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
116 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @return void |
127 | 127 | */ |
128 | 128 | private function daily_events() { |
129 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
130 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
129 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
130 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return string |
143 | 143 | */ |
144 | - public static function get_cron_action( $type = 'weekly' ) { |
|
145 | - switch ( $type ) { |
|
144 | + public static function get_cron_action($type = 'weekly') { |
|
145 | + switch ($type) { |
|
146 | 146 | case 'daily': |
147 | 147 | $cron_action = 'give_daily_scheduled_events'; |
148 | 148 | break; |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | * @param $action |
165 | 165 | * @param string $type |
166 | 166 | */ |
167 | - private static function add_event( $action, $type = 'weekly' ) { |
|
168 | - $cron_event = self::get_cron_action( $type ); |
|
169 | - add_action( $cron_event, $action ); |
|
167 | + private static function add_event($action, $type = 'weekly') { |
|
168 | + $cron_event = self::get_cron_action($type); |
|
169 | + add_action($cron_event, $action); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @param $action |
179 | 179 | */ |
180 | - public static function add_weekly_event( $action ) { |
|
181 | - self::add_event( $action, 'weekly' ); |
|
180 | + public static function add_weekly_event($action) { |
|
181 | + self::add_event($action, 'weekly'); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @param $action |
191 | 191 | */ |
192 | - public static function add_daily_event( $action ) { |
|
193 | - self::add_event( $action, 'daily' ); |
|
192 | + public static function add_daily_event($action) { |
|
193 | + self::add_event($action, 'daily'); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 |
@@ -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,16 +98,16 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return object |
100 | 100 | */ |
101 | - public function get( $row_id ) { |
|
101 | + public function get($row_id) { |
|
102 | 102 | /* @var WPDB $wpdb */ |
103 | 103 | global $wpdb; |
104 | 104 | |
105 | 105 | // Bailout. |
106 | - if ( empty( $row_id ) ) { |
|
106 | + if (empty($row_id)) { |
|
107 | 107 | return null; |
108 | 108 | } |
109 | 109 | |
110 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
110 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return object |
123 | 123 | */ |
124 | - public function get_by( $column, $row_id ) { |
|
124 | + public function get_by($column, $row_id) { |
|
125 | 125 | /* @var WPDB $wpdb */ |
126 | 126 | global $wpdb; |
127 | 127 | |
128 | 128 | // Bailout. |
129 | - if ( empty( $column ) || empty( $row_id ) ) { |
|
129 | + if (empty($column) || empty($row_id)) { |
|
130 | 130 | return null; |
131 | 131 | } |
132 | 132 | |
133 | - $column = esc_sql( $column ); |
|
133 | + $column = esc_sql($column); |
|
134 | 134 | |
135 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
|
135 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id)); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -146,18 +146,18 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return string Column value. |
148 | 148 | */ |
149 | - public function get_column( $column, $row_id ) { |
|
149 | + public function get_column($column, $row_id) { |
|
150 | 150 | /* @var WPDB $wpdb */ |
151 | 151 | global $wpdb; |
152 | 152 | |
153 | 153 | // Bailout. |
154 | - if ( empty( $column ) || empty( $row_id ) ) { |
|
154 | + if (empty($column) || empty($row_id)) { |
|
155 | 155 | return null; |
156 | 156 | } |
157 | 157 | |
158 | - $column = esc_sql( $column ); |
|
158 | + $column = esc_sql($column); |
|
159 | 159 | |
160 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
160 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -172,19 +172,19 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public function get_column_by( $column, $column_where, $column_value ) { |
|
175 | + public function get_column_by($column, $column_where, $column_value) { |
|
176 | 176 | /* @var WPDB $wpdb */ |
177 | 177 | global $wpdb; |
178 | 178 | |
179 | 179 | // Bailout. |
180 | - if ( empty( $column ) || empty( $column_where ) || empty( $column_value ) ) { |
|
180 | + if (empty($column) || empty($column_where) || empty($column_value)) { |
|
181 | 181 | return null; |
182 | 182 | } |
183 | 183 | |
184 | - $column_where = esc_sql( $column_where ); |
|
185 | - $column = esc_sql( $column ); |
|
184 | + $column_where = esc_sql($column_where); |
|
185 | + $column = esc_sql($column); |
|
186 | 186 | |
187 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) ); |
|
187 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value)); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -198,12 +198,12 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @return int |
200 | 200 | */ |
201 | - public function insert( $data, $type = '' ) { |
|
201 | + public function insert($data, $type = '') { |
|
202 | 202 | /* @var WPDB $wpdb */ |
203 | 203 | global $wpdb; |
204 | 204 | |
205 | 205 | // Set default values. |
206 | - $data = wp_parse_args( $data, $this->get_column_defaults() ); |
|
206 | + $data = wp_parse_args($data, $this->get_column_defaults()); |
|
207 | 207 | |
208 | 208 | /** |
209 | 209 | * Fires before inserting data to the database. |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param array $data |
214 | 214 | */ |
215 | - do_action( "give_pre_insert_{$type}", $data ); |
|
215 | + do_action("give_pre_insert_{$type}", $data); |
|
216 | 216 | |
217 | 217 | // Initialise column format array |
218 | 218 | $column_formats = $this->get_columns(); |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | // $data = array_change_key_case( $data ); |
222 | 222 | |
223 | 223 | // White list columns |
224 | - $data = array_intersect_key( $data, $column_formats ); |
|
224 | + $data = array_intersect_key($data, $column_formats); |
|
225 | 225 | |
226 | 226 | // Reorder $column_formats to match the order of columns given in $data |
227 | - $data_keys = array_keys( $data ); |
|
228 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
227 | + $data_keys = array_keys($data); |
|
228 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
229 | 229 | |
230 | - $wpdb->insert( $this->table_name, $data, $column_formats ); |
|
230 | + $wpdb->insert($this->table_name, $data, $column_formats); |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Fires after inserting data to the database. |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @param int $insert_id |
238 | 238 | * @param array $data |
239 | 239 | */ |
240 | - do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data ); |
|
240 | + do_action("give_post_insert_{$type}", $wpdb->insert_id, $data); |
|
241 | 241 | |
242 | 242 | return $wpdb->insert_id; |
243 | 243 | } |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return bool |
256 | 256 | */ |
257 | - public function update( $row_id, $data = array(), $where = '' ) { |
|
257 | + public function update($row_id, $data = array(), $where = '') { |
|
258 | 258 | /* @var WPDB $wpdb */ |
259 | 259 | global $wpdb; |
260 | 260 | |
261 | 261 | // Row ID must be positive integer |
262 | - $row_id = absint( $row_id ); |
|
262 | + $row_id = absint($row_id); |
|
263 | 263 | |
264 | - if ( empty( $row_id ) ) { |
|
264 | + if (empty($row_id)) { |
|
265 | 265 | return false; |
266 | 266 | } |
267 | 267 | |
268 | - if ( empty( $where ) ) { |
|
268 | + if (empty($where)) { |
|
269 | 269 | $where = $this->primary_key; |
270 | 270 | } |
271 | 271 | |
@@ -273,16 +273,16 @@ discard block |
||
273 | 273 | $column_formats = $this->get_columns(); |
274 | 274 | |
275 | 275 | // Force fields to lower case |
276 | - $data = array_change_key_case( $data ); |
|
276 | + $data = array_change_key_case($data); |
|
277 | 277 | |
278 | 278 | // White list columns |
279 | - $data = array_intersect_key( $data, $column_formats ); |
|
279 | + $data = array_intersect_key($data, $column_formats); |
|
280 | 280 | |
281 | 281 | // Reorder $column_formats to match the order of columns given in $data |
282 | - $data_keys = array_keys( $data ); |
|
283 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
282 | + $data_keys = array_keys($data); |
|
283 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
284 | 284 | |
285 | - if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) { |
|
285 | + if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) { |
|
286 | 286 | return false; |
287 | 287 | } |
288 | 288 | |
@@ -299,18 +299,18 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @return bool |
301 | 301 | */ |
302 | - public function delete( $row_id = 0 ) { |
|
302 | + public function delete($row_id = 0) { |
|
303 | 303 | /* @var WPDB $wpdb */ |
304 | 304 | global $wpdb; |
305 | 305 | |
306 | 306 | // Row ID must be positive integer |
307 | - $row_id = absint( $row_id ); |
|
307 | + $row_id = absint($row_id); |
|
308 | 308 | |
309 | - if ( empty( $row_id ) ) { |
|
309 | + if (empty($row_id)) { |
|
310 | 310 | return false; |
311 | 311 | } |
312 | 312 | |
313 | - if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) { |
|
313 | + if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) { |
|
314 | 314 | return false; |
315 | 315 | } |
316 | 316 | |
@@ -327,13 +327,13 @@ discard block |
||
327 | 327 | * |
328 | 328 | * @return bool If the table name exists. |
329 | 329 | */ |
330 | - public function table_exists( $table ) { |
|
330 | + public function table_exists($table) { |
|
331 | 331 | /* @var WPDB $wpdb */ |
332 | 332 | global $wpdb; |
333 | 333 | |
334 | - $table = sanitize_text_field( $table ); |
|
334 | + $table = sanitize_text_field($table); |
|
335 | 335 | |
336 | - return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table; |
|
336 | + return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -347,16 +347,16 @@ discard block |
||
347 | 347 | * |
348 | 348 | * @return bool |
349 | 349 | */ |
350 | - public function does_column_exist( $column_name ) { |
|
350 | + public function does_column_exist($column_name) { |
|
351 | 351 | |
352 | 352 | global $wpdb; |
353 | 353 | |
354 | - $column = $wpdb->get_results( $wpdb->prepare( |
|
354 | + $column = $wpdb->get_results($wpdb->prepare( |
|
355 | 355 | "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ", |
356 | 356 | DB_NAME, $this->table_name, $column_name |
357 | - ) ); |
|
357 | + )); |
|
358 | 358 | |
359 | - if ( ! empty( $column ) ) { |
|
359 | + if ( ! empty($column)) { |
|
360 | 360 | return true; |
361 | 361 | } |
362 | 362 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * @return bool Returns if the customers table was installed and upgrade routine run. |
373 | 373 | */ |
374 | 374 | public function installed() { |
375 | - return $this->table_exists( $this->table_name ); |
|
375 | + return $this->table_exists($this->table_name); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @access public |
383 | 383 | */ |
384 | 384 | public function register_table() { |
385 | - $current_version = get_option( $this->table_name . '_db_version' ); |
|
386 | - if ( ! $current_version || version_compare( $current_version, $this->version, '<' ) ) { |
|
385 | + $current_version = get_option($this->table_name.'_db_version'); |
|
386 | + if ( ! $current_version || version_compare($current_version, $this->version, '<')) { |
|
387 | 387 | $this->create_table(); |
388 | 388 | } |
389 | 389 | } |
@@ -408,23 +408,23 @@ discard block |
||
408 | 408 | * |
409 | 409 | * @return int|bool The normalized log ID or false if it's found to not be valid. |
410 | 410 | */ |
411 | - public function sanitize_id( $id ) { |
|
412 | - if ( ! is_numeric( $id ) ) { |
|
411 | + public function sanitize_id($id) { |
|
412 | + if ( ! is_numeric($id)) { |
|
413 | 413 | return false; |
414 | 414 | } |
415 | 415 | |
416 | 416 | $id = (int) $id; |
417 | 417 | |
418 | 418 | // We were given a non positive number. |
419 | - if ( absint( $id ) !== $id ) { |
|
419 | + if (absint($id) !== $id) { |
|
420 | 420 | return false; |
421 | 421 | } |
422 | 422 | |
423 | - if ( empty( $id ) ) { |
|
423 | + if (empty($id)) { |
|
424 | 424 | return false; |
425 | 425 | } |
426 | 426 | |
427 | - return absint( $id ); |
|
427 | + return absint($id); |
|
428 | 428 | |
429 | 429 | } |
430 | 430 | } |
@@ -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,26 +25,26 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_load_scripts() { |
27 | 27 | |
28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
30 | - $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
30 | + $scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false; |
|
31 | 31 | |
32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
34 | 34 | |
35 | 35 | // Localize / PHP to AJAX vars. |
36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), // Do not use this nonce. Its deprecated. |
|
38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), // Do not use this nonce. Its deprecated. |
|
39 | 39 | 'currency' => give_get_currency(), |
40 | - 'currency_sign' => give_currency_filter( '' ), |
|
40 | + 'currency_sign' => give_currency_filter(''), |
|
41 | 41 | 'currency_pos' => give_get_currency_position(), |
42 | 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
43 | 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
44 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
45 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
46 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
47 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
44 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
45 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
46 | + 'general_loading' => __('Loading...', 'give'), |
|
47 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
48 | 48 | 'number_decimals' => give_get_price_decimals(), |
49 | 49 | 'give_version' => GIVE_VERSION, |
50 | 50 | 'magnific_options' => apply_filters( |
@@ -58,83 +58,83 @@ discard block |
||
58 | 58 | 'give_form_translation_js', |
59 | 59 | array( |
60 | 60 | // Field name Validation message. |
61 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
62 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
63 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
64 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
65 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
66 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
67 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
61 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
62 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
63 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
64 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
65 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
66 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
67 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
68 | 68 | ) |
69 | 69 | ), |
70 | - 'confirm_email_sent_message' => __( 'Please check your email and click on the link to access your complete donation history.', 'give' ), |
|
71 | - ) ); |
|
70 | + 'confirm_email_sent_message' => __('Please check your email and click on the link to access your complete donation history.', 'give'), |
|
71 | + )); |
|
72 | 72 | |
73 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
73 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
74 | 74 | 'ajaxurl' => give_get_ajax_url(), |
75 | - 'ajaxNonce' => wp_create_nonce( 'give_ajax_nonce' ), |
|
76 | - 'loading' => __( 'Loading', 'give' ), |
|
75 | + 'ajaxNonce' => wp_create_nonce('give_ajax_nonce'), |
|
76 | + 'loading' => __('Loading', 'give'), |
|
77 | 77 | // General loading message. |
78 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
78 | + 'select_option' => __('Please select an option', 'give'), |
|
79 | 79 | // Variable pricing error with multi-donation option enabled. |
80 | - 'default_gateway' => give_get_default_gateway( null ), |
|
81 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
80 | + 'default_gateway' => give_get_default_gateway(null), |
|
81 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
82 | 82 | 'number_decimals' => give_get_price_decimals(), |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | |
85 | 85 | // DEBUG is On. |
86 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
86 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
87 | 87 | |
88 | - if ( give_is_cc_verify_enabled() ) { |
|
89 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
90 | - wp_enqueue_script( 'give-cc-validator' ); |
|
88 | + if (give_is_cc_verify_enabled()) { |
|
89 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
90 | + wp_enqueue_script('give-cc-validator'); |
|
91 | 91 | } |
92 | 92 | |
93 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
94 | - wp_enqueue_script( 'give-float-labels' ); |
|
93 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
94 | + wp_enqueue_script('give-float-labels'); |
|
95 | 95 | |
96 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
97 | - wp_enqueue_script( 'give-blockui' ); |
|
96 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
97 | + wp_enqueue_script('give-blockui'); |
|
98 | 98 | |
99 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
100 | - wp_enqueue_script( 'give-accounting' ); |
|
99 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
100 | + wp_enqueue_script('give-accounting'); |
|
101 | 101 | |
102 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
103 | - wp_enqueue_script( 'give-magnific' ); |
|
102 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
103 | + wp_enqueue_script('give-magnific'); |
|
104 | 104 | |
105 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-donations' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
106 | - wp_enqueue_script( 'give-checkout-global' ); |
|
105 | + wp_register_script('give-checkout-global', $js_dir.'give-donations'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
106 | + wp_enqueue_script('give-checkout-global'); |
|
107 | 107 | |
108 | - wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
109 | - wp_enqueue_script( 'give-hint.css' ); |
|
108 | + wp_register_script('give-hint.css', $js_plugins.'give-hint.css'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
109 | + wp_enqueue_script('give-hint.css'); |
|
110 | 110 | |
111 | 111 | // General scripts. |
112 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
113 | - wp_enqueue_script( 'give-scripts' ); |
|
112 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
113 | + wp_enqueue_script('give-scripts'); |
|
114 | 114 | |
115 | 115 | // Load AJAX scripts, if enabled. |
116 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
117 | - wp_enqueue_script( 'give-ajax' ); |
|
116 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
117 | + wp_enqueue_script('give-ajax'); |
|
118 | 118 | |
119 | 119 | // Localize / Pass AJAX vars from PHP, |
120 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
121 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
120 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
121 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | 125 | // DEBUG is OFF (one JS file to rule them all!). |
126 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
127 | - wp_enqueue_script( 'give' ); |
|
126 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
127 | + wp_enqueue_script('give'); |
|
128 | 128 | |
129 | 129 | // Localize / Pass AJAX vars from PHP. |
130 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
131 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
130 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
131 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
137 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
138 | 138 | |
139 | 139 | /** |
140 | 140 | * Register styles. |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function give_register_styles() { |
149 | 149 | |
150 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
150 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
151 | 151 | return; |
152 | 152 | } |
153 | 153 | |
154 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
155 | - wp_enqueue_style( 'give-styles' ); |
|
154 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
155 | + wp_enqueue_style('give-styles'); |
|
156 | 156 | |
157 | 157 | } |
158 | 158 | |
159 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
159 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
160 | 160 | |
161 | 161 | |
162 | 162 | /** |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | function give_get_stylesheet_uri() { |
170 | 170 | |
171 | 171 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
172 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
172 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
173 | 173 | |
174 | 174 | // LTR or RTL files. |
175 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
175 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
176 | 176 | |
177 | - $file = 'give' . $direction . $suffix . '.css'; |
|
177 | + $file = 'give'.$direction.$suffix.'.css'; |
|
178 | 178 | $templates_dir = give_get_theme_template_dir_name(); |
179 | 179 | |
180 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
181 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
182 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
183 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
184 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
180 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
181 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
182 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
183 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
184 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
185 | 185 | |
186 | 186 | $uri = false; |
187 | 187 | |
@@ -191,23 +191,23 @@ discard block |
||
191 | 191 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
192 | 192 | * This allows users to copy just give.css to their theme. |
193 | 193 | */ |
194 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
195 | - if ( ! empty( $nonmin ) ) { |
|
196 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
194 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
195 | + if ( ! empty($nonmin)) { |
|
196 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
197 | 197 | } else { |
198 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
198 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
199 | 199 | } |
200 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
201 | - if ( ! empty( $nonmin ) ) { |
|
202 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
200 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
201 | + if ( ! empty($nonmin)) { |
|
202 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
203 | 203 | } else { |
204 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
204 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
205 | 205 | } |
206 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
207 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
206 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
207 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
208 | 208 | } |
209 | 209 | |
210 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
210 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
211 | 211 | |
212 | 212 | } |
213 | 213 | |
@@ -224,82 +224,82 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return void |
226 | 226 | */ |
227 | -function give_load_admin_scripts( $hook ) { |
|
227 | +function give_load_admin_scripts($hook) { |
|
228 | 228 | |
229 | 229 | global $post, $post_type; |
230 | 230 | |
231 | 231 | $give_options = give_get_settings(); |
232 | 232 | |
233 | 233 | // Directories of assets. |
234 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
235 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
236 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
234 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
235 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
236 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
237 | 237 | |
238 | 238 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
239 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
239 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
240 | 240 | |
241 | 241 | // LTR or RTL files. |
242 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
242 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
243 | 243 | |
244 | 244 | // Global Admin. |
245 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
246 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
245 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
246 | + wp_enqueue_style('give-admin-bar-notification'); |
|
247 | 247 | |
248 | 248 | // Give Admin Only. |
249 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
249 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | 253 | // CSS. |
254 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
255 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
256 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
257 | - wp_enqueue_style( 'give-admin' ); |
|
258 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
259 | - wp_enqueue_style( 'jquery-chosen' ); |
|
260 | - wp_enqueue_style( 'thickbox' ); |
|
261 | - wp_enqueue_style( 'wp-color-picker' ); |
|
254 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
255 | + wp_enqueue_style('jquery-ui-css'); |
|
256 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
257 | + wp_enqueue_style('give-admin'); |
|
258 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
259 | + wp_enqueue_style('jquery-chosen'); |
|
260 | + wp_enqueue_style('thickbox'); |
|
261 | + wp_enqueue_style('wp-color-picker'); |
|
262 | 262 | |
263 | 263 | |
264 | 264 | // JS. |
265 | - wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
266 | - wp_enqueue_script( 'give-selector-cache' ); |
|
265 | + wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
266 | + wp_enqueue_script('give-selector-cache'); |
|
267 | 267 | |
268 | - wp_register_script( 'give-ajaxify-fields', $js_plugins . 'give-ajaxify-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
269 | - wp_enqueue_script( 'give-ajaxify-fields' ); |
|
268 | + wp_register_script('give-ajaxify-fields', $js_plugins.'give-ajaxify-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
269 | + wp_enqueue_script('give-ajaxify-fields'); |
|
270 | 270 | |
271 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
272 | - wp_enqueue_script( 'jquery-chosen' ); |
|
271 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
272 | + wp_enqueue_script('jquery-chosen'); |
|
273 | 273 | |
274 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
275 | - wp_enqueue_script( 'give-accounting' ); |
|
274 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
275 | + wp_enqueue_script('give-accounting'); |
|
276 | 276 | |
277 | - wp_enqueue_script( 'wp-color-picker' ); |
|
278 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
279 | - wp_enqueue_script( 'thickbox' ); |
|
277 | + wp_enqueue_script('wp-color-picker'); |
|
278 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
279 | + wp_enqueue_script('thickbox'); |
|
280 | 280 | |
281 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false ); |
|
282 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
281 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query'), GIVE_VERSION, false); |
|
282 | + wp_enqueue_script('give-admin-scripts'); |
|
283 | 283 | |
284 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
285 | - wp_enqueue_script( 'jquery-flot' ); |
|
284 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
285 | + wp_enqueue_script('jquery-flot'); |
|
286 | 286 | |
287 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
288 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
287 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
288 | + wp_enqueue_script('give-repeatable-fields'); |
|
289 | 289 | |
290 | - wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
291 | - wp_enqueue_script( 'give-hint.css' ); |
|
290 | + wp_register_script('give-hint.css', $js_plugins.'give-hint.css'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
291 | + wp_enqueue_script('give-hint.css'); |
|
292 | 292 | |
293 | 293 | // Forms CPT Script. |
294 | - if ( $post_type === 'give_forms' ) { |
|
295 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
296 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
294 | + if ($post_type === 'give_forms') { |
|
295 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
296 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | // Settings Scripts. |
300 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
301 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
302 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
300 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
301 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
302 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | // Price Separators. |
@@ -307,91 +307,91 @@ discard block |
||
307 | 307 | $decimal_separator = give_get_price_decimal_separator(); |
308 | 308 | |
309 | 309 | // Localize strings & variables for JS. |
310 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
311 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
310 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
311 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
312 | 312 | 'give_version' => GIVE_VERSION, |
313 | 313 | 'thousands_separator' => $thousand_separator, |
314 | 314 | 'decimal_separator' => $decimal_separator, |
315 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
316 | - 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
317 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
318 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
319 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
320 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
321 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
322 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
323 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
324 | - 'currency_sign' => give_currency_filter( '' ), |
|
325 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
315 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
316 | + 'delete_payment' => __('Are you sure you want to delete this payment?', 'give'), |
|
317 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
318 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
319 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
320 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
321 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
322 | + 'one_option' => __('Choose a form', 'give'), |
|
323 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
324 | + 'currency_sign' => give_currency_filter(''), |
|
325 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
326 | 326 | 'currency_decimals' => give_get_price_decimals(), |
327 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
328 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
329 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
330 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
331 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
332 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
327 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
328 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
329 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
330 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
331 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
332 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
333 | 333 | /* translators : %s: Donation form options metabox */ |
334 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this item?', 'give' ), |
|
335 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
336 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
337 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
338 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
339 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
340 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
341 | - 'unlock_donor_fields' => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ), |
|
342 | - 'remove_from_bulk_delete' => __( 'Remove from Bulk Delete', 'give' ), |
|
334 | + 'confirm_before_remove_row_text' => __('Do you want to delete this item?', 'give'), |
|
335 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
336 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
337 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
338 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
339 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
340 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
341 | + 'unlock_donor_fields' => __('To edit first name and last name, please go to user profile of the donor.', 'give'), |
|
342 | + 'remove_from_bulk_delete' => __('Remove from Bulk Delete', 'give'), |
|
343 | 343 | 'donors_bulk_action' => array( |
344 | - 'no_donor_selected' => __( 'You must choose at least one or more donors to delete.', 'give' ), |
|
345 | - 'no_action_selected' => __( 'You must select a bulk action to proceed.', 'give' ), |
|
344 | + 'no_donor_selected' => __('You must choose at least one or more donors to delete.', 'give'), |
|
345 | + 'no_action_selected' => __('You must select a bulk action to proceed.', 'give'), |
|
346 | 346 | ), |
347 | 347 | 'donations_bulk_action' => array( |
348 | 348 | 'delete' => array( |
349 | - 'zero' => __( 'You must choose at least one or more donations to delete.', 'give' ), |
|
350 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
351 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
349 | + 'zero' => __('You must choose at least one or more donations to delete.', 'give'), |
|
350 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
351 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
352 | 352 | ), |
353 | 353 | 'resend-receipt' => array( |
354 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
355 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
356 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
354 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
355 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
356 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
357 | 357 | ), |
358 | 358 | 'set-to-status' => array( |
359 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
360 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
361 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
359 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
360 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
361 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
362 | 362 | ), |
363 | 363 | ), |
364 | 364 | 'updates' => array( |
365 | - 'ajax_error' => __( 'Please reload this page and try again', 'give' ) |
|
365 | + 'ajax_error' => __('Please reload this page and try again', 'give') |
|
366 | 366 | ), |
367 | 367 | 'metabox_fields' => array( |
368 | 368 | 'media' => array( |
369 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
369 | + 'button_title' => __('Choose Image', 'give'), |
|
370 | 370 | ), |
371 | 371 | 'file' => array( |
372 | - 'button_title' => __( 'Choose File', 'give' ), |
|
372 | + 'button_title' => __('Choose File', 'give'), |
|
373 | 373 | ), |
374 | 374 | ), |
375 | 375 | 'chosen' => array( |
376 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
377 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
376 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
377 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
378 | 378 | ), |
379 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
380 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
381 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
379 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
380 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
381 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
382 | 382 | 'give_donation_import' => 'give_donation_import', |
383 | 383 | 'core_settings_import' => 'give_core_settings_import', |
384 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
385 | - ) ); |
|
384 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
385 | + )); |
|
386 | 386 | |
387 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
387 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
388 | 388 | // call for new media manager. |
389 | 389 | wp_enqueue_media(); |
390 | 390 | } |
391 | 391 | |
392 | 392 | } |
393 | 393 | |
394 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
394 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Admin Give Icon |
@@ -406,13 +406,13 @@ discard block |
||
406 | 406 | ?> |
407 | 407 | <style type="text/css" media="screen"> |
408 | 408 | |
409 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
409 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
410 | 410 | @font-face { |
411 | 411 | font-family: 'give-icomoon'; |
412 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
413 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
414 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
415 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
412 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
413 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
414 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
415 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
416 | 416 | font-weight: normal; |
417 | 417 | font-style: normal; |
418 | 418 | } |
@@ -431,4 +431,4 @@ discard block |
||
431 | 431 | <?php |
432 | 432 | } |
433 | 433 | |
434 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
434 | +add_action('admin_head', 'give_admin_icon'); |
@@ -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 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
88 | 88 | */ |
89 | - public function __construct( $args = array() ) { |
|
89 | + public function __construct($args = array()) { |
|
90 | 90 | $defaults = array( |
91 | 91 | 'number' => 20, |
92 | 92 | 'offset' => 0, |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // 'form' => array(), |
105 | 105 | ); |
106 | 106 | |
107 | - $this->args = wp_parse_args( $args, $defaults ); |
|
107 | + $this->args = wp_parse_args($args, $defaults); |
|
108 | 108 | $this->table_name = Give()->donors->table_name; |
109 | 109 | $this->meta_table_name = Give()->donor_meta->table_name; |
110 | 110 | $this->meta_type = Give()->donor_meta->meta_type; |
@@ -146,21 +146,21 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param Give_Donors_Query $this Donors query object. |
148 | 148 | */ |
149 | - do_action( 'give_pre_get_donors', $this ); |
|
149 | + do_action('give_pre_get_donors', $this); |
|
150 | 150 | |
151 | - $cache_key = Give_Cache::get_key( 'give_donor', $this->get_sql(), false ); |
|
151 | + $cache_key = Give_Cache::get_key('give_donor', $this->get_sql(), false); |
|
152 | 152 | |
153 | 153 | // Get donors from cache. |
154 | - $this->donors = Give_Cache::get_db_query( $cache_key ); |
|
154 | + $this->donors = Give_Cache::get_db_query($cache_key); |
|
155 | 155 | |
156 | - if ( is_null( $this->donors ) ) { |
|
157 | - if ( empty( $this->args['count'] ) ) { |
|
158 | - $this->donors = $wpdb->get_results( $this->get_sql() ); |
|
156 | + if (is_null($this->donors)) { |
|
157 | + if (empty($this->args['count'])) { |
|
158 | + $this->donors = $wpdb->get_results($this->get_sql()); |
|
159 | 159 | } else { |
160 | - $this->donors = $wpdb->get_var( $this->get_sql() ); |
|
160 | + $this->donors = $wpdb->get_var($this->get_sql()); |
|
161 | 161 | } |
162 | 162 | |
163 | - Give_Cache::set_db_query( $cache_key, $this->donors ); |
|
163 | + Give_Cache::set_db_query($cache_key, $this->donors); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * |
172 | 172 | * @param Give_Donors_Query $this Donors query object. |
173 | 173 | */ |
174 | - do_action( 'give_post_get_donors', $this ); |
|
174 | + do_action('give_post_get_donors', $this); |
|
175 | 175 | |
176 | 176 | return $this->donors; |
177 | 177 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | public function get_sql() { |
189 | 189 | global $wpdb; |
190 | 190 | |
191 | - if ( $this->args['number'] < 1 ) { |
|
191 | + if ($this->args['number'] < 1) { |
|
192 | 192 | $this->args['number'] = 999999999999; |
193 | 193 | } |
194 | 194 | |
@@ -196,22 +196,22 @@ discard block |
||
196 | 196 | |
197 | 197 | |
198 | 198 | // Set offset. |
199 | - if ( empty( $this->args['offset'] ) && ( 0 < $this->args['paged'] ) ) { |
|
200 | - $this->args['offset'] = $this->args['number'] * ( $this->args['paged'] - 1 ); |
|
199 | + if (empty($this->args['offset']) && (0 < $this->args['paged'])) { |
|
200 | + $this->args['offset'] = $this->args['number'] * ($this->args['paged'] - 1); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | // Set fields. |
204 | 204 | $fields = "{$this->table_name}.*"; |
205 | - if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) { |
|
206 | - if ( is_string( $this->args['fields'] ) ) { |
|
205 | + if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) { |
|
206 | + if (is_string($this->args['fields'])) { |
|
207 | 207 | $fields = "{$this->table_name}.{$this->args['fields']}"; |
208 | - } elseif ( is_array( $this->args['fields'] ) ) { |
|
209 | - $fields = "{$this->table_name}." . implode( " , {$this->table_name}.", $this->args['fields'] ); |
|
208 | + } elseif (is_array($this->args['fields'])) { |
|
209 | + $fields = "{$this->table_name}.".implode(" , {$this->table_name}.", $this->args['fields']); |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
213 | 213 | // Set count. |
214 | - if ( ! empty( $this->args['count'] ) ) { |
|
214 | + if ( ! empty($this->args['count'])) { |
|
215 | 215 | $fields = "COUNT({$this->table_name}.id)"; |
216 | 216 | } |
217 | 217 | |
@@ -219,13 +219,13 @@ discard block |
||
219 | 219 | |
220 | 220 | $sql = $wpdb->prepare( |
221 | 221 | "SELECT {$fields} FROM {$this->table_name} LIMIT %d,%d;", |
222 | - absint( $this->args['offset'] ), |
|
223 | - absint( $this->args['number'] ) |
|
222 | + absint($this->args['offset']), |
|
223 | + absint($this->args['number']) |
|
224 | 224 | ); |
225 | 225 | |
226 | 226 | // $where, $orderby and order already prepared query they can generate notice if you re prepare them in above. |
227 | 227 | // WordPress consider LIKE condition as placeholder if start with s,f, or d. |
228 | - $sql = str_replace( 'LIMIT', "{$where} {$orderby} {$this->args['order']} LIMIT", $sql ); |
|
228 | + $sql = str_replace('LIMIT', "{$where} {$orderby} {$this->args['order']} LIMIT", $sql); |
|
229 | 229 | |
230 | 230 | return $sql; |
231 | 231 | } |
@@ -243,15 +243,15 @@ discard block |
||
243 | 243 | $where = ''; |
244 | 244 | |
245 | 245 | // Get sql query for meta. |
246 | - if ( ! empty( $this->args['meta_query'] ) ) { |
|
247 | - $meta_query_object = new WP_Meta_Query( $this->args['meta_query'] ); |
|
246 | + if ( ! empty($this->args['meta_query'])) { |
|
247 | + $meta_query_object = new WP_Meta_Query($this->args['meta_query']); |
|
248 | 248 | $meta_query = $meta_query_object->get_sql( |
249 | 249 | $this->meta_type, |
250 | 250 | $this->table_name, |
251 | 251 | 'id' |
252 | 252 | ); |
253 | 253 | |
254 | - $where = implode( '', $meta_query ); |
|
254 | + $where = implode('', $meta_query); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | $where .= 'WHERE 1=1 '; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $where .= $this->get_where_user(); |
262 | 262 | $where .= $this->get_where_date(); |
263 | 263 | |
264 | - return trim( $where ); |
|
264 | + return trim($where); |
|
265 | 265 | |
266 | 266 | } |
267 | 267 | |
@@ -279,17 +279,17 @@ discard block |
||
279 | 279 | |
280 | 280 | $where = ''; |
281 | 281 | |
282 | - if ( ! empty( $this->args['email'] ) ) { |
|
282 | + if ( ! empty($this->args['email'])) { |
|
283 | 283 | |
284 | - if ( is_array( $this->args['email'] ) ) { |
|
284 | + if (is_array($this->args['email'])) { |
|
285 | 285 | |
286 | - $emails_count = count( $this->args['email'] ); |
|
287 | - $emails_placeholder = array_fill( 0, $emails_count, '%s' ); |
|
288 | - $emails = implode( ', ', $emails_placeholder ); |
|
286 | + $emails_count = count($this->args['email']); |
|
287 | + $emails_placeholder = array_fill(0, $emails_count, '%s'); |
|
288 | + $emails = implode(', ', $emails_placeholder); |
|
289 | 289 | |
290 | - $where .= $wpdb->prepare( "AND {$this->table_name}.email IN( $emails )", $this->args['email'] ); |
|
290 | + $where .= $wpdb->prepare("AND {$this->table_name}.email IN( $emails )", $this->args['email']); |
|
291 | 291 | } else { |
292 | - $where .= $wpdb->prepare( "AND {$this->table_name}.email = %s", $this->args['email'] ); |
|
292 | + $where .= $wpdb->prepare("AND {$this->table_name}.email = %s", $this->args['email']); |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | $where = ''; |
310 | 310 | |
311 | 311 | // Specific donors. |
312 | - if ( ! empty( $this->args['donor'] ) ) { |
|
313 | - if ( ! is_array( $this->args['donor'] ) ) { |
|
314 | - $this->args['donor'] = explode( ',', $this->args['donor'] ); |
|
312 | + if ( ! empty($this->args['donor'])) { |
|
313 | + if ( ! is_array($this->args['donor'])) { |
|
314 | + $this->args['donor'] = explode(',', $this->args['donor']); |
|
315 | 315 | } |
316 | - $donor_ids = implode( ',', array_map( 'intval', $this->args['donor'] ) ); |
|
316 | + $donor_ids = implode(',', array_map('intval', $this->args['donor'])); |
|
317 | 317 | |
318 | 318 | $where .= "AND {$this->table_name}.id IN( {$donor_ids} )"; |
319 | 319 | } |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | $where = ''; |
335 | 335 | |
336 | 336 | // Donors created for a specific date or in a date range |
337 | - if ( ! empty( $this->args['date_query'] ) ) { |
|
337 | + if ( ! empty($this->args['date_query'])) { |
|
338 | 338 | $date_query_object = new WP_Date_Query( |
339 | - is_array( $this->args['date_query'] ) ? $this->args['date_query'] : wp_parse_args( $this->args['date_query'] ), |
|
339 | + is_array($this->args['date_query']) ? $this->args['date_query'] : wp_parse_args($this->args['date_query']), |
|
340 | 340 | "{$this->table_name}.date_created" |
341 | 341 | ); |
342 | 342 | |
@@ -371,11 +371,11 @@ discard block |
||
371 | 371 | $where = ''; |
372 | 372 | |
373 | 373 | // Donors created for a specific date or in a date range |
374 | - if ( ! empty( $this->args['s'] ) && false !== strpos( $this->args['s'], ':' ) ) { |
|
375 | - $search_parts = explode( ':', $this->args['s'] ); |
|
374 | + if ( ! empty($this->args['s']) && false !== strpos($this->args['s'], ':')) { |
|
375 | + $search_parts = explode(':', $this->args['s']); |
|
376 | 376 | |
377 | - if ( ! empty( $search_parts[0] ) ) { |
|
378 | - switch ( $search_parts[0] ) { |
|
377 | + if ( ! empty($search_parts[0])) { |
|
378 | + switch ($search_parts[0]) { |
|
379 | 379 | case 'name': |
380 | 380 | $where = "AND {$this->table_name}.name LIKE '%{$search_parts[1]}%'"; |
381 | 381 | break; |
@@ -403,11 +403,11 @@ discard block |
||
403 | 403 | $where = ''; |
404 | 404 | |
405 | 405 | // Donors create for specific wp user. |
406 | - if ( ! empty( $this->args['user'] ) ) { |
|
407 | - if ( ! is_array( $this->args['user'] ) ) { |
|
408 | - $this->args['user'] = explode( ',', $this->args['user'] ); |
|
406 | + if ( ! empty($this->args['user'])) { |
|
407 | + if ( ! is_array($this->args['user'])) { |
|
408 | + $this->args['user'] = explode(',', $this->args['user']); |
|
409 | 409 | } |
410 | - $user_ids = implode( ',', array_map( 'intval', $this->args['user'] ) ); |
|
410 | + $user_ids = implode(',', array_map('intval', $this->args['user'])); |
|
411 | 411 | |
412 | 412 | $where .= "AND {$this->table_name}.user_id IN( {$user_ids} )"; |
413 | 413 | } |
@@ -426,14 +426,13 @@ discard block |
||
426 | 426 | private function get_order_query() { |
427 | 427 | $table_columns = Give()->donors->get_columns(); |
428 | 428 | |
429 | - $this->args['orderby'] = ! array_key_exists( $this->args['orderby'], $table_columns ) ? |
|
430 | - 'id' : |
|
431 | - $this->args['orderby']; |
|
429 | + $this->args['orderby'] = ! array_key_exists($this->args['orderby'], $table_columns) ? |
|
430 | + 'id' : $this->args['orderby']; |
|
432 | 431 | |
433 | - $this->args['orderby'] = esc_sql( $this->args['orderby'] ); |
|
434 | - $this->args['order'] = esc_sql( $this->args['order'] ); |
|
432 | + $this->args['orderby'] = esc_sql($this->args['orderby']); |
|
433 | + $this->args['order'] = esc_sql($this->args['order']); |
|
435 | 434 | |
436 | - switch ( $table_columns[ $this->args['orderby'] ] ) { |
|
435 | + switch ($table_columns[$this->args['orderby']]) { |
|
437 | 436 | case '%d': |
438 | 437 | case '%f': |
439 | 438 | $query = "ORDER BY {$this->table_name}.{$this->args['orderby']}+0"; |
@@ -11,19 +11,19 @@ |
||
11 | 11 | * |
12 | 12 | * @return string|array |
13 | 13 | */ |
14 | -function __give_v20_bc_user_address( $meta_value, $user_id, $meta_key, $single ) { |
|
14 | +function __give_v20_bc_user_address($meta_value, $user_id, $meta_key, $single) { |
|
15 | 15 | if ( |
16 | - give_has_upgrade_completed( 'v20_upgrades_user_address' ) && |
|
16 | + give_has_upgrade_completed('v20_upgrades_user_address') && |
|
17 | 17 | '_give_user_address' === $meta_key |
18 | 18 | ) { |
19 | - $meta_value = give_get_donor_address( $user_id ); |
|
19 | + $meta_value = give_get_donor_address($user_id); |
|
20 | 20 | |
21 | - if ( $single ) { |
|
22 | - $meta_value = array( $meta_value ); |
|
21 | + if ($single) { |
|
22 | + $meta_value = array($meta_value); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | 26 | return $meta_value; |
27 | 27 | } |
28 | 28 | |
29 | -add_filter( 'get_user_metadata', '__give_v20_bc_user_address', 10, 4 ); |
|
30 | 29 | \ No newline at end of file |
30 | +add_filter('get_user_metadata', '__give_v20_bc_user_address', 10, 4); |
|
31 | 31 | \ 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 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /* @var WPDB $wpdb */ |
51 | 51 | global $wpdb; |
52 | 52 | |
53 | - $wpdb->formmeta = $this->table_name = $wpdb->prefix . 'give_formmeta'; |
|
53 | + $wpdb->formmeta = $this->table_name = $wpdb->prefix.'give_formmeta'; |
|
54 | 54 | $this->primary_key = 'meta_id'; |
55 | 55 | $this->version = '1.0'; |
56 | 56 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | KEY meta_key (meta_key) |
100 | 100 | ) {$charset_collate};"; |
101 | 101 | |
102 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
103 | - dbDelta( $sql ); |
|
102 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
103 | + dbDelta($sql); |
|
104 | 104 | |
105 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
105 | + update_option($this->table_name.'_db_version', $this->version); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -113,6 +113,6 @@ discard block |
||
113 | 113 | * @return bool |
114 | 114 | */ |
115 | 115 | protected function is_custom_meta_table_active() { |
116 | - return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ); |
|
116 | + return give_has_upgrade_completed('v20_move_metadata_into_new_table'); |
|
117 | 117 | } |
118 | 118 | } |
@@ -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 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /* @var WPDB $wpdb */ |
54 | 54 | global $wpdb; |
55 | 55 | |
56 | - $wpdb->donormeta = $this->table_name = $wpdb->prefix . 'give_donormeta'; |
|
56 | + $wpdb->donormeta = $this->table_name = $wpdb->prefix.'give_donormeta'; |
|
57 | 57 | $this->primary_key = 'meta_id'; |
58 | 58 | $this->version = '1.0'; |
59 | 59 | |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return bool False for failure. True for success. |
92 | 92 | */ |
93 | - public function delete_all_meta( $donor_id = 0 ) { |
|
93 | + public function delete_all_meta($donor_id = 0) { |
|
94 | 94 | global $wpdb; |
95 | - $status = $wpdb->delete( $this->table_name, array( 'customer_id' => $donor_id ), array( '%d' ) ); |
|
95 | + $status = $wpdb->delete($this->table_name, array('customer_id' => $donor_id), array('%d')); |
|
96 | 96 | |
97 | - if( $status ) { |
|
98 | - Give_Cache::delete_group( $donor_id, 'give-donors' ); |
|
97 | + if ($status) { |
|
98 | + Give_Cache::delete_group($donor_id, 'give-donors'); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function create_table() { |
111 | 111 | |
112 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
112 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
113 | 113 | |
114 | 114 | $sql = "CREATE TABLE {$this->table_name} ( |
115 | 115 | meta_id bigint(20) NOT NULL AUTO_INCREMENT, |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | KEY meta_key (meta_key) |
122 | 122 | ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; |
123 | 123 | |
124 | - dbDelta( $sql ); |
|
124 | + dbDelta($sql); |
|
125 | 125 | |
126 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
126 | + update_option($this->table_name.'_db_version', $this->version); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | global $wpdb; |
139 | 139 | |
140 | 140 | if ( |
141 | - ! give_has_upgrade_completed( 'v20_rename_donor_tables' ) && |
|
142 | - $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s","{$wpdb->prefix}give_customermeta" ) ) |
|
141 | + ! give_has_upgrade_completed('v20_rename_donor_tables') && |
|
142 | + $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customermeta")) |
|
143 | 143 | ) { |
144 | 144 | $wpdb->donormeta = $this->table_name = "{$wpdb->prefix}give_customermeta"; |
145 | 145 | $this->meta_type = 'customer'; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return bool |
160 | 160 | */ |
161 | - protected function is_valid_post_type( $ID ) { |
|
161 | + protected function is_valid_post_type($ID) { |
|
162 | 162 | return $ID && true; |
163 | 163 | } |
164 | 164 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function __construct() { |
104 | 104 | |
105 | - if ( 'none' === $this->get_template() ) { |
|
105 | + if ('none' === $this->get_template()) { |
|
106 | 106 | $this->html = false; |
107 | 107 | } |
108 | 108 | |
109 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
110 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
109 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
110 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
111 | 111 | |
112 | 112 | } |
113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param $key |
120 | 120 | * @param $value |
121 | 121 | */ |
122 | - public function __set( $key, $value ) { |
|
122 | + public function __set($key, $value) { |
|
123 | 123 | $this->$key = $value; |
124 | 124 | } |
125 | 125 | |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | * @since 1.0 |
130 | 130 | */ |
131 | 131 | public function get_from_name() { |
132 | - if ( ! $this->from_name ) { |
|
133 | - $this->from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
132 | + if ( ! $this->from_name) { |
|
133 | + $this->from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
134 | 134 | } |
135 | 135 | |
136 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
136 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | * @since 1.0 |
143 | 143 | */ |
144 | 144 | public function get_from_address() { |
145 | - if ( ! $this->from_address ) { |
|
146 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
145 | + if ( ! $this->from_address) { |
|
146 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
147 | 147 | } |
148 | 148 | |
149 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
149 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | * @since 1.0 |
156 | 156 | */ |
157 | 157 | public function get_content_type() { |
158 | - if ( ! $this->content_type ) { |
|
158 | + if ( ! $this->content_type) { |
|
159 | 159 | $this->content_type = $this->html |
160 | - ? apply_filters( 'give_email_default_content_type', 'text/html', $this ) |
|
160 | + ? apply_filters('give_email_default_content_type', 'text/html', $this) |
|
161 | 161 | : 'text/plain'; |
162 | 162 | } |
163 | 163 | |
164 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
164 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | * @since 1.0 |
171 | 171 | */ |
172 | 172 | public function get_headers() { |
173 | - if ( ! $this->headers ) { |
|
173 | + if ( ! $this->headers) { |
|
174 | 174 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
175 | 175 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
176 | 176 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
177 | 177 | } |
178 | 178 | |
179 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
179 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function get_templates() { |
188 | 188 | $templates = array( |
189 | - 'default' => esc_html__( 'Default Template', 'give' ), |
|
190 | - 'none' => esc_html__( 'No template, plain text only', 'give' ) |
|
189 | + 'default' => esc_html__('Default Template', 'give'), |
|
190 | + 'none' => esc_html__('No template, plain text only', 'give') |
|
191 | 191 | ); |
192 | 192 | |
193 | - return apply_filters( 'give_email_templates', $templates ); |
|
193 | + return apply_filters('give_email_templates', $templates); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | * @since 1.0 |
200 | 200 | */ |
201 | 201 | public function get_template() { |
202 | - if ( ! $this->template ) { |
|
203 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
202 | + if ( ! $this->template) { |
|
203 | + $this->template = give_get_option('email_template', 'default'); |
|
204 | 204 | } |
205 | 205 | |
206 | - return apply_filters( 'give_email_template', $this->template ); |
|
206 | + return apply_filters('give_email_template', $this->template); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @since 1.0 |
213 | 213 | */ |
214 | 214 | public function get_heading() { |
215 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
215 | + return apply_filters('give_email_heading', $this->heading); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return mixed |
224 | 224 | */ |
225 | - public function parse_tags( $content ) { |
|
225 | + public function parse_tags($content) { |
|
226 | 226 | return $content; |
227 | 227 | } |
228 | 228 | |
@@ -235,34 +235,34 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - public function build_email( $message ) { |
|
238 | + public function build_email($message) { |
|
239 | 239 | |
240 | - if ( false === $this->html ) { |
|
240 | + if (false === $this->html) { |
|
241 | 241 | |
242 | 242 | // Added Replacement check to simply behaviour of anchor tags. |
243 | 243 | $pattern = '/<a.+?href\=(?:["|\'])(.+?)(?:["|\']).*?>(.+?)<\/a>/i'; |
244 | 244 | $message = preg_replace_callback( |
245 | 245 | $pattern, |
246 | - function ( $return ) { |
|
247 | - if ( $return[1] !== $return[2] ) { |
|
246 | + function($return) { |
|
247 | + if ($return[1] !== $return[2]) { |
|
248 | 248 | return "{$return[2]} ( {$return[1]} )"; |
249 | 249 | } |
250 | 250 | |
251 | - return trailingslashit( $return[1] ); |
|
251 | + return trailingslashit($return[1]); |
|
252 | 252 | }, |
253 | 253 | $message |
254 | 254 | ); |
255 | 255 | |
256 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
256 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
257 | 257 | } |
258 | 258 | |
259 | - $message = $this->text_to_html( $message ); |
|
259 | + $message = $this->text_to_html($message); |
|
260 | 260 | |
261 | 261 | $template = $this->get_template(); |
262 | 262 | |
263 | 263 | ob_start(); |
264 | 264 | |
265 | - give_get_template_part( 'emails/header', $template, true ); |
|
265 | + give_get_template_part('emails/header', $template, true); |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Fires in the email head. |
@@ -271,17 +271,17 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @param Give_Emails $this The email object. |
273 | 273 | */ |
274 | - do_action( 'give_email_header', $this ); |
|
274 | + do_action('give_email_header', $this); |
|
275 | 275 | |
276 | - if ( has_action( 'give_email_template_' . $template ) ) { |
|
276 | + if (has_action('give_email_template_'.$template)) { |
|
277 | 277 | /** |
278 | 278 | * Fires in a specific email template. |
279 | 279 | * |
280 | 280 | * @since 1.0 |
281 | 281 | */ |
282 | - do_action( "give_email_template_{$template}" ); |
|
282 | + do_action("give_email_template_{$template}"); |
|
283 | 283 | } else { |
284 | - give_get_template_part( 'emails/body', $template, true ); |
|
284 | + give_get_template_part('emails/body', $template, true); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | * |
292 | 292 | * @param Give_Emails $this The email object. |
293 | 293 | */ |
294 | - do_action( 'give_email_body', $this ); |
|
294 | + do_action('give_email_body', $this); |
|
295 | 295 | |
296 | - give_get_template_part( 'emails/footer', $template, true ); |
|
296 | + give_get_template_part('emails/footer', $template, true); |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * Fires in the email footer. |
@@ -302,28 +302,28 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @param Give_Emails $this The email object. |
304 | 304 | */ |
305 | - do_action( 'give_email_footer', $this ); |
|
305 | + do_action('give_email_footer', $this); |
|
306 | 306 | |
307 | 307 | $body = ob_get_clean(); |
308 | 308 | |
309 | 309 | // Email tag. |
310 | - $message = str_replace( '{email}', $message, $body ); |
|
310 | + $message = str_replace('{email}', $message, $body); |
|
311 | 311 | |
312 | 312 | // Email logo tag. |
313 | - $header_img = give_get_meta( $this->form_id, '_give_email_logo', true ); |
|
314 | - $header_img = $this->form_id ? $header_img : give_get_option( 'email_logo', '' ); |
|
313 | + $header_img = give_get_meta($this->form_id, '_give_email_logo', true); |
|
314 | + $header_img = $this->form_id ? $header_img : give_get_option('email_logo', ''); |
|
315 | 315 | |
316 | - if ( ! empty( $header_img ) ) { |
|
316 | + if ( ! empty($header_img)) { |
|
317 | 317 | $header_img = sprintf( |
318 | 318 | '<div id="template_header_image"><p style="margin-top:0;"><img style="max-width:450px;" src="%1$s" alt="%2$s" /></p></div>', |
319 | - esc_url( $header_img ), |
|
320 | - get_bloginfo( 'name' ) |
|
319 | + esc_url($header_img), |
|
320 | + get_bloginfo('name') |
|
321 | 321 | ); |
322 | 322 | } |
323 | 323 | |
324 | - $message = str_replace( '{email_logo}', $header_img, $message ); |
|
324 | + $message = str_replace('{email_logo}', $header_img, $message); |
|
325 | 325 | |
326 | - return apply_filters( 'give_email_message', $message, $this ); |
|
326 | + return apply_filters('give_email_message', $message, $this); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @return bool |
338 | 338 | */ |
339 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
339 | + public function send($to, $subject, $message, $attachments = '') { |
|
340 | 340 | |
341 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
342 | - give_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); |
|
341 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
342 | + give_doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null); |
|
343 | 343 | |
344 | 344 | return false; |
345 | 345 | } |
@@ -351,16 +351,16 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @param Give_Emails $this The email object. |
353 | 353 | */ |
354 | - do_action( 'give_email_send_before', $this ); |
|
354 | + do_action('give_email_send_before', $this); |
|
355 | 355 | |
356 | - $subject = $this->parse_tags( $subject ); |
|
357 | - $message = $this->parse_tags( $message ); |
|
356 | + $subject = $this->parse_tags($subject); |
|
357 | + $message = $this->parse_tags($message); |
|
358 | 358 | |
359 | - $message = $this->build_email( $message ); |
|
359 | + $message = $this->build_email($message); |
|
360 | 360 | |
361 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
361 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
362 | 362 | |
363 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
363 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
364 | 364 | |
365 | 365 | /** |
366 | 366 | * Fires after sending an email. |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @param Give_Emails $this The email object. |
371 | 371 | */ |
372 | - do_action( 'give_email_send_after', $this ); |
|
372 | + do_action('give_email_send_after', $this); |
|
373 | 373 | |
374 | 374 | return $sent; |
375 | 375 | |
@@ -381,9 +381,9 @@ discard block |
||
381 | 381 | * @since 1.0 |
382 | 382 | */ |
383 | 383 | public function send_before() { |
384 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
385 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
386 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
384 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
385 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
386 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | * @since 1.0 |
393 | 393 | */ |
394 | 394 | public function send_after() { |
395 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
396 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
397 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
395 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
396 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
397 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
398 | 398 | |
399 | 399 | // Reset email related params. |
400 | 400 | $this->heading = ''; |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | * |
409 | 409 | * @since 1.0 |
410 | 410 | */ |
411 | - public function text_to_html( $message ) { |
|
411 | + public function text_to_html($message) { |
|
412 | 412 | |
413 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
414 | - $message = wpautop( $message ); |
|
413 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
414 | + $message = wpautop($message); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | return $message; |