@@ -178,7 +178,7 @@ |
||
178 | 178 | public $email_access; |
179 | 179 | |
180 | 180 | /** |
181 | - * Give notices Object |
|
181 | + * Give notices Object |
|
182 | 182 | * |
183 | 183 | * @since 2.0 |
184 | 184 | * @access public |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly. |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Main Give Class |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return Give |
203 | 203 | */ |
204 | 204 | public static function instance() { |
205 | - if ( is_null( self::$_instance ) ) { |
|
205 | + if (is_null(self::$_instance)) { |
|
206 | 206 | self::$_instance = new self(); |
207 | 207 | } |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->includes(); |
218 | 218 | $this->init_hooks(); |
219 | 219 | |
220 | - do_action( 'give_loaded' ); |
|
220 | + do_action('give_loaded'); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | * @since 1.8.9 |
227 | 227 | */ |
228 | 228 | private function init_hooks() { |
229 | - register_activation_hook( __FILE__, 'give_install' ); |
|
230 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
229 | + register_activation_hook(__FILE__, 'give_install'); |
|
230 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
231 | 231 | } |
232 | 232 | /** |
233 | 233 | * Init Give when WordPress Initializes. |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @since 1.8.9 |
243 | 243 | */ |
244 | - do_action( 'before_give_init' ); |
|
244 | + do_action('before_give_init'); |
|
245 | 245 | |
246 | 246 | // Set up localization. |
247 | 247 | $this->load_textdomain(); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @since 1.8.7 |
268 | 268 | */ |
269 | - do_action( 'give_init', $this ); |
|
269 | + do_action('give_init', $this); |
|
270 | 270 | |
271 | 271 | } |
272 | 272 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function __clone() { |
285 | 285 | // Cloning instances of the class is forbidden. |
286 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
286 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function __wakeup() { |
298 | 298 | // Unserializing instances of the class is forbidden. |
299 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
299 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -310,38 +310,38 @@ discard block |
||
310 | 310 | private function setup_constants() { |
311 | 311 | |
312 | 312 | // Plugin version |
313 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
314 | - define( 'GIVE_VERSION', '1.8.12' ); |
|
313 | + if ( ! defined('GIVE_VERSION')) { |
|
314 | + define('GIVE_VERSION', '1.8.12'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | // Plugin Folder Path |
318 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
319 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
318 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
319 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | // Plugin Folder URL |
323 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
324 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
323 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
324 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | // Plugin Basename aka: "give/give.php" |
328 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
329 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
328 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
329 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | // Plugin Root File |
333 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
334 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
333 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
334 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // Make sure CAL_GREGORIAN is defined |
338 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
339 | - define( 'CAL_GREGORIAN', 1 ); |
|
338 | + if ( ! defined('CAL_GREGORIAN')) { |
|
339 | + define('CAL_GREGORIAN', 1); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | // PHP version |
343 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
344 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
343 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
344 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
@@ -356,128 +356,128 @@ discard block |
||
356 | 356 | private function includes() { |
357 | 357 | global $give_options; |
358 | 358 | |
359 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
361 | 361 | $give_options = give_get_settings(); |
362 | 362 | |
363 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
365 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
366 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
367 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
368 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
371 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
372 | - |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
374 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
375 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
377 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
378 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
379 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
380 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
387 | - |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
393 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
395 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
396 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
404 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
406 | - |
|
407 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
408 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
409 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
410 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
411 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
412 | - |
|
413 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
414 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
415 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
416 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
417 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
418 | - |
|
419 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
420 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
421 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
422 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
423 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
424 | - |
|
425 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
426 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
363 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
365 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
366 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
368 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
372 | + |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
374 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
375 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
377 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
378 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
379 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
380 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
387 | + |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
393 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
395 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
396 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
404 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
406 | + |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
408 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
409 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
410 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
411 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
412 | + |
|
413 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
414 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
415 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
416 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
417 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
418 | + |
|
419 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
420 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
421 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
422 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
423 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
424 | + |
|
425 | + if (defined('WP_CLI') && WP_CLI) { |
|
426 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
427 | 427 | } |
428 | 428 | |
429 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
429 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
430 | 430 | |
431 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
432 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
433 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
434 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
435 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
436 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
437 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
438 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
439 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
440 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
431 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
432 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
433 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
434 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
435 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
436 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
437 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
438 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
439 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
440 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
441 | 441 | |
442 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
443 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
442 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
443 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
444 | 444 | |
445 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
446 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
447 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
445 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
446 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
447 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
448 | 448 | |
449 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
450 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
451 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
449 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
450 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
451 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
452 | 452 | |
453 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
454 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
455 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
456 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
453 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
454 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
455 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
456 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
457 | 457 | |
458 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
459 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
460 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
458 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
459 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
460 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
461 | 461 | |
462 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
462 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
463 | 463 | |
464 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
464 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
465 | 465 | |
466 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
467 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
468 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
469 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
470 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
471 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
472 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
473 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
474 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
466 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
467 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
468 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
469 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
470 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
471 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
475 | 475 | |
476 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
477 | 477 | |
478 | 478 | }// End if(). |
479 | 479 | |
480 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
481 | 481 | |
482 | 482 | } |
483 | 483 | |
@@ -492,16 +492,16 @@ discard block |
||
492 | 492 | public function load_textdomain() { |
493 | 493 | |
494 | 494 | // Set filter for Give's languages directory |
495 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
496 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
495 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
496 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
497 | 497 | |
498 | 498 | // Traditional WordPress plugin locale filter. |
499 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
500 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
499 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
500 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
501 | 501 | |
502 | - unload_textdomain( 'give' ); |
|
503 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
504 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
502 | + unload_textdomain('give'); |
|
503 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
504 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
505 | 505 | |
506 | 506 | } |
507 | 507 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | function give_donation_history() { |
27 | 27 | |
28 | 28 | // If payment_key query arg exists, return receipt instead of donation history. |
29 | - if ( isset( $_GET['payment_key'] ) ) { |
|
29 | + if (isset($_GET['payment_key'])) { |
|
30 | 30 | ob_start(); |
31 | - echo give_receipt_shortcode( array() ); |
|
32 | - echo '<a href="' . esc_url( give_get_history_page_uri() ) . '">« ' . __( 'Return to All Donations', 'give' ) . '</a>'; |
|
31 | + echo give_receipt_shortcode(array()); |
|
32 | + echo '<a href="'.esc_url(give_get_history_page_uri()).'">« '.__('Return to All Donations', 'give').'</a>'; |
|
33 | 33 | |
34 | 34 | return ob_get_clean(); |
35 | 35 | } |
36 | 36 | |
37 | - $email_access = give_get_option( 'email_access' ); |
|
37 | + $email_access = give_get_option('email_access'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Determine access |
@@ -44,30 +44,30 @@ discard block |
||
44 | 44 | */ |
45 | 45 | if ( |
46 | 46 | is_user_logged_in() || false !== Give()->session->get_session_expiration() |
47 | - || ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists ) |
|
47 | + || (give_is_setting_enabled($email_access) && Give()->email_access->token_exists) |
|
48 | 48 | ) { |
49 | 49 | ob_start(); |
50 | - give_get_template_part( 'history', 'donations' ); |
|
50 | + give_get_template_part('history', 'donations'); |
|
51 | 51 | |
52 | 52 | return ob_get_clean(); |
53 | 53 | |
54 | - } elseif ( give_is_setting_enabled( $email_access ) ) { |
|
54 | + } elseif (give_is_setting_enabled($email_access)) { |
|
55 | 55 | // Is Email-based access enabled? |
56 | 56 | ob_start(); |
57 | - give_get_template_part( 'email', 'login-form' ); |
|
57 | + give_get_template_part('email', 'login-form'); |
|
58 | 58 | |
59 | 59 | return ob_get_clean(); |
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
63 | - $output = apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) ); |
|
64 | - $output .= do_shortcode( '[give_login]' ); |
|
63 | + $output = apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false)); |
|
64 | + $output .= do_shortcode('[give_login]'); |
|
65 | 65 | |
66 | 66 | return $output; |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
70 | +add_shortcode('donation_history', 'give_donation_history'); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Donation Form Shortcode |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return string |
82 | 82 | */ |
83 | -function give_form_shortcode( $atts ) { |
|
84 | - $atts = shortcode_atts( array( |
|
83 | +function give_form_shortcode($atts) { |
|
84 | + $atts = shortcode_atts(array( |
|
85 | 85 | 'id' => '', |
86 | 86 | 'show_title' => true, |
87 | 87 | 'show_goal' => true, |
@@ -89,21 +89,21 @@ discard block |
||
89 | 89 | 'float_labels' => '', |
90 | 90 | 'display_style' => '', |
91 | 91 | 'continue_button_title' => '', |
92 | - ), $atts, 'give_form' ); |
|
92 | + ), $atts, 'give_form'); |
|
93 | 93 | |
94 | 94 | // Convert string to bool. |
95 | - $atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN ); |
|
96 | - $atts['show_goal'] = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN ); |
|
95 | + $atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN); |
|
96 | + $atts['show_goal'] = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN); |
|
97 | 97 | |
98 | 98 | //get the Give Form |
99 | 99 | ob_start(); |
100 | - give_get_donation_form( $atts ); |
|
100 | + give_get_donation_form($atts); |
|
101 | 101 | $final_output = ob_get_clean(); |
102 | 102 | |
103 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
103 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
104 | 104 | } |
105 | 105 | |
106 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
106 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Donation Form Goal Shortcode. |
@@ -116,37 +116,37 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return string |
118 | 118 | */ |
119 | -function give_goal_shortcode( $atts ) { |
|
120 | - $atts = shortcode_atts( array( |
|
119 | +function give_goal_shortcode($atts) { |
|
120 | + $atts = shortcode_atts(array( |
|
121 | 121 | 'id' => '', |
122 | 122 | 'show_text' => true, |
123 | 123 | 'show_bar' => true, |
124 | - ), $atts, 'give_goal' ); |
|
124 | + ), $atts, 'give_goal'); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | //get the Give Form. |
128 | 128 | ob_start(); |
129 | 129 | |
130 | 130 | //Sanity check 1: ensure there is an ID Provided. |
131 | - if ( empty( $atts['id'] ) ) { |
|
132 | - Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true ); |
|
131 | + if (empty($atts['id'])) { |
|
132 | + Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | //Sanity check 2: Check the form even has Goals enabled. |
136 | - if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) { |
|
136 | + if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) { |
|
137 | 137 | |
138 | - Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true ); |
|
138 | + Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true); |
|
139 | 139 | } else { |
140 | 140 | //Passed all sanity checks: output Goal. |
141 | - give_show_goal_progress( $atts['id'], $atts ); |
|
141 | + give_show_goal_progress($atts['id'], $atts); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $final_output = ob_get_clean(); |
145 | 145 | |
146 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
146 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
147 | 147 | } |
148 | 148 | |
149 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
149 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
150 | 150 | |
151 | 151 | |
152 | 152 | /** |
@@ -163,22 +163,22 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return string |
165 | 165 | */ |
166 | -function give_login_form_shortcode( $atts ) { |
|
167 | - $atts = shortcode_atts( array( |
|
166 | +function give_login_form_shortcode($atts) { |
|
167 | + $atts = shortcode_atts(array( |
|
168 | 168 | // Add backward compatibility for redirect attribute. |
169 | 169 | 'redirect' => '', |
170 | 170 | |
171 | 171 | 'login-redirect' => '', |
172 | 172 | 'logout-redirect' => '', |
173 | - ), $atts, 'give_login' ); |
|
173 | + ), $atts, 'give_login'); |
|
174 | 174 | |
175 | 175 | // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
176 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' ); |
|
176 | + $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : ''); |
|
177 | 177 | |
178 | - return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
|
178 | + return give_login_form($atts['login-redirect'], $atts['logout-redirect']); |
|
179 | 179 | } |
180 | 180 | |
181 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
181 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Register Shortcode. |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @return string |
195 | 195 | */ |
196 | -function give_register_form_shortcode( $atts ) { |
|
197 | - $atts = shortcode_atts( array( |
|
196 | +function give_register_form_shortcode($atts) { |
|
197 | + $atts = shortcode_atts(array( |
|
198 | 198 | 'redirect' => '', |
199 | - ), $atts, 'give_register' ); |
|
199 | + ), $atts, 'give_register'); |
|
200 | 200 | |
201 | - return give_register_form( $atts['redirect'] ); |
|
201 | + return give_register_form($atts['redirect']); |
|
202 | 202 | } |
203 | 203 | |
204 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
204 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Receipt Shortcode. |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @return string |
216 | 216 | */ |
217 | -function give_receipt_shortcode( $atts ) { |
|
217 | +function give_receipt_shortcode($atts) { |
|
218 | 218 | |
219 | 219 | global $give_receipt_args, $payment; |
220 | 220 | |
221 | - $give_receipt_args = shortcode_atts( array( |
|
222 | - 'error' => __( 'You are missing the payment key to view this donation receipt.', 'give' ), |
|
221 | + $give_receipt_args = shortcode_atts(array( |
|
222 | + 'error' => __('You are missing the payment key to view this donation receipt.', 'give'), |
|
223 | 223 | 'price' => true, |
224 | 224 | 'donor' => true, |
225 | 225 | 'date' => true, |
@@ -228,50 +228,50 @@ discard block |
||
228 | 228 | 'payment_id' => true, |
229 | 229 | 'payment_status' => false, |
230 | 230 | 'status_notice' => true, |
231 | - ), $atts, 'give_receipt' ); |
|
231 | + ), $atts, 'give_receipt'); |
|
232 | 232 | |
233 | 233 | //set $session var |
234 | 234 | $session = give_get_purchase_session(); |
235 | 235 | |
236 | 236 | //set payment key var |
237 | - if ( isset( $_GET['payment_key'] ) ) { |
|
238 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
239 | - } elseif ( $session ) { |
|
237 | + if (isset($_GET['payment_key'])) { |
|
238 | + $payment_key = urldecode($_GET['payment_key']); |
|
239 | + } elseif ($session) { |
|
240 | 240 | $payment_key = $session['purchase_key']; |
241 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
241 | + } elseif ($give_receipt_args['payment_key']) { |
|
242 | 242 | $payment_key = $give_receipt_args['payment_key']; |
243 | 243 | } |
244 | 244 | |
245 | - $email_access = give_get_option( 'email_access' ); |
|
245 | + $email_access = give_get_option('email_access'); |
|
246 | 246 | |
247 | 247 | // No payment_key found & Email Access is Turned on: |
248 | - if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
248 | + if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
249 | 249 | |
250 | 250 | ob_start(); |
251 | 251 | |
252 | - give_get_template_part( 'email-login-form' ); |
|
252 | + give_get_template_part('email-login-form'); |
|
253 | 253 | |
254 | 254 | return ob_get_clean(); |
255 | 255 | |
256 | - } elseif ( ! isset( $payment_key ) ) { |
|
256 | + } elseif ( ! isset($payment_key)) { |
|
257 | 257 | |
258 | - return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' ); |
|
258 | + return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error'); |
|
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
263 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
262 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
263 | + $user_can_view = give_can_view_receipt($payment_key); |
|
264 | 264 | |
265 | 265 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt. |
266 | - if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
266 | + if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
267 | 267 | |
268 | 268 | ob_start(); |
269 | 269 | |
270 | - give_get_template_part( 'email-login-form' ); |
|
270 | + give_get_template_part('email-login-form'); |
|
271 | 271 | |
272 | 272 | return ob_get_clean(); |
273 | 273 | |
274 | - } elseif ( ! $user_can_view ) { |
|
274 | + } elseif ( ! $user_can_view) { |
|
275 | 275 | |
276 | 276 | global $give_login_redirect; |
277 | 277 | |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | |
280 | 280 | ob_start(); |
281 | 281 | |
282 | - Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) ); |
|
282 | + Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give'))); |
|
283 | 283 | |
284 | - give_get_template_part( 'shortcode', 'login' ); |
|
284 | + give_get_template_part('shortcode', 'login'); |
|
285 | 285 | |
286 | 286 | $login_form = ob_get_clean(); |
287 | 287 | |
@@ -296,20 +296,20 @@ discard block |
||
296 | 296 | * or if user is logged in and the user can view sensitive shop data. |
297 | 297 | * |
298 | 298 | */ |
299 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
300 | - return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' ); |
|
299 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
300 | + return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | ob_start(); |
304 | 304 | |
305 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
305 | + give_get_template_part('shortcode', 'receipt'); |
|
306 | 306 | |
307 | 307 | $display = ob_get_clean(); |
308 | 308 | |
309 | 309 | return $display; |
310 | 310 | } |
311 | 311 | |
312 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
312 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * Profile Editor Shortcode. |
@@ -328,18 +328,18 @@ discard block |
||
328 | 328 | * |
329 | 329 | * @return string Output generated from the profile editor |
330 | 330 | */ |
331 | -function give_profile_editor_shortcode( $atts ) { |
|
331 | +function give_profile_editor_shortcode($atts) { |
|
332 | 332 | |
333 | 333 | ob_start(); |
334 | 334 | |
335 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
335 | + give_get_template_part('shortcode', 'profile-editor'); |
|
336 | 336 | |
337 | 337 | $display = ob_get_clean(); |
338 | 338 | |
339 | 339 | return $display; |
340 | 340 | } |
341 | 341 | |
342 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
342 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Process Profile Updater Form. |
@@ -352,30 +352,30 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @return bool |
354 | 354 | */ |
355 | -function give_process_profile_editor_updates( $data ) { |
|
355 | +function give_process_profile_editor_updates($data) { |
|
356 | 356 | // Profile field change request |
357 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
357 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
358 | 358 | return false; |
359 | 359 | } |
360 | 360 | |
361 | 361 | // Nonce security |
362 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
362 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
363 | 363 | return false; |
364 | 364 | } |
365 | 365 | |
366 | 366 | $user_id = get_current_user_id(); |
367 | - $old_user_data = get_userdata( $user_id ); |
|
368 | - |
|
369 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
370 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
371 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
372 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
373 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
374 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
375 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
376 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
377 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
378 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
367 | + $old_user_data = get_userdata($user_id); |
|
368 | + |
|
369 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
370 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
371 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
372 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
373 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
374 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
375 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
376 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
377 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
378 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
379 | 379 | |
380 | 380 | $userdata = array( |
381 | 381 | 'ID' => $user_id, |
@@ -403,40 +403,40 @@ discard block |
||
403 | 403 | * @param int $user_id The ID of the user. |
404 | 404 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
405 | 405 | */ |
406 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
406 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
407 | 407 | |
408 | 408 | // Make sure to validate passwords for existing Donors |
409 | - give_validate_user_password( $data['give_new_user_pass1'], $data['give_new_user_pass2'] ); |
|
409 | + give_validate_user_password($data['give_new_user_pass1'], $data['give_new_user_pass2']); |
|
410 | 410 | |
411 | - if ( empty( $email ) ) { |
|
411 | + if (empty($email)) { |
|
412 | 412 | // Make sure email should not be empty. |
413 | - give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) ); |
|
413 | + give_set_error('email_empty', __('The email you entered is empty.', 'give')); |
|
414 | 414 | |
415 | - } else if ( ! is_email( $email ) ) { |
|
415 | + } else if ( ! is_email($email)) { |
|
416 | 416 | // Make sure email should be valid. |
417 | - give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) ); |
|
417 | + give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give')); |
|
418 | 418 | |
419 | - } else if ( $email != $old_user_data->user_email ) { |
|
419 | + } else if ($email != $old_user_data->user_email) { |
|
420 | 420 | // Make sure the new email doesn't belong to another user |
421 | - if ( email_exists( $email ) ) { |
|
422 | - give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
421 | + if (email_exists($email)) { |
|
422 | + give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | 426 | // Check for errors |
427 | 427 | $errors = give_get_errors(); |
428 | 428 | |
429 | - if ( $errors ) { |
|
429 | + if ($errors) { |
|
430 | 430 | // Send back to the profile editor if there are errors |
431 | - wp_redirect( $data['give_redirect'] ); |
|
431 | + wp_redirect($data['give_redirect']); |
|
432 | 432 | give_die(); |
433 | 433 | } |
434 | 434 | |
435 | 435 | // Update the user |
436 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
437 | - $updated = wp_update_user( $userdata ); |
|
436 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
437 | + $updated = wp_update_user($userdata); |
|
438 | 438 | |
439 | - if ( $updated ) { |
|
439 | + if ($updated) { |
|
440 | 440 | |
441 | 441 | /** |
442 | 442 | * Fires after updating user profile. |
@@ -446,12 +446,12 @@ discard block |
||
446 | 446 | * @param int $user_id The ID of the user. |
447 | 447 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
448 | 448 | */ |
449 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
450 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
449 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
450 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
451 | 451 | give_die(); |
452 | 452 | } |
453 | 453 | |
454 | 454 | return false; |
455 | 455 | } |
456 | 456 | |
457 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
457 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
@@ -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 | |
@@ -30,54 +30,54 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool|array List of all user donations. |
32 | 32 | */ |
33 | -function give_get_users_donations( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) { |
|
33 | +function give_get_users_donations($user = 0, $number = 20, $pagination = false, $status = 'complete') { |
|
34 | 34 | |
35 | - if ( empty( $user ) ) { |
|
35 | + if (empty($user)) { |
|
36 | 36 | $user = get_current_user_id(); |
37 | 37 | } |
38 | 38 | |
39 | - if ( 0 === $user && ! Give()->email_access->token_exists ) { |
|
39 | + if (0 === $user && ! Give()->email_access->token_exists) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $status = $status === 'complete' ? 'publish' : $status; |
44 | 44 | $paged = 1; |
45 | 45 | |
46 | - if ( $pagination ) { |
|
47 | - if ( get_query_var( 'paged' ) ) { |
|
48 | - $paged = get_query_var( 'paged' ); |
|
49 | - } elseif ( get_query_var( 'page' ) ) { |
|
50 | - $paged = get_query_var( 'page' ); |
|
46 | + if ($pagination) { |
|
47 | + if (get_query_var('paged')) { |
|
48 | + $paged = get_query_var('paged'); |
|
49 | + } elseif (get_query_var('page')) { |
|
50 | + $paged = get_query_var('page'); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | - $args = apply_filters( 'give_get_users_donations_args', array( |
|
54 | + $args = apply_filters('give_get_users_donations_args', array( |
|
55 | 55 | 'user' => $user, |
56 | 56 | 'number' => $number, |
57 | 57 | 'status' => $status, |
58 | 58 | 'orderby' => 'date', |
59 | - ) ); |
|
59 | + )); |
|
60 | 60 | |
61 | - if ( $pagination ) { |
|
61 | + if ($pagination) { |
|
62 | 62 | $args['page'] = $paged; |
63 | 63 | } else { |
64 | 64 | $args['nopaging'] = true; |
65 | 65 | } |
66 | 66 | |
67 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
68 | - $donor = new Give_Donor( $user, $by_user_id ); |
|
67 | + $by_user_id = is_numeric($user) ? true : false; |
|
68 | + $donor = new Give_Donor($user, $by_user_id); |
|
69 | 69 | |
70 | - if ( ! empty( $donor->payment_ids ) ) { |
|
70 | + if ( ! empty($donor->payment_ids)) { |
|
71 | 71 | |
72 | - unset( $args['user'] ); |
|
73 | - $args['post__in'] = array_map( 'absint', explode( ',', $donor->payment_ids ) ); |
|
72 | + unset($args['user']); |
|
73 | + $args['post__in'] = array_map('absint', explode(',', $donor->payment_ids)); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
77 | - $donations = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) ); |
|
77 | + $donations = give_get_payments(apply_filters('give_get_users_donations_args', $args)); |
|
78 | 78 | |
79 | 79 | // No donations |
80 | - if ( ! $donations ) { |
|
80 | + if ( ! $donations) { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | |
@@ -96,65 +96,65 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return bool|object List of unique forms donated by user |
98 | 98 | */ |
99 | -function give_get_users_completed_donations( $user = 0, $status = 'complete' ) { |
|
100 | - if ( empty( $user ) ) { |
|
99 | +function give_get_users_completed_donations($user = 0, $status = 'complete') { |
|
100 | + if (empty($user)) { |
|
101 | 101 | $user = get_current_user_id(); |
102 | 102 | } |
103 | 103 | |
104 | - if ( empty( $user ) ) { |
|
104 | + if (empty($user)) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
108 | + $by_user_id = is_numeric($user) ? true : false; |
|
109 | 109 | |
110 | - $donor = new Give_Donor( $user, $by_user_id ); |
|
110 | + $donor = new Give_Donor($user, $by_user_id); |
|
111 | 111 | |
112 | - if ( empty( $donor->payment_ids ) ) { |
|
112 | + if (empty($donor->payment_ids)) { |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | |
116 | 116 | // Get all the items donated. |
117 | - $payment_ids = array_reverse( explode( ',', $donor->payment_ids ) ); |
|
118 | - $limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 ); |
|
119 | - if ( ! empty( $limit_payments ) ) { |
|
120 | - $payment_ids = array_slice( $payment_ids, 0, $limit_payments ); |
|
117 | + $payment_ids = array_reverse(explode(',', $donor->payment_ids)); |
|
118 | + $limit_payments = apply_filters('give_users_completed_donations_payments', 50); |
|
119 | + if ( ! empty($limit_payments)) { |
|
120 | + $payment_ids = array_slice($payment_ids, 0, $limit_payments); |
|
121 | 121 | } |
122 | 122 | $donation_data = array(); |
123 | - foreach ( $payment_ids as $payment_id ) { |
|
124 | - $donation_data[] = give_get_payment_meta( $payment_id ); |
|
123 | + foreach ($payment_ids as $payment_id) { |
|
124 | + $donation_data[] = give_get_payment_meta($payment_id); |
|
125 | 125 | } |
126 | 126 | |
127 | - if ( empty( $donation_data ) ) { |
|
127 | + if (empty($donation_data)) { |
|
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Grab only the post ids "form_id" of the forms donated on this order |
132 | 132 | $completed_donations_ids = array(); |
133 | - foreach ( $donation_data as $donation_meta ) { |
|
134 | - $completed_donations_ids[] = isset( $donation_meta['form_id'] ) ? $donation_meta['form_id'] : ''; |
|
133 | + foreach ($donation_data as $donation_meta) { |
|
134 | + $completed_donations_ids[] = isset($donation_meta['form_id']) ? $donation_meta['form_id'] : ''; |
|
135 | 135 | } |
136 | 136 | |
137 | - if ( empty( $completed_donations_ids ) ) { |
|
137 | + if (empty($completed_donations_ids)) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | |
141 | 141 | // Only include each donation once |
142 | - $form_ids = array_unique( $completed_donations_ids ); |
|
142 | + $form_ids = array_unique($completed_donations_ids); |
|
143 | 143 | |
144 | 144 | // Make sure we still have some products and a first item |
145 | - if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) { |
|
145 | + if (empty($form_ids) || ! isset($form_ids[0])) { |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | |
149 | - $post_type = get_post_type( $form_ids[0] ); |
|
149 | + $post_type = get_post_type($form_ids[0]); |
|
150 | 150 | |
151 | - $args = apply_filters( 'give_get_users_completed_donations_args', array( |
|
151 | + $args = apply_filters('give_get_users_completed_donations_args', array( |
|
152 | 152 | 'include' => $form_ids, |
153 | 153 | 'post_type' => $post_type, |
154 | - 'posts_per_page' => - 1, |
|
155 | - ) ); |
|
154 | + 'posts_per_page' => -1, |
|
155 | + )); |
|
156 | 156 | |
157 | - return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) ); |
|
157 | + return apply_filters('give_users_completed_donations_list', get_posts($args)); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return bool True if has donated, false other wise. |
172 | 172 | */ |
173 | -function give_has_donations( $user_id = null ) { |
|
174 | - if ( empty( $user_id ) ) { |
|
173 | +function give_has_donations($user_id = null) { |
|
174 | + if (empty($user_id)) { |
|
175 | 175 | $user_id = get_current_user_id(); |
176 | 176 | } |
177 | 177 | |
178 | - if ( give_get_users_donations( $user_id, 1 ) ) { |
|
178 | + if (give_get_users_donations($user_id, 1)) { |
|
179 | 179 | return true; // User has at least one donation. |
180 | 180 | } |
181 | 181 | |
@@ -196,23 +196,23 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return array |
198 | 198 | */ |
199 | -function give_get_donation_stats_by_user( $user = '' ) { |
|
199 | +function give_get_donation_stats_by_user($user = '') { |
|
200 | 200 | |
201 | 201 | $field = ''; |
202 | 202 | |
203 | - if ( is_email( $user ) ) { |
|
203 | + if (is_email($user)) { |
|
204 | 204 | $field = 'email'; |
205 | - } elseif ( is_numeric( $user ) ) { |
|
205 | + } elseif (is_numeric($user)) { |
|
206 | 206 | $field = 'user_id'; |
207 | 207 | } |
208 | 208 | |
209 | - $stats = array(); |
|
210 | - $donor = Give()->donors->get_donor_by( $field, $user ); |
|
209 | + $stats = array(); |
|
210 | + $donor = Give()->donors->get_donor_by($field, $user); |
|
211 | 211 | |
212 | - if ( $donor ) { |
|
213 | - $donor = new Give_Donor( $donor->id ); |
|
214 | - $stats['purchases'] = absint( $donor->purchase_count ); |
|
215 | - $stats['total_spent'] = give_sanitize_amount( $donor->purchase_value ); |
|
212 | + if ($donor) { |
|
213 | + $donor = new Give_Donor($donor->id); |
|
214 | + $stats['purchases'] = absint($donor->purchase_count); |
|
215 | + $stats['total_spent'] = give_sanitize_amount($donor->purchase_value); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @since 1.7 |
222 | 222 | */ |
223 | - $stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user ); |
|
223 | + $stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user); |
|
224 | 224 | |
225 | 225 | return $stats; |
226 | 226 | } |
@@ -238,21 +238,21 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return int The total number of donations. |
240 | 240 | */ |
241 | -function give_count_donations_of_donor( $user = null ) { |
|
241 | +function give_count_donations_of_donor($user = null) { |
|
242 | 242 | |
243 | 243 | // Logged in? |
244 | - if ( empty( $user ) ) { |
|
244 | + if (empty($user)) { |
|
245 | 245 | $user = get_current_user_id(); |
246 | 246 | } |
247 | 247 | |
248 | 248 | // Email access? |
249 | - if ( empty( $user ) && Give()->email_access->token_email ) { |
|
249 | + if (empty($user) && Give()->email_access->token_email) { |
|
250 | 250 | $user = Give()->email_access->token_email; |
251 | 251 | } |
252 | 252 | |
253 | - $stats = ! empty( $user ) ? give_get_donation_stats_by_user( $user ) : false; |
|
253 | + $stats = ! empty($user) ? give_get_donation_stats_by_user($user) : false; |
|
254 | 254 | |
255 | - return isset( $stats['purchases'] ) ? $stats['purchases'] : 0; |
|
255 | + return isset($stats['purchases']) ? $stats['purchases'] : 0; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return float The total amount the user has spent |
267 | 267 | */ |
268 | -function give_donation_total_of_user( $user = null ) { |
|
268 | +function give_donation_total_of_user($user = null) { |
|
269 | 269 | |
270 | - $stats = give_get_donation_stats_by_user( $user ); |
|
270 | + $stats = give_get_donation_stats_by_user($user); |
|
271 | 271 | |
272 | 272 | return $stats['total_spent']; |
273 | 273 | } |
@@ -283,40 +283,40 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @return bool |
285 | 285 | */ |
286 | -function give_validate_username( $username, $form_id = 0 ) { |
|
286 | +function give_validate_username($username, $form_id = 0) { |
|
287 | 287 | $valid = true; |
288 | 288 | |
289 | 289 | // Validate username. |
290 | - if ( ! empty( $username ) ) { |
|
290 | + if ( ! empty($username)) { |
|
291 | 291 | |
292 | 292 | // Sanitize username. |
293 | - $sanitized_user_name = sanitize_user( $username, false ); |
|
293 | + $sanitized_user_name = sanitize_user($username, false); |
|
294 | 294 | |
295 | 295 | // We have an user name, check if it already exists. |
296 | - if ( username_exists( $username ) ) { |
|
296 | + if (username_exists($username)) { |
|
297 | 297 | // Username already registered. |
298 | - give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) ); |
|
298 | + give_set_error('username_unavailable', __('Username already taken.', 'give')); |
|
299 | 299 | $valid = false; |
300 | 300 | |
301 | 301 | // Check if it's valid. |
302 | - } elseif ( $sanitized_user_name !== $username ) { |
|
302 | + } elseif ($sanitized_user_name !== $username) { |
|
303 | 303 | // Invalid username. |
304 | - if ( is_multisite() ) { |
|
305 | - give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) ); |
|
304 | + if (is_multisite()) { |
|
305 | + give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give')); |
|
306 | 306 | $valid = false; |
307 | 307 | } else { |
308 | - give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) ); |
|
308 | + give_set_error('username_invalid', __('Invalid username.', 'give')); |
|
309 | 309 | $valid = false; |
310 | 310 | } |
311 | 311 | } |
312 | 312 | } else { |
313 | 313 | // Username is empty. |
314 | - give_set_error( 'username_empty', __( 'Enter a username.', 'give' ) ); |
|
314 | + give_set_error('username_empty', __('Enter a username.', 'give')); |
|
315 | 315 | $valid = false; |
316 | 316 | |
317 | 317 | // Check if guest checkout is disable for form. |
318 | - if ( $form_id && give_logged_in_only( $form_id ) ) { |
|
319 | - give_set_error( 'registration_required', __( 'You must register or login to complete your donation.', 'give' ) ); |
|
318 | + if ($form_id && give_logged_in_only($form_id)) { |
|
319 | + give_set_error('registration_required', __('You must register or login to complete your donation.', 'give')); |
|
320 | 320 | $valid = false; |
321 | 321 | } |
322 | 322 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @param string $username |
331 | 331 | * @param bool $form_id |
332 | 332 | */ |
333 | - $valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id ); |
|
333 | + $valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id); |
|
334 | 334 | |
335 | 335 | return $valid; |
336 | 336 | } |
@@ -346,22 +346,22 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @return bool |
348 | 348 | */ |
349 | -function give_validate_user_email( $email, $registering_new_user = false ) { |
|
349 | +function give_validate_user_email($email, $registering_new_user = false) { |
|
350 | 350 | $valid = true; |
351 | 351 | |
352 | - if ( empty( $email ) ) { |
|
352 | + if (empty($email)) { |
|
353 | 353 | // No email. |
354 | - give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) ); |
|
354 | + give_set_error('email_empty', __('Enter an email.', 'give')); |
|
355 | 355 | $valid = false; |
356 | 356 | |
357 | - } elseif ( ! is_email( $email ) ) { |
|
357 | + } elseif ( ! is_email($email)) { |
|
358 | 358 | // Validate email. |
359 | - give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) ); |
|
359 | + give_set_error('email_invalid', __('Invalid email.', 'give')); |
|
360 | 360 | $valid = false; |
361 | 361 | |
362 | - } elseif ( $registering_new_user && ( give_donor_email_exists( $email ) || email_exists( $email ) ) ) { |
|
362 | + } elseif ($registering_new_user && (give_donor_email_exists($email) || email_exists($email))) { |
|
363 | 363 | // Check if email exists. |
364 | - give_set_error( 'email_used', __( 'The email address provided is already active for another user.', 'give' ) ); |
|
364 | + give_set_error('email_used', __('The email address provided is already active for another user.', 'give')); |
|
365 | 365 | $valid = false; |
366 | 366 | } |
367 | 367 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * @param string $email |
375 | 375 | * @param bool $registering_new_user |
376 | 376 | */ |
377 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user ); |
|
377 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user); |
|
378 | 378 | |
379 | 379 | return $valid; |
380 | 380 | } |
@@ -390,34 +390,34 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @return bool |
392 | 392 | */ |
393 | -function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) { |
|
393 | +function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) { |
|
394 | 394 | $valid = true; |
395 | 395 | |
396 | 396 | // Passwords Validation For New Donors Only |
397 | - if ( $registering_new_user ) { |
|
397 | + if ($registering_new_user) { |
|
398 | 398 | // Password or confirmation missing. |
399 | - if ( ! $password ) { |
|
399 | + if ( ! $password) { |
|
400 | 400 | // The password is invalid. |
401 | - give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) ); |
|
401 | + give_set_error('password_empty', __('Enter a password.', 'give')); |
|
402 | 402 | $valid = false; |
403 | - } elseif ( ! $confirm_password ) { |
|
403 | + } elseif ( ! $confirm_password) { |
|
404 | 404 | // Confirmation password is invalid. |
405 | - give_set_error( 'confirmation_empty', __( 'Enter the password confirmation.', 'give' ) ); |
|
405 | + give_set_error('confirmation_empty', __('Enter the password confirmation.', 'give')); |
|
406 | 406 | $valid = false; |
407 | 407 | } |
408 | 408 | } |
409 | 409 | // Passwords Validation For New Donors as well as Existing Donors |
410 | - if( $password || $confirm_password ) { |
|
411 | - if ( strlen( $password ) < 6 || strlen( $confirm_password ) < 6 ) { |
|
410 | + if ($password || $confirm_password) { |
|
411 | + if (strlen($password) < 6 || strlen($confirm_password) < 6) { |
|
412 | 412 | // Seems Weak Password |
413 | - give_set_error( 'password_weak', __( 'Passwords should have atleast 6 characters.', 'give' ) ); |
|
413 | + give_set_error('password_weak', __('Passwords should have atleast 6 characters.', 'give')); |
|
414 | 414 | $valid = false; |
415 | 415 | } |
416 | - if ( $password && $confirm_password ) { |
|
416 | + if ($password && $confirm_password) { |
|
417 | 417 | // Verify confirmation matches. |
418 | - if ( $password != $confirm_password ) { |
|
418 | + if ($password != $confirm_password) { |
|
419 | 419 | // Passwords do not match |
420 | - give_set_error( 'password_mismatch', __( 'Passwords you entered do not match. Please try again.', 'give' ) ); |
|
420 | + give_set_error('password_mismatch', __('Passwords you entered do not match. Please try again.', 'give')); |
|
421 | 421 | $valid = false; |
422 | 422 | } |
423 | 423 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @param string $confirm_password |
434 | 434 | * @param bool $registering_new_user |
435 | 435 | */ |
436 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user ); |
|
436 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user); |
|
437 | 437 | |
438 | 438 | return $valid; |
439 | 439 | } |
@@ -451,33 +451,33 @@ discard block |
||
451 | 451 | * |
452 | 452 | * @return void |
453 | 453 | */ |
454 | -function give_add_past_donations_to_new_user( $user_id ) { |
|
454 | +function give_add_past_donations_to_new_user($user_id) { |
|
455 | 455 | |
456 | - $email = get_the_author_meta( 'user_email', $user_id ); |
|
456 | + $email = get_the_author_meta('user_email', $user_id); |
|
457 | 457 | |
458 | - $payments = give_get_payments( array( |
|
458 | + $payments = give_get_payments(array( |
|
459 | 459 | 's' => $email, |
460 | - ) ); |
|
460 | + )); |
|
461 | 461 | |
462 | - if ( $payments ) { |
|
463 | - foreach ( $payments as $payment ) { |
|
464 | - if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) { |
|
462 | + if ($payments) { |
|
463 | + foreach ($payments as $payment) { |
|
464 | + if (intval(give_get_payment_user_id($payment->ID)) > 0) { |
|
465 | 465 | continue; |
466 | 466 | } // End if(). |
467 | 467 | |
468 | - $meta = give_get_payment_meta( $payment->ID ); |
|
469 | - $meta['user_info'] = maybe_unserialize( $meta['user_info'] ); |
|
468 | + $meta = give_get_payment_meta($payment->ID); |
|
469 | + $meta['user_info'] = maybe_unserialize($meta['user_info']); |
|
470 | 470 | $meta['user_info']['id'] = $user_id; |
471 | 471 | |
472 | 472 | // Store the updated user ID in the payment meta. |
473 | - give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta ); |
|
474 | - give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id ); |
|
473 | + give_update_payment_meta($payment->ID, '_give_payment_meta', $meta); |
|
474 | + give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id); |
|
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
478 | 478 | } |
479 | 479 | |
480 | -add_action( 'user_register', 'give_add_past_donations_to_new_user' ); |
|
480 | +add_action('user_register', 'give_add_past_donations_to_new_user'); |
|
481 | 481 | |
482 | 482 | |
483 | 483 | /** |
@@ -503,34 +503,34 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @return array The donor's address, if any |
505 | 505 | */ |
506 | -function give_get_donor_address( $user_id = 0 ) { |
|
507 | - if ( empty( $user_id ) ) { |
|
506 | +function give_get_donor_address($user_id = 0) { |
|
507 | + if (empty($user_id)) { |
|
508 | 508 | $user_id = get_current_user_id(); |
509 | 509 | } |
510 | 510 | |
511 | - $address = get_user_meta( $user_id, '_give_user_address', true ); |
|
511 | + $address = get_user_meta($user_id, '_give_user_address', true); |
|
512 | 512 | |
513 | - if ( ! isset( $address['line1'] ) ) { |
|
513 | + if ( ! isset($address['line1'])) { |
|
514 | 514 | $address['line1'] = ''; |
515 | 515 | } |
516 | 516 | |
517 | - if ( ! isset( $address['line2'] ) ) { |
|
517 | + if ( ! isset($address['line2'])) { |
|
518 | 518 | $address['line2'] = ''; |
519 | 519 | } |
520 | 520 | |
521 | - if ( ! isset( $address['city'] ) ) { |
|
521 | + if ( ! isset($address['city'])) { |
|
522 | 522 | $address['city'] = ''; |
523 | 523 | } |
524 | 524 | |
525 | - if ( ! isset( $address['zip'] ) ) { |
|
525 | + if ( ! isset($address['zip'])) { |
|
526 | 526 | $address['zip'] = ''; |
527 | 527 | } |
528 | 528 | |
529 | - if ( ! isset( $address['country'] ) ) { |
|
529 | + if ( ! isset($address['country'])) { |
|
530 | 530 | $address['country'] = ''; |
531 | 531 | } |
532 | 532 | |
533 | - if ( ! isset( $address['state'] ) ) { |
|
533 | + if ( ! isset($address['state'])) { |
|
534 | 534 | $address['state'] = ''; |
535 | 535 | } |
536 | 536 | |
@@ -550,32 +550,32 @@ discard block |
||
550 | 550 | * |
551 | 551 | * @return void |
552 | 552 | */ |
553 | -function give_new_user_notification( $user_id = 0, $user_data = array() ) { |
|
553 | +function give_new_user_notification($user_id = 0, $user_data = array()) { |
|
554 | 554 | |
555 | - if ( empty( $user_id ) || empty( $user_data ) ) { |
|
555 | + if (empty($user_id) || empty($user_data)) { |
|
556 | 556 | return; |
557 | 557 | } |
558 | - $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); |
|
558 | + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
|
559 | 559 | |
560 | 560 | |
561 | 561 | // New User Registration: Email sends to the site admin. |
562 | 562 | $emails = Give()->emails; |
563 | - $emails->__set( 'heading', esc_html__( 'New User Registration', 'give' ) ); |
|
563 | + $emails->__set('heading', esc_html__('New User Registration', 'give')); |
|
564 | 564 | |
565 | 565 | /* translators: %s: site name */ |
566 | - $message = sprintf( esc_attr__( 'A new user has registered on %s:', 'give' ), $blogname ) . "\r\n\r\n"; |
|
566 | + $message = sprintf(esc_attr__('A new user has registered on %s:', 'give'), $blogname)."\r\n\r\n"; |
|
567 | 567 | /* translators: %s: user login */ |
568 | - $message .= '<strong>' . esc_attr__( 'Username:', 'give' ) . '</strong> ' . $user_data['user_login'] . "\r\n"; |
|
568 | + $message .= '<strong>'.esc_attr__('Username:', 'give').'</strong> '.$user_data['user_login']."\r\n"; |
|
569 | 569 | /* translators: %s: user email */ |
570 | - $message .= '<strong>' . esc_attr__( 'E-mail:', 'give' ) . '</strong> ' . $user_data['user_email'] . "\r\n\r\n"; |
|
570 | + $message .= '<strong>'.esc_attr__('E-mail:', 'give').'</strong> '.$user_data['user_email']."\r\n\r\n"; |
|
571 | 571 | |
572 | - $message .= '<a href="' . admin_url('user-edit.php?user_id=' . $user_id) . '" target="_blank"> ' . esc_attr__( 'Click here to view »', 'give' ) . '</a>' . "\r\n"; |
|
572 | + $message .= '<a href="'.admin_url('user-edit.php?user_id='.$user_id).'" target="_blank"> '.esc_attr__('Click here to view »', 'give').'</a>'."\r\n"; |
|
573 | 573 | |
574 | 574 | $emails->send( |
575 | - get_option( 'admin_email' ), |
|
575 | + get_option('admin_email'), |
|
576 | 576 | sprintf( |
577 | 577 | /* translators: %s: site name */ |
578 | - esc_attr__( '[%s] New User Registration', 'give' ), |
|
578 | + esc_attr__('[%s] New User Registration', 'give'), |
|
579 | 579 | $blogname |
580 | 580 | ), |
581 | 581 | $message |
@@ -583,22 +583,22 @@ discard block |
||
583 | 583 | |
584 | 584 | |
585 | 585 | // Account Information: Email sends to donor who registered. |
586 | - $emails->__set( 'heading', esc_html__( 'Account Information', 'give' ) ); |
|
586 | + $emails->__set('heading', esc_html__('Account Information', 'give')); |
|
587 | 587 | |
588 | - $message = sprintf( esc_attr__( 'The following email contains your account information for %s:', 'give' ), $blogname ) . "\r\n\r\n"; |
|
588 | + $message = sprintf(esc_attr__('The following email contains your account information for %s:', 'give'), $blogname)."\r\n\r\n"; |
|
589 | 589 | |
590 | 590 | /* translators: %s: user login */ |
591 | - $message .= '<strong>' . esc_attr__( 'Username:', 'give' ) . '</strong> ' . $user_data['user_login'] . "\r\n"; |
|
591 | + $message .= '<strong>'.esc_attr__('Username:', 'give').'</strong> '.$user_data['user_login']."\r\n"; |
|
592 | 592 | /* translators: %s: password */ |
593 | - $message .= '<strong>' . esc_attr__( 'Password:', 'give' ) . '</strong> ' . esc_attr__( '[Password entered during donation]', 'give' ) . "\r\n\r\n"; |
|
593 | + $message .= '<strong>'.esc_attr__('Password:', 'give').'</strong> '.esc_attr__('[Password entered during donation]', 'give')."\r\n\r\n"; |
|
594 | 594 | |
595 | - $message .= '<a href="' . wp_login_url() . '" target="_blank"> ' . esc_attr__( 'Click here to login »', 'give' ) . '</a>' . "\r\n"; |
|
595 | + $message .= '<a href="'.wp_login_url().'" target="_blank"> '.esc_attr__('Click here to login »', 'give').'</a>'."\r\n"; |
|
596 | 596 | |
597 | 597 | $emails->send( |
598 | 598 | $user_data['user_email'], |
599 | 599 | sprintf( |
600 | 600 | /* translators: %s: site name */ |
601 | - esc_attr__( '[%s] Your username and password', 'give' ), |
|
601 | + esc_attr__('[%s] Your username and password', 'give'), |
|
602 | 602 | $blogname |
603 | 603 | ), |
604 | 604 | $message |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | |
607 | 607 | } |
608 | 608 | |
609 | -add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
609 | +add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
610 | 610 | |
611 | 611 | |
612 | 612 | /** |
@@ -622,34 +622,34 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @return string |
624 | 624 | */ |
625 | -function give_get_donor_name_by( $id = 0, $from = 'donation' ) { |
|
625 | +function give_get_donor_name_by($id = 0, $from = 'donation') { |
|
626 | 626 | |
627 | 627 | // ID shouldn't be empty |
628 | - if ( empty( $id ) ) { |
|
628 | + if (empty($id)) { |
|
629 | 629 | return; |
630 | 630 | } |
631 | 631 | |
632 | 632 | $name = ''; |
633 | 633 | |
634 | - switch ( $from ) { |
|
634 | + switch ($from) { |
|
635 | 635 | |
636 | 636 | case 'donation': |
637 | 637 | |
638 | - $user_info = give_get_payment_meta_user_info( $id ); |
|
639 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
638 | + $user_info = give_get_payment_meta_user_info($id); |
|
639 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
640 | 640 | |
641 | 641 | break; |
642 | 642 | |
643 | 643 | case 'donor': |
644 | 644 | |
645 | - $donor = new Give_Donor( $id ); |
|
645 | + $donor = new Give_Donor($id); |
|
646 | 646 | $name = $donor->name; |
647 | 647 | |
648 | 648 | break; |
649 | 649 | |
650 | 650 | } |
651 | 651 | |
652 | - return trim( $name ); |
|
652 | + return trim($name); |
|
653 | 653 | |
654 | 654 | } |
655 | 655 | |
@@ -661,8 +661,8 @@ discard block |
||
661 | 661 | * @param string $email Donor Email. |
662 | 662 | * @return boolean The user's ID on success, and false on failure. |
663 | 663 | */ |
664 | -function give_donor_email_exists( $email ) { |
|
665 | - if ( Give()->donors->get_donor_by( 'email', $email ) ) { |
|
664 | +function give_donor_email_exists($email) { |
|
665 | + if (Give()->donors->get_donor_by('email', $email)) { |
|
666 | 666 | return true; |
667 | 667 | } |
668 | 668 | return false; |
@@ -45,22 +45,22 @@ discard block |
||
45 | 45 | * @param string $default_path Default path. Default is empty. |
46 | 46 | */ |
47 | 47 | function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | - extract( $args ); |
|
50 | - } |
|
48 | + if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | + extract( $args ); |
|
50 | + } |
|
51 | 51 | |
52 | - $template_names = array( $template_name . '.php' ); |
|
52 | + $template_names = array( $template_name . '.php' ); |
|
53 | 53 | |
54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
54 | + $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
55 | 55 | |
56 | - if ( ! file_exists( $located ) ) { |
|
56 | + if ( ! file_exists( $located ) ) { |
|
57 | 57 | /* translators: %s: the template */ |
58 | - Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
59 | - return; |
|
60 | - } |
|
58 | + Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
59 | + return; |
|
60 | + } |
|
61 | 61 | |
62 | - // Allow 3rd party plugin filter template file from their plugin. |
|
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
62 | + // Allow 3rd party plugin filter template file from their plugin. |
|
63 | + $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
75 | 75 | * @param array $args Passed arguments. |
76 | 76 | */ |
77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
77 | + do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
78 | 78 | |
79 | - include( $located ); |
|
79 | + include( $located ); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
91 | 91 | * @param array $args Passed arguments. |
92 | 92 | */ |
93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
93 | + do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function give_get_templates_dir() { |
24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function give_get_templates_url() { |
34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
34 | + return GIVE_PLUGIN_URL.'templates'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | * @param string $template_path Template file path. Default is empty. |
45 | 45 | * @param string $default_path Default path. Default is empty. |
46 | 46 | */ |
47 | -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | - extract( $args ); |
|
47 | +function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
48 | + if ( ! empty($args) && is_array($args)) { |
|
49 | + extract($args); |
|
50 | 50 | } |
51 | 51 | |
52 | - $template_names = array( $template_name . '.php' ); |
|
52 | + $template_names = array($template_name.'.php'); |
|
53 | 53 | |
54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
54 | + $located = give_locate_template($template_names, $template_path, $default_path); |
|
55 | 55 | |
56 | - if ( ! file_exists( $located ) ) { |
|
56 | + if ( ! file_exists($located)) { |
|
57 | 57 | /* translators: %s: the template */ |
58 | - Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
58 | + Give()->notices->print_frontend_notice(sprintf(__('The %s template was not found.', 'give'), $located), true); |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // Allow 3rd party plugin filter template file from their plugin. |
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
63 | + $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
75 | 75 | * @param array $args Passed arguments. |
76 | 76 | */ |
77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
77 | + do_action('give_before_template_part', $template_name, $template_path, $located, $args); |
|
78 | 78 | |
79 | - include( $located ); |
|
79 | + include($located); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
91 | 91 | * @param array $args Passed arguments. |
92 | 92 | */ |
93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
93 | + do_action('give_after_template_part', $template_name, $template_path, $located, $args); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
109 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Fires in give template part, before the template part is retrieved. |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param string $slug Template part file slug {slug}.php. |
119 | 119 | * @param string $name Template part file name {slug}-{name}.php. |
120 | 120 | */ |
121 | - do_action( "get_template_part_{$slug}", $slug, $name ); |
|
121 | + do_action("get_template_part_{$slug}", $slug, $name); |
|
122 | 122 | |
123 | 123 | // Setup possible parts |
124 | 124 | $templates = array(); |
125 | - if ( isset( $name ) ) { |
|
126 | - $templates[] = $slug . '-' . $name . '.php'; |
|
125 | + if (isset($name)) { |
|
126 | + $templates[] = $slug.'-'.$name.'.php'; |
|
127 | 127 | } |
128 | - $templates[] = $slug . '.php'; |
|
128 | + $templates[] = $slug.'.php'; |
|
129 | 129 | |
130 | 130 | // Allow template parts to be filtered |
131 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
131 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
132 | 132 | |
133 | 133 | // Return the part that is found |
134 | - return give_locate_template( $templates, $load, false ); |
|
134 | + return give_locate_template($templates, $load, false); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -152,37 +152,37 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return string The template filename if one is located. |
154 | 154 | */ |
155 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
155 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
156 | 156 | // No file found yet |
157 | 157 | $located = false; |
158 | 158 | |
159 | 159 | // Try to find a template file |
160 | - foreach ( (array) $template_names as $template_name ) { |
|
160 | + foreach ((array) $template_names as $template_name) { |
|
161 | 161 | |
162 | 162 | // Continue if template is empty |
163 | - if ( empty( $template_name ) ) { |
|
163 | + if (empty($template_name)) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Trim off any slashes from the template name |
168 | - $template_name = ltrim( $template_name, '/' ); |
|
168 | + $template_name = ltrim($template_name, '/'); |
|
169 | 169 | |
170 | 170 | // try locating this template file by looping through the template paths |
171 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
171 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
172 | 172 | |
173 | - if ( file_exists( $template_path . $template_name ) ) { |
|
174 | - $located = $template_path . $template_name; |
|
173 | + if (file_exists($template_path.$template_name)) { |
|
174 | + $located = $template_path.$template_name; |
|
175 | 175 | break; |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if ( $located ) { |
|
179 | + if ($located) { |
|
180 | 180 | break; |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
185 | - load_template( $located, $require_once ); |
|
184 | + if ((true == $load) && ! empty($located)) { |
|
185 | + load_template($located, $require_once); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return $located; |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | $template_dir = give_get_theme_template_dir_name(); |
200 | 200 | |
201 | 201 | $file_paths = array( |
202 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
203 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
202 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
203 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
204 | 204 | 100 => give_get_templates_dir() |
205 | 205 | ); |
206 | 206 | |
207 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
207 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
208 | 208 | |
209 | 209 | // sort the file paths based on priority |
210 | - ksort( $file_paths, SORT_NUMERIC ); |
|
210 | + ksort($file_paths, SORT_NUMERIC); |
|
211 | 211 | |
212 | - return array_map( 'trailingslashit', $file_paths ); |
|
212 | + return array_map('trailingslashit', $file_paths); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return string |
222 | 222 | */ |
223 | 223 | function give_get_theme_template_dir_name() { |
224 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
224 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | * @return void |
232 | 232 | */ |
233 | 233 | function give_version_in_header() { |
234 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
234 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
235 | 235 | } |
236 | 236 | |
237 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
237 | +add_action('wp_head', 'give_version_in_header'); |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Determines if we're currently on the Donations History page. |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | function give_is_donation_history_page() { |
246 | 246 | |
247 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
247 | + $ret = is_page(give_get_option('history_page')); |
|
248 | 248 | |
249 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
249 | + return apply_filters('give_is_donation_history_page', $ret); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -258,25 +258,25 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return array Modified array of classes |
260 | 260 | */ |
261 | -function give_add_body_classes( $class ) { |
|
261 | +function give_add_body_classes($class) { |
|
262 | 262 | $classes = (array) $class; |
263 | 263 | |
264 | - if ( give_is_success_page() ) { |
|
264 | + if (give_is_success_page()) { |
|
265 | 265 | $classes[] = 'give-success'; |
266 | 266 | $classes[] = 'give-page'; |
267 | 267 | } |
268 | 268 | |
269 | - if ( give_is_failed_transaction_page() ) { |
|
269 | + if (give_is_failed_transaction_page()) { |
|
270 | 270 | $classes[] = 'give-failed-transaction'; |
271 | 271 | $classes[] = 'give-page'; |
272 | 272 | } |
273 | 273 | |
274 | - if ( give_is_donation_history_page() ) { |
|
274 | + if (give_is_donation_history_page()) { |
|
275 | 275 | $classes[] = 'give-donation-history'; |
276 | 276 | $classes[] = 'give-page'; |
277 | 277 | } |
278 | 278 | |
279 | - if ( give_is_test_mode() ) { |
|
279 | + if (give_is_test_mode()) { |
|
280 | 280 | $classes[] = 'give-test-mode'; |
281 | 281 | $classes[] = 'give-page'; |
282 | 282 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | //Theme-specific Classes used to prevent conflicts via CSS |
285 | 285 | $current_theme = wp_get_theme(); |
286 | 286 | |
287 | - switch ( $current_theme->template ) { |
|
287 | + switch ($current_theme->template) { |
|
288 | 288 | |
289 | 289 | case 'Divi': |
290 | 290 | $classes[] = 'give-divi'; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | |
299 | 299 | } |
300 | 300 | |
301 | - return array_unique( $classes ); |
|
301 | + return array_unique($classes); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
304 | +add_filter('body_class', 'give_add_body_classes'); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
@@ -317,22 +317,22 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return array |
319 | 319 | */ |
320 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
321 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
320 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
321 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
322 | 322 | return $classes; |
323 | 323 | } |
324 | 324 | |
325 | 325 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
326 | 326 | |
327 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
328 | - unset( $classes[ $key ] ); |
|
327 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
328 | + unset($classes[$key]); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | return $classes; |
332 | 332 | } |
333 | 333 | |
334 | 334 | |
335 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
335 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * Get the placeholder image URL for forms etc |
@@ -342,74 +342,74 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function give_get_placeholder_img_src() { |
344 | 344 | |
345 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
345 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
346 | 346 | |
347 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
347 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
351 | 351 | /** |
352 | 352 | * Global |
353 | 353 | */ |
354 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
354 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
355 | 355 | |
356 | 356 | /** |
357 | 357 | * Output the start of the page wrapper. |
358 | 358 | */ |
359 | 359 | function give_output_content_wrapper() { |
360 | - give_get_template_part( 'global/wrapper-start' ); |
|
360 | + give_get_template_part('global/wrapper-start'); |
|
361 | 361 | } |
362 | 362 | } |
363 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
363 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
364 | 364 | |
365 | 365 | /** |
366 | 366 | * Output the end of the page wrapper. |
367 | 367 | */ |
368 | 368 | function give_output_content_wrapper_end() { |
369 | - give_get_template_part( 'global/wrapper-end' ); |
|
369 | + give_get_template_part('global/wrapper-end'); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Single Give Form |
375 | 375 | */ |
376 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
376 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
377 | 377 | function give_left_sidebar_pre_wrap() { |
378 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
378 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
382 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
383 | 383 | function give_left_sidebar_post_wrap() { |
384 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
384 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
388 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
389 | 389 | function give_get_forms_sidebar() { |
390 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
390 | + give_get_template_part('single-give-form/sidebar'); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
394 | +if ( ! function_exists('give_show_form_images')) { |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Output the donation form featured image. |
398 | 398 | */ |
399 | 399 | function give_show_form_images() { |
400 | - if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
401 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
400 | + if (give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
401 | + give_get_template_part('single-give-form/featured-image'); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
406 | +if ( ! function_exists('give_template_single_title')) { |
|
407 | 407 | |
408 | 408 | /** |
409 | 409 | * Output the form title. |
410 | 410 | */ |
411 | 411 | function give_template_single_title() { |
412 | - give_get_template_part( 'single-give-form/title' ); |
|
412 | + give_get_template_part('single-give-form/title'); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * Conditional Functions |
418 | 418 | */ |
419 | 419 | |
420 | -if ( ! function_exists( 'is_give_form' ) ) { |
|
420 | +if ( ! function_exists('is_give_form')) { |
|
421 | 421 | |
422 | 422 | /** |
423 | 423 | * is_give_form |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | * @return bool |
430 | 430 | */ |
431 | 431 | function is_give_form() { |
432 | - return is_singular( array( 'give_form' ) ); |
|
432 | + return is_singular(array('give_form')); |
|
433 | 433 | } |
434 | 434 | } |
435 | 435 | |
436 | -if ( ! function_exists( 'is_give_category' ) ) { |
|
436 | +if ( ! function_exists('is_give_category')) { |
|
437 | 437 | |
438 | 438 | /** |
439 | 439 | * is_give_category |
@@ -448,12 +448,12 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return bool |
450 | 450 | */ |
451 | - function is_give_category( $term = '' ) { |
|
452 | - return is_tax( 'give_forms_category', $term ); |
|
451 | + function is_give_category($term = '') { |
|
452 | + return is_tax('give_forms_category', $term); |
|
453 | 453 | } |
454 | 454 | } |
455 | 455 | |
456 | -if ( ! function_exists( 'is_give_tag' ) ) { |
|
456 | +if ( ! function_exists('is_give_tag')) { |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * is_give_tag |
@@ -468,12 +468,12 @@ discard block |
||
468 | 468 | * |
469 | 469 | * @return bool |
470 | 470 | */ |
471 | - function is_give_tag( $term = '' ) { |
|
472 | - return is_tax( 'give_forms_tag', $term ); |
|
471 | + function is_give_tag($term = '') { |
|
472 | + return is_tax('give_forms_tag', $term); |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
476 | -if ( ! function_exists( 'is_give_taxonomy' ) ) { |
|
476 | +if ( ! function_exists('is_give_taxonomy')) { |
|
477 | 477 | |
478 | 478 | /** |
479 | 479 | * is_give_taxonomy |
@@ -485,6 +485,6 @@ discard block |
||
485 | 485 | * @return bool |
486 | 486 | */ |
487 | 487 | function is_give_taxonomy() { |
488 | - return is_tax( get_object_taxonomies( 'give_form' ) ); |
|
488 | + return is_tax(get_object_taxonomies('give_form')); |
|
489 | 489 | } |
490 | 490 | } |
@@ -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 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string $message Fully formatted message |
43 | 43 | */ |
44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
45 | - return give_do_email_tags( $message, $payment_id ); |
|
44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
45 | + return give_do_email_tags($message, $payment_id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -56,42 +56,42 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return string $message Fully formatted message |
58 | 58 | */ |
59 | -function give_email_preview_template_tags( $message ) { |
|
59 | +function give_email_preview_template_tags($message) { |
|
60 | 60 | |
61 | - $price = give_currency_filter( give_format_amount( 10.50 ) ); |
|
61 | + $price = give_currency_filter(give_format_amount(10.50)); |
|
62 | 62 | |
63 | 63 | $gateway = 'PayPal'; |
64 | 64 | |
65 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
65 | + $receipt_id = strtolower(md5(uniqid())); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ); |
|
69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())); |
|
70 | 70 | $receipt_link = sprintf( |
71 | 71 | '<a href="%1$s">%2$s</a>', |
72 | 72 | $receipt_link_url, |
73 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
73 | + esc_html__('View the receipt in your browser »', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $user = wp_get_current_user(); |
77 | 77 | |
78 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
79 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
80 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
81 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
82 | - $message = str_replace( '{amount}', $price, $message ); |
|
83 | - $message = str_replace( '{price}', $price, $message ); |
|
84 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
85 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
86 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
87 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
88 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
89 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
90 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
91 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
92 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
93 | - |
|
94 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
78 | + $message = str_replace('{name}', $user->display_name, $message); |
|
79 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
80 | + $message = str_replace('{username}', $user->user_login, $message); |
|
81 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
82 | + $message = str_replace('{amount}', $price, $message); |
|
83 | + $message = str_replace('{price}', $price, $message); |
|
84 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
85 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
86 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
87 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
88 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
89 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
90 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
91 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
92 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
93 | + |
|
94 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | * @since 1.0 |
104 | 104 | * @return array|bool |
105 | 105 | */ |
106 | -function give_email_template_preview( $array ) { |
|
106 | +function give_email_template_preview($array) { |
|
107 | 107 | |
108 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
108 | + if ( ! current_user_can('manage_give_settings')) { |
|
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | $custom_field = array( |
112 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
113 | - 'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ), |
|
112 | + 'name' => esc_html__('Preview Email', 'give'), |
|
113 | + 'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'), |
|
114 | 114 | 'id' => 'give_email_preview_buttons', |
115 | 115 | 'type' => 'email_preview_buttons' |
116 | 116 | ); |
117 | 117 | |
118 | - return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) ); |
|
118 | + return give_settings_array_insert($array, 'donation_subject', array($custom_field)); |
|
119 | 119 | |
120 | 120 | } |
121 | 121 | |
122 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
122 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Output Email Template Preview Buttons. |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | function give_email_preview_buttons_callback() { |
132 | 132 | ob_start(); |
133 | 133 | ?> |
134 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
135 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
134 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
135 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
136 | 136 | 'give_action' => 'send_test_email', |
137 | 137 | 'give-message' => 'sent-test-email', |
138 | 138 | 'tag' => 'emails' |
139 | - ) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
139 | + )), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
140 | 140 | <?php |
141 | 141 | echo ob_get_clean(); |
142 | 142 | } |
@@ -149,46 +149,46 @@ discard block |
||
149 | 149 | */ |
150 | 150 | function give_display_email_template_preview() { |
151 | 151 | |
152 | - if ( empty( $_GET['give_action'] ) ) { |
|
152 | + if (empty($_GET['give_action'])) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
156 | + if ('preview_email' !== $_GET['give_action']) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
160 | + if ( ! current_user_can('manage_give_settings')) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 | |
164 | 164 | |
165 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
165 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
166 | 166 | |
167 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
167 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
168 | 168 | |
169 | 169 | echo give_get_preview_email_header(); |
170 | 170 | |
171 | 171 | //Are we previewing an actual payment? |
172 | - if ( ! empty( $payment_id ) ) { |
|
172 | + if ( ! empty($payment_id)) { |
|
173 | 173 | |
174 | - $content = give_get_email_body_content( $payment_id ); |
|
174 | + $content = give_get_email_body_content($payment_id); |
|
175 | 175 | |
176 | - $preview_content = give_do_email_tags( $content, $payment_id ); |
|
176 | + $preview_content = give_do_email_tags($content, $payment_id); |
|
177 | 177 | |
178 | 178 | } else { |
179 | 179 | |
180 | 180 | //No payment ID, use sample preview content |
181 | - $preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
181 | + $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | - echo Give()->emails->build_email( $preview_content ); |
|
185 | + echo Give()->emails->build_email($preview_content); |
|
186 | 186 | |
187 | 187 | exit; |
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | -add_action( 'init', 'give_display_email_template_preview' ); |
|
191 | +add_action('init', 'give_display_email_template_preview'); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Email Template Body. |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string $email_body Body of the email |
202 | 202 | */ |
203 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
203 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
204 | 204 | |
205 | 205 | $default_email_body = give_get_default_donation_receipt_email(); |
206 | 206 | |
207 | - $email_content = give_get_option( 'donation_receipt' ); |
|
208 | - $email_content = ( $email_content ) ? stripslashes( $email_content ) : $default_email_body; |
|
207 | + $email_content = give_get_option('donation_receipt'); |
|
208 | + $email_content = ($email_content) ? stripslashes($email_content) : $default_email_body; |
|
209 | 209 | |
210 | - $email_body = wpautop( $email_content ); |
|
210 | + $email_body = wpautop($email_content); |
|
211 | 211 | |
212 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
212 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
213 | 213 | |
214 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
214 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -224,36 +224,36 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return string $email_body Body of the email |
226 | 226 | */ |
227 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
227 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
228 | 228 | |
229 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
230 | - $email = give_get_payment_user_email( $payment_id ); |
|
229 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
230 | + $email = give_get_payment_user_email($payment_id); |
|
231 | 231 | |
232 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
233 | - $user_data = get_userdata( $user_info['id'] ); |
|
232 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
233 | + $user_data = get_userdata($user_info['id']); |
|
234 | 234 | $name = $user_data->display_name; |
235 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
236 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
235 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
236 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
237 | 237 | } else { |
238 | 238 | $name = $email; |
239 | 239 | } |
240 | 240 | |
241 | - $gateway = give_get_gateway_admin_label( give_get_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
241 | + $gateway = give_get_gateway_admin_label(give_get_meta($payment_id, '_give_payment_gateway', true)); |
|
242 | 242 | |
243 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
244 | - $default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n"; |
|
245 | - $default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n"; |
|
246 | - $default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
247 | - $default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
248 | - $default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n"; |
|
249 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
243 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
244 | + $default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n"; |
|
245 | + $default_email_body .= esc_html__('Donation:', 'give')."\n\n"; |
|
246 | + $default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
247 | + $default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n"; |
|
248 | + $default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n"; |
|
249 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
250 | 250 | |
251 | - $email = give_get_option( 'donation_notification' ); |
|
252 | - $email = isset( $email ) ? stripslashes( $email ) : $default_email_body; |
|
251 | + $email = give_get_option('donation_notification'); |
|
252 | + $email = isset($email) ? stripslashes($email) : $default_email_body; |
|
253 | 253 | |
254 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
254 | + $email_body = give_do_email_tags($email, $payment_id); |
|
255 | 255 | |
256 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
256 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -266,19 +266,19 @@ discard block |
||
266 | 266 | * @since 1.0 |
267 | 267 | */ |
268 | 268 | function give_render_receipt_in_browser() { |
269 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
270 | - wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
269 | + if ( ! isset($_GET['payment_key'])) { |
|
270 | + wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
271 | 271 | } |
272 | 272 | |
273 | - $key = urlencode( $_GET['payment_key'] ); |
|
273 | + $key = urlencode($_GET['payment_key']); |
|
274 | 274 | |
275 | 275 | ob_start(); |
276 | 276 | //Disallows caching of the page |
277 | - header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); |
|
278 | - header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 |
|
279 | - header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
280 | - header( "Pragma: no-cache" ); // HTTP/1.0 |
|
281 | - header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past |
|
277 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
278 | + header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
|
279 | + header("Cache-Control: post-check=0, pre-check=0", false); |
|
280 | + header("Pragma: no-cache"); // HTTP/1.0 |
|
281 | + header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past |
|
282 | 282 | ?> |
283 | 283 | <!DOCTYPE html> |
284 | 284 | <html lang="en"> |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @since 1.0 |
291 | 291 | */ |
292 | - do_action( 'give_receipt_head' ); |
|
292 | + do_action('give_receipt_head'); |
|
293 | 293 | ?> |
294 | 294 | </head> |
295 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
295 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
296 | 296 | |
297 | 297 | <div id="give_receipt_wrapper"> |
298 | 298 | <?php |
@@ -301,16 +301,16 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @since 1.0 |
303 | 303 | */ |
304 | - do_action( 'give_render_receipt_in_browser_before' ); |
|
304 | + do_action('give_render_receipt_in_browser_before'); |
|
305 | 305 | |
306 | - echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); |
|
306 | + echo do_shortcode('[give_receipt payment_key='.$key.']'); |
|
307 | 307 | |
308 | 308 | /** |
309 | 309 | * Fires in the receipt template after the content. |
310 | 310 | * |
311 | 311 | * @since 1.0 |
312 | 312 | */ |
313 | - do_action( 'give_render_receipt_in_browser_after' ); |
|
313 | + do_action('give_render_receipt_in_browser_after'); |
|
314 | 314 | ?> |
315 | 315 | </div> |
316 | 316 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @since 1.0 |
322 | 322 | */ |
323 | - do_action( 'give_receipt_footer' ); |
|
323 | + do_action('give_receipt_footer'); |
|
324 | 324 | ?> |
325 | 325 | </body> |
326 | 326 | </html> |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | die(); |
330 | 330 | } |
331 | 331 | |
332 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
332 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
|
333 | 333 | |
334 | 334 | |
335 | 335 | /** |
@@ -344,29 +344,29 @@ discard block |
||
344 | 344 | |
345 | 345 | //Payment receipt switcher |
346 | 346 | $payment_count = give_count_payments()->publish; |
347 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
347 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
348 | 348 | |
349 | - if ( $payment_count <= 0 ) { |
|
349 | + if ($payment_count <= 0) { |
|
350 | 350 | return false; |
351 | 351 | } |
352 | 352 | |
353 | 353 | //Get payments. |
354 | - $payments = new Give_Payments_Query( array( |
|
354 | + $payments = new Give_Payments_Query(array( |
|
355 | 355 | 'number' => 100 |
356 | - ) ); |
|
356 | + )); |
|
357 | 357 | $payments = $payments->get_payments(); |
358 | 358 | $options = array(); |
359 | 359 | |
360 | 360 | //Provide nice human readable options. |
361 | - if ( $payments ) { |
|
362 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
363 | - foreach ( $payments as $payment ) { |
|
361 | + if ($payments) { |
|
362 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
363 | + foreach ($payments as $payment) { |
|
364 | 364 | |
365 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
365 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
366 | 366 | |
367 | 367 | } |
368 | 368 | } else { |
369 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
369 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | //Start constructing HTML output. |
@@ -379,16 +379,16 @@ discard block |
||
379 | 379 | var selected_trans = transactions.options[transactions.selectedIndex]; |
380 | 380 | console.log(selected_trans); |
381 | 381 | if (selected_trans){ |
382 | - var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value; |
|
382 | + var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value; |
|
383 | 383 | window.location = url_string; |
384 | 384 | } |
385 | 385 | } |
386 | 386 | </script>'; |
387 | 387 | |
388 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
388 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
389 | 389 | |
390 | 390 | //The select field with 100 latest transactions |
391 | - $transaction_header .= Give()->html->select( array( |
|
391 | + $transaction_header .= Give()->html->select(array( |
|
392 | 392 | 'name' => 'preview_email_payment_id', |
393 | 393 | 'selected' => $payment_id, |
394 | 394 | 'id' => 'give_preview_email_payment_id', |
@@ -398,12 +398,12 @@ discard block |
||
398 | 398 | 'select_atts' => 'onchange="change_preview()">', |
399 | 399 | 'show_option_all' => false, |
400 | 400 | 'show_option_none' => false |
401 | - ) ); |
|
401 | + )); |
|
402 | 402 | |
403 | 403 | //Closing tag |
404 | 404 | $transaction_header .= '</div>'; |
405 | 405 | |
406 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
406 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
407 | 407 | |
408 | 408 | } |
409 | 409 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | function give_receipt_head_content() { |
418 | 418 | |
419 | 419 | //Title. |
420 | - $output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>'; |
|
420 | + $output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>'; |
|
421 | 421 | |
422 | 422 | //Meta. |
423 | 423 | $output .= '<meta charset="utf-8"/> |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | <meta name="robots" content="noindex, nofollow"/>'; |
432 | 432 | |
433 | 433 | //CSS |
434 | - $output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">'; |
|
434 | + $output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">'; |
|
435 | 435 | |
436 | - echo apply_filters( 'give_receipt_head_content', $output ); |
|
436 | + echo apply_filters('give_receipt_head_content', $output); |
|
437 | 437 | |
438 | 438 | } |
439 | 439 | |
440 | -add_action( 'give_receipt_head', 'give_receipt_head_content' ); |
|
441 | 440 | \ No newline at end of file |
441 | +add_action('give_receipt_head', 'give_receipt_head_content'); |
|
442 | 442 | \ 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 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | 32 | |
33 | 33 | // Make sure that payments are only completed once. |
34 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
34 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Make sure the payment completion is only processed when new status is complete. |
39 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
39 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $payment = new Give_Payment( $payment_id ); |
|
43 | + $payment = new Give_Payment($payment_id); |
|
44 | 44 | |
45 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
45 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
46 | 46 | $payment_meta = $payment->payment_meta; |
47 | 47 | $completed_date = $payment->completed_date; |
48 | 48 | $user_info = $payment->user_info; |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param int $payment_id The ID of the payment. |
60 | 60 | */ |
61 | - do_action( 'give_pre_complete_donation', $payment_id ); |
|
61 | + do_action('give_pre_complete_donation', $payment_id); |
|
62 | 62 | |
63 | 63 | // Ensure these actions only run once, ever. |
64 | - if ( empty( $completed_date ) ) { |
|
64 | + if (empty($completed_date)) { |
|
65 | 65 | |
66 | - give_record_donation_in_log( $form_id, $payment_id, $price_id, $creation_date ); |
|
66 | + give_record_donation_in_log($form_id, $payment_id, $price_id, $creation_date); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Fires after logging donation record. |
@@ -74,29 +74,29 @@ discard block |
||
74 | 74 | * @param int $payment_id The ID number of the payment. |
75 | 75 | * @param array $payment_meta The payment meta. |
76 | 76 | */ |
77 | - do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta ); |
|
77 | + do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta); |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Increase the earnings for this form ID. |
82 | - give_increase_earnings( $form_id, $amount ); |
|
83 | - give_increase_donation_count( $form_id ); |
|
82 | + give_increase_earnings($form_id, $amount); |
|
83 | + give_increase_donation_count($form_id); |
|
84 | 84 | |
85 | 85 | // @todo: Refresh only range related stat cache |
86 | 86 | give_delete_donation_stats(); |
87 | 87 | |
88 | 88 | // Increase the donor's donation stats. |
89 | - $donor = new Give_Donor( $donor_id ); |
|
89 | + $donor = new Give_Donor($donor_id); |
|
90 | 90 | $donor->increase_purchase_count(); |
91 | - $donor->increase_value( $amount ); |
|
91 | + $donor->increase_value($amount); |
|
92 | 92 | |
93 | - give_increase_total_earnings( $amount ); |
|
93 | + give_increase_total_earnings($amount); |
|
94 | 94 | |
95 | 95 | // Ensure this action only runs once ever. |
96 | - if ( empty( $completed_date ) ) { |
|
96 | + if (empty($completed_date)) { |
|
97 | 97 | |
98 | 98 | // Save the completed date. |
99 | - $payment->completed_date = current_time( 'mysql' ); |
|
99 | + $payment->completed_date = current_time('mysql'); |
|
100 | 100 | $payment->save(); |
101 | 101 | |
102 | 102 | /** |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param int $payment_id The ID of the payment. |
108 | 108 | */ |
109 | - do_action( 'give_complete_donation', $payment_id ); |
|
109 | + do_action('give_complete_donation', $payment_id); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | } |
113 | 113 | |
114 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
114 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
115 | 115 | |
116 | 116 | |
117 | 117 | /** |
@@ -125,20 +125,20 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
128 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
129 | 129 | |
130 | 130 | // Get the list of statuses so that status in the payment note can be translated. |
131 | 131 | $stati = give_get_payment_statuses(); |
132 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
133 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
132 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
133 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
134 | 134 | |
135 | 135 | // translators: 1: old status 2: new status. |
136 | - $status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status ); |
|
136 | + $status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status); |
|
137 | 137 | |
138 | - give_insert_payment_note( $payment_id, $status_change ); |
|
138 | + give_insert_payment_note($payment_id, $status_change); |
|
139 | 139 | } |
140 | 140 | |
141 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
141 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
@@ -154,25 +154,25 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return void |
156 | 156 | */ |
157 | -function give_update_old_payments_with_totals( $data ) { |
|
158 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
157 | +function give_update_old_payments_with_totals($data) { |
|
158 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
162 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
162 | + if (get_option('give_payment_totals_upgraded')) { |
|
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | - $payments = give_get_payments( array( |
|
166 | + $payments = give_get_payments(array( |
|
167 | 167 | 'offset' => 0, |
168 | - 'number' => - 1, |
|
168 | + 'number' => -1, |
|
169 | 169 | 'mode' => 'all', |
170 | - ) ); |
|
170 | + )); |
|
171 | 171 | |
172 | - if ( $payments ) { |
|
173 | - foreach ( $payments as $payment ) { |
|
172 | + if ($payments) { |
|
173 | + foreach ($payments as $payment) { |
|
174 | 174 | |
175 | - $payment = new Give_Payment( $payment->ID ); |
|
175 | + $payment = new Give_Payment($payment->ID); |
|
176 | 176 | $meta = $payment->get_meta(); |
177 | 177 | |
178 | 178 | $payment->total = $meta['amount']; |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
184 | + add_option('give_payment_totals_upgraded', 1); |
|
185 | 185 | } |
186 | 186 | |
187 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
187 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Mark Abandoned Donations |
@@ -198,17 +198,17 @@ discard block |
||
198 | 198 | function give_mark_abandoned_donations() { |
199 | 199 | $args = array( |
200 | 200 | 'status' => 'pending', |
201 | - 'number' => - 1, |
|
201 | + 'number' => -1, |
|
202 | 202 | 'output' => 'give_payments', |
203 | 203 | ); |
204 | 204 | |
205 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
205 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
206 | 206 | |
207 | - $payments = give_get_payments( $args ); |
|
207 | + $payments = give_get_payments($args); |
|
208 | 208 | |
209 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
209 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
210 | 210 | |
211 | - if ( $payments ) { |
|
211 | + if ($payments) { |
|
212 | 212 | /** |
213 | 213 | * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon. |
214 | 214 | * |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @param array $skip_payment_gateways Array of payment gateways |
218 | 218 | */ |
219 | - $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) ); |
|
219 | + $skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline')); |
|
220 | 220 | |
221 | - foreach ( $payments as $payment ) { |
|
222 | - $gateway = give_get_payment_gateway( $payment ); |
|
221 | + foreach ($payments as $payment) { |
|
222 | + $gateway = give_get_payment_gateway($payment); |
|
223 | 223 | |
224 | 224 | // Skip payment gateways. |
225 | - if ( in_array( $gateway, $skip_payment_gateways ) ) { |
|
225 | + if (in_array($gateway, $skip_payment_gateways)) { |
|
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
235 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
235 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | /** |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return void |
246 | 246 | */ |
247 | -function give_refresh_thismonth_stat_transients( $payment_ID ) { |
|
247 | +function give_refresh_thismonth_stat_transients($payment_ID) { |
|
248 | 248 | // Monthly stats. |
249 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
249 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
250 | 250 | |
251 | 251 | // @todo: Refresh only range related stat cache |
252 | 252 | give_delete_donation_stats(); |
253 | 253 | } |
254 | 254 | |
255 | -add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' ); |
|
255 | +add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients'); |
@@ -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 | |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function get_predefined_dates() { |
95 | 95 | $predefined = array( |
96 | - 'today' => esc_html__( 'Today', 'give' ), |
|
97 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
98 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
99 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
100 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
101 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
102 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
103 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
104 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
105 | - 'last_year' => esc_html__( 'Last Year', 'give' ) |
|
96 | + 'today' => esc_html__('Today', 'give'), |
|
97 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
98 | + 'this_week' => esc_html__('This Week', 'give'), |
|
99 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
100 | + 'this_month' => esc_html__('This Month', 'give'), |
|
101 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
102 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
103 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
104 | + 'this_year' => esc_html__('This Year', 'give'), |
|
105 | + 'last_year' => esc_html__('Last Year', 'give') |
|
106 | 106 | ); |
107 | 107 | |
108 | - return apply_filters( 'give_stats_predefined_dates', $predefined ); |
|
108 | + return apply_filters('give_stats_predefined_dates', $predefined); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return void |
123 | 123 | */ |
124 | - public function setup_dates( $_start_date = 'this_month', $_end_date = false ) { |
|
124 | + public function setup_dates($_start_date = 'this_month', $_end_date = false) { |
|
125 | 125 | |
126 | - if ( empty( $_start_date ) ) { |
|
126 | + if (empty($_start_date)) { |
|
127 | 127 | $_start_date = 'this_month'; |
128 | 128 | } |
129 | 129 | |
130 | - if ( empty( $_end_date ) ) { |
|
130 | + if (empty($_end_date)) { |
|
131 | 131 | $_end_date = $_start_date; |
132 | 132 | } |
133 | 133 | |
134 | - $this->start_date = $this->convert_date( $_start_date ); |
|
135 | - $this->end_date = $this->convert_date( $_end_date, true ); |
|
134 | + $this->start_date = $this->convert_date($_start_date); |
|
135 | + $this->end_date = $this->convert_date($_end_date, true); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return array|WP_Error If the date is invalid, a WP_Error object will be returned. |
150 | 150 | */ |
151 | - public function convert_date( $date, $end_date = false ) { |
|
151 | + public function convert_date($date, $end_date = false) { |
|
152 | 152 | |
153 | 153 | $this->timestamp = false; |
154 | 154 | $second = $end_date ? 59 : 0; |
155 | 155 | $minute = $end_date ? 59 : 0; |
156 | 156 | $hour = $end_date ? 23 : 0; |
157 | 157 | $day = 1; |
158 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
159 | - $year = date( 'Y', current_time( 'timestamp' ) ); |
|
158 | + $month = date('n', current_time('timestamp')); |
|
159 | + $year = date('Y', current_time('timestamp')); |
|
160 | 160 | |
161 | - if ( array_key_exists( $date, $this->get_predefined_dates() ) ) { |
|
161 | + if (array_key_exists($date, $this->get_predefined_dates())) { |
|
162 | 162 | |
163 | 163 | // This is a predefined date rate, such as last_week |
164 | - switch ( $date ) { |
|
164 | + switch ($date) { |
|
165 | 165 | |
166 | 166 | case 'this_month' : |
167 | 167 | |
168 | - if ( $end_date ) { |
|
168 | + if ($end_date) { |
|
169 | 169 | |
170 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
170 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
171 | 171 | $hour = 23; |
172 | 172 | $minute = 59; |
173 | 173 | $second = 59; |
@@ -177,28 +177,28 @@ discard block |
||
177 | 177 | |
178 | 178 | case 'last_month' : |
179 | 179 | |
180 | - if ( $month == 1 ) { |
|
180 | + if ($month == 1) { |
|
181 | 181 | |
182 | 182 | $month = 12; |
183 | - $year --; |
|
183 | + $year--; |
|
184 | 184 | |
185 | 185 | } else { |
186 | 186 | |
187 | - $month --; |
|
187 | + $month--; |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | - if ( $end_date ) { |
|
192 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
191 | + if ($end_date) { |
|
192 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | break; |
196 | 196 | |
197 | 197 | case 'today' : |
198 | 198 | |
199 | - $day = date( 'd', current_time( 'timestamp' ) ); |
|
199 | + $day = date('d', current_time('timestamp')); |
|
200 | 200 | |
201 | - if ( $end_date ) { |
|
201 | + if ($end_date) { |
|
202 | 202 | $hour = 23; |
203 | 203 | $minute = 59; |
204 | 204 | $second = 59; |
@@ -208,23 +208,23 @@ discard block |
||
208 | 208 | |
209 | 209 | case 'yesterday' : |
210 | 210 | |
211 | - $day = date( 'd', current_time( 'timestamp' ) ) - 1; |
|
211 | + $day = date('d', current_time('timestamp')) - 1; |
|
212 | 212 | |
213 | 213 | // Check if Today is the first day of the month (meaning subtracting one will get us 0) |
214 | - if ( $day < 1 ) { |
|
214 | + if ($day < 1) { |
|
215 | 215 | |
216 | 216 | // If current month is 1 |
217 | - if ( 1 == $month ) { |
|
217 | + if (1 == $month) { |
|
218 | 218 | |
219 | 219 | $year -= 1; // Today is January 1, so skip back to last day of December |
220 | 220 | $month = 12; |
221 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
221 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
222 | 222 | |
223 | 223 | } else { |
224 | 224 | |
225 | 225 | // Go back one month and get the last day of the month |
226 | 226 | $month -= 1; |
227 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
227 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
228 | 228 | |
229 | 229 | } |
230 | 230 | } |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | |
234 | 234 | case 'this_week' : |
235 | 235 | |
236 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
237 | - $today = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
236 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
237 | + $today = date('d', current_time('timestamp')) * 60 * 60 * 24; |
|
238 | 238 | |
239 | - if ( $today < $days_to_week_start ) { |
|
239 | + if ($today < $days_to_week_start) { |
|
240 | 240 | |
241 | - if ( $month > 1 ) { |
|
241 | + if ($month > 1) { |
|
242 | 242 | $month -= 1; |
243 | 243 | } else { |
244 | 244 | $month = 12; |
@@ -246,19 +246,19 @@ discard block |
||
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | - if ( ! $end_date ) { |
|
249 | + if ( ! $end_date) { |
|
250 | 250 | |
251 | 251 | // Getting the start day |
252 | 252 | |
253 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
254 | - $day += get_option( 'start_of_week' ); |
|
253 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
254 | + $day += get_option('start_of_week'); |
|
255 | 255 | |
256 | 256 | } else { |
257 | 257 | |
258 | 258 | // Getting the end day |
259 | 259 | |
260 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
261 | - $day += get_option( 'start_of_week' ) + 6; |
|
260 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
261 | + $day += get_option('start_of_week') + 6; |
|
262 | 262 | |
263 | 263 | } |
264 | 264 | |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | |
267 | 267 | case 'last_week' : |
268 | 268 | |
269 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
270 | - $today = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
269 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
270 | + $today = date('d', current_time('timestamp')) * 60 * 60 * 24; |
|
271 | 271 | |
272 | - if ( $today < $days_to_week_start ) { |
|
272 | + if ($today < $days_to_week_start) { |
|
273 | 273 | |
274 | - if ( $month > 1 ) { |
|
274 | + if ($month > 1) { |
|
275 | 275 | $month -= 1; |
276 | 276 | } else { |
277 | 277 | $month = 12; |
@@ -279,19 +279,19 @@ discard block |
||
279 | 279 | |
280 | 280 | } |
281 | 281 | |
282 | - if ( ! $end_date ) { |
|
282 | + if ( ! $end_date) { |
|
283 | 283 | |
284 | 284 | // Getting the start day |
285 | 285 | |
286 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
287 | - $day += get_option( 'start_of_week' ); |
|
286 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
287 | + $day += get_option('start_of_week'); |
|
288 | 288 | |
289 | 289 | } else { |
290 | 290 | |
291 | 291 | // Getting the end day |
292 | 292 | |
293 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
294 | - $day += get_option( 'start_of_week' ) + 6; |
|
293 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
294 | + $day += get_option('start_of_week') + 6; |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | |
@@ -299,39 +299,39 @@ discard block |
||
299 | 299 | |
300 | 300 | case 'this_quarter' : |
301 | 301 | |
302 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
302 | + $month_now = date('n', current_time('timestamp')); |
|
303 | 303 | |
304 | - if ( $month_now <= 3 ) { |
|
304 | + if ($month_now <= 3) { |
|
305 | 305 | |
306 | - if ( ! $end_date ) { |
|
306 | + if ( ! $end_date) { |
|
307 | 307 | $month = 1; |
308 | 308 | } else { |
309 | 309 | $month = 3; |
310 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
310 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
311 | 311 | $hour = 23; |
312 | 312 | $minute = 59; |
313 | 313 | $second = 59; |
314 | 314 | } |
315 | 315 | |
316 | - } else if ( $month_now <= 6 ) { |
|
316 | + } else if ($month_now <= 6) { |
|
317 | 317 | |
318 | - if ( ! $end_date ) { |
|
318 | + if ( ! $end_date) { |
|
319 | 319 | $month = 4; |
320 | 320 | } else { |
321 | 321 | $month = 6; |
322 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
322 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
323 | 323 | $hour = 23; |
324 | 324 | $minute = 59; |
325 | 325 | $second = 59; |
326 | 326 | } |
327 | 327 | |
328 | - } else if ( $month_now <= 9 ) { |
|
328 | + } else if ($month_now <= 9) { |
|
329 | 329 | |
330 | - if ( ! $end_date ) { |
|
330 | + if ( ! $end_date) { |
|
331 | 331 | $month = 7; |
332 | 332 | } else { |
333 | 333 | $month = 9; |
334 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
334 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
335 | 335 | $hour = 23; |
336 | 336 | $minute = 59; |
337 | 337 | $second = 59; |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | |
340 | 340 | } else { |
341 | 341 | |
342 | - if ( ! $end_date ) { |
|
342 | + if ( ! $end_date) { |
|
343 | 343 | $month = 10; |
344 | 344 | } else { |
345 | 345 | $month = 12; |
346 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
346 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
347 | 347 | $hour = 23; |
348 | 348 | $minute = 59; |
349 | 349 | $second = 59; |
@@ -355,40 +355,40 @@ discard block |
||
355 | 355 | |
356 | 356 | case 'last_quarter' : |
357 | 357 | |
358 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
358 | + $month_now = date('n', current_time('timestamp')); |
|
359 | 359 | |
360 | - if ( $month_now <= 3 ) { |
|
360 | + if ($month_now <= 3) { |
|
361 | 361 | |
362 | - if ( ! $end_date ) { |
|
362 | + if ( ! $end_date) { |
|
363 | 363 | $month = 10; |
364 | 364 | } else { |
365 | 365 | $year -= 1; |
366 | 366 | $month = 12; |
367 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
367 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
368 | 368 | $hour = 23; |
369 | 369 | $minute = 59; |
370 | 370 | $second = 59; |
371 | 371 | } |
372 | 372 | |
373 | - } else if ( $month_now <= 6 ) { |
|
373 | + } else if ($month_now <= 6) { |
|
374 | 374 | |
375 | - if ( ! $end_date ) { |
|
375 | + if ( ! $end_date) { |
|
376 | 376 | $month = 1; |
377 | 377 | } else { |
378 | 378 | $month = 3; |
379 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
379 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
380 | 380 | $hour = 23; |
381 | 381 | $minute = 59; |
382 | 382 | $second = 59; |
383 | 383 | } |
384 | 384 | |
385 | - } else if ( $month_now <= 9 ) { |
|
385 | + } else if ($month_now <= 9) { |
|
386 | 386 | |
387 | - if ( ! $end_date ) { |
|
387 | + if ( ! $end_date) { |
|
388 | 388 | $month = 4; |
389 | 389 | } else { |
390 | 390 | $month = 6; |
391 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
391 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
392 | 392 | $hour = 23; |
393 | 393 | $minute = 59; |
394 | 394 | $second = 59; |
@@ -396,11 +396,11 @@ discard block |
||
396 | 396 | |
397 | 397 | } else { |
398 | 398 | |
399 | - if ( ! $end_date ) { |
|
399 | + if ( ! $end_date) { |
|
400 | 400 | $month = 7; |
401 | 401 | } else { |
402 | 402 | $month = 9; |
403 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
403 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
404 | 404 | $hour = 23; |
405 | 405 | $minute = 59; |
406 | 406 | $second = 59; |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | |
413 | 413 | case 'this_year' : |
414 | 414 | |
415 | - if ( ! $end_date ) { |
|
415 | + if ( ! $end_date) { |
|
416 | 416 | $month = 1; |
417 | 417 | } else { |
418 | 418 | $month = 12; |
419 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
419 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
420 | 420 | $hour = 23; |
421 | 421 | $minute = 59; |
422 | 422 | $second = 59; |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | case 'last_year' : |
428 | 428 | |
429 | 429 | $year -= 1; |
430 | - if ( ! $end_date ) { |
|
430 | + if ( ! $end_date) { |
|
431 | 431 | $month = 1; |
432 | 432 | } else { |
433 | 433 | $month = 12; |
434 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
434 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
435 | 435 | $hour = 23; |
436 | 436 | $minute = 59; |
437 | 437 | $second = 59; |
@@ -442,30 +442,30 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | |
445 | - } else if ( is_numeric( $date ) ) { |
|
445 | + } else if (is_numeric($date)) { |
|
446 | 446 | |
447 | 447 | // return $date unchanged since it is a timestamp |
448 | 448 | $this->timestamp = true; |
449 | 449 | |
450 | - } else if ( false !== strtotime( $date ) ) { |
|
450 | + } else if (false !== strtotime($date)) { |
|
451 | 451 | |
452 | - $date = strtotime( $date, current_time( 'timestamp' ) ); |
|
453 | - $year = date( 'Y', $date ); |
|
454 | - $month = date( 'm', $date ); |
|
455 | - $day = date( 'd', $date ); |
|
452 | + $date = strtotime($date, current_time('timestamp')); |
|
453 | + $year = date('Y', $date); |
|
454 | + $month = date('m', $date); |
|
455 | + $day = date('d', $date); |
|
456 | 456 | |
457 | 457 | } else { |
458 | 458 | |
459 | - return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) ); |
|
459 | + return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give')); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
463 | - if ( false === $this->timestamp ) { |
|
463 | + if (false === $this->timestamp) { |
|
464 | 464 | // Create an exact timestamp |
465 | - $date = mktime( $hour, $minute, $second, $month, $day, $year ); |
|
465 | + $date = mktime($hour, $minute, $second, $month, $day, $year); |
|
466 | 466 | } |
467 | 467 | |
468 | - return apply_filters( 'give_stats_date', $date, $end_date, $this ); |
|
468 | + return apply_filters('give_stats_date', $date, $end_date, $this); |
|
469 | 469 | |
470 | 470 | } |
471 | 471 | |
@@ -481,33 +481,33 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @return string |
483 | 483 | */ |
484 | - public function count_where( $where = '' ) { |
|
484 | + public function count_where($where = '') { |
|
485 | 485 | // Only get payments in our date range |
486 | 486 | |
487 | 487 | $start_where = ''; |
488 | 488 | $end_where = ''; |
489 | 489 | |
490 | - if ( $this->start_date ) { |
|
490 | + if ($this->start_date) { |
|
491 | 491 | |
492 | - if ( $this->timestamp ) { |
|
492 | + if ($this->timestamp) { |
|
493 | 493 | $format = 'Y-m-d H:i:s'; |
494 | 494 | } else { |
495 | 495 | $format = 'Y-m-d 00:00:00'; |
496 | 496 | } |
497 | 497 | |
498 | - $start_date = date( $format, $this->start_date ); |
|
498 | + $start_date = date($format, $this->start_date); |
|
499 | 499 | $start_where = " AND p.post_date >= '{$start_date}'"; |
500 | 500 | } |
501 | 501 | |
502 | - if ( $this->end_date ) { |
|
502 | + if ($this->end_date) { |
|
503 | 503 | |
504 | - if ( $this->timestamp ) { |
|
504 | + if ($this->timestamp) { |
|
505 | 505 | $format = 'Y-m-d H:i:s'; |
506 | 506 | } else { |
507 | 507 | $format = 'Y-m-d 23:59:59'; |
508 | 508 | } |
509 | 509 | |
510 | - $end_date = date( $format, $this->end_date ); |
|
510 | + $end_date = date($format, $this->end_date); |
|
511 | 511 | |
512 | 512 | $end_where = " AND p.post_date <= '{$end_date}'"; |
513 | 513 | } |
@@ -529,34 +529,34 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @return string |
531 | 531 | */ |
532 | - public function payments_where( $where = '' ) { |
|
532 | + public function payments_where($where = '') { |
|
533 | 533 | |
534 | 534 | global $wpdb; |
535 | 535 | |
536 | 536 | $start_where = ''; |
537 | 537 | $end_where = ''; |
538 | 538 | |
539 | - if ( ! is_wp_error( $this->start_date ) ) { |
|
539 | + if ( ! is_wp_error($this->start_date)) { |
|
540 | 540 | |
541 | - if ( $this->timestamp ) { |
|
541 | + if ($this->timestamp) { |
|
542 | 542 | $format = 'Y-m-d H:i:s'; |
543 | 543 | } else { |
544 | 544 | $format = 'Y-m-d 00:00:00'; |
545 | 545 | } |
546 | 546 | |
547 | - $start_date = date( $format, $this->start_date ); |
|
547 | + $start_date = date($format, $this->start_date); |
|
548 | 548 | $start_where = " AND $wpdb->posts.post_date >= '{$start_date}'"; |
549 | 549 | } |
550 | 550 | |
551 | - if ( ! is_wp_error( $this->end_date ) ) { |
|
551 | + if ( ! is_wp_error($this->end_date)) { |
|
552 | 552 | |
553 | - if ( $this->timestamp ) { |
|
553 | + if ($this->timestamp) { |
|
554 | 554 | $format = 'Y-m-d H:i:s'; |
555 | 555 | } else { |
556 | 556 | $format = 'Y-m-d 23:59:59'; |
557 | 557 | } |
558 | 558 | |
559 | - $end_date = date( $format, $this->end_date ); |
|
559 | + $end_date = date($format, $this->end_date); |
|
560 | 560 | |
561 | 561 | $end_where = " AND $wpdb->posts.post_date <= '{$end_date}'"; |
562 | 562 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | ) { |
45 | 45 | // If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache. |
46 | 46 | if ( (is_plugin_active( 'wordpress-seo/wp-seo.php' ) |
47 | - || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' )) |
|
47 | + || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' )) |
|
48 | 48 | && class_exists( 'WPSEO_Sitemaps_Cache' ) |
49 | 49 | ) { |
50 | 50 | $yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache(); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | * @return void |
20 | 20 | */ |
21 | 21 | function give_disable_mandrill_nl2br() { |
22 | - add_filter( 'mandrill_nl2br', '__return_false' ); |
|
22 | + add_filter('mandrill_nl2br', '__return_false'); |
|
23 | 23 | } |
24 | -add_action( 'give_email_send_before', 'give_disable_mandrill_nl2br' ); |
|
24 | +add_action('give_email_send_before', 'give_disable_mandrill_nl2br'); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | /** |
@@ -33,26 +33,26 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function give_clear_seo_sitemap_cache_on_settings_change() { |
35 | 35 | // Load required file if the fn 'is_plugin_active' doesn't exists. |
36 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
37 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
36 | + if ( ! function_exists('is_plugin_active')) { |
|
37 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // If there is change detected for Single Form View and Form Archives options then proceed. |
41 | 41 | if ( |
42 | - ( $_POST['forms_singular'] != give_get_option( 'forms_singular' ) ) || |
|
43 | - ( $_POST['forms_archives'] != give_get_option( 'forms_archives' ) ) |
|
42 | + ($_POST['forms_singular'] != give_get_option('forms_singular')) || |
|
43 | + ($_POST['forms_archives'] != give_get_option('forms_archives')) |
|
44 | 44 | ) { |
45 | 45 | // If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache. |
46 | - if ( (is_plugin_active( 'wordpress-seo/wp-seo.php' ) |
|
47 | - || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' )) |
|
48 | - && class_exists( 'WPSEO_Sitemaps_Cache' ) |
|
46 | + if ((is_plugin_active('wordpress-seo/wp-seo.php') |
|
47 | + || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) |
|
48 | + && class_exists('WPSEO_Sitemaps_Cache') |
|
49 | 49 | ) { |
50 | 50 | $yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache(); |
51 | - if ( method_exists( $yoast_sitemaps_cache, 'clear' ) ) { |
|
51 | + if (method_exists($yoast_sitemaps_cache, 'clear')) { |
|
52 | 52 | WPSEO_Sitemaps_Cache::clear(); |
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | -add_action( 'give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change' ); |
|
58 | +add_action('give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change'); |
@@ -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 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /* @var WPDB $wpdb */ |
34 | 34 | global $wpdb; |
35 | 35 | |
36 | - $wpdb->customermeta = $this->table_name = $wpdb->prefix . 'give_customermeta'; |
|
36 | + $wpdb->customermeta = $this->table_name = $wpdb->prefix.'give_customermeta'; |
|
37 | 37 | $this->primary_key = 'meta_id'; |
38 | 38 | $this->version = '1.0'; |
39 | 39 | |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true. |
73 | 73 | */ |
74 | - public function get_meta( $donor_id = 0, $meta_key = '', $single = false ) { |
|
75 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
76 | - if ( false === $donor_id ) { |
|
74 | + public function get_meta($donor_id = 0, $meta_key = '', $single = false) { |
|
75 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
76 | + if (false === $donor_id) { |
|
77 | 77 | return false; |
78 | 78 | } |
79 | 79 | |
80 | - return get_metadata( 'customer', $donor_id, $meta_key, $single ); |
|
80 | + return get_metadata('customer', $donor_id, $meta_key, $single); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return bool False for failure. True for success. |
97 | 97 | */ |
98 | - public function add_meta( $donor_id = 0, $meta_key = '', $meta_value, $unique = false ) { |
|
99 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
100 | - if ( false === $donor_id ) { |
|
98 | + public function add_meta($donor_id = 0, $meta_key = '', $meta_value, $unique = false) { |
|
99 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
100 | + if (false === $donor_id) { |
|
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | - return add_metadata( 'customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
104 | + return add_metadata('customer', $donor_id, $meta_key, $meta_value, $unique); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return bool False on failure, true if success. |
126 | 126 | */ |
127 | - public function update_meta( $donor_id = 0, $meta_key = '', $meta_value, $prev_value = '' ) { |
|
128 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
129 | - if ( false === $donor_id ) { |
|
127 | + public function update_meta($donor_id = 0, $meta_key = '', $meta_value, $prev_value = '') { |
|
128 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
129 | + if (false === $donor_id) { |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | |
133 | - return update_metadata( 'customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
133 | + return update_metadata('customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return bool False for failure. True for success. |
153 | 153 | */ |
154 | - public function delete_meta( $donor_id = 0, $meta_key = '', $meta_value = '' ) { |
|
155 | - return delete_metadata( 'customer', $donor_id, $meta_key, $meta_value ); |
|
154 | + public function delete_meta($donor_id = 0, $meta_key = '', $meta_value = '') { |
|
155 | + return delete_metadata('customer', $donor_id, $meta_key, $meta_value); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function create_table() { |
167 | 167 | |
168 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
168 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
169 | 169 | |
170 | 170 | $sql = "CREATE TABLE {$this->table_name} ( |
171 | 171 | meta_id bigint(20) NOT NULL AUTO_INCREMENT, |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | KEY meta_key (meta_key) |
178 | 178 | ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; |
179 | 179 | |
180 | - dbDelta( $sql ); |
|
180 | + dbDelta($sql); |
|
181 | 181 | |
182 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
182 | + update_option($this->table_name.'_db_version', $this->version); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -192,23 +192,23 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return int|bool The normalized donor ID or false if it's found to not be valid. |
194 | 194 | */ |
195 | - private function sanitize_donor_id( $donor_id ) { |
|
196 | - if ( ! is_numeric( $donor_id ) ) { |
|
195 | + private function sanitize_donor_id($donor_id) { |
|
196 | + if ( ! is_numeric($donor_id)) { |
|
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | |
200 | 200 | $donor_id = (int) $donor_id; |
201 | 201 | |
202 | 202 | // We were given a non positive number. |
203 | - if ( absint( $donor_id ) !== $donor_id ) { |
|
203 | + if (absint($donor_id) !== $donor_id) { |
|
204 | 204 | return false; |
205 | 205 | } |
206 | 206 | |
207 | - if ( empty( $donor_id ) ) { |
|
207 | + if (empty($donor_id)) { |
|
208 | 208 | return false; |
209 | 209 | } |
210 | 210 | |
211 | - return absint( $donor_id ); |
|
211 | + return absint($donor_id); |
|
212 | 212 | |
213 | 213 | } |
214 | 214 |