@@ -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 | |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | /* @var WPDB $wpdb */ |
| 36 | 36 | global $wpdb; |
| 37 | 37 | |
| 38 | - $this->table_name = $wpdb->prefix . 'give_customers'; |
|
| 38 | + $this->table_name = $wpdb->prefix.'give_customers'; |
|
| 39 | 39 | $this->primary_key = 'id'; |
| 40 | 40 | $this->version = '1.0'; |
| 41 | 41 | |
| 42 | 42 | // Set hooks and register table only if instance loading first time. |
| 43 | - if( ! ( Give()->donors instanceof Give_DB_Donors ) ) { |
|
| 43 | + if ( ! (Give()->donors instanceof Give_DB_Donors)) { |
|
| 44 | 44 | // Setup hook. |
| 45 | - add_action( 'profile_update', array( $this, 'update_donor_email_on_user_update' ), 10, 2 ); |
|
| 45 | + add_action('profile_update', array($this, 'update_donor_email_on_user_update'), 10, 2); |
|
| 46 | 46 | |
| 47 | 47 | // Install table. |
| 48 | 48 | $this->register_table(); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | 'purchase_value' => 0.00, |
| 90 | 90 | 'purchase_count' => 0, |
| 91 | 91 | 'notes' => '', |
| 92 | - 'date_created' => date( 'Y-m-d H:i:s' ), |
|
| 92 | + 'date_created' => date('Y-m-d H:i:s'), |
|
| 93 | 93 | ); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -103,40 +103,40 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @return int|bool |
| 105 | 105 | */ |
| 106 | - public function add( $data = array() ) { |
|
| 106 | + public function add($data = array()) { |
|
| 107 | 107 | |
| 108 | 108 | $defaults = array( |
| 109 | 109 | 'payment_ids' => '' |
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | - $args = wp_parse_args( $data, $defaults ); |
|
| 112 | + $args = wp_parse_args($data, $defaults); |
|
| 113 | 113 | |
| 114 | - if ( empty( $args['email'] ) ) { |
|
| 114 | + if (empty($args['email'])) { |
|
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) { |
|
| 119 | - $args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) ); |
|
| 118 | + if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) { |
|
| 119 | + $args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids']))); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $donor = $this->get_donor_by( 'email', $args['email'] ); |
|
| 122 | + $donor = $this->get_donor_by('email', $args['email']); |
|
| 123 | 123 | |
| 124 | 124 | // update an existing donor. |
| 125 | - if ( $donor ) { |
|
| 125 | + if ($donor) { |
|
| 126 | 126 | |
| 127 | 127 | // Update the payment IDs attached to the donor |
| 128 | - if ( ! empty( $args['payment_ids'] ) ) { |
|
| 128 | + if ( ! empty($args['payment_ids'])) { |
|
| 129 | 129 | |
| 130 | - if ( empty( $donor->payment_ids ) ) { |
|
| 130 | + if (empty($donor->payment_ids)) { |
|
| 131 | 131 | |
| 132 | 132 | $donor->payment_ids = $args['payment_ids']; |
| 133 | 133 | |
| 134 | 134 | } else { |
| 135 | 135 | |
| 136 | - $existing_ids = array_map( 'absint', explode( ',', $donor->payment_ids ) ); |
|
| 137 | - $payment_ids = array_map( 'absint', explode( ',', $args['payment_ids'] ) ); |
|
| 138 | - $payment_ids = array_merge( $payment_ids, $existing_ids ); |
|
| 139 | - $donor->payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
| 136 | + $existing_ids = array_map('absint', explode(',', $donor->payment_ids)); |
|
| 137 | + $payment_ids = array_map('absint', explode(',', $args['payment_ids'])); |
|
| 138 | + $payment_ids = array_merge($payment_ids, $existing_ids); |
|
| 139 | + $donor->payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - $this->update( $donor->id, $args ); |
|
| 147 | + $this->update($donor->id, $args); |
|
| 148 | 148 | |
| 149 | 149 | return $donor->id; |
| 150 | 150 | |
| 151 | 151 | } else { |
| 152 | 152 | |
| 153 | - return $this->insert( $args, 'donor' ); |
|
| 153 | + return $this->insert($args, 'donor'); |
|
| 154 | 154 | |
| 155 | 155 | } |
| 156 | 156 | |
@@ -169,20 +169,20 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | * @return bool|int |
| 171 | 171 | */ |
| 172 | - public function delete( $_id_or_email = false ) { |
|
| 172 | + public function delete($_id_or_email = false) { |
|
| 173 | 173 | |
| 174 | - if ( empty( $_id_or_email ) ) { |
|
| 174 | + if (empty($_id_or_email)) { |
|
| 175 | 175 | return false; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $column = is_email( $_id_or_email ) ? 'email' : 'id'; |
|
| 179 | - $donor = $this->get_donor_by( $column, $_id_or_email ); |
|
| 178 | + $column = is_email($_id_or_email) ? 'email' : 'id'; |
|
| 179 | + $donor = $this->get_donor_by($column, $_id_or_email); |
|
| 180 | 180 | |
| 181 | - if ( $donor->id > 0 ) { |
|
| 181 | + if ($donor->id > 0) { |
|
| 182 | 182 | |
| 183 | 183 | global $wpdb; |
| 184 | 184 | |
| 185 | - return $wpdb->delete( $this->table_name, array( 'id' => $donor->id ), array( '%d' ) ); |
|
| 185 | + return $wpdb->delete($this->table_name, array('id' => $donor->id), array('%d')); |
|
| 186 | 186 | |
| 187 | 187 | } else { |
| 188 | 188 | return false; |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @return bool True is exists, false otherwise. |
| 203 | 203 | */ |
| 204 | - public function exists( $value = '', $field = 'email' ) { |
|
| 204 | + public function exists($value = '', $field = 'email') { |
|
| 205 | 205 | |
| 206 | 206 | $columns = $this->get_columns(); |
| 207 | - if ( ! array_key_exists( $field, $columns ) ) { |
|
| 207 | + if ( ! array_key_exists($field, $columns)) { |
|
| 208 | 208 | return false; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - return (bool) $this->get_column_by( 'id', $field, $value ); |
|
| 211 | + return (bool) $this->get_column_by('id', $field, $value); |
|
| 212 | 212 | |
| 213 | 213 | } |
| 214 | 214 | |
@@ -223,16 +223,16 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @return bool |
| 225 | 225 | */ |
| 226 | - public function attach_payment( $donor_id = 0, $payment_id = 0 ) { |
|
| 226 | + public function attach_payment($donor_id = 0, $payment_id = 0) { |
|
| 227 | 227 | |
| 228 | - $donor = new Give_Donor( $donor_id ); |
|
| 228 | + $donor = new Give_Donor($donor_id); |
|
| 229 | 229 | |
| 230 | - if ( empty( $donor->id ) ) { |
|
| 230 | + if (empty($donor->id)) { |
|
| 231 | 231 | return false; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // Attach the payment, but don't increment stats, as this function previously did not |
| 235 | - return $donor->attach_payment( $payment_id, false ); |
|
| 235 | + return $donor->attach_payment($payment_id, false); |
|
| 236 | 236 | |
| 237 | 237 | } |
| 238 | 238 | |
@@ -247,16 +247,16 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | * @return bool |
| 249 | 249 | */ |
| 250 | - public function remove_payment( $donor_id = 0, $payment_id = 0 ) { |
|
| 250 | + public function remove_payment($donor_id = 0, $payment_id = 0) { |
|
| 251 | 251 | |
| 252 | - $donor = new Give_Donor( $donor_id ); |
|
| 252 | + $donor = new Give_Donor($donor_id); |
|
| 253 | 253 | |
| 254 | - if ( ! $donor ) { |
|
| 254 | + if ( ! $donor) { |
|
| 255 | 255 | return false; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // Remove the payment, but don't decrease stats, as this function previously did not |
| 259 | - return $donor->remove_payment( $payment_id, false ); |
|
| 259 | + return $donor->remove_payment($payment_id, false); |
|
| 260 | 260 | |
| 261 | 261 | } |
| 262 | 262 | |
@@ -270,18 +270,18 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @return bool |
| 272 | 272 | */ |
| 273 | - public function increment_stats( $donor_id = 0, $amount = 0.00 ) { |
|
| 273 | + public function increment_stats($donor_id = 0, $amount = 0.00) { |
|
| 274 | 274 | |
| 275 | - $donor = new Give_Donor( $donor_id ); |
|
| 275 | + $donor = new Give_Donor($donor_id); |
|
| 276 | 276 | |
| 277 | - if ( empty( $donor->id ) ) { |
|
| 277 | + if (empty($donor->id)) { |
|
| 278 | 278 | return false; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | $increased_count = $donor->increase_purchase_count(); |
| 282 | - $increased_value = $donor->increase_value( $amount ); |
|
| 282 | + $increased_value = $donor->increase_value($amount); |
|
| 283 | 283 | |
| 284 | - return ( $increased_count && $increased_value ) ? true : false; |
|
| 284 | + return ($increased_count && $increased_value) ? true : false; |
|
| 285 | 285 | |
| 286 | 286 | } |
| 287 | 287 | |
@@ -296,18 +296,18 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @return bool |
| 298 | 298 | */ |
| 299 | - public function decrement_stats( $donor_id = 0, $amount = 0.00 ) { |
|
| 299 | + public function decrement_stats($donor_id = 0, $amount = 0.00) { |
|
| 300 | 300 | |
| 301 | - $donor = new Give_Donor( $donor_id ); |
|
| 301 | + $donor = new Give_Donor($donor_id); |
|
| 302 | 302 | |
| 303 | - if ( ! $donor ) { |
|
| 303 | + if ( ! $donor) { |
|
| 304 | 304 | return false; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | $decreased_count = $donor->decrease_donation_count(); |
| 308 | - $decreased_value = $donor->decrease_value( $amount ); |
|
| 308 | + $decreased_value = $donor->decrease_value($amount); |
|
| 309 | 309 | |
| 310 | - return ( $decreased_count && $decreased_value ) ? true : false; |
|
| 310 | + return ($decreased_count && $decreased_value) ? true : false; |
|
| 311 | 311 | |
| 312 | 312 | } |
| 313 | 313 | |
@@ -322,31 +322,31 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @return bool |
| 324 | 324 | */ |
| 325 | - public function update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) { |
|
| 325 | + public function update_donor_email_on_user_update($user_id = 0, $old_user_data = false) { |
|
| 326 | 326 | |
| 327 | - $donor = new Give_Donor( $user_id, true ); |
|
| 327 | + $donor = new Give_Donor($user_id, true); |
|
| 328 | 328 | |
| 329 | - if( ! $donor ) { |
|
| 329 | + if ( ! $donor) { |
|
| 330 | 330 | return false; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - $user = get_userdata( $user_id ); |
|
| 333 | + $user = get_userdata($user_id); |
|
| 334 | 334 | |
| 335 | - if( ! empty( $user ) && $user->user_email !== $donor->email ) { |
|
| 335 | + if ( ! empty($user) && $user->user_email !== $donor->email) { |
|
| 336 | 336 | |
| 337 | - if( ! $this->get_donor_by( 'email', $user->user_email ) ) { |
|
| 337 | + if ( ! $this->get_donor_by('email', $user->user_email)) { |
|
| 338 | 338 | |
| 339 | - $success = $this->update( $donor->id, array( 'email' => $user->user_email ) ); |
|
| 339 | + $success = $this->update($donor->id, array('email' => $user->user_email)); |
|
| 340 | 340 | |
| 341 | - if( $success ) { |
|
| 341 | + if ($success) { |
|
| 342 | 342 | // Update some payment meta if we need to |
| 343 | - $payments_array = explode( ',', $donor->payment_ids ); |
|
| 343 | + $payments_array = explode(',', $donor->payment_ids); |
|
| 344 | 344 | |
| 345 | - if( ! empty( $payments_array ) ) { |
|
| 345 | + if ( ! empty($payments_array)) { |
|
| 346 | 346 | |
| 347 | - foreach ( $payments_array as $payment_id ) { |
|
| 347 | + foreach ($payments_array as $payment_id) { |
|
| 348 | 348 | |
| 349 | - give_update_payment_meta( $payment_id, 'email', $user->user_email ); |
|
| 349 | + give_update_payment_meta($payment_id, 'email', $user->user_email); |
|
| 350 | 350 | |
| 351 | 351 | } |
| 352 | 352 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * @param WP_User $user WordPress User object. |
| 361 | 361 | * @param Give_Donor $donor Give donor object. |
| 362 | 362 | */ |
| 363 | - do_action( 'give_update_donor_email_on_user_update', $user, $donor ); |
|
| 363 | + do_action('give_update_donor_email_on_user_update', $user, $donor); |
|
| 364 | 364 | |
| 365 | 365 | } |
| 366 | 366 | |
@@ -381,46 +381,46 @@ discard block |
||
| 381 | 381 | * |
| 382 | 382 | * @return mixed Upon success, an object of the donor. Upon failure, NULL |
| 383 | 383 | */ |
| 384 | - public function get_donor_by( $field = 'id', $value = 0 ) { |
|
| 384 | + public function get_donor_by($field = 'id', $value = 0) { |
|
| 385 | 385 | /* @var WPDB $wpdb */ |
| 386 | 386 | global $wpdb; |
| 387 | 387 | |
| 388 | - if ( empty( $field ) || empty( $value ) ) { |
|
| 388 | + if (empty($field) || empty($value)) { |
|
| 389 | 389 | return null; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - if ( 'id' == $field || 'user_id' == $field ) { |
|
| 392 | + if ('id' == $field || 'user_id' == $field) { |
|
| 393 | 393 | // Make sure the value is numeric to avoid casting objects, for example, |
| 394 | 394 | // to int 1. |
| 395 | - if ( ! is_numeric( $value ) ) { |
|
| 395 | + if ( ! is_numeric($value)) { |
|
| 396 | 396 | return false; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - $value = intval( $value ); |
|
| 399 | + $value = intval($value); |
|
| 400 | 400 | |
| 401 | - if ( $value < 1 ) { |
|
| 401 | + if ($value < 1) { |
|
| 402 | 402 | return false; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - } elseif ( 'email' === $field ) { |
|
| 405 | + } elseif ('email' === $field) { |
|
| 406 | 406 | |
| 407 | - if ( ! is_email( $value ) ) { |
|
| 407 | + if ( ! is_email($value)) { |
|
| 408 | 408 | return false; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - $value = trim( $value ); |
|
| 411 | + $value = trim($value); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - if ( ! $value ) { |
|
| 414 | + if ( ! $value) { |
|
| 415 | 415 | return false; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - switch ( $field ) { |
|
| 418 | + switch ($field) { |
|
| 419 | 419 | case 'id': |
| 420 | 420 | $db_field = 'id'; |
| 421 | 421 | break; |
| 422 | 422 | case 'email': |
| 423 | - $value = sanitize_text_field( $value ); |
|
| 423 | + $value = sanitize_text_field($value); |
|
| 424 | 424 | $db_field = 'email'; |
| 425 | 425 | break; |
| 426 | 426 | case 'user_id': |
@@ -430,15 +430,15 @@ discard block |
||
| 430 | 430 | return false; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - if ( ! $donor = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $db_field = %s LIMIT 1", $value ) ) ) { |
|
| 433 | + if ( ! $donor = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $db_field = %s LIMIT 1", $value))) { |
|
| 434 | 434 | |
| 435 | 435 | // Look for donor from an additional email. |
| 436 | - if( 'email' === $field ) { |
|
| 437 | - $meta_table = Give()->donor_meta->table_name; |
|
| 438 | - $donor_id = $wpdb->get_var( $wpdb->prepare( "SELECT customer_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $value ) ); |
|
| 436 | + if ('email' === $field) { |
|
| 437 | + $meta_table = Give()->donor_meta->table_name; |
|
| 438 | + $donor_id = $wpdb->get_var($wpdb->prepare("SELECT customer_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $value)); |
|
| 439 | 439 | |
| 440 | - if( ! empty( $donor_id ) ) { |
|
| 441 | - return $this->get( $donor_id ); |
|
| 440 | + if ( ! empty($donor_id)) { |
|
| 441 | + return $this->get($donor_id); |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | * |
| 459 | 459 | * @return array|object|null Customers array or object. Null if not found. |
| 460 | 460 | */ |
| 461 | - public function get_donors( $args = array() ) { |
|
| 461 | + public function get_donors($args = array()) { |
|
| 462 | 462 | /* @var WPDB $wpdb */ |
| 463 | 463 | global $wpdb; |
| 464 | 464 | |
@@ -470,21 +470,21 @@ discard block |
||
| 470 | 470 | 'order' => 'DESC' |
| 471 | 471 | ); |
| 472 | 472 | |
| 473 | - $args = wp_parse_args( $args, $defaults ); |
|
| 473 | + $args = wp_parse_args($args, $defaults); |
|
| 474 | 474 | |
| 475 | - if ( $args['number'] < 1 ) { |
|
| 475 | + if ($args['number'] < 1) { |
|
| 476 | 476 | $args['number'] = 999999999999; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $where = ' WHERE 1=1 '; |
| 480 | 480 | |
| 481 | 481 | // specific donors. |
| 482 | - if ( ! empty( $args['id'] ) ) { |
|
| 482 | + if ( ! empty($args['id'])) { |
|
| 483 | 483 | |
| 484 | - if ( is_array( $args['id'] ) ) { |
|
| 485 | - $ids = implode( ',', array_map( 'intval', $args['id'] ) ); |
|
| 484 | + if (is_array($args['id'])) { |
|
| 485 | + $ids = implode(',', array_map('intval', $args['id'])); |
|
| 486 | 486 | } else { |
| 487 | - $ids = intval( $args['id'] ); |
|
| 487 | + $ids = intval($args['id']); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | $where .= " AND `id` IN( {$ids} ) "; |
@@ -492,12 +492,12 @@ discard block |
||
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | // donors for specific user accounts |
| 495 | - if ( ! empty( $args['user_id'] ) ) { |
|
| 495 | + if ( ! empty($args['user_id'])) { |
|
| 496 | 496 | |
| 497 | - if ( is_array( $args['user_id'] ) ) { |
|
| 498 | - $user_ids = implode( ',', array_map( 'intval', $args['user_id'] ) ); |
|
| 497 | + if (is_array($args['user_id'])) { |
|
| 498 | + $user_ids = implode(',', array_map('intval', $args['user_id'])); |
|
| 499 | 499 | } else { |
| 500 | - $user_ids = intval( $args['user_id'] ); |
|
| 500 | + $user_ids = intval($args['user_id']); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | $where .= " AND `user_id` IN( {$user_ids} ) "; |
@@ -505,41 +505,41 @@ discard block |
||
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | //specific donors by email |
| 508 | - if( ! empty( $args['email'] ) ) { |
|
| 508 | + if ( ! empty($args['email'])) { |
|
| 509 | 509 | |
| 510 | - if( is_array( $args['email'] ) ) { |
|
| 510 | + if (is_array($args['email'])) { |
|
| 511 | 511 | |
| 512 | - $emails_count = count( $args['email'] ); |
|
| 513 | - $emails_placeholder = array_fill( 0, $emails_count, '%s' ); |
|
| 514 | - $emails = implode( ', ', $emails_placeholder ); |
|
| 512 | + $emails_count = count($args['email']); |
|
| 513 | + $emails_placeholder = array_fill(0, $emails_count, '%s'); |
|
| 514 | + $emails = implode(', ', $emails_placeholder); |
|
| 515 | 515 | |
| 516 | - $where .= $wpdb->prepare( " AND `email` IN( $emails ) ", $args['email'] ); |
|
| 516 | + $where .= $wpdb->prepare(" AND `email` IN( $emails ) ", $args['email']); |
|
| 517 | 517 | } else { |
| 518 | - $where .= $wpdb->prepare( " AND `email` = %s ", $args['email'] ); |
|
| 518 | + $where .= $wpdb->prepare(" AND `email` = %s ", $args['email']); |
|
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // specific donors by name |
| 523 | - if( ! empty( $args['name'] ) ) { |
|
| 524 | - $where .= $wpdb->prepare( " AND `name` LIKE '%%%%" . '%s' . "%%%%' ", $args['name'] ); |
|
| 523 | + if ( ! empty($args['name'])) { |
|
| 524 | + $where .= $wpdb->prepare(" AND `name` LIKE '%%%%".'%s'."%%%%' ", $args['name']); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | // Donors created for a specific date or in a date range |
| 528 | - if ( ! empty( $args['date'] ) ) { |
|
| 528 | + if ( ! empty($args['date'])) { |
|
| 529 | 529 | |
| 530 | - if ( is_array( $args['date'] ) ) { |
|
| 530 | + if (is_array($args['date'])) { |
|
| 531 | 531 | |
| 532 | - if ( ! empty( $args['date']['start'] ) ) { |
|
| 532 | + if ( ! empty($args['date']['start'])) { |
|
| 533 | 533 | |
| 534 | - $start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) ); |
|
| 534 | + $start = date('Y-m-d H:i:s', strtotime($args['date']['start'])); |
|
| 535 | 535 | |
| 536 | 536 | $where .= " AND `date_created` >= '{$start}'"; |
| 537 | 537 | |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | - if ( ! empty( $args['date']['end'] ) ) { |
|
| 540 | + if ( ! empty($args['date']['end'])) { |
|
| 541 | 541 | |
| 542 | - $end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) ); |
|
| 542 | + $end = date('Y-m-d H:i:s', strtotime($args['date']['end'])); |
|
| 543 | 543 | |
| 544 | 544 | $where .= " AND `date_created` <= '{$end}'"; |
| 545 | 545 | |
@@ -547,31 +547,31 @@ discard block |
||
| 547 | 547 | |
| 548 | 548 | } else { |
| 549 | 549 | |
| 550 | - $year = date( 'Y', strtotime( $args['date'] ) ); |
|
| 551 | - $month = date( 'm', strtotime( $args['date'] ) ); |
|
| 552 | - $day = date( 'd', strtotime( $args['date'] ) ); |
|
| 550 | + $year = date('Y', strtotime($args['date'])); |
|
| 551 | + $month = date('m', strtotime($args['date'])); |
|
| 552 | + $day = date('d', strtotime($args['date'])); |
|
| 553 | 553 | |
| 554 | 554 | $where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )"; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - $args['orderby'] = ! array_key_exists( $args['orderby'], $this->get_columns() ) ? 'id' : $args['orderby']; |
|
| 559 | + $args['orderby'] = ! array_key_exists($args['orderby'], $this->get_columns()) ? 'id' : $args['orderby']; |
|
| 560 | 560 | |
| 561 | - if ( 'purchase_value' == $args['orderby'] ) { |
|
| 561 | + if ('purchase_value' == $args['orderby']) { |
|
| 562 | 562 | $args['orderby'] = 'purchase_value+0'; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - $cache_key = md5( 'give_donors_' . serialize( $args ) ); |
|
| 565 | + $cache_key = md5('give_donors_'.serialize($args)); |
|
| 566 | 566 | |
| 567 | - $donors = wp_cache_get( $cache_key, 'donors' ); |
|
| 567 | + $donors = wp_cache_get($cache_key, 'donors'); |
|
| 568 | 568 | |
| 569 | - $args['orderby'] = esc_sql( $args['orderby'] ); |
|
| 570 | - $args['order'] = esc_sql( $args['order'] ); |
|
| 569 | + $args['orderby'] = esc_sql($args['orderby']); |
|
| 570 | + $args['order'] = esc_sql($args['order']); |
|
| 571 | 571 | |
| 572 | - if ( $donors === false ) { |
|
| 573 | - $donors = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint( $args['offset'] ), absint( $args['number'] ) ) ); |
|
| 574 | - wp_cache_set( $cache_key, $donors, 'donors', 3600 ); |
|
| 572 | + if ($donors === false) { |
|
| 573 | + $donors = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint($args['offset']), absint($args['number']))); |
|
| 574 | + wp_cache_set($cache_key, $donors, 'donors', 3600); |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | return $donors; |
@@ -589,26 +589,26 @@ discard block |
||
| 589 | 589 | * |
| 590 | 590 | * @return int Total number of donors. |
| 591 | 591 | */ |
| 592 | - public function count( $args = array() ) { |
|
| 592 | + public function count($args = array()) { |
|
| 593 | 593 | /* @var WPDB $wpdb */ |
| 594 | 594 | global $wpdb; |
| 595 | 595 | |
| 596 | 596 | $where = ' WHERE 1=1 '; |
| 597 | 597 | |
| 598 | - if ( ! empty( $args['date'] ) ) { |
|
| 598 | + if ( ! empty($args['date'])) { |
|
| 599 | 599 | |
| 600 | - if ( is_array( $args['date'] ) ) { |
|
| 600 | + if (is_array($args['date'])) { |
|
| 601 | 601 | |
| 602 | - $start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) ); |
|
| 603 | - $end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) ); |
|
| 602 | + $start = date('Y-m-d H:i:s', strtotime($args['date']['start'])); |
|
| 603 | + $end = date('Y-m-d H:i:s', strtotime($args['date']['end'])); |
|
| 604 | 604 | |
| 605 | 605 | $where .= " AND `date_created` >= '{$start}' AND `date_created` <= '{$end}'"; |
| 606 | 606 | |
| 607 | 607 | } else { |
| 608 | 608 | |
| 609 | - $year = date( 'Y', strtotime( $args['date'] ) ); |
|
| 610 | - $month = date( 'm', strtotime( $args['date'] ) ); |
|
| 611 | - $day = date( 'd', strtotime( $args['date'] ) ); |
|
| 609 | + $year = date('Y', strtotime($args['date'])); |
|
| 610 | + $month = date('m', strtotime($args['date'])); |
|
| 611 | + $day = date('d', strtotime($args['date'])); |
|
| 612 | 612 | |
| 613 | 613 | $where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )"; |
| 614 | 614 | } |
@@ -616,16 +616,16 @@ discard block |
||
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | |
| 619 | - $cache_key = md5( 'give_donors_count' . serialize( $args ) ); |
|
| 619 | + $cache_key = md5('give_donors_count'.serialize($args)); |
|
| 620 | 620 | |
| 621 | - $count = wp_cache_get( $cache_key, 'donors' ); |
|
| 621 | + $count = wp_cache_get($cache_key, 'donors'); |
|
| 622 | 622 | |
| 623 | - if ( $count === false ) { |
|
| 624 | - $count = $wpdb->get_var( "SELECT COUNT($this->primary_key) FROM " . $this->table_name . "{$where};" ); |
|
| 625 | - wp_cache_set( $cache_key, $count, 'donors', 3600 ); |
|
| 623 | + if ($count === false) { |
|
| 624 | + $count = $wpdb->get_var("SELECT COUNT($this->primary_key) FROM ".$this->table_name."{$where};"); |
|
| 625 | + wp_cache_set($cache_key, $count, 'donors', 3600); |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - return absint( $count ); |
|
| 628 | + return absint($count); |
|
| 629 | 629 | |
| 630 | 630 | } |
| 631 | 631 | |
@@ -639,9 +639,9 @@ discard block |
||
| 639 | 639 | */ |
| 640 | 640 | public function create_table() { |
| 641 | 641 | |
| 642 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
| 642 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
| 643 | 643 | |
| 644 | - $sql = "CREATE TABLE " . $this->table_name . " ( |
|
| 644 | + $sql = "CREATE TABLE ".$this->table_name." ( |
|
| 645 | 645 | id bigint(20) NOT NULL AUTO_INCREMENT, |
| 646 | 646 | user_id bigint(20) NOT NULL, |
| 647 | 647 | email varchar(50) NOT NULL, |
@@ -656,9 +656,9 @@ discard block |
||
| 656 | 656 | KEY user (user_id) |
| 657 | 657 | ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; |
| 658 | 658 | |
| 659 | - dbDelta( $sql ); |
|
| 659 | + dbDelta($sql); |
|
| 660 | 660 | |
| 661 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
| 661 | + update_option($this->table_name.'_db_version', $this->version); |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | /** |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | * @return bool Returns if the donors table was installed and upgrade routine run. |
| 671 | 671 | */ |
| 672 | 672 | public function installed() { |
| 673 | - return $this->table_exists( $this->table_name ); |
|
| 673 | + return $this->table_exists($this->table_name); |
|
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,50 +23,50 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string Donation form. |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | |
| 30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
| 30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
| 31 | 31 | |
| 32 | - if ( isset( $args['id'] ) ) { |
|
| 32 | + if (isset($args['id'])) { |
|
| 33 | 33 | $form_id = $args['id']; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
| 36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
| 37 | 37 | 'form_id' => $form_id, |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 42 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 43 | 43 | |
| 44 | 44 | //bail if no form ID. |
| 45 | - if ( empty( $form->ID ) ) { |
|
| 45 | + if (empty($form->ID)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 50 | 50 | |
| 51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
| 58 | 58 | if ( |
| 59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
| 60 | - || ( 'trash' === $form->post_status ) |
|
| 59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
| 60 | + || ('trash' === $form->post_status) |
|
| 61 | 61 | ) { |
| 62 | 62 | return false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | //Get the form wrap CSS classes. |
| 66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
| 66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 67 | 67 | |
| 68 | 68 | //Get the <form> tag wrap CSS classes. |
| 69 | - $form_classes = $form->get_form_classes( $args ); |
|
| 69 | + $form_classes = $form->get_form_classes($args); |
|
| 70 | 70 | |
| 71 | 71 | ob_start(); |
| 72 | 72 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | * @param int $form_id The form ID. |
| 79 | 79 | * @param array $args An array of form arguments. |
| 80 | 80 | */ |
| 81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
| 81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
| 82 | 82 | |
| 83 | 83 | ?> |
| 84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
| 85 | 85 | |
| 86 | - <?php if ( $form->is_close_donation_form() ) { |
|
| 86 | + <?php if ($form->is_close_donation_form()) { |
|
| 87 | 87 | |
| 88 | 88 | // Get Goal thank you message. |
| 89 | - $goal_achieved_message = give_get_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
| 90 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
| 89 | + $goal_achieved_message = give_get_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
| 90 | + $goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : ''; |
|
| 91 | 91 | |
| 92 | 92 | // Print thank you message. |
| 93 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID ); |
|
| 93 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID); |
|
| 94 | 94 | |
| 95 | 95 | } else { |
| 96 | 96 | /** |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | * 1. if show_title params set to true |
| 99 | 99 | * 2. if admin set form display_style to button |
| 100 | 100 | */ |
| 101 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
| 101 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
| 102 | 102 | if ( |
| 103 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
| 104 | - && ! doing_action( 'give_single_form_summary' ) |
|
| 103 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
| 104 | + && ! doing_action('give_single_form_summary') |
|
| 105 | 105 | ) { |
| 106 | 106 | echo $form_title; |
| 107 | 107 | } |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | * @param int $form_id The form ID. |
| 115 | 115 | * @param array $args An array of form arguments. |
| 116 | 116 | */ |
| 117 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
| 117 | + do_action('give_pre_form', $form->ID, $args); |
|
| 118 | 118 | ?> |
| 119 | 119 | |
| 120 | 120 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
| 121 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
| 121 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
| 122 | 122 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 123 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 123 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 124 | 124 | <input type="hidden" name="give-current-url" |
| 125 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 125 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 126 | 126 | <input type="hidden" name="give-form-url" |
| 127 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 127 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 128 | 128 | <input type="hidden" name="give-form-minimum" |
| 129 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
| 129 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
| 130 | 130 | |
| 131 | 131 | <!-- The following field is for robots only, invisible to humans: --> |
| 132 | 132 | <span class="give-hidden" style="display: none !important;"> |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | <?php |
| 139 | 139 | |
| 140 | 140 | // Price ID hidden field for variable (multi-level) donation forms. |
| 141 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 141 | + if (give_has_variable_prices($form_id)) { |
|
| 142 | 142 | // Get default selected price ID. |
| 143 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 143 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 144 | 144 | $price_id = 0; |
| 145 | 145 | //loop through prices. |
| 146 | - foreach ( $prices as $price ) { |
|
| 147 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 146 | + foreach ($prices as $price) { |
|
| 147 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 148 | 148 | $price_id = $price['_give_id']['level_id']; |
| 149 | 149 | }; |
| 150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param int $form_id The form ID. |
| 161 | 161 | * @param array $args An array of form arguments. |
| 162 | 162 | */ |
| 163 | - do_action( 'give_donation_form_top', $form->ID, $args ); |
|
| 163 | + do_action('give_donation_form_top', $form->ID, $args); |
|
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * Fires while outputting donation form, for payment gateway fields. |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param int $form_id The form ID. |
| 171 | 171 | * @param array $args An array of form arguments. |
| 172 | 172 | */ |
| 173 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 173 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Fires while outputting donation form, after all other fields. |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param int $form_id The form ID. |
| 181 | 181 | * @param array $args An array of form arguments. |
| 182 | 182 | */ |
| 183 | - do_action( 'give_donation_form_bottom', $form->ID, $args ); |
|
| 183 | + do_action('give_donation_form_bottom', $form->ID, $args); |
|
| 184 | 184 | |
| 185 | 185 | ?> |
| 186 | 186 | </form> |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | * @param int $form_id The form ID. |
| 195 | 195 | * @param array $args An array of form arguments. |
| 196 | 196 | */ |
| 197 | - do_action( 'give_post_form', $form->ID, $args ); |
|
| 197 | + do_action('give_post_form', $form->ID, $args); |
|
| 198 | 198 | |
| 199 | 199 | } |
| 200 | 200 | ?> |
| 201 | 201 | |
| 202 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
| 202 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
| 203 | 203 | <?php |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | * @param int $form_id The form ID. |
| 211 | 211 | * @param array $args An array of form arguments. |
| 212 | 212 | */ |
| 213 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 213 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 214 | 214 | |
| 215 | 215 | $final_output = ob_get_clean(); |
| 216 | 216 | |
| 217 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 217 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return string |
| 233 | 233 | */ |
| 234 | -function give_show_purchase_form( $form_id ) { |
|
| 234 | +function give_show_purchase_form($form_id) { |
|
| 235 | 235 | |
| 236 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 236 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 237 | 237 | |
| 238 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 238 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 239 | 239 | $form_id = $_POST['give_form_id']; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -244,33 +244,33 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @since 1.7 |
| 246 | 246 | */ |
| 247 | - do_action( 'give_payment_fields_top', $form_id ); |
|
| 247 | + do_action('give_payment_fields_top', $form_id); |
|
| 248 | 248 | |
| 249 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 249 | + if (give_can_checkout() && isset($form_id)) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Fires while displaying donation form, before registration login. |
| 253 | 253 | * |
| 254 | 254 | * @since 1.7 |
| 255 | 255 | */ |
| 256 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
| 256 | + do_action('give_donation_form_before_register_login', $form_id); |
|
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * Fire when register/login form fields render. |
| 260 | 260 | * |
| 261 | 261 | * @since 1.7 |
| 262 | 262 | */ |
| 263 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
| 263 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * Fire when credit card form fields render. |
| 267 | 267 | * |
| 268 | 268 | * @since 1.7 |
| 269 | 269 | */ |
| 270 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
| 270 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
| 271 | 271 | |
| 272 | 272 | // Load the credit card form and allow gateways to load their own if they wish. |
| 273 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 273 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 274 | 274 | /** |
| 275 | 275 | * Fires while displaying donation form, credit card form fields for a given gateway. |
| 276 | 276 | * |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @param int $form_id The form ID. |
| 280 | 280 | */ |
| 281 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
| 281 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
| 282 | 282 | } else { |
| 283 | 283 | /** |
| 284 | 284 | * Fires while displaying donation form, credit card form fields. |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @param int $form_id The form ID. |
| 289 | 289 | */ |
| 290 | - do_action( 'give_cc_form', $form_id ); |
|
| 290 | + do_action('give_cc_form', $form_id); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @since 1.7 |
| 297 | 297 | */ |
| 298 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
| 298 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
| 299 | 299 | |
| 300 | 300 | } else { |
| 301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | * @since 1.7 |
| 305 | 305 | */ |
| 306 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
| 306 | + do_action('give_donation_form_no_access', $form_id); |
|
| 307 | 307 | |
| 308 | 308 | } |
| 309 | 309 | |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @since 1.7 |
| 314 | 314 | */ |
| 315 | - do_action( 'give_payment_fields_bottom', $form_id ); |
|
| 315 | + do_action('give_payment_fields_bottom', $form_id); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
| 318 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * Give Show Login/Register Form Fields. |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return void |
| 328 | 328 | */ |
| 329 | -function give_show_register_login_fields( $form_id ) { |
|
| 329 | +function give_show_register_login_fields($form_id) { |
|
| 330 | 330 | |
| 331 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 331 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 332 | 332 | |
| 333 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 333 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 334 | 334 | ?> |
| 335 | 335 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 336 | 336 | <?php |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @since 1.7 |
| 341 | 341 | */ |
| 342 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
| 342 | + do_action('give_donation_form_register_fields', $form_id); |
|
| 343 | 343 | ?> |
| 344 | 344 | </div> |
| 345 | 345 | <?php |
| 346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 346 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 347 | 347 | ?> |
| 348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 349 | 349 | <?php |
@@ -352,23 +352,23 @@ discard block |
||
| 352 | 352 | * |
| 353 | 353 | * @since 1.7 |
| 354 | 354 | */ |
| 355 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
| 355 | + do_action('give_donation_form_login_fields', $form_id); |
|
| 356 | 356 | ?> |
| 357 | 357 | </div> |
| 358 | 358 | <?php |
| 359 | 359 | endif; |
| 360 | 360 | |
| 361 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 361 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 362 | 362 | /** |
| 363 | 363 | * Fire when user info render. |
| 364 | 364 | * |
| 365 | 365 | * @since 1.7 |
| 366 | 366 | */ |
| 367 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
| 367 | + do_action('give_donation_form_after_user_info', $form_id); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 371 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Donation Amount Field. |
@@ -383,16 +383,16 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return void |
| 385 | 385 | */ |
| 386 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 386 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 387 | 387 | |
| 388 | 388 | $give_options = give_get_settings(); |
| 389 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 390 | - $allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
| 391 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 392 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 393 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 394 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 395 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 389 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 390 | + $allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
| 391 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 392 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 393 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 394 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 395 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * Fires while displaying donation form, before donation level fields. |
@@ -402,20 +402,20 @@ discard block |
||
| 402 | 402 | * @param int $form_id The form ID. |
| 403 | 403 | * @param array $args An array of form arguments. |
| 404 | 404 | */ |
| 405 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 405 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 406 | 406 | |
| 407 | 407 | //Set Price, No Custom Amount Allowed means hidden price field |
| 408 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
| 408 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
| 409 | 409 | ?> |
| 410 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 410 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 411 | 411 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 412 | 412 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
| 413 | 413 | <div class="set-price give-donation-amount form-row-wide"> |
| 414 | - <?php if ( $currency_position == 'before' ) { |
|
| 414 | + <?php if ($currency_position == 'before') { |
|
| 415 | 415 | echo $currency_output; |
| 416 | 416 | } ?> |
| 417 | 417 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 418 | - <?php if ( $currency_position == 'after' ) { |
|
| 418 | + <?php if ($currency_position == 'after') { |
|
| 419 | 419 | echo $currency_output; |
| 420 | 420 | } ?> |
| 421 | 421 | </div> |
@@ -425,13 +425,13 @@ discard block |
||
| 425 | 425 | ?> |
| 426 | 426 | <div class="give-total-wrap"> |
| 427 | 427 | <div class="give-donation-amount form-row-wide"> |
| 428 | - <?php if ( $currency_position == 'before' ) { |
|
| 428 | + <?php if ($currency_position == 'before') { |
|
| 429 | 429 | echo $currency_output; |
| 430 | 430 | } ?> |
| 431 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 431 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 432 | 432 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
| 433 | 433 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 434 | - <?php if ( $currency_position == 'after' ) { |
|
| 434 | + <?php if ($currency_position == 'after') { |
|
| 435 | 435 | echo $currency_output; |
| 436 | 436 | } ?> |
| 437 | 437 | </div> |
@@ -446,16 +446,16 @@ discard block |
||
| 446 | 446 | * @param int $form_id The form ID. |
| 447 | 447 | * @param array $args An array of form arguments. |
| 448 | 448 | */ |
| 449 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 449 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 450 | 450 | |
| 451 | 451 | //Custom Amount Text |
| 452 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
| 452 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
| 453 | 453 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 454 | 454 | <?php } |
| 455 | 455 | |
| 456 | 456 | //Output Variable Pricing Levels. |
| 457 | - if ( $variable_pricing ) { |
|
| 458 | - give_output_levels( $form_id ); |
|
| 457 | + if ($variable_pricing) { |
|
| 458 | + give_output_levels($form_id); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | * @param int $form_id The form ID. |
| 467 | 467 | * @param array $args An array of form arguments. |
| 468 | 468 | */ |
| 469 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 469 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | -add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 472 | +add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 473 | 473 | |
| 474 | 474 | /** |
| 475 | 475 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -480,30 +480,30 @@ discard block |
||
| 480 | 480 | * |
| 481 | 481 | * @return string Donation levels. |
| 482 | 482 | */ |
| 483 | -function give_output_levels( $form_id ) { |
|
| 483 | +function give_output_levels($form_id) { |
|
| 484 | 484 | |
| 485 | 485 | //Get variable pricing. |
| 486 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 487 | - $display_style = give_get_meta( $form_id, '_give_display_style', true ); |
|
| 488 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
| 489 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 490 | - if ( empty( $custom_amount_text ) ) { |
|
| 491 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 486 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 487 | + $display_style = give_get_meta($form_id, '_give_display_style', true); |
|
| 488 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
| 489 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
| 490 | + if (empty($custom_amount_text)) { |
|
| 491 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | $output = ''; |
| 495 | 495 | |
| 496 | - switch ( $display_style ) { |
|
| 496 | + switch ($display_style) { |
|
| 497 | 497 | case 'buttons': |
| 498 | 498 | |
| 499 | 499 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 500 | 500 | |
| 501 | - foreach ( $prices as $price ) { |
|
| 502 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 503 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
| 501 | + foreach ($prices as $price) { |
|
| 502 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 503 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
| 504 | 504 | |
| 505 | 505 | $output .= '<li>'; |
| 506 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 506 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 507 | 507 | $output .= $level_text; |
| 508 | 508 | $output .= '</button>'; |
| 509 | 509 | $output .= '</li>'; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | //Custom Amount. |
| 514 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 514 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 515 | 515 | $output .= '<li>'; |
| 516 | 516 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 517 | 517 | $output .= $custom_amount_text; |
@@ -527,22 +527,22 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 529 | 529 | |
| 530 | - foreach ( $prices as $price ) { |
|
| 531 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 532 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 530 | + foreach ($prices as $price) { |
|
| 531 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 532 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 533 | 533 | |
| 534 | 534 | $output .= '<li>'; |
| 535 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 536 | - $output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>'; |
|
| 535 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 536 | + $output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>'; |
|
| 537 | 537 | $output .= '</li>'; |
| 538 | 538 | |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | //Custom Amount. |
| 542 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 542 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 543 | 543 | $output .= '<li>'; |
| 544 | 544 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
| 545 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 545 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 546 | 546 | $output .= '</li>'; |
| 547 | 547 | } |
| 548 | 548 | |
@@ -552,23 +552,23 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | case 'dropdown': |
| 554 | 554 | |
| 555 | - $output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 556 | - $output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 555 | + $output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 556 | + $output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 557 | 557 | |
| 558 | 558 | //first loop through prices. |
| 559 | - foreach ( $prices as $price ) { |
|
| 560 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 561 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 559 | + foreach ($prices as $price) { |
|
| 560 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 561 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 562 | 562 | |
| 563 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 563 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 564 | 564 | $output .= $level_text; |
| 565 | 565 | $output .= '</option>'; |
| 566 | 566 | |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | //Custom Amount. |
| 570 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 571 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 570 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 571 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | $output .= '</select>'; |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | break; |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 579 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | /** |
@@ -591,27 +591,27 @@ discard block |
||
| 591 | 591 | * |
| 592 | 592 | * @return string Checkout button. |
| 593 | 593 | */ |
| 594 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 594 | +function give_display_checkout_button($form_id, $args) { |
|
| 595 | 595 | |
| 596 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 596 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 597 | 597 | ? $args['display_style'] |
| 598 | - : give_get_meta( $form_id, '_give_payment_display', true ); |
|
| 598 | + : give_get_meta($form_id, '_give_payment_display', true); |
|
| 599 | 599 | |
| 600 | - if ( 'button' === $display_option ) { |
|
| 600 | + if ('button' === $display_option) { |
|
| 601 | 601 | $display_option = 'modal'; |
| 602 | - } elseif ( $display_option === 'onpage' ) { |
|
| 602 | + } elseif ($display_option === 'onpage') { |
|
| 603 | 603 | return ''; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - $display_label_field = give_get_meta( $form_id, '_give_reveal_label', true ); |
|
| 607 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 606 | + $display_label_field = give_get_meta($form_id, '_give_reveal_label', true); |
|
| 607 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 608 | 608 | |
| 609 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 609 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 610 | 610 | |
| 611 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 611 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 614 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 615 | 615 | |
| 616 | 616 | /** |
| 617 | 617 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -622,57 +622,57 @@ discard block |
||
| 622 | 622 | * |
| 623 | 623 | * @return void |
| 624 | 624 | */ |
| 625 | -function give_user_info_fields( $form_id ) { |
|
| 625 | +function give_user_info_fields($form_id) { |
|
| 626 | 626 | // Get user info. |
| 627 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 627 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 628 | 628 | |
| 629 | 629 | /** |
| 630 | 630 | * Fire before user personal information fields |
| 631 | 631 | * |
| 632 | 632 | * @since 1.7 |
| 633 | 633 | */ |
| 634 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
| 634 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
| 635 | 635 | ?> |
| 636 | 636 | <fieldset id="give_checkout_user_info"> |
| 637 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
| 637 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
| 638 | 638 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
| 639 | 639 | <label class="give-label" for="give-first"> |
| 640 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
| 641 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
| 640 | + <?php esc_html_e('First Name', 'give'); ?> |
|
| 641 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
| 642 | 642 | <span class="give-required-indicator">*</span> |
| 643 | 643 | <?php endif ?> |
| 644 | 644 | <span class="give-tooltip give-icon give-icon-question" |
| 645 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 645 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 646 | 646 | </label> |
| 647 | 647 | <input |
| 648 | 648 | class="give-input required" |
| 649 | 649 | type="text" |
| 650 | 650 | name="give_first" |
| 651 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
| 651 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
| 652 | 652 | id="give-first" |
| 653 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
| 654 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 653 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
| 654 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 655 | 655 | /> |
| 656 | 656 | </p> |
| 657 | 657 | |
| 658 | 658 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
| 659 | 659 | <label class="give-label" for="give-last"> |
| 660 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
| 661 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
| 660 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
| 661 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
| 662 | 662 | <span class="give-required-indicator">*</span> |
| 663 | 663 | <?php endif ?> |
| 664 | 664 | <span class="give-tooltip give-icon give-icon-question" |
| 665 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 665 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 666 | 666 | </label> |
| 667 | 667 | |
| 668 | 668 | <input |
| 669 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
| 669 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
| 670 | 670 | type="text" |
| 671 | 671 | name="give_last" |
| 672 | 672 | id="give-last" |
| 673 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
| 674 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
| 675 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 673 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
| 674 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
| 675 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 676 | 676 | /> |
| 677 | 677 | </p> |
| 678 | 678 | |
@@ -682,26 +682,26 @@ discard block |
||
| 682 | 682 | * |
| 683 | 683 | * @since 1.7 |
| 684 | 684 | */ |
| 685 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
| 685 | + do_action('give_donation_form_before_email', $form_id); |
|
| 686 | 686 | ?> |
| 687 | 687 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 688 | 688 | <label class="give-label" for="give-email"> |
| 689 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
| 690 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 689 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
| 690 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 691 | 691 | <span class="give-required-indicator">*</span> |
| 692 | 692 | <?php } ?> |
| 693 | 693 | <span class="give-tooltip give-icon give-icon-question" |
| 694 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
| 694 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
| 695 | 695 | </label> |
| 696 | 696 | |
| 697 | 697 | <input |
| 698 | 698 | class="give-input required" |
| 699 | 699 | type="email" |
| 700 | 700 | name="give_email" |
| 701 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
| 701 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
| 702 | 702 | id="give-email" |
| 703 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
| 704 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 703 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
| 704 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 705 | 705 | /> |
| 706 | 706 | |
| 707 | 707 | </p> |
@@ -711,14 +711,14 @@ discard block |
||
| 711 | 711 | * |
| 712 | 712 | * @since 1.7 |
| 713 | 713 | */ |
| 714 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
| 714 | + do_action('give_donation_form_after_email', $form_id); |
|
| 715 | 715 | |
| 716 | 716 | /** |
| 717 | 717 | * Fire after personal email field |
| 718 | 718 | * |
| 719 | 719 | * @since 1.7 |
| 720 | 720 | */ |
| 721 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 721 | + do_action('give_donation_form_user_info', $form_id); |
|
| 722 | 722 | ?> |
| 723 | 723 | </fieldset> |
| 724 | 724 | <?php |
@@ -727,11 +727,11 @@ discard block |
||
| 727 | 727 | * |
| 728 | 728 | * @since 1.7 |
| 729 | 729 | */ |
| 730 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
| 730 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
| 734 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 733 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
| 734 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 735 | 735 | |
| 736 | 736 | /** |
| 737 | 737 | * Renders the credit card info form. |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | * |
| 743 | 743 | * @return void |
| 744 | 744 | */ |
| 745 | -function give_get_cc_form( $form_id ) { |
|
| 745 | +function give_get_cc_form($form_id) { |
|
| 746 | 746 | |
| 747 | 747 | ob_start(); |
| 748 | 748 | |
@@ -753,53 +753,53 @@ discard block |
||
| 753 | 753 | * |
| 754 | 754 | * @param int $form_id The form ID. |
| 755 | 755 | */ |
| 756 | - do_action( 'give_before_cc_fields', $form_id ); |
|
| 756 | + do_action('give_before_cc_fields', $form_id); |
|
| 757 | 757 | ?> |
| 758 | 758 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 759 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 760 | - <?php if ( is_ssl() ) : ?> |
|
| 759 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
| 760 | + <?php if (is_ssl()) : ?> |
|
| 761 | 761 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 762 | 762 | <span class="give-icon padlock"></span> |
| 763 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 763 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 764 | 764 | </div> |
| 765 | 765 | <?php endif; ?> |
| 766 | 766 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 767 | 767 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 768 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
| 768 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
| 769 | 769 | <span class="give-required-indicator">*</span> |
| 770 | 770 | <span class="give-tooltip give-icon give-icon-question" |
| 771 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 771 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 772 | 772 | <span class="card-type"></span> |
| 773 | 773 | </label> |
| 774 | 774 | |
| 775 | 775 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
| 776 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
| 776 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
| 777 | 777 | required aria-required="true"/> |
| 778 | 778 | </p> |
| 779 | 779 | |
| 780 | 780 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
| 781 | 781 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 782 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
| 782 | + <?php esc_html_e('CVC', 'give'); ?> |
|
| 783 | 783 | <span class="give-required-indicator">*</span> |
| 784 | 784 | <span class="give-tooltip give-icon give-icon-question" |
| 785 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 785 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 786 | 786 | </label> |
| 787 | 787 | |
| 788 | 788 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
| 789 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
| 789 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
| 790 | 790 | required aria-required="true"/> |
| 791 | 791 | </p> |
| 792 | 792 | |
| 793 | 793 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 794 | 794 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 795 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
| 795 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
| 796 | 796 | <span class="give-required-indicator">*</span> |
| 797 | 797 | <span class="give-tooltip give-icon give-icon-question" |
| 798 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 798 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 799 | 799 | </label> |
| 800 | 800 | |
| 801 | 801 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
| 802 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
| 802 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
| 803 | 803 | required aria-required="true"/> |
| 804 | 804 | </p> |
| 805 | 805 | <?php |
@@ -810,14 +810,14 @@ discard block |
||
| 810 | 810 | * |
| 811 | 811 | * @param int $form_id The form ID. |
| 812 | 812 | */ |
| 813 | - do_action( 'give_before_cc_expiration' ); |
|
| 813 | + do_action('give_before_cc_expiration'); |
|
| 814 | 814 | ?> |
| 815 | 815 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
| 816 | 816 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 817 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
| 817 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
| 818 | 818 | <span class="give-required-indicator">*</span> |
| 819 | 819 | <span class="give-tooltip give-icon give-icon-question" |
| 820 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 820 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 821 | 821 | </label> |
| 822 | 822 | |
| 823 | 823 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | class="card-expiry-year"/> |
| 827 | 827 | |
| 828 | 828 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
| 829 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
| 829 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
| 830 | 830 | required aria-required="true"/> |
| 831 | 831 | </p> |
| 832 | 832 | <?php |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | * |
| 838 | 838 | * @param int $form_id The form ID. |
| 839 | 839 | */ |
| 840 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
| 840 | + do_action('give_after_cc_expiration', $form_id); |
|
| 841 | 841 | ?> |
| 842 | 842 | </fieldset> |
| 843 | 843 | <?php |
@@ -848,12 +848,12 @@ discard block |
||
| 848 | 848 | * |
| 849 | 849 | * @param int $form_id The form ID. |
| 850 | 850 | */ |
| 851 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 851 | + do_action('give_after_cc_fields', $form_id); |
|
| 852 | 852 | |
| 853 | 853 | echo ob_get_clean(); |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 856 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 857 | 857 | |
| 858 | 858 | /** |
| 859 | 859 | * Outputs the default credit card address fields. |
@@ -864,24 +864,24 @@ discard block |
||
| 864 | 864 | * |
| 865 | 865 | * @return void |
| 866 | 866 | */ |
| 867 | -function give_default_cc_address_fields( $form_id ) { |
|
| 867 | +function give_default_cc_address_fields($form_id) { |
|
| 868 | 868 | // Get user info. |
| 869 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 869 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 870 | 870 | |
| 871 | 871 | $logged_in = is_user_logged_in(); |
| 872 | 872 | |
| 873 | - if ( $logged_in ) { |
|
| 874 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 873 | + if ($logged_in) { |
|
| 874 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 875 | 875 | } |
| 876 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 877 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 878 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 879 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 876 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 877 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 878 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 879 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 880 | 880 | |
| 881 | 881 | ob_start(); |
| 882 | 882 | ?> |
| 883 | 883 | <fieldset id="give_cc_address" class="cc-address"> |
| 884 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 884 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 885 | 885 | <?php |
| 886 | 886 | /** |
| 887 | 887 | * Fires while rendering credit card billing form, before address fields. |
@@ -890,79 +890,79 @@ discard block |
||
| 890 | 890 | * |
| 891 | 891 | * @param int $form_id The form ID. |
| 892 | 892 | */ |
| 893 | - do_action( 'give_cc_billing_top' ); |
|
| 893 | + do_action('give_cc_billing_top'); |
|
| 894 | 894 | ?> |
| 895 | 895 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
| 896 | 896 | <label for="card_address" class="give-label"> |
| 897 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
| 897 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
| 898 | 898 | <?php |
| 899 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
| 899 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
| 900 | 900 | <span class="give-required-indicator">*</span> |
| 901 | 901 | <?php endif; ?> |
| 902 | 902 | <span class="give-tooltip give-icon give-icon-question" |
| 903 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 903 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 904 | 904 | </label> |
| 905 | 905 | |
| 906 | 906 | <input |
| 907 | 907 | type="text" |
| 908 | 908 | id="card_address" |
| 909 | 909 | name="card_address" |
| 910 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
| 911 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
| 912 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
| 913 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 910 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
| 911 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
| 912 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
| 913 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 914 | 914 | /> |
| 915 | 915 | </p> |
| 916 | 916 | |
| 917 | 917 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
| 918 | 918 | <label for="card_address_2" class="give-label"> |
| 919 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
| 920 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
| 919 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
| 920 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
| 921 | 921 | <span class="give-required-indicator">*</span> |
| 922 | 922 | <?php endif; ?> |
| 923 | 923 | <span class="give-tooltip give-icon give-icon-question" |
| 924 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 924 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 925 | 925 | </label> |
| 926 | 926 | |
| 927 | 927 | <input |
| 928 | 928 | type="text" |
| 929 | 929 | id="card_address_2" |
| 930 | 930 | name="card_address_2" |
| 931 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
| 932 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
| 933 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 934 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 931 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
| 932 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
| 933 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 934 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 935 | 935 | /> |
| 936 | 936 | </p> |
| 937 | 937 | |
| 938 | 938 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
| 939 | 939 | <label for="card_city" class="give-label"> |
| 940 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
| 941 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
| 940 | + <?php esc_html_e('City', 'give'); ?> |
|
| 941 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
| 942 | 942 | <span class="give-required-indicator">*</span> |
| 943 | 943 | <?php endif; ?> |
| 944 | 944 | <span class="give-tooltip give-icon give-icon-question" |
| 945 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 945 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
| 946 | 946 | </label> |
| 947 | 947 | <input |
| 948 | 948 | type="text" |
| 949 | 949 | id="card_city" |
| 950 | 950 | name="card_city" |
| 951 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
| 952 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
| 953 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
| 954 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 951 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
| 952 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
| 953 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
| 954 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 955 | 955 | /> |
| 956 | 956 | </p> |
| 957 | 957 | |
| 958 | 958 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
| 959 | 959 | <label for="card_zip" class="give-label"> |
| 960 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
| 961 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
| 960 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
| 961 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
| 962 | 962 | <span class="give-required-indicator">*</span> |
| 963 | 963 | <?php endif; ?> |
| 964 | 964 | <span class="give-tooltip give-icon give-icon-question" |
| 965 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 965 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 966 | 966 | </label> |
| 967 | 967 | |
| 968 | 968 | <input |
@@ -970,40 +970,40 @@ discard block |
||
| 970 | 970 | size="4" |
| 971 | 971 | id="card_zip" |
| 972 | 972 | name="card_zip" |
| 973 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
| 974 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
| 975 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 976 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 973 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
| 974 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
| 975 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 976 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 977 | 977 | /> |
| 978 | 978 | </p> |
| 979 | 979 | |
| 980 | 980 | <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive"> |
| 981 | 981 | <label for="billing_country" class="give-label"> |
| 982 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 983 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
| 982 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 983 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
| 984 | 984 | <span class="give-required-indicator">*</span> |
| 985 | 985 | <?php endif; ?> |
| 986 | 986 | <span class="give-tooltip give-icon give-icon-question" |
| 987 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 987 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 988 | 988 | </label> |
| 989 | 989 | |
| 990 | 990 | <select |
| 991 | 991 | name="billing_country" |
| 992 | 992 | id="billing_country" |
| 993 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
| 994 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 993 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
| 994 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 995 | 995 | > |
| 996 | 996 | <?php |
| 997 | 997 | |
| 998 | 998 | $selected_country = give_get_country(); |
| 999 | 999 | |
| 1000 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
| 1000 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
| 1001 | 1001 | $selected_country = $give_user_info['billing_country']; |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | $countries = give_get_country_list(); |
| 1005 | - foreach ( $countries as $country_code => $country ) { |
|
| 1006 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 1005 | + foreach ($countries as $country_code => $country) { |
|
| 1006 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 1007 | 1007 | } |
| 1008 | 1008 | ?> |
| 1009 | 1009 | </select> |
@@ -1012,42 +1012,42 @@ discard block |
||
| 1012 | 1012 | |
| 1013 | 1013 | <?php |
| 1014 | 1014 | $selected_state = give_get_state(); |
| 1015 | - $states = give_get_states( $selected_country ); |
|
| 1015 | + $states = give_get_states($selected_country); |
|
| 1016 | 1016 | |
| 1017 | 1017 | // Get the country list that does not have any states init. |
| 1018 | 1018 | $no_states_country = give_no_states_country_list(); |
| 1019 | 1019 | |
| 1020 | 1020 | |
| 1021 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
| 1021 | + if ( ! empty($give_user_info['card_state'])) { |
|
| 1022 | 1022 | $selected_state = $give_user_info['card_state']; |
| 1023 | 1023 | } |
| 1024 | 1024 | ?> |
| 1025 | - <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> "> |
|
| 1025 | + <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> "> |
|
| 1026 | 1026 | <label for="card_state" class="give-label"> |
| 1027 | - <?php esc_html_e( 'State / Province / County', 'give' ); ?> |
|
| 1028 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
| 1027 | + <?php esc_html_e('State / Province / County', 'give'); ?> |
|
| 1028 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
| 1029 | 1029 | <span class="give-required-indicator">*</span> |
| 1030 | 1030 | <?php endif; ?> |
| 1031 | 1031 | <span class="give-tooltip give-icon give-icon-question" |
| 1032 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 1032 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 1033 | 1033 | </label> |
| 1034 | 1034 | <?php |
| 1035 | 1035 | |
| 1036 | - if ( ! empty( $states ) ) : ?> |
|
| 1036 | + if ( ! empty($states)) : ?> |
|
| 1037 | 1037 | <select |
| 1038 | 1038 | name="card_state" |
| 1039 | 1039 | id="card_state" |
| 1040 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
| 1041 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
| 1040 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
| 1041 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
| 1042 | 1042 | <?php |
| 1043 | - foreach ( $states as $state_code => $state ) { |
|
| 1044 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 1043 | + foreach ($states as $state_code => $state) { |
|
| 1044 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 1045 | 1045 | } |
| 1046 | 1046 | ?> |
| 1047 | 1047 | </select> |
| 1048 | 1048 | <?php else : ?> |
| 1049 | 1049 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1050 | - placeholder="<?php esc_attr_e( 'State / Province / County', 'give' ); ?>"/> |
|
| 1050 | + placeholder="<?php esc_attr_e('State / Province / County', 'give'); ?>"/> |
|
| 1051 | 1051 | <?php endif; ?> |
| 1052 | 1052 | </p> |
| 1053 | 1053 | <?php |
@@ -1058,14 +1058,14 @@ discard block |
||
| 1058 | 1058 | * |
| 1059 | 1059 | * @param int $form_id The form ID. |
| 1060 | 1060 | */ |
| 1061 | - do_action( 'give_cc_billing_bottom' ); |
|
| 1061 | + do_action('give_cc_billing_bottom'); |
|
| 1062 | 1062 | ?> |
| 1063 | 1063 | </fieldset> |
| 1064 | 1064 | <?php |
| 1065 | 1065 | echo ob_get_clean(); |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 1068 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 1069 | 1069 | |
| 1070 | 1070 | |
| 1071 | 1071 | /** |
@@ -1078,24 +1078,24 @@ discard block |
||
| 1078 | 1078 | * |
| 1079 | 1079 | * @return string |
| 1080 | 1080 | */ |
| 1081 | -function give_get_register_fields( $form_id ) { |
|
| 1081 | +function give_get_register_fields($form_id) { |
|
| 1082 | 1082 | |
| 1083 | 1083 | global $user_ID; |
| 1084 | 1084 | |
| 1085 | - if ( is_user_logged_in() ) { |
|
| 1086 | - $user_data = get_userdata( $user_ID ); |
|
| 1085 | + if (is_user_logged_in()) { |
|
| 1086 | + $user_data = get_userdata($user_ID); |
|
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1089 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1090 | 1090 | |
| 1091 | 1091 | ob_start(); ?> |
| 1092 | 1092 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 1093 | 1093 | |
| 1094 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1094 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1095 | 1095 | <div class="give-login-account-wrap"> |
| 1096 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 1097 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
| 1098 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 1096 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 1097 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
| 1098 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 1099 | 1099 | </p> |
| 1100 | 1100 | <p class="give-loading-text"> |
| 1101 | 1101 | <span class="give-loading-animation"></span> |
@@ -1111,15 +1111,15 @@ discard block |
||
| 1111 | 1111 | * |
| 1112 | 1112 | * @param int $form_id The form ID. |
| 1113 | 1113 | */ |
| 1114 | - do_action( 'give_register_fields_before', $form_id ); |
|
| 1114 | + do_action('give_register_fields_before', $form_id); |
|
| 1115 | 1115 | ?> |
| 1116 | 1116 | |
| 1117 | 1117 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 1118 | 1118 | <legend> |
| 1119 | 1119 | <?php |
| 1120 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
| 1121 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1122 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1120 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
| 1121 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1122 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1123 | 1123 | } |
| 1124 | 1124 | ?> |
| 1125 | 1125 | </legend> |
@@ -1131,54 +1131,54 @@ discard block |
||
| 1131 | 1131 | * |
| 1132 | 1132 | * @param int $form_id The form ID. |
| 1133 | 1133 | */ |
| 1134 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
| 1134 | + do_action('give_register_account_fields_before', $form_id); |
|
| 1135 | 1135 | ?> |
| 1136 | 1136 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" |
| 1137 | 1137 | class="form-row form-row-one-third form-row-first form-row-responsive"> |
| 1138 | 1138 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 1139 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1140 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1139 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1140 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1141 | 1141 | <span class="give-required-indicator">*</span> |
| 1142 | 1142 | <?php } ?> |
| 1143 | 1143 | <span class="give-tooltip give-icon give-icon-question" |
| 1144 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 1144 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 1145 | 1145 | </label> |
| 1146 | 1146 | |
| 1147 | 1147 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
| 1148 | 1148 | type="text" |
| 1149 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1149 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1150 | 1150 | </div> |
| 1151 | 1151 | |
| 1152 | 1152 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1153 | 1153 | class="form-row form-row-one-third form-row-responsive"> |
| 1154 | 1154 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 1155 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1156 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1155 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1156 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1157 | 1157 | <span class="give-required-indicator">*</span> |
| 1158 | 1158 | <?php } ?> |
| 1159 | 1159 | <span class="give-tooltip give-icon give-icon-question" |
| 1160 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 1160 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
| 1161 | 1161 | </label> |
| 1162 | 1162 | |
| 1163 | 1163 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
| 1164 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
| 1165 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1164 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
| 1165 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1166 | 1166 | </div> |
| 1167 | 1167 | |
| 1168 | 1168 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
| 1169 | 1169 | class="give-register-password form-row form-row-one-third form-row-responsive"> |
| 1170 | 1170 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 1171 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
| 1172 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1171 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
| 1172 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1173 | 1173 | <span class="give-required-indicator">*</span> |
| 1174 | 1174 | <?php } ?> |
| 1175 | 1175 | <span class="give-tooltip give-icon give-icon-question" |
| 1176 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 1176 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 1177 | 1177 | </label> |
| 1178 | 1178 | |
| 1179 | 1179 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
| 1180 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
| 1181 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1180 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
| 1181 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1182 | 1182 | </div> |
| 1183 | 1183 | <?php |
| 1184 | 1184 | /** |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | * |
| 1189 | 1189 | * @param int $form_id The form ID. |
| 1190 | 1190 | */ |
| 1191 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
| 1191 | + do_action('give_register_account_fields_after', $form_id); |
|
| 1192 | 1192 | ?> |
| 1193 | 1193 | </fieldset> |
| 1194 | 1194 | |
@@ -1200,7 +1200,7 @@ discard block |
||
| 1200 | 1200 | * |
| 1201 | 1201 | * @param int $form_id The form ID. |
| 1202 | 1202 | */ |
| 1203 | - do_action( 'give_register_fields_after', $form_id ); |
|
| 1203 | + do_action('give_register_fields_after', $form_id); |
|
| 1204 | 1204 | ?> |
| 1205 | 1205 | |
| 1206 | 1206 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | * |
| 1212 | 1212 | * @since 1.7 |
| 1213 | 1213 | */ |
| 1214 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 1214 | + do_action('give_donation_form_user_info', $form_id); |
|
| 1215 | 1215 | ?> |
| 1216 | 1216 | |
| 1217 | 1217 | </fieldset> |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | echo ob_get_clean(); |
| 1220 | 1220 | } |
| 1221 | 1221 | |
| 1222 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
| 1222 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
| 1223 | 1223 | |
| 1224 | 1224 | /** |
| 1225 | 1225 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1232,27 +1232,27 @@ discard block |
||
| 1232 | 1232 | * |
| 1233 | 1233 | * @return string |
| 1234 | 1234 | */ |
| 1235 | -function give_get_login_fields( $form_id ) { |
|
| 1235 | +function give_get_login_fields($form_id) { |
|
| 1236 | 1236 | |
| 1237 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 1238 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1237 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 1238 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1239 | 1239 | |
| 1240 | 1240 | ob_start(); |
| 1241 | 1241 | ?> |
| 1242 | 1242 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 1243 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
| 1244 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1245 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1243 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
| 1244 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1245 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1246 | 1246 | } ?> |
| 1247 | 1247 | </legend> |
| 1248 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1248 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1249 | 1249 | <p class="give-new-account-link"> |
| 1250 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
| 1251 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
| 1250 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
| 1251 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
| 1252 | 1252 | data-action="give_checkout_register"> |
| 1253 | - <?php esc_html_e( 'Register', 'give' ); |
|
| 1254 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1255 | - echo ' ' . esc_html__( 'and donate as a guest »', 'give' ); |
|
| 1253 | + <?php esc_html_e('Register', 'give'); |
|
| 1254 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1255 | + echo ' '.esc_html__('and donate as a guest »', 'give'); |
|
| 1256 | 1256 | } ?> |
| 1257 | 1257 | </a> |
| 1258 | 1258 | </p> |
@@ -1268,49 +1268,49 @@ discard block |
||
| 1268 | 1268 | * |
| 1269 | 1269 | * @param int $form_id The form ID. |
| 1270 | 1270 | */ |
| 1271 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
| 1271 | + do_action('give_checkout_login_fields_before', $form_id); |
|
| 1272 | 1272 | ?> |
| 1273 | 1273 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
| 1274 | 1274 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 1275 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1276 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1275 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1276 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1277 | 1277 | <span class="give-required-indicator">*</span> |
| 1278 | 1278 | <?php } ?> |
| 1279 | 1279 | </label> |
| 1280 | 1280 | |
| 1281 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
| 1281 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
| 1282 | 1282 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
| 1283 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1283 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1284 | 1284 | </div> |
| 1285 | 1285 | |
| 1286 | 1286 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1287 | 1287 | class="give_login_password form-row form-row-last form-row-responsive"> |
| 1288 | 1288 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 1289 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1290 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1289 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1290 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1291 | 1291 | <span class="give-required-indicator">*</span> |
| 1292 | 1292 | <?php } ?> |
| 1293 | 1293 | </label> |
| 1294 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
| 1294 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
| 1295 | 1295 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
| 1296 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1296 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1297 | 1297 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 1298 | 1298 | </div> |
| 1299 | 1299 | |
| 1300 | 1300 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 1301 | 1301 | <span class="give-forgot-password "> |
| 1302 | 1302 | <a href="<?php echo wp_lostpassword_url() ?>" |
| 1303 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
| 1303 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
| 1304 | 1304 | </span> |
| 1305 | 1305 | </div> |
| 1306 | 1306 | |
| 1307 | 1307 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 1308 | 1308 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
| 1309 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
| 1310 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 1309 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
| 1310 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 1311 | 1311 | <input type="button" data-action="give_cancel_login" |
| 1312 | 1312 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
| 1313 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
| 1313 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
| 1314 | 1314 | <?php } ?> |
| 1315 | 1315 | <span class="give-loading-animation"></span> |
| 1316 | 1316 | </div> |
@@ -1322,14 +1322,14 @@ discard block |
||
| 1322 | 1322 | * |
| 1323 | 1323 | * @param int $form_id The form ID. |
| 1324 | 1324 | */ |
| 1325 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
| 1325 | + do_action('give_checkout_login_fields_after', $form_id); |
|
| 1326 | 1326 | ?> |
| 1327 | 1327 | </fieldset><!--end #give-login-fields--> |
| 1328 | 1328 | <?php |
| 1329 | 1329 | echo ob_get_clean(); |
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 1332 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 1333 | 1333 | |
| 1334 | 1334 | /** |
| 1335 | 1335 | * Payment Mode Select. |
@@ -1345,9 +1345,9 @@ discard block |
||
| 1345 | 1345 | * |
| 1346 | 1346 | * @return void |
| 1347 | 1347 | */ |
| 1348 | -function give_payment_mode_select( $form_id ) { |
|
| 1348 | +function give_payment_mode_select($form_id) { |
|
| 1349 | 1349 | |
| 1350 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
| 1350 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
| 1351 | 1351 | |
| 1352 | 1352 | /** |
| 1353 | 1353 | * Fires while selecting payment gateways, before the fields. |
@@ -1356,10 +1356,10 @@ discard block |
||
| 1356 | 1356 | * |
| 1357 | 1357 | * @param int $form_id The form ID. |
| 1358 | 1358 | */ |
| 1359 | - do_action( 'give_payment_mode_top', $form_id ); |
|
| 1359 | + do_action('give_payment_mode_top', $form_id); |
|
| 1360 | 1360 | ?> |
| 1361 | 1361 | |
| 1362 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
| 1362 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
| 1363 | 1363 | echo 'style="display: none;"'; |
| 1364 | 1364 | } ?>> |
| 1365 | 1365 | <?php |
@@ -1370,10 +1370,10 @@ discard block |
||
| 1370 | 1370 | * |
| 1371 | 1371 | * @param int $form_id The form ID. |
| 1372 | 1372 | */ |
| 1373 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
| 1373 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
| 1374 | 1374 | ?> |
| 1375 | 1375 | <legend |
| 1376 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
| 1376 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
| 1377 | 1377 | <span class="give-loading-text"><span |
| 1378 | 1378 | class="give-loading-animation"></span> |
| 1379 | 1379 | </span> |
@@ -1386,26 +1386,26 @@ discard block |
||
| 1386 | 1386 | * |
| 1387 | 1387 | * @since 1.7 |
| 1388 | 1388 | */ |
| 1389 | - do_action( 'give_payment_mode_before_gateways' ) |
|
| 1389 | + do_action('give_payment_mode_before_gateways') |
|
| 1390 | 1390 | ?> |
| 1391 | 1391 | <ul id="give-gateway-radio-list"> |
| 1392 | 1392 | <?php |
| 1393 | 1393 | /** |
| 1394 | 1394 | * Loop through the active payment gateways. |
| 1395 | 1395 | */ |
| 1396 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
| 1396 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
| 1397 | 1397 | |
| 1398 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 1398 | + foreach ($gateways as $gateway_id => $gateway) : |
|
| 1399 | 1399 | //Determine the default gateway. |
| 1400 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
| 1400 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
| 1401 | 1401 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
| 1402 | 1402 | <li<?php echo $checked_class ?>> |
| 1403 | 1403 | <input type="radio" name="payment-mode" class="give-gateway" |
| 1404 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1405 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
| 1406 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1404 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1405 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
| 1406 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1407 | 1407 | class="give-gateway-option" |
| 1408 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
| 1408 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
| 1409 | 1409 | </li> |
| 1410 | 1410 | <?php |
| 1411 | 1411 | endforeach; |
@@ -1417,7 +1417,7 @@ discard block |
||
| 1417 | 1417 | * |
| 1418 | 1418 | * @since 1.7 |
| 1419 | 1419 | */ |
| 1420 | - do_action( 'give_payment_mode_after_gateways' ); |
|
| 1420 | + do_action('give_payment_mode_after_gateways'); |
|
| 1421 | 1421 | ?> |
| 1422 | 1422 | </div> |
| 1423 | 1423 | <?php |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | * |
| 1429 | 1429 | * @param int $form_id The form ID. |
| 1430 | 1430 | */ |
| 1431 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
| 1431 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
| 1432 | 1432 | ?> |
| 1433 | 1433 | </fieldset> |
| 1434 | 1434 | |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | * |
| 1441 | 1441 | * @param int $form_id The form ID. |
| 1442 | 1442 | */ |
| 1443 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
| 1443 | + do_action('give_payment_mode_bottom', $form_id); |
|
| 1444 | 1444 | ?> |
| 1445 | 1445 | |
| 1446 | 1446 | <div id="give_purchase_form_wrap"> |
@@ -1451,7 +1451,7 @@ discard block |
||
| 1451 | 1451 | * |
| 1452 | 1452 | * @since 1.7 |
| 1453 | 1453 | */ |
| 1454 | - do_action( 'give_donation_form', $form_id ); |
|
| 1454 | + do_action('give_donation_form', $form_id); |
|
| 1455 | 1455 | ?> |
| 1456 | 1456 | |
| 1457 | 1457 | </div> |
@@ -1462,10 +1462,10 @@ discard block |
||
| 1462 | 1462 | * |
| 1463 | 1463 | * @since 1.7 |
| 1464 | 1464 | */ |
| 1465 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
| 1465 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 1468 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 1469 | 1469 | |
| 1470 | 1470 | /** |
| 1471 | 1471 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1478,31 +1478,31 @@ discard block |
||
| 1478 | 1478 | * |
| 1479 | 1479 | * @return bool |
| 1480 | 1480 | */ |
| 1481 | -function give_terms_agreement( $form_id ) { |
|
| 1482 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
| 1481 | +function give_terms_agreement($form_id) { |
|
| 1482 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
| 1483 | 1483 | |
| 1484 | 1484 | // Bailout if per form and global term and conditions is not setup. |
| 1485 | 1485 | if ( |
| 1486 | - give_is_setting_enabled( $form_option, 'global' ) |
|
| 1487 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
| 1486 | + give_is_setting_enabled($form_option, 'global') |
|
| 1487 | + && give_is_setting_enabled(give_get_option('terms')) |
|
| 1488 | 1488 | ) { |
| 1489 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
| 1490 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
| 1491 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
| 1489 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
| 1490 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
| 1491 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
| 1492 | 1492 | |
| 1493 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
| 1494 | - $label = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
| 1495 | - $terms = give_get_meta( $form_id, '_give_agree_text', true ); |
|
| 1496 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
| 1493 | + } elseif (give_is_setting_enabled($form_option)) { |
|
| 1494 | + $label = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
| 1495 | + $terms = give_get_meta($form_id, '_give_agree_text', true); |
|
| 1496 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
| 1497 | 1497 | |
| 1498 | 1498 | } else { |
| 1499 | 1499 | return false; |
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | 1502 | // Bailout: Check if term and conditions text is empty or not. |
| 1503 | - if ( empty( $terms ) ) { |
|
| 1504 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
| 1505 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
| 1503 | + if (empty($terms)) { |
|
| 1504 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
| 1505 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
| 1506 | 1506 | } |
| 1507 | 1507 | |
| 1508 | 1508 | return false; |
@@ -1510,7 +1510,7 @@ discard block |
||
| 1510 | 1510 | |
| 1511 | 1511 | ?> |
| 1512 | 1512 | <fieldset id="give_terms_agreement"> |
| 1513 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
| 1513 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
| 1514 | 1514 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
| 1515 | 1515 | <?php |
| 1516 | 1516 | /** |
@@ -1518,22 +1518,22 @@ discard block |
||
| 1518 | 1518 | * |
| 1519 | 1519 | * @since 1.0 |
| 1520 | 1520 | */ |
| 1521 | - do_action( 'give_before_terms' ); |
|
| 1521 | + do_action('give_before_terms'); |
|
| 1522 | 1522 | |
| 1523 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1523 | + echo wpautop(stripslashes($terms)); |
|
| 1524 | 1524 | /** |
| 1525 | 1525 | * Fires while rendering terms of agreement, after the fields. |
| 1526 | 1526 | * |
| 1527 | 1527 | * @since 1.0 |
| 1528 | 1528 | */ |
| 1529 | - do_action( 'give_after_terms' ); |
|
| 1529 | + do_action('give_after_terms'); |
|
| 1530 | 1530 | ?> |
| 1531 | 1531 | </div> |
| 1532 | 1532 | <div id="give_show_terms"> |
| 1533 | 1533 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1534 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1534 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1535 | 1535 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1536 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1536 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1537 | 1537 | </div> |
| 1538 | 1538 | |
| 1539 | 1539 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | <?php |
| 1545 | 1545 | } |
| 1546 | 1546 | |
| 1547 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
| 1547 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
| 1548 | 1548 | |
| 1549 | 1549 | /** |
| 1550 | 1550 | * Checkout Final Total. |
@@ -1557,29 +1557,29 @@ discard block |
||
| 1557 | 1557 | * |
| 1558 | 1558 | * @return void |
| 1559 | 1559 | */ |
| 1560 | -function give_checkout_final_total( $form_id ) { |
|
| 1560 | +function give_checkout_final_total($form_id) { |
|
| 1561 | 1561 | |
| 1562 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1563 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1562 | + if (isset($_POST['give_total'])) { |
|
| 1563 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1564 | 1564 | } else { |
| 1565 | 1565 | //default total. |
| 1566 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1566 | + $total = give_get_default_form_amount($form_id); |
|
| 1567 | 1567 | } |
| 1568 | 1568 | //Only proceed if give_total available. |
| 1569 | - if ( empty( $total ) ) { |
|
| 1569 | + if (empty($total)) { |
|
| 1570 | 1570 | return; |
| 1571 | 1571 | } |
| 1572 | 1572 | ?> |
| 1573 | 1573 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1574 | 1574 | <span |
| 1575 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1575 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
| 1576 | 1576 | <span class="give-final-total-amount" |
| 1577 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1577 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1578 | 1578 | </p> |
| 1579 | 1579 | <?php |
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1582 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1583 | 1583 | |
| 1584 | 1584 | /** |
| 1585 | 1585 | * Renders the Checkout Submit section. |
@@ -1590,7 +1590,7 @@ discard block |
||
| 1590 | 1590 | * |
| 1591 | 1591 | * @return void |
| 1592 | 1592 | */ |
| 1593 | -function give_checkout_submit( $form_id ) { |
|
| 1593 | +function give_checkout_submit($form_id) { |
|
| 1594 | 1594 | ?> |
| 1595 | 1595 | <fieldset id="give_purchase_submit"> |
| 1596 | 1596 | <?php |
@@ -1599,24 +1599,24 @@ discard block |
||
| 1599 | 1599 | * |
| 1600 | 1600 | * @since 1.7 |
| 1601 | 1601 | */ |
| 1602 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
| 1602 | + do_action('give_donation_form_before_submit', $form_id); |
|
| 1603 | 1603 | |
| 1604 | - give_checkout_hidden_fields( $form_id ); |
|
| 1604 | + give_checkout_hidden_fields($form_id); |
|
| 1605 | 1605 | |
| 1606 | - echo give_get_donation_form_submit_button( $form_id ); |
|
| 1606 | + echo give_get_donation_form_submit_button($form_id); |
|
| 1607 | 1607 | |
| 1608 | 1608 | /** |
| 1609 | 1609 | * Fire after donation form submit. |
| 1610 | 1610 | * |
| 1611 | 1611 | * @since 1.7 |
| 1612 | 1612 | */ |
| 1613 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
| 1613 | + do_action('give_donation_form_after_submit', $form_id); |
|
| 1614 | 1614 | ?> |
| 1615 | 1615 | </fieldset> |
| 1616 | 1616 | <?php |
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1619 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1620 | 1620 | |
| 1621 | 1621 | /** |
| 1622 | 1622 | * Give Donation form submit button. |
@@ -1627,10 +1627,10 @@ discard block |
||
| 1627 | 1627 | * |
| 1628 | 1628 | * @return string |
| 1629 | 1629 | */ |
| 1630 | -function give_get_donation_form_submit_button( $form_id ) { |
|
| 1630 | +function give_get_donation_form_submit_button($form_id) { |
|
| 1631 | 1631 | |
| 1632 | - $display_label_field = give_get_meta( $form_id, '_give_checkout_label', true ); |
|
| 1633 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1632 | + $display_label_field = give_get_meta($form_id, '_give_checkout_label', true); |
|
| 1633 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1634 | 1634 | ob_start(); |
| 1635 | 1635 | ?> |
| 1636 | 1636 | <div class="give-submit-button-wrap give-clearfix"> |
@@ -1638,7 +1638,7 @@ discard block |
||
| 1638 | 1638 | <span class="give-loading-animation"></span> |
| 1639 | 1639 | </div> |
| 1640 | 1640 | <?php |
| 1641 | - return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id ); |
|
| 1641 | + return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id); |
|
| 1642 | 1642 | } |
| 1643 | 1643 | |
| 1644 | 1644 | /** |
@@ -1653,17 +1653,17 @@ discard block |
||
| 1653 | 1653 | * |
| 1654 | 1654 | * @return mixed |
| 1655 | 1655 | */ |
| 1656 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1656 | +function give_show_goal_progress($form_id, $args) { |
|
| 1657 | 1657 | |
| 1658 | 1658 | ob_start(); |
| 1659 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
| 1659 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
| 1660 | 1660 | |
| 1661 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
| 1661 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
| 1662 | 1662 | |
| 1663 | 1663 | return true; |
| 1664 | 1664 | } |
| 1665 | 1665 | |
| 1666 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1666 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1667 | 1667 | |
| 1668 | 1668 | |
| 1669 | 1669 | /** |
@@ -1676,10 +1676,10 @@ discard block |
||
| 1676 | 1676 | * |
| 1677 | 1677 | * @return mixed|string |
| 1678 | 1678 | */ |
| 1679 | -function give_get_form_content_placement( $form_id, $args ) { |
|
| 1679 | +function give_get_form_content_placement($form_id, $args) { |
|
| 1680 | 1680 | $show_content = ''; |
| 1681 | 1681 | |
| 1682 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
| 1682 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
| 1683 | 1683 | // Content positions. |
| 1684 | 1684 | $content_placement = array( |
| 1685 | 1685 | 'above' => 'give_pre_form', |
@@ -1687,18 +1687,18 @@ discard block |
||
| 1687 | 1687 | ); |
| 1688 | 1688 | |
| 1689 | 1689 | // Check if content position already decoded. |
| 1690 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
| 1690 | + if (in_array($args['show_content'], $content_placement)) { |
|
| 1691 | 1691 | return $args['show_content']; |
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
| 1694 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
| 1695 | 1695 | |
| 1696 | - } elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) { |
|
| 1697 | - $show_content = give_get_meta( $form_id, '_give_content_placement', true ); |
|
| 1696 | + } elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) { |
|
| 1697 | + $show_content = give_get_meta($form_id, '_give_content_placement', true); |
|
| 1698 | 1698 | |
| 1699 | - } elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) { |
|
| 1699 | + } elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) { |
|
| 1700 | 1700 | // Backward compatibility for _give_content_option for v18. |
| 1701 | - $show_content = give_get_meta( $form_id, '_give_content_option', true ); |
|
| 1701 | + $show_content = give_get_meta($form_id, '_give_content_option', true); |
|
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | 1704 | return $show_content; |
@@ -1714,20 +1714,20 @@ discard block |
||
| 1714 | 1714 | * |
| 1715 | 1715 | * @return void|bool |
| 1716 | 1716 | */ |
| 1717 | -function give_form_content( $form_id, $args ) { |
|
| 1717 | +function give_form_content($form_id, $args) { |
|
| 1718 | 1718 | |
| 1719 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1719 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1720 | 1720 | |
| 1721 | 1721 | // Bailout. |
| 1722 | - if ( empty( $show_content ) ) { |
|
| 1722 | + if (empty($show_content)) { |
|
| 1723 | 1723 | return false; |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | 1726 | // Add action according to value. |
| 1727 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 1727 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 1728 | 1728 | } |
| 1729 | 1729 | |
| 1730 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1730 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1731 | 1731 | |
| 1732 | 1732 | /** |
| 1733 | 1733 | * Renders Post Form Content. |
@@ -1741,22 +1741,22 @@ discard block |
||
| 1741 | 1741 | * |
| 1742 | 1742 | * @return void |
| 1743 | 1743 | */ |
| 1744 | -function give_form_display_content( $form_id, $args ) { |
|
| 1744 | +function give_form_display_content($form_id, $args) { |
|
| 1745 | 1745 | |
| 1746 | - $content = wpautop( give_get_meta( $form_id, '_give_form_content', true ) ); |
|
| 1747 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1746 | + $content = wpautop(give_get_meta($form_id, '_give_form_content', true)); |
|
| 1747 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1748 | 1748 | |
| 1749 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
| 1750 | - $content = apply_filters( 'the_content', $content ); |
|
| 1749 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
| 1750 | + $content = apply_filters('the_content', $content); |
|
| 1751 | 1751 | } |
| 1752 | 1752 | |
| 1753 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
| 1753 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
| 1754 | 1754 | |
| 1755 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1755 | + echo apply_filters('give_form_content_output', $output); |
|
| 1756 | 1756 | |
| 1757 | 1757 | //remove action to prevent content output on addition forms on page. |
| 1758 | 1758 | //@see: https://github.com/WordImpress/Give/issues/634. |
| 1759 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 1759 | + remove_action($show_content, 'give_form_display_content'); |
|
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | 1762 | /** |
@@ -1768,7 +1768,7 @@ discard block |
||
| 1768 | 1768 | * |
| 1769 | 1769 | * @return void |
| 1770 | 1770 | */ |
| 1771 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1771 | +function give_checkout_hidden_fields($form_id) { |
|
| 1772 | 1772 | |
| 1773 | 1773 | /** |
| 1774 | 1774 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1777,13 +1777,13 @@ discard block |
||
| 1777 | 1777 | * |
| 1778 | 1778 | * @param int $form_id The form ID. |
| 1779 | 1779 | */ |
| 1780 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1780 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1781 | 1781 | |
| 1782 | - if ( is_user_logged_in() ) { ?> |
|
| 1782 | + if (is_user_logged_in()) { ?> |
|
| 1783 | 1783 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1784 | 1784 | <?php } ?> |
| 1785 | 1785 | <input type="hidden" name="give_action" value="purchase"/> |
| 1786 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1786 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1787 | 1787 | <?php |
| 1788 | 1788 | /** |
| 1789 | 1789 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1792,7 +1792,7 @@ discard block |
||
| 1792 | 1792 | * |
| 1793 | 1793 | * @param int $form_id The form ID. |
| 1794 | 1794 | */ |
| 1795 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1795 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1796 | 1796 | |
| 1797 | 1797 | } |
| 1798 | 1798 | |
@@ -1807,20 +1807,20 @@ discard block |
||
| 1807 | 1807 | * |
| 1808 | 1808 | * @return string $content Filtered content. |
| 1809 | 1809 | */ |
| 1810 | -function give_filter_success_page_content( $content ) { |
|
| 1810 | +function give_filter_success_page_content($content) { |
|
| 1811 | 1811 | |
| 1812 | 1812 | $give_options = give_get_settings(); |
| 1813 | 1813 | |
| 1814 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1815 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1816 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1814 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1815 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1816 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1817 | 1817 | } |
| 1818 | 1818 | } |
| 1819 | 1819 | |
| 1820 | 1820 | return $content; |
| 1821 | 1821 | } |
| 1822 | 1822 | |
| 1823 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1823 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1824 | 1824 | |
| 1825 | 1825 | /** |
| 1826 | 1826 | * Test Mode Frontend Warning. |
@@ -1831,12 +1831,12 @@ discard block |
||
| 1831 | 1831 | */ |
| 1832 | 1832 | function give_test_mode_frontend_warning() { |
| 1833 | 1833 | |
| 1834 | - if ( give_is_test_mode() ) { |
|
| 1835 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
| 1834 | + if (give_is_test_mode()) { |
|
| 1835 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
| 1836 | 1836 | } |
| 1837 | 1837 | } |
| 1838 | 1838 | |
| 1839 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1839 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 1840 | 1840 | |
| 1841 | 1841 | /** |
| 1842 | 1842 | * Members-only Form. |
@@ -1850,21 +1850,21 @@ discard block |
||
| 1850 | 1850 | * |
| 1851 | 1851 | * @return string |
| 1852 | 1852 | */ |
| 1853 | -function give_members_only_form( $final_output, $args ) { |
|
| 1853 | +function give_members_only_form($final_output, $args) { |
|
| 1854 | 1854 | |
| 1855 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 1855 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 1856 | 1856 | |
| 1857 | 1857 | //Sanity Check: Must have form_id & not be logged in. |
| 1858 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 1858 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 1859 | 1859 | return $final_output; |
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | 1862 | //Logged in only and Register / Login set to none. |
| 1863 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 1863 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 1864 | 1864 | |
| 1865 | - $final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
| 1865 | + $final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
| 1866 | 1866 | |
| 1867 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 1867 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 1868 | 1868 | |
| 1869 | 1869 | } |
| 1870 | 1870 | |
@@ -1872,4 +1872,4 @@ discard block |
||
| 1872 | 1872 | |
| 1873 | 1873 | } |
| 1874 | 1874 | |
| 1875 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 1875 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
@@ -1045,9 +1045,12 @@ |
||
| 1045 | 1045 | } |
| 1046 | 1046 | ?> |
| 1047 | 1047 | </select> |
| 1048 | - <?php else : ?> |
|
| 1048 | + <?php else { |
|
| 1049 | + : ?> |
|
| 1049 | 1050 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1050 | - placeholder="<?php esc_attr_e( 'State / Province / County', 'give' ); ?>"/> |
|
| 1051 | + placeholder="<?php esc_attr_e( 'State / Province / County', 'give' ); |
|
| 1052 | +} |
|
| 1053 | +?>"/> |
|
| 1051 | 1054 | <?php endif; ?> |
| 1052 | 1055 | </p> |
| 1053 | 1056 | <?php |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_get_actions() { |
| 27 | 27 | |
| 28 | - $_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null; |
|
| 28 | + $_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null; |
|
| 29 | 29 | |
| 30 | 30 | // Add backward compatibility to give-action param ( $_GET ) |
| 31 | - if( empty( $_get_action ) ) { |
|
| 32 | - $_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null; |
|
| 31 | + if (empty($_get_action)) { |
|
| 32 | + $_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if ( isset( $_get_action ) ) { |
|
| 35 | + if (isset($_get_action)) { |
|
| 36 | 36 | /** |
| 37 | 37 | * Fires in WordPress init or admin init, when give_action is present in $_GET. |
| 38 | 38 | * |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @param array $_GET Array of HTTP GET variables. |
| 42 | 42 | */ |
| 43 | - do_action( "give_{$_get_action}", $_GET ); |
|
| 43 | + do_action("give_{$_get_action}", $_GET); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | -add_action( 'init', 'give_get_actions' ); |
|
| 48 | +add_action('init', 'give_get_actions'); |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Hooks Give actions, when present in the $_POST super global. Every give_action |
@@ -58,15 +58,15 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | function give_post_actions() { |
| 60 | 60 | |
| 61 | - $_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null; |
|
| 61 | + $_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null; |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | // Add backward compatibility to give-action param ( $_POST ). |
| 65 | - if( empty( $_post_action ) ) { |
|
| 66 | - $_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null; |
|
| 65 | + if (empty($_post_action)) { |
|
| 66 | + $_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if ( isset( $_post_action ) ) { |
|
| 69 | + if (isset($_post_action)) { |
|
| 70 | 70 | /** |
| 71 | 71 | * Fires in WordPress init or admin init, when give_action is present in $_POST. |
| 72 | 72 | * |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @param array $_POST Array of HTTP POST variables. |
| 76 | 76 | */ |
| 77 | - do_action( "give_{$_post_action}", $_POST ); |
|
| 77 | + do_action("give_{$_post_action}", $_POST); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | -add_action( 'init', 'give_post_actions' ); |
|
| 82 | +add_action('init', 'give_post_actions'); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Connect WordPress user with Donor. |
@@ -89,28 +89,28 @@ discard block |
||
| 89 | 89 | * @param array $user_data User Data |
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | -function give_connect_donor_to_wpuser( $user_id, $user_data ){ |
|
| 92 | +function give_connect_donor_to_wpuser($user_id, $user_data) { |
|
| 93 | 93 | /* @var Give_Donor $donor */ |
| 94 | - $donor = new Give_Donor( $user_data['user_email'] ); |
|
| 94 | + $donor = new Give_Donor($user_data['user_email']); |
|
| 95 | 95 | |
| 96 | 96 | // Validate donor id and check if do nor is already connect to wp user or not. |
| 97 | - if( $donor->id && ! $donor->user_id ) { |
|
| 97 | + if ($donor->id && ! $donor->user_id) { |
|
| 98 | 98 | |
| 99 | 99 | // Update donor user_id. |
| 100 | - if( $donor->update( array( 'user_id' => $user_id ) ) ) { |
|
| 101 | - $donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id ); |
|
| 102 | - $donor->add_note( $donor_note ); |
|
| 100 | + if ($donor->update(array('user_id' => $user_id))) { |
|
| 101 | + $donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id); |
|
| 102 | + $donor->add_note($donor_note); |
|
| 103 | 103 | |
| 104 | 104 | // Update user_id meta in payments. |
| 105 | - if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) { |
|
| 106 | - foreach ( $donations as $donation ) { |
|
| 107 | - give_update_meta( $donation, '_give_payment_user_id', $user_id ); |
|
| 105 | + if ( ! empty($donor->payment_ids) && ($donations = explode(',', $donor->payment_ids))) { |
|
| 106 | + foreach ($donations as $donation) { |
|
| 107 | + give_update_meta($donation, '_give_payment_user_id', $user_id); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | -add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 ); |
|
| 113 | +add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2); |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -124,24 +124,24 @@ discard block |
||
| 124 | 124 | function give_validate_license_when_site_migrated() { |
| 125 | 125 | // Store current site address if not already stored. |
| 126 | 126 | $homeurl = home_url(); |
| 127 | - if( ! get_option( 'give_site_address_before_migrate' ) ) { |
|
| 127 | + if ( ! get_option('give_site_address_before_migrate')) { |
|
| 128 | 128 | // Update site address. |
| 129 | - update_option( 'give_site_address_before_migrate', $homeurl ); |
|
| 129 | + update_option('give_site_address_before_migrate', $homeurl); |
|
| 130 | 130 | |
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if( $homeurl !== get_option( 'give_site_address_before_migrate' ) ) { |
|
| 134 | + if ($homeurl !== get_option('give_site_address_before_migrate')) { |
|
| 135 | 135 | // Immediately run cron. |
| 136 | - wp_schedule_single_event( time() , 'give_validate_license_when_site_migrated' ); |
|
| 136 | + wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated'); |
|
| 137 | 137 | |
| 138 | 138 | // Update site address. |
| 139 | - update_option( 'give_site_address_before_migrate', home_url() ); |
|
| 139 | + update_option('give_site_address_before_migrate', home_url()); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | } |
| 143 | -add_action( 'init', 'give_validate_license_when_site_migrated' ); |
|
| 144 | -add_action( 'admin_init', 'give_validate_license_when_site_migrated' ); |
|
| 143 | +add_action('init', 'give_validate_license_when_site_migrated'); |
|
| 144 | +add_action('admin_init', 'give_validate_license_when_site_migrated'); |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -150,18 +150,18 @@ discard block |
||
| 150 | 150 | * @since 1.8 |
| 151 | 151 | * @param $data |
| 152 | 152 | */ |
| 153 | -function give_donor_batch_export_complete( $data ) { |
|
| 153 | +function give_donor_batch_export_complete($data) { |
|
| 154 | 154 | // Remove donor ids cache. |
| 155 | - if( |
|
| 156 | - isset( $data['class'] ) |
|
| 155 | + if ( |
|
| 156 | + isset($data['class']) |
|
| 157 | 157 | && 'Give_Batch_Donors_Export' === $data['class'] |
| 158 | - && ! empty( $data['forms'] ) |
|
| 159 | - && isset( $data['give_export_option']['query_id'] ) |
|
| 158 | + && ! empty($data['forms']) |
|
| 159 | + && isset($data['give_export_option']['query_id']) |
|
| 160 | 160 | ) { |
| 161 | - Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) ); |
|
| 161 | + Give_Cache::delete(Give_Cache::get_key($data['give_export_option']['query_id'])); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | -add_action('give_file_export_complete', 'give_donor_batch_export_complete' ); |
|
| 164 | +add_action('give_file_export_complete', 'give_donor_batch_export_complete'); |
|
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * Print css for wordpress setting pages. |
@@ -172,12 +172,12 @@ discard block |
||
| 172 | 172 | /* @var WP_Screen $screen */ |
| 173 | 173 | $screen = get_current_screen(); |
| 174 | 174 | |
| 175 | - if( ! ( $screen instanceof WP_Screen ) ) { |
|
| 175 | + if ( ! ($screen instanceof WP_Screen)) { |
|
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - switch ( true ) { |
|
| 180 | - case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ): |
|
| 179 | + switch (true) { |
|
| 180 | + case ('plugins' === $screen->base || 'plugins-network' === $screen->base): |
|
| 181 | 181 | ?> |
| 182 | 182 | <style> |
| 183 | 183 | tr.active.update + tr.give-addon-notice-tr td{ |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | <?php |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | -add_action( 'admin_head', 'give_admin_quick_css' ); |
|
| 213 | +add_action('admin_head', 'give_admin_quick_css'); |
|
| 214 | 214 | |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -223,25 +223,25 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @return void |
| 225 | 225 | */ |
| 226 | -function give_set_donation_levels_max_min_amount( $form_id ) { |
|
| 226 | +function give_set_donation_levels_max_min_amount($form_id) { |
|
| 227 | 227 | if ( |
| 228 | - ( 'set' === $_POST['_give_price_option'] ) || |
|
| 229 | - ( in_array( '_give_donation_levels', $_POST ) && count( $_POST['_give_donation_levels'] ) <= 0 ) || |
|
| 230 | - ! ( $donation_levels_amounts = wp_list_pluck( $_POST['_give_donation_levels'], '_give_amount' ) ) |
|
| 228 | + ('set' === $_POST['_give_price_option']) || |
|
| 229 | + (in_array('_give_donation_levels', $_POST) && count($_POST['_give_donation_levels']) <= 0) || |
|
| 230 | + ! ($donation_levels_amounts = wp_list_pluck($_POST['_give_donation_levels'], '_give_amount')) |
|
| 231 | 231 | ) { |
| 232 | 232 | // Delete old meta. |
| 233 | - give_delete_meta( $form_id, '_give_levels_minimum_amount' ); |
|
| 234 | - give_delete_meta( $form_id, '_give_levels_maximum_amount' ); |
|
| 233 | + give_delete_meta($form_id, '_give_levels_minimum_amount'); |
|
| 234 | + give_delete_meta($form_id, '_give_levels_maximum_amount'); |
|
| 235 | 235 | |
| 236 | 236 | return; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - $min_amount = min( $donation_levels_amounts ); |
|
| 240 | - $max_amount = max( $donation_levels_amounts ); |
|
| 239 | + $min_amount = min($donation_levels_amounts); |
|
| 240 | + $max_amount = max($donation_levels_amounts); |
|
| 241 | 241 | |
| 242 | 242 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
| 243 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
| 244 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount? give_sanitize_amount( $max_amount ) : 0 ); |
|
| 243 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
| 244 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | -add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 ); |
|
| 248 | 247 | \ No newline at end of file |
| 248 | +add_action('give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30); |
|
| 249 | 249 | \ 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 | |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return array $payments Payments retrieved from the database |
| 45 | 45 | */ |
| 46 | -function give_get_payments( $args = array() ) { |
|
| 46 | +function give_get_payments($args = array()) { |
|
| 47 | 47 | |
| 48 | 48 | // Fallback to post objects to ensure backwards compatibility. |
| 49 | - if ( ! isset( $args['output'] ) ) { |
|
| 49 | + if ( ! isset($args['output'])) { |
|
| 50 | 50 | $args['output'] = 'posts'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $args = apply_filters( 'give_get_payments_args', $args ); |
|
| 54 | - $payments = new Give_Payments_Query( $args ); |
|
| 53 | + $args = apply_filters('give_get_payments_args', $args); |
|
| 54 | + $payments = new Give_Payments_Query($args); |
|
| 55 | 55 | |
| 56 | 56 | return $payments->get_payments(); |
| 57 | 57 | } |
@@ -66,48 +66,48 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | -function give_get_payment_by( $field = '', $value = '' ) { |
|
| 69 | +function give_get_payment_by($field = '', $value = '') { |
|
| 70 | 70 | |
| 71 | - if ( empty( $field ) || empty( $value ) ) { |
|
| 71 | + if (empty($field) || empty($value)) { |
|
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - switch ( strtolower( $field ) ) { |
|
| 75 | + switch (strtolower($field)) { |
|
| 76 | 76 | |
| 77 | 77 | case 'id': |
| 78 | - $payment = new Give_Payment( $value ); |
|
| 78 | + $payment = new Give_Payment($value); |
|
| 79 | 79 | $id = $payment->ID; |
| 80 | 80 | |
| 81 | - if ( empty( $id ) ) { |
|
| 81 | + if (empty($id)) { |
|
| 82 | 82 | return false; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | break; |
| 86 | 86 | |
| 87 | 87 | case 'key': |
| 88 | - $payment = give_get_payments( array( |
|
| 88 | + $payment = give_get_payments(array( |
|
| 89 | 89 | 'meta_key' => '_give_payment_purchase_key', |
| 90 | 90 | 'meta_value' => $value, |
| 91 | 91 | 'posts_per_page' => 1, |
| 92 | 92 | 'fields' => 'ids', |
| 93 | - ) ); |
|
| 93 | + )); |
|
| 94 | 94 | |
| 95 | - if ( $payment ) { |
|
| 96 | - $payment = new Give_Payment( $payment[0] ); |
|
| 95 | + if ($payment) { |
|
| 96 | + $payment = new Give_Payment($payment[0]); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | break; |
| 100 | 100 | |
| 101 | 101 | case 'payment_number': |
| 102 | - $payment = give_get_payments( array( |
|
| 102 | + $payment = give_get_payments(array( |
|
| 103 | 103 | 'meta_key' => '_give_payment_number', |
| 104 | 104 | 'meta_value' => $value, |
| 105 | 105 | 'posts_per_page' => 1, |
| 106 | 106 | 'fields' => 'ids', |
| 107 | - ) ); |
|
| 107 | + )); |
|
| 108 | 108 | |
| 109 | - if ( $payment ) { |
|
| 110 | - $payment = new Give_Payment( $payment[0] ); |
|
| 109 | + if ($payment) { |
|
| 110 | + $payment = new Give_Payment($payment[0]); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | break; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | return false; |
| 117 | 117 | }// End switch(). |
| 118 | 118 | |
| 119 | - if ( $payment ) { |
|
| 119 | + if ($payment) { |
|
| 120 | 120 | return $payment; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -132,23 +132,23 @@ discard block |
||
| 132 | 132 | * |
| 133 | 133 | * @return int|bool Payment ID if payment is inserted, false otherwise. |
| 134 | 134 | */ |
| 135 | -function give_insert_payment( $payment_data = array() ) { |
|
| 135 | +function give_insert_payment($payment_data = array()) { |
|
| 136 | 136 | |
| 137 | - if ( empty( $payment_data ) ) { |
|
| 137 | + if (empty($payment_data)) { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $payment = new Give_Payment(); |
| 142 | - $gateway = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : ''; |
|
| 143 | - $gateway = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway; |
|
| 144 | - $form_id = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0; |
|
| 145 | - $price_id = give_get_payment_meta_price_id( $payment_data ); |
|
| 146 | - $form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id ); |
|
| 142 | + $gateway = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : ''; |
|
| 143 | + $gateway = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway; |
|
| 144 | + $form_id = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0; |
|
| 145 | + $price_id = give_get_payment_meta_price_id($payment_data); |
|
| 146 | + $form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id); |
|
| 147 | 147 | |
| 148 | 148 | // Set properties. |
| 149 | 149 | $payment->total = $payment_data['price']; |
| 150 | - $payment->status = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending'; |
|
| 151 | - $payment->currency = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency(); |
|
| 150 | + $payment->status = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending'; |
|
| 151 | + $payment->currency = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency(); |
|
| 152 | 152 | $payment->user_info = $payment_data['user_info']; |
| 153 | 153 | $payment->gateway = $gateway; |
| 154 | 154 | $payment->form_title = $form_title; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $payment->ip = give_get_ip(); |
| 163 | 163 | $payment->key = $payment_data['purchase_key']; |
| 164 | 164 | $payment->mode = give_is_test_mode() ? 'test' : 'live'; |
| 165 | - $payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : ''; |
|
| 165 | + $payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : ''; |
|
| 166 | 166 | |
| 167 | 167 | // Add the donation. |
| 168 | 168 | $args = array( |
@@ -170,22 +170,22 @@ discard block |
||
| 170 | 170 | 'price_id' => $payment->price_id, |
| 171 | 171 | ); |
| 172 | 172 | |
| 173 | - $payment->add_donation( $payment->form_id, $args ); |
|
| 173 | + $payment->add_donation($payment->form_id, $args); |
|
| 174 | 174 | |
| 175 | 175 | // Set date if present. |
| 176 | - if ( isset( $payment_data['post_date'] ) ) { |
|
| 176 | + if (isset($payment_data['post_date'])) { |
|
| 177 | 177 | $payment->date = $payment_data['post_date']; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // Handle sequential payments. |
| 181 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
| 181 | + if (give_get_option('enable_sequential')) { |
|
| 182 | 182 | $number = give_get_next_payment_number(); |
| 183 | - $payment->number = give_format_payment_number( $number ); |
|
| 184 | - update_option( 'give_last_payment_number', $number ); |
|
| 183 | + $payment->number = give_format_payment_number($number); |
|
| 184 | + update_option('give_last_payment_number', $number); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | // Clear the user's donation cache. |
| 188 | - delete_transient( 'give_user_' . $payment_data['user_info']['id'] . '_purchases' ); |
|
| 188 | + delete_transient('give_user_'.$payment_data['user_info']['id'].'_purchases'); |
|
| 189 | 189 | |
| 190 | 190 | // Save payment. |
| 191 | 191 | $payment->save(); |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | * @param int $payment_id The payment ID. |
| 199 | 199 | * @param array $payment_data Arguments passed. |
| 200 | 200 | */ |
| 201 | - do_action( 'give_insert_payment', $payment->ID, $payment_data ); |
|
| 201 | + do_action('give_insert_payment', $payment->ID, $payment_data); |
|
| 202 | 202 | |
| 203 | 203 | // Return payment ID upon success. |
| 204 | - if ( ! empty( $payment->ID ) ) { |
|
| 204 | + if ( ! empty($payment->ID)) { |
|
| 205 | 205 | return $payment->ID; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @return bool|int |
| 219 | 219 | */ |
| 220 | -function give_create_payment( $payment_data ) { |
|
| 220 | +function give_create_payment($payment_data) { |
|
| 221 | 221 | |
| 222 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
| 223 | - $price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : ''; |
|
| 222 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
| 223 | + $price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : ''; |
|
| 224 | 224 | |
| 225 | 225 | // Collect payment data. |
| 226 | 226 | $insert_payment_data = array( |
@@ -244,10 +244,10 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @param array $insert_payment_data |
| 246 | 246 | */ |
| 247 | - $insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data ); |
|
| 247 | + $insert_payment_data = apply_filters('give_create_payment', $insert_payment_data); |
|
| 248 | 248 | |
| 249 | 249 | // Record the pending payment. |
| 250 | - return give_insert_payment( $insert_payment_data ); |
|
| 250 | + return give_insert_payment($insert_payment_data); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | * |
| 261 | 261 | * @return bool |
| 262 | 262 | */ |
| 263 | -function give_update_payment_status( $payment_id, $new_status = 'publish' ) { |
|
| 263 | +function give_update_payment_status($payment_id, $new_status = 'publish') { |
|
| 264 | 264 | |
| 265 | - $payment = new Give_Payment( $payment_id ); |
|
| 265 | + $payment = new Give_Payment($payment_id); |
|
| 266 | 266 | $payment->status = $new_status; |
| 267 | 267 | $updated = $payment->save(); |
| 268 | 268 | |
@@ -281,38 +281,38 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * @return void |
| 283 | 283 | */ |
| 284 | -function give_delete_donation( $payment_id = 0, $update_donor = true ) { |
|
| 284 | +function give_delete_donation($payment_id = 0, $update_donor = true) { |
|
| 285 | 285 | global $give_logs; |
| 286 | 286 | |
| 287 | - $payment = new Give_Payment( $payment_id ); |
|
| 288 | - $amount = give_get_payment_amount( $payment_id ); |
|
| 287 | + $payment = new Give_Payment($payment_id); |
|
| 288 | + $amount = give_get_payment_amount($payment_id); |
|
| 289 | 289 | $status = $payment->post_status; |
| 290 | - $donor_id = give_get_payment_donor_id( $payment_id ); |
|
| 291 | - $donor = new Give_Donor( $donor_id ); |
|
| 290 | + $donor_id = give_get_payment_donor_id($payment_id); |
|
| 291 | + $donor = new Give_Donor($donor_id); |
|
| 292 | 292 | |
| 293 | 293 | // Only undo donations that aren't these statuses. |
| 294 | - $dont_undo_statuses = apply_filters( 'give_undo_donation_statuses', array( |
|
| 294 | + $dont_undo_statuses = apply_filters('give_undo_donation_statuses', array( |
|
| 295 | 295 | 'pending', |
| 296 | 296 | 'cancelled', |
| 297 | - ) ); |
|
| 297 | + )); |
|
| 298 | 298 | |
| 299 | - if ( ! in_array( $status, $dont_undo_statuses ) ) { |
|
| 300 | - give_undo_donation( $payment_id ); |
|
| 299 | + if ( ! in_array($status, $dont_undo_statuses)) { |
|
| 300 | + give_undo_donation($payment_id); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - if ( $status == 'publish' ) { |
|
| 303 | + if ($status == 'publish') { |
|
| 304 | 304 | |
| 305 | 305 | // Only decrease earnings if they haven't already been decreased (or were never increased for this payment). |
| 306 | - give_decrease_total_earnings( $amount ); |
|
| 306 | + give_decrease_total_earnings($amount); |
|
| 307 | 307 | |
| 308 | 308 | // @todo: Refresh only range related stat cache |
| 309 | 309 | give_delete_donation_stats(); |
| 310 | 310 | |
| 311 | - if ( $donor->id && $update_donor ) { |
|
| 311 | + if ($donor->id && $update_donor) { |
|
| 312 | 312 | |
| 313 | 313 | // Decrement the stats for the donor. |
| 314 | 314 | $donor->decrease_donation_count(); |
| 315 | - $donor->decrease_value( $amount ); |
|
| 315 | + $donor->decrease_value($amount); |
|
| 316 | 316 | |
| 317 | 317 | } |
| 318 | 318 | } |
@@ -324,25 +324,25 @@ discard block |
||
| 324 | 324 | * |
| 325 | 325 | * @param int $payment_id Payment ID. |
| 326 | 326 | */ |
| 327 | - do_action( 'give_payment_delete', $payment_id ); |
|
| 327 | + do_action('give_payment_delete', $payment_id); |
|
| 328 | 328 | |
| 329 | - if ( $donor->id && $update_donor ) { |
|
| 329 | + if ($donor->id && $update_donor) { |
|
| 330 | 330 | |
| 331 | 331 | // Remove the payment ID from the donor. |
| 332 | - $donor->remove_payment( $payment_id ); |
|
| 332 | + $donor->remove_payment($payment_id); |
|
| 333 | 333 | |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | // Remove the payment. |
| 337 | - wp_delete_post( $payment_id, true ); |
|
| 337 | + wp_delete_post($payment_id, true); |
|
| 338 | 338 | |
| 339 | 339 | // Remove related sale log entries. |
| 340 | - $give_logs->delete_logs( null, 'sale', array( |
|
| 340 | + $give_logs->delete_logs(null, 'sale', array( |
|
| 341 | 341 | array( |
| 342 | 342 | 'key' => '_give_log_payment_id', |
| 343 | 343 | 'value' => $payment_id, |
| 344 | 344 | ), |
| 345 | - ) ); |
|
| 345 | + )); |
|
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | 348 | * Fires after payment deleted. |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @param int $payment_id Payment ID. |
| 353 | 353 | */ |
| 354 | - do_action( 'give_payment_deleted', $payment_id ); |
|
| 354 | + do_action('give_payment_deleted', $payment_id); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
@@ -366,20 +366,20 @@ discard block |
||
| 366 | 366 | * |
| 367 | 367 | * @return void |
| 368 | 368 | */ |
| 369 | -function give_undo_donation( $payment_id ) { |
|
| 369 | +function give_undo_donation($payment_id) { |
|
| 370 | 370 | |
| 371 | - $payment = new Give_Payment( $payment_id ); |
|
| 371 | + $payment = new Give_Payment($payment_id); |
|
| 372 | 372 | |
| 373 | - $maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id ); |
|
| 374 | - if ( true === $maybe_decrease_earnings ) { |
|
| 373 | + $maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id); |
|
| 374 | + if (true === $maybe_decrease_earnings) { |
|
| 375 | 375 | // Decrease earnings. |
| 376 | - give_decrease_earnings( $payment->form_id, $payment->total ); |
|
| 376 | + give_decrease_earnings($payment->form_id, $payment->total); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - $maybe_decrease_donations = apply_filters( 'give_decrease_donations_on_undo', true, $payment, $payment->form_id ); |
|
| 380 | - if ( true === $maybe_decrease_donations ) { |
|
| 379 | + $maybe_decrease_donations = apply_filters('give_decrease_donations_on_undo', true, $payment, $payment->form_id); |
|
| 380 | + if (true === $maybe_decrease_donations) { |
|
| 381 | 381 | // Decrease donation count. |
| 382 | - give_decrease_donation_count( $payment->form_id ); |
|
| 382 | + give_decrease_donation_count($payment->form_id); |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | * |
| 397 | 397 | * @return object $stats Contains the number of payments per payment status. |
| 398 | 398 | */ |
| 399 | -function give_count_payments( $args = array() ) { |
|
| 399 | +function give_count_payments($args = array()) { |
|
| 400 | 400 | |
| 401 | 401 | global $wpdb; |
| 402 | 402 | |
@@ -408,18 +408,18 @@ discard block |
||
| 408 | 408 | 'form_id' => null, |
| 409 | 409 | ); |
| 410 | 410 | |
| 411 | - $args = wp_parse_args( $args, $defaults ); |
|
| 411 | + $args = wp_parse_args($args, $defaults); |
|
| 412 | 412 | |
| 413 | 413 | $select = 'SELECT p.post_status,count( * ) AS num_posts'; |
| 414 | 414 | $join = ''; |
| 415 | 415 | $where = "WHERE p.post_type = 'give_payment'"; |
| 416 | 416 | |
| 417 | 417 | // Count payments for a specific user. |
| 418 | - if ( ! empty( $args['user'] ) ) { |
|
| 418 | + if ( ! empty($args['user'])) { |
|
| 419 | 419 | |
| 420 | - if ( is_email( $args['user'] ) ) { |
|
| 420 | + if (is_email($args['user'])) { |
|
| 421 | 421 | $field = 'email'; |
| 422 | - } elseif ( is_numeric( $args['user'] ) ) { |
|
| 422 | + } elseif (is_numeric($args['user'])) { |
|
| 423 | 423 | $field = 'id'; |
| 424 | 424 | } else { |
| 425 | 425 | $field = ''; |
@@ -427,107 +427,107 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
| 429 | 429 | |
| 430 | - if ( ! empty( $field ) ) { |
|
| 430 | + if ( ! empty($field)) { |
|
| 431 | 431 | $where .= " |
| 432 | 432 | AND m.meta_key = '_give_payment_user_{$field}' |
| 433 | 433 | AND m.meta_value = '{$args['user']}'"; |
| 434 | 434 | } |
| 435 | - } elseif ( ! empty( $args['donor'] ) ) { |
|
| 435 | + } elseif ( ! empty($args['donor'])) { |
|
| 436 | 436 | |
| 437 | - $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 437 | + $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 438 | 438 | $where .= " |
| 439 | 439 | AND m.meta_key = '_give_payment_customer_id' |
| 440 | 440 | AND m.meta_value = '{$args['donor']}'"; |
| 441 | 441 | |
| 442 | 442 | // Count payments for a search. |
| 443 | - } elseif ( ! empty( $args['s'] ) ) { |
|
| 443 | + } elseif ( ! empty($args['s'])) { |
|
| 444 | 444 | |
| 445 | - if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) { |
|
| 445 | + if (is_email($args['s']) || strlen($args['s']) == 32) { |
|
| 446 | 446 | |
| 447 | - if ( is_email( $args['s'] ) ) { |
|
| 447 | + if (is_email($args['s'])) { |
|
| 448 | 448 | $field = '_give_payment_user_email'; |
| 449 | 449 | } else { |
| 450 | 450 | $field = '_give_payment_purchase_key'; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 454 | - $where .= $wpdb->prepare( ' |
|
| 453 | + $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 454 | + $where .= $wpdb->prepare(' |
|
| 455 | 455 | AND m.meta_key = %s |
| 456 | - AND m.meta_value = %s', $field, $args['s'] ); |
|
| 456 | + AND m.meta_value = %s', $field, $args['s']); |
|
| 457 | 457 | |
| 458 | - } elseif ( '#' == substr( $args['s'], 0, 1 ) ) { |
|
| 458 | + } elseif ('#' == substr($args['s'], 0, 1)) { |
|
| 459 | 459 | |
| 460 | - $search = str_replace( '#:', '', $args['s'] ); |
|
| 461 | - $search = str_replace( '#', '', $search ); |
|
| 460 | + $search = str_replace('#:', '', $args['s']); |
|
| 461 | + $search = str_replace('#', '', $search); |
|
| 462 | 462 | |
| 463 | 463 | $select = 'SELECT p.post_status,count( * ) AS num_posts '; |
| 464 | 464 | $join = ''; |
| 465 | - $where = $wpdb->prepare( 'WHERE p.post_type=%s AND p.ID = %d ', 'give_payment', $search ); |
|
| 465 | + $where = $wpdb->prepare('WHERE p.post_type=%s AND p.ID = %d ', 'give_payment', $search); |
|
| 466 | 466 | |
| 467 | - } elseif ( is_numeric( $args['s'] ) ) { |
|
| 467 | + } elseif (is_numeric($args['s'])) { |
|
| 468 | 468 | |
| 469 | - $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 470 | - $where .= $wpdb->prepare( " |
|
| 469 | + $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 470 | + $where .= $wpdb->prepare(" |
|
| 471 | 471 | AND m.meta_key = '_give_payment_user_id' |
| 472 | - AND m.meta_value = %d", $args['s'] ); |
|
| 472 | + AND m.meta_value = %d", $args['s']); |
|
| 473 | 473 | |
| 474 | 474 | } else { |
| 475 | - $search = $wpdb->esc_like( $args['s'] ); |
|
| 476 | - $search = '%' . $search . '%'; |
|
| 475 | + $search = $wpdb->esc_like($args['s']); |
|
| 476 | + $search = '%'.$search.'%'; |
|
| 477 | 477 | |
| 478 | - $where .= $wpdb->prepare( 'AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search ); |
|
| 478 | + $where .= $wpdb->prepare('AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search); |
|
| 479 | 479 | }// End if(). |
| 480 | 480 | }// End if(). |
| 481 | 481 | |
| 482 | - if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) { |
|
| 482 | + if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) { |
|
| 483 | 483 | |
| 484 | - $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 485 | - $where .= $wpdb->prepare( ' |
|
| 484 | + $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 485 | + $where .= $wpdb->prepare(' |
|
| 486 | 486 | AND m.meta_key = %s |
| 487 | - AND m.meta_value = %s', '_give_payment_form_id', $args['form_id'] ); |
|
| 487 | + AND m.meta_value = %s', '_give_payment_form_id', $args['form_id']); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | // Limit payments count by date. |
| 491 | - if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) { |
|
| 491 | + if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) { |
|
| 492 | 492 | |
| 493 | - $date_parts = explode( '/', $args['start-date'] ); |
|
| 494 | - $month = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0; |
|
| 495 | - $day = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0; |
|
| 496 | - $year = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0; |
|
| 493 | + $date_parts = explode('/', $args['start-date']); |
|
| 494 | + $month = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0; |
|
| 495 | + $day = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0; |
|
| 496 | + $year = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0; |
|
| 497 | 497 | |
| 498 | - $is_date = checkdate( $month, $day, $year ); |
|
| 499 | - if ( false !== $is_date ) { |
|
| 498 | + $is_date = checkdate($month, $day, $year); |
|
| 499 | + if (false !== $is_date) { |
|
| 500 | 500 | |
| 501 | - $date = new DateTime( $args['start-date'] ); |
|
| 502 | - $where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) ); |
|
| 501 | + $date = new DateTime($args['start-date']); |
|
| 502 | + $where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d')); |
|
| 503 | 503 | |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | // Fixes an issue with the payments list table counts when no end date is specified (with stats class). |
| 507 | - if ( empty( $args['end-date'] ) ) { |
|
| 507 | + if (empty($args['end-date'])) { |
|
| 508 | 508 | $args['end-date'] = $args['start-date']; |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - if ( ! empty( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) { |
|
| 512 | + if ( ! empty($args['end-date']) && false !== strpos($args['end-date'], '/')) { |
|
| 513 | 513 | |
| 514 | - $date_parts = explode( '/', $args['end-date'] ); |
|
| 514 | + $date_parts = explode('/', $args['end-date']); |
|
| 515 | 515 | |
| 516 | - $month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0; |
|
| 517 | - $day = ! empty( $date_parts[1] ) ? $date_parts[1] : 0; |
|
| 518 | - $year = ! empty( $date_parts[2] ) ? $date_parts[2] : 0; |
|
| 516 | + $month = ! empty($date_parts[0]) ? $date_parts[0] : 0; |
|
| 517 | + $day = ! empty($date_parts[1]) ? $date_parts[1] : 0; |
|
| 518 | + $year = ! empty($date_parts[2]) ? $date_parts[2] : 0; |
|
| 519 | 519 | |
| 520 | - $is_date = checkdate( $month, $day, $year ); |
|
| 521 | - if ( false !== $is_date ) { |
|
| 520 | + $is_date = checkdate($month, $day, $year); |
|
| 521 | + if (false !== $is_date) { |
|
| 522 | 522 | |
| 523 | - $date = new DateTime( $args['end-date'] ); |
|
| 524 | - $where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) ); |
|
| 523 | + $date = new DateTime($args['end-date']); |
|
| 524 | + $where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d')); |
|
| 525 | 525 | |
| 526 | 526 | } |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - $where = apply_filters( 'give_count_payments_where', $where ); |
|
| 530 | - $join = apply_filters( 'give_count_payments_join', $join ); |
|
| 529 | + $where = apply_filters('give_count_payments_where', $where); |
|
| 530 | + $join = apply_filters('give_count_payments_join', $join); |
|
| 531 | 531 | |
| 532 | 532 | $query = "$select |
| 533 | 533 | FROM $wpdb->posts p |
@@ -536,36 +536,36 @@ discard block |
||
| 536 | 536 | GROUP BY p.post_status |
| 537 | 537 | "; |
| 538 | 538 | |
| 539 | - $cache_key = md5( $query ); |
|
| 539 | + $cache_key = md5($query); |
|
| 540 | 540 | |
| 541 | - $count = wp_cache_get( $cache_key, 'counts' ); |
|
| 542 | - if ( false !== $count ) { |
|
| 541 | + $count = wp_cache_get($cache_key, 'counts'); |
|
| 542 | + if (false !== $count) { |
|
| 543 | 543 | return $count; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | - $count = $wpdb->get_results( $query, ARRAY_A ); |
|
| 546 | + $count = $wpdb->get_results($query, ARRAY_A); |
|
| 547 | 547 | |
| 548 | 548 | $stats = array(); |
| 549 | 549 | $statuses = get_post_stati(); |
| 550 | - if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) { |
|
| 551 | - unset( $statuses['private'] ); |
|
| 550 | + if (isset($statuses['private']) && empty($args['s'])) { |
|
| 551 | + unset($statuses['private']); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - foreach ( $statuses as $state ) { |
|
| 555 | - $stats[ $state ] = 0; |
|
| 554 | + foreach ($statuses as $state) { |
|
| 555 | + $stats[$state] = 0; |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | - foreach ( (array) $count as $row ) { |
|
| 558 | + foreach ((array) $count as $row) { |
|
| 559 | 559 | |
| 560 | - if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) { |
|
| 560 | + if ('private' == $row['post_status'] && empty($args['s'])) { |
|
| 561 | 561 | continue; |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - $stats[ $row['post_status'] ] = $row['num_posts']; |
|
| 564 | + $stats[$row['post_status']] = $row['num_posts']; |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | $stats = (object) $stats; |
| 568 | - wp_cache_set( $cache_key, $stats, 'counts' ); |
|
| 568 | + wp_cache_set($cache_key, $stats, 'counts'); |
|
| 569 | 569 | |
| 570 | 570 | return $stats; |
| 571 | 571 | } |
@@ -580,11 +580,11 @@ discard block |
||
| 580 | 580 | * |
| 581 | 581 | * @return bool $exists True if payment exists, false otherwise. |
| 582 | 582 | */ |
| 583 | -function give_check_for_existing_payment( $payment_id ) { |
|
| 583 | +function give_check_for_existing_payment($payment_id) { |
|
| 584 | 584 | $exists = false; |
| 585 | - $payment = new Give_Payment( $payment_id ); |
|
| 585 | + $payment = new Give_Payment($payment_id); |
|
| 586 | 586 | |
| 587 | - if ( $payment_id === $payment->ID && 'publish' === $payment->status ) { |
|
| 587 | + if ($payment_id === $payment->ID && 'publish' === $payment->status) { |
|
| 588 | 588 | $exists = true; |
| 589 | 589 | } |
| 590 | 590 | |
@@ -602,31 +602,31 @@ discard block |
||
| 602 | 602 | * |
| 603 | 603 | * @return bool|mixed True if payment status exists, false otherwise. |
| 604 | 604 | */ |
| 605 | -function give_get_payment_status( $payment, $return_label = false ) { |
|
| 605 | +function give_get_payment_status($payment, $return_label = false) { |
|
| 606 | 606 | |
| 607 | - if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) { |
|
| 607 | + if ( ! is_object($payment) || ! isset($payment->post_status)) { |
|
| 608 | 608 | return false; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | $statuses = give_get_payment_statuses(); |
| 612 | 612 | |
| 613 | - if ( ! is_array( $statuses ) || empty( $statuses ) ) { |
|
| 613 | + if ( ! is_array($statuses) || empty($statuses)) { |
|
| 614 | 614 | return false; |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | // Get payment object if no already given. |
| 618 | - $payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID ); |
|
| 618 | + $payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID); |
|
| 619 | 619 | |
| 620 | - if ( array_key_exists( $payment->status, $statuses ) ) { |
|
| 621 | - if ( true === $return_label ) { |
|
| 620 | + if (array_key_exists($payment->status, $statuses)) { |
|
| 621 | + if (true === $return_label) { |
|
| 622 | 622 | // Return translated status label. |
| 623 | - return $statuses[ $payment->status ]; |
|
| 623 | + return $statuses[$payment->status]; |
|
| 624 | 624 | } else { |
| 625 | 625 | // Account that our 'publish' status is labeled 'Complete' |
| 626 | 626 | $post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status; |
| 627 | 627 | |
| 628 | 628 | // Make sure we're matching cases, since they matter |
| 629 | - return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) ); |
|
| 629 | + return array_search(strtolower($post_status), array_map('strtolower', $statuses)); |
|
| 630 | 630 | } |
| 631 | 631 | } |
| 632 | 632 | |
@@ -642,18 +642,18 @@ discard block |
||
| 642 | 642 | */ |
| 643 | 643 | function give_get_payment_statuses() { |
| 644 | 644 | $payment_statuses = array( |
| 645 | - 'pending' => __( 'Pending', 'give' ), |
|
| 646 | - 'publish' => __( 'Complete', 'give' ), |
|
| 647 | - 'refunded' => __( 'Refunded', 'give' ), |
|
| 648 | - 'failed' => __( 'Failed', 'give' ), |
|
| 649 | - 'cancelled' => __( 'Cancelled', 'give' ), |
|
| 650 | - 'abandoned' => __( 'Abandoned', 'give' ), |
|
| 651 | - 'preapproval' => __( 'Pre-Approved', 'give' ), |
|
| 652 | - 'processing' => __( 'Processing', 'give' ), |
|
| 653 | - 'revoked' => __( 'Revoked', 'give' ), |
|
| 645 | + 'pending' => __('Pending', 'give'), |
|
| 646 | + 'publish' => __('Complete', 'give'), |
|
| 647 | + 'refunded' => __('Refunded', 'give'), |
|
| 648 | + 'failed' => __('Failed', 'give'), |
|
| 649 | + 'cancelled' => __('Cancelled', 'give'), |
|
| 650 | + 'abandoned' => __('Abandoned', 'give'), |
|
| 651 | + 'preapproval' => __('Pre-Approved', 'give'), |
|
| 652 | + 'processing' => __('Processing', 'give'), |
|
| 653 | + 'revoked' => __('Revoked', 'give'), |
|
| 654 | 654 | ); |
| 655 | 655 | |
| 656 | - return apply_filters( 'give_payment_statuses', $payment_statuses ); |
|
| 656 | + return apply_filters('give_payment_statuses', $payment_statuses); |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | /** |
@@ -666,10 +666,10 @@ discard block |
||
| 666 | 666 | * @return array $payment_status All the available payment statuses. |
| 667 | 667 | */ |
| 668 | 668 | function give_get_payment_status_keys() { |
| 669 | - $statuses = array_keys( give_get_payment_statuses() ); |
|
| 670 | - asort( $statuses ); |
|
| 669 | + $statuses = array_keys(give_get_payment_statuses()); |
|
| 670 | + asort($statuses); |
|
| 671 | 671 | |
| 672 | - return array_values( $statuses ); |
|
| 672 | + return array_values($statuses); |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | /** |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | * |
| 685 | 685 | * @return int $earnings Earnings |
| 686 | 686 | */ |
| 687 | -function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) { |
|
| 687 | +function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) { |
|
| 688 | 688 | |
| 689 | 689 | // This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead. |
| 690 | 690 | global $wpdb; |
@@ -694,41 +694,41 @@ discard block |
||
| 694 | 694 | 'nopaging' => true, |
| 695 | 695 | 'year' => $year, |
| 696 | 696 | 'monthnum' => $month_num, |
| 697 | - 'post_status' => array( 'publish' ), |
|
| 697 | + 'post_status' => array('publish'), |
|
| 698 | 698 | 'fields' => 'ids', |
| 699 | 699 | 'update_post_term_cache' => false, |
| 700 | 700 | ); |
| 701 | - if ( ! empty( $day ) ) { |
|
| 701 | + if ( ! empty($day)) { |
|
| 702 | 702 | $args['day'] = $day; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - if ( ! empty( $hour ) ) { |
|
| 705 | + if ( ! empty($hour)) { |
|
| 706 | 706 | $args['hour'] = $hour; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - $args = apply_filters( 'give_get_earnings_by_date_args', $args ); |
|
| 710 | - $key = Give_Cache::get_key( 'give_stats', $args ); |
|
| 709 | + $args = apply_filters('give_get_earnings_by_date_args', $args); |
|
| 710 | + $key = Give_Cache::get_key('give_stats', $args); |
|
| 711 | 711 | |
| 712 | - if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) { |
|
| 712 | + if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) { |
|
| 713 | 713 | $earnings = false; |
| 714 | 714 | } else { |
| 715 | - $earnings = Give_Cache::get( $key ); |
|
| 715 | + $earnings = Give_Cache::get($key); |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | - if ( false === $earnings ) { |
|
| 719 | - $donations = get_posts( $args ); |
|
| 718 | + if (false === $earnings) { |
|
| 719 | + $donations = get_posts($args); |
|
| 720 | 720 | $earnings = 0; |
| 721 | - if ( $donations ) { |
|
| 722 | - $donations = implode( ',', $donations ); |
|
| 721 | + if ($donations) { |
|
| 722 | + $donations = implode(',', $donations); |
|
| 723 | 723 | |
| 724 | - $earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})" ); |
|
| 724 | + $earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})"); |
|
| 725 | 725 | |
| 726 | 726 | } |
| 727 | 727 | // Cache the results for one hour. |
| 728 | - Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS ); |
|
| 728 | + Give_Cache::set($key, $earnings, HOUR_IN_SECONDS); |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - return round( $earnings, 2 ); |
|
| 731 | + return round($earnings, 2); |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | /** |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | * |
| 744 | 744 | * @return int $count Sales |
| 745 | 745 | */ |
| 746 | -function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) { |
|
| 746 | +function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) { |
|
| 747 | 747 | |
| 748 | 748 | // This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead. |
| 749 | 749 | $args = array( |
@@ -751,14 +751,14 @@ discard block |
||
| 751 | 751 | 'nopaging' => true, |
| 752 | 752 | 'year' => $year, |
| 753 | 753 | 'fields' => 'ids', |
| 754 | - 'post_status' => array( 'publish' ), |
|
| 754 | + 'post_status' => array('publish'), |
|
| 755 | 755 | 'update_post_meta_cache' => false, |
| 756 | 756 | 'update_post_term_cache' => false, |
| 757 | 757 | ); |
| 758 | 758 | |
| 759 | - $show_free = apply_filters( 'give_sales_by_date_show_free', true, $args ); |
|
| 759 | + $show_free = apply_filters('give_sales_by_date_show_free', true, $args); |
|
| 760 | 760 | |
| 761 | - if ( false === $show_free ) { |
|
| 761 | + if (false === $show_free) { |
|
| 762 | 762 | $args['meta_query'] = array( |
| 763 | 763 | array( |
| 764 | 764 | 'key' => '_give_payment_total', |
@@ -769,33 +769,33 @@ discard block |
||
| 769 | 769 | ); |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - if ( ! empty( $month_num ) ) { |
|
| 772 | + if ( ! empty($month_num)) { |
|
| 773 | 773 | $args['monthnum'] = $month_num; |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | - if ( ! empty( $day ) ) { |
|
| 776 | + if ( ! empty($day)) { |
|
| 777 | 777 | $args['day'] = $day; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - if ( ! empty( $hour ) ) { |
|
| 780 | + if ( ! empty($hour)) { |
|
| 781 | 781 | $args['hour'] = $hour; |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | - $args = apply_filters( 'give_get_sales_by_date_args', $args ); |
|
| 784 | + $args = apply_filters('give_get_sales_by_date_args', $args); |
|
| 785 | 785 | |
| 786 | - $key = Give_Cache::get_key( 'give_stats', $args ); |
|
| 786 | + $key = Give_Cache::get_key('give_stats', $args); |
|
| 787 | 787 | |
| 788 | - if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) { |
|
| 788 | + if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) { |
|
| 789 | 789 | $count = false; |
| 790 | 790 | } else { |
| 791 | - $count = Give_Cache::get( $key ); |
|
| 791 | + $count = Give_Cache::get($key); |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | - if ( false === $count ) { |
|
| 795 | - $donations = new WP_Query( $args ); |
|
| 794 | + if (false === $count) { |
|
| 795 | + $donations = new WP_Query($args); |
|
| 796 | 796 | $count = (int) $donations->post_count; |
| 797 | 797 | // Cache the results for one hour. |
| 798 | - Give_Cache::set( $key, $count, HOUR_IN_SECONDS ); |
|
| 798 | + Give_Cache::set($key, $count, HOUR_IN_SECONDS); |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | return $count; |
@@ -810,19 +810,19 @@ discard block |
||
| 810 | 810 | * |
| 811 | 811 | * @return bool $ret True if complete, false otherwise. |
| 812 | 812 | */ |
| 813 | -function give_is_payment_complete( $payment_id ) { |
|
| 814 | - $payment = new Give_Payment( $payment_id ); |
|
| 813 | +function give_is_payment_complete($payment_id) { |
|
| 814 | + $payment = new Give_Payment($payment_id); |
|
| 815 | 815 | |
| 816 | 816 | $ret = false; |
| 817 | 817 | |
| 818 | - if ( $payment->ID > 0 ) { |
|
| 818 | + if ($payment->ID > 0) { |
|
| 819 | 819 | |
| 820 | - if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) { |
|
| 820 | + if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) { |
|
| 821 | 821 | $ret = true; |
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | - return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status ); |
|
| 825 | + return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status); |
|
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | /** |
@@ -848,49 +848,49 @@ discard block |
||
| 848 | 848 | * |
| 849 | 849 | * @return float $total Total earnings. |
| 850 | 850 | */ |
| 851 | -function give_get_total_earnings( $recalculate = false ) { |
|
| 851 | +function give_get_total_earnings($recalculate = false) { |
|
| 852 | 852 | |
| 853 | - $total = get_option( 'give_earnings_total', 0 ); |
|
| 853 | + $total = get_option('give_earnings_total', 0); |
|
| 854 | 854 | |
| 855 | 855 | // Calculate total earnings. |
| 856 | - if ( ! $total || $recalculate ) { |
|
| 856 | + if ( ! $total || $recalculate) { |
|
| 857 | 857 | global $wpdb; |
| 858 | 858 | |
| 859 | 859 | $total = (float) 0; |
| 860 | 860 | |
| 861 | - $args = apply_filters( 'give_get_total_earnings_args', array( |
|
| 861 | + $args = apply_filters('give_get_total_earnings_args', array( |
|
| 862 | 862 | 'offset' => 0, |
| 863 | - 'number' => - 1, |
|
| 864 | - 'status' => array( 'publish' ), |
|
| 863 | + 'number' => -1, |
|
| 864 | + 'status' => array('publish'), |
|
| 865 | 865 | 'fields' => 'ids', |
| 866 | - ) ); |
|
| 866 | + )); |
|
| 867 | 867 | |
| 868 | - $payments = give_get_payments( $args ); |
|
| 869 | - if ( $payments ) { |
|
| 868 | + $payments = give_get_payments($args); |
|
| 869 | + if ($payments) { |
|
| 870 | 870 | |
| 871 | 871 | /** |
| 872 | 872 | * If performing a donation, we need to skip the very last payment in the database, |
| 873 | 873 | * since it calls give_increase_total_earnings() on completion, |
| 874 | 874 | * which results in duplicated earnings for the very first donation. |
| 875 | 875 | */ |
| 876 | - if ( did_action( 'give_update_payment_status' ) ) { |
|
| 877 | - array_pop( $payments ); |
|
| 876 | + if (did_action('give_update_payment_status')) { |
|
| 877 | + array_pop($payments); |
|
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - if ( ! empty( $payments ) ) { |
|
| 881 | - $payments = implode( ',', $payments ); |
|
| 882 | - $total += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" ); |
|
| 880 | + if ( ! empty($payments)) { |
|
| 881 | + $payments = implode(',', $payments); |
|
| 882 | + $total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})"); |
|
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | - update_option( 'give_earnings_total', $total, 'no' ); |
|
| 886 | + update_option('give_earnings_total', $total, 'no'); |
|
| 887 | 887 | } |
| 888 | 888 | |
| 889 | - if ( $total < 0 ) { |
|
| 889 | + if ($total < 0) { |
|
| 890 | 890 | $total = 0; // Don't ever show negative earnings. |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | - return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) ); |
|
| 893 | + return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter())); |
|
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | /** |
@@ -903,10 +903,10 @@ discard block |
||
| 903 | 903 | * |
| 904 | 904 | * @return float $total Total earnings. |
| 905 | 905 | */ |
| 906 | -function give_increase_total_earnings( $amount = 0 ) { |
|
| 906 | +function give_increase_total_earnings($amount = 0) { |
|
| 907 | 907 | $total = give_get_total_earnings(); |
| 908 | 908 | $total += $amount; |
| 909 | - update_option( 'give_earnings_total', $total ); |
|
| 909 | + update_option('give_earnings_total', $total); |
|
| 910 | 910 | |
| 911 | 911 | return $total; |
| 912 | 912 | } |
@@ -920,13 +920,13 @@ discard block |
||
| 920 | 920 | * |
| 921 | 921 | * @return float $total Total earnings. |
| 922 | 922 | */ |
| 923 | -function give_decrease_total_earnings( $amount = 0 ) { |
|
| 923 | +function give_decrease_total_earnings($amount = 0) { |
|
| 924 | 924 | $total = give_get_total_earnings(); |
| 925 | 925 | $total -= $amount; |
| 926 | - if ( $total < 0 ) { |
|
| 926 | + if ($total < 0) { |
|
| 927 | 927 | $total = 0; |
| 928 | 928 | } |
| 929 | - update_option( 'give_earnings_total', $total ); |
|
| 929 | + update_option('give_earnings_total', $total); |
|
| 930 | 930 | |
| 931 | 931 | return $total; |
| 932 | 932 | } |
@@ -942,10 +942,10 @@ discard block |
||
| 942 | 942 | * |
| 943 | 943 | * @return mixed $meta Payment Meta. |
| 944 | 944 | */ |
| 945 | -function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) { |
|
| 946 | - $payment = new Give_Payment( $payment_id ); |
|
| 945 | +function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) { |
|
| 946 | + $payment = new Give_Payment($payment_id); |
|
| 947 | 947 | |
| 948 | - return $payment->get_meta( $meta_key, $single ); |
|
| 948 | + return $payment->get_meta($meta_key, $single); |
|
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | /** |
@@ -958,10 +958,10 @@ discard block |
||
| 958 | 958 | * |
| 959 | 959 | * @return mixed Meta ID if successful, false if unsuccessful. |
| 960 | 960 | */ |
| 961 | -function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) { |
|
| 962 | - $payment = new Give_Payment( $payment_id ); |
|
| 961 | +function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') { |
|
| 962 | + $payment = new Give_Payment($payment_id); |
|
| 963 | 963 | |
| 964 | - return $payment->update_meta( $meta_key, $meta_value, $prev_value ); |
|
| 964 | + return $payment->update_meta($meta_key, $meta_value, $prev_value); |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | /** |
@@ -973,8 +973,8 @@ discard block |
||
| 973 | 973 | * |
| 974 | 974 | * @return array $user_info User Info Meta Values. |
| 975 | 975 | */ |
| 976 | -function give_get_payment_meta_user_info( $payment_id ) { |
|
| 977 | - $payment = new Give_Payment( $payment_id ); |
|
| 976 | +function give_get_payment_meta_user_info($payment_id) { |
|
| 977 | + $payment = new Give_Payment($payment_id); |
|
| 978 | 978 | |
| 979 | 979 | return $payment->user_info; |
| 980 | 980 | } |
@@ -990,8 +990,8 @@ discard block |
||
| 990 | 990 | * |
| 991 | 991 | * @return int $form_id Form ID. |
| 992 | 992 | */ |
| 993 | -function give_get_payment_form_id( $payment_id ) { |
|
| 994 | - $payment = new Give_Payment( $payment_id ); |
|
| 993 | +function give_get_payment_form_id($payment_id) { |
|
| 994 | + $payment = new Give_Payment($payment_id); |
|
| 995 | 995 | |
| 996 | 996 | return $payment->form_id; |
| 997 | 997 | } |
@@ -1005,8 +1005,8 @@ discard block |
||
| 1005 | 1005 | * |
| 1006 | 1006 | * @return string $email User email. |
| 1007 | 1007 | */ |
| 1008 | -function give_get_payment_user_email( $payment_id ) { |
|
| 1009 | - $payment = new Give_Payment( $payment_id ); |
|
| 1008 | +function give_get_payment_user_email($payment_id) { |
|
| 1009 | + $payment = new Give_Payment($payment_id); |
|
| 1010 | 1010 | |
| 1011 | 1011 | return $payment->email; |
| 1012 | 1012 | } |
@@ -1020,11 +1020,11 @@ discard block |
||
| 1020 | 1020 | * |
| 1021 | 1021 | * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true) |
| 1022 | 1022 | */ |
| 1023 | -function give_is_guest_payment( $payment_id ) { |
|
| 1024 | - $payment_user_id = give_get_payment_user_id( $payment_id ); |
|
| 1025 | - $is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true; |
|
| 1023 | +function give_is_guest_payment($payment_id) { |
|
| 1024 | + $payment_user_id = give_get_payment_user_id($payment_id); |
|
| 1025 | + $is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true; |
|
| 1026 | 1026 | |
| 1027 | - return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id ); |
|
| 1027 | + return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id); |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | /** |
@@ -1036,8 +1036,8 @@ discard block |
||
| 1036 | 1036 | * |
| 1037 | 1037 | * @return int $user_id User ID. |
| 1038 | 1038 | */ |
| 1039 | -function give_get_payment_user_id( $payment_id ) { |
|
| 1040 | - $payment = new Give_Payment( $payment_id ); |
|
| 1039 | +function give_get_payment_user_id($payment_id) { |
|
| 1040 | + $payment = new Give_Payment($payment_id); |
|
| 1041 | 1041 | |
| 1042 | 1042 | return $payment->user_id; |
| 1043 | 1043 | } |
@@ -1051,8 +1051,8 @@ discard block |
||
| 1051 | 1051 | * |
| 1052 | 1052 | * @return int $payment->customer_id Donor ID. |
| 1053 | 1053 | */ |
| 1054 | -function give_get_payment_donor_id( $payment_id ) { |
|
| 1055 | - $payment = new Give_Payment( $payment_id ); |
|
| 1054 | +function give_get_payment_donor_id($payment_id) { |
|
| 1055 | + $payment = new Give_Payment($payment_id); |
|
| 1056 | 1056 | |
| 1057 | 1057 | return $payment->customer_id; |
| 1058 | 1058 | } |
@@ -1066,8 +1066,8 @@ discard block |
||
| 1066 | 1066 | * |
| 1067 | 1067 | * @return string $ip User IP. |
| 1068 | 1068 | */ |
| 1069 | -function give_get_payment_user_ip( $payment_id ) { |
|
| 1070 | - $payment = new Give_Payment( $payment_id ); |
|
| 1069 | +function give_get_payment_user_ip($payment_id) { |
|
| 1070 | + $payment = new Give_Payment($payment_id); |
|
| 1071 | 1071 | |
| 1072 | 1072 | return $payment->ip; |
| 1073 | 1073 | } |
@@ -1081,8 +1081,8 @@ discard block |
||
| 1081 | 1081 | * |
| 1082 | 1082 | * @return string $date The date the payment was completed. |
| 1083 | 1083 | */ |
| 1084 | -function give_get_payment_completed_date( $payment_id = 0 ) { |
|
| 1085 | - $payment = new Give_Payment( $payment_id ); |
|
| 1084 | +function give_get_payment_completed_date($payment_id = 0) { |
|
| 1085 | + $payment = new Give_Payment($payment_id); |
|
| 1086 | 1086 | |
| 1087 | 1087 | return $payment->completed_date; |
| 1088 | 1088 | } |
@@ -1096,8 +1096,8 @@ discard block |
||
| 1096 | 1096 | * |
| 1097 | 1097 | * @return string $gateway Gateway. |
| 1098 | 1098 | */ |
| 1099 | -function give_get_payment_gateway( $payment_id ) { |
|
| 1100 | - $payment = new Give_Payment( $payment_id ); |
|
| 1099 | +function give_get_payment_gateway($payment_id) { |
|
| 1100 | + $payment = new Give_Payment($payment_id); |
|
| 1101 | 1101 | |
| 1102 | 1102 | return $payment->gateway; |
| 1103 | 1103 | } |
@@ -1111,8 +1111,8 @@ discard block |
||
| 1111 | 1111 | * |
| 1112 | 1112 | * @return string $currency The currency code. |
| 1113 | 1113 | */ |
| 1114 | -function give_get_payment_currency_code( $payment_id = 0 ) { |
|
| 1115 | - $payment = new Give_Payment( $payment_id ); |
|
| 1114 | +function give_get_payment_currency_code($payment_id = 0) { |
|
| 1115 | + $payment = new Give_Payment($payment_id); |
|
| 1116 | 1116 | |
| 1117 | 1117 | return $payment->currency; |
| 1118 | 1118 | } |
@@ -1126,10 +1126,10 @@ discard block |
||
| 1126 | 1126 | * |
| 1127 | 1127 | * @return string $currency The currency name. |
| 1128 | 1128 | */ |
| 1129 | -function give_get_payment_currency( $payment_id = 0 ) { |
|
| 1130 | - $currency = give_get_payment_currency_code( $payment_id ); |
|
| 1129 | +function give_get_payment_currency($payment_id = 0) { |
|
| 1130 | + $currency = give_get_payment_currency_code($payment_id); |
|
| 1131 | 1131 | |
| 1132 | - return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id ); |
|
| 1132 | + return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id); |
|
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | 1135 | /** |
@@ -1141,8 +1141,8 @@ discard block |
||
| 1141 | 1141 | * |
| 1142 | 1142 | * @return string $key Donation key. |
| 1143 | 1143 | */ |
| 1144 | -function give_get_payment_key( $payment_id = 0 ) { |
|
| 1145 | - $payment = new Give_Payment( $payment_id ); |
|
| 1144 | +function give_get_payment_key($payment_id = 0) { |
|
| 1145 | + $payment = new Give_Payment($payment_id); |
|
| 1146 | 1146 | |
| 1147 | 1147 | return $payment->key; |
| 1148 | 1148 | } |
@@ -1158,8 +1158,8 @@ discard block |
||
| 1158 | 1158 | * |
| 1159 | 1159 | * @return string $number Payment order number. |
| 1160 | 1160 | */ |
| 1161 | -function give_get_payment_number( $payment_id = 0 ) { |
|
| 1162 | - $payment = new Give_Payment( $payment_id ); |
|
| 1161 | +function give_get_payment_number($payment_id = 0) { |
|
| 1162 | + $payment = new Give_Payment($payment_id); |
|
| 1163 | 1163 | |
| 1164 | 1164 | return $payment->number; |
| 1165 | 1165 | } |
@@ -1173,23 +1173,23 @@ discard block |
||
| 1173 | 1173 | * |
| 1174 | 1174 | * @return string The formatted payment number. |
| 1175 | 1175 | */ |
| 1176 | -function give_format_payment_number( $number ) { |
|
| 1176 | +function give_format_payment_number($number) { |
|
| 1177 | 1177 | |
| 1178 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
| 1178 | + if ( ! give_get_option('enable_sequential')) { |
|
| 1179 | 1179 | return $number; |
| 1180 | 1180 | } |
| 1181 | 1181 | |
| 1182 | - if ( ! is_numeric( $number ) ) { |
|
| 1182 | + if ( ! is_numeric($number)) { |
|
| 1183 | 1183 | return $number; |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | - $prefix = give_get_option( 'sequential_prefix' ); |
|
| 1187 | - $number = absint( $number ); |
|
| 1188 | - $postfix = give_get_option( 'sequential_postfix' ); |
|
| 1186 | + $prefix = give_get_option('sequential_prefix'); |
|
| 1187 | + $number = absint($number); |
|
| 1188 | + $postfix = give_get_option('sequential_postfix'); |
|
| 1189 | 1189 | |
| 1190 | - $formatted_number = $prefix . $number . $postfix; |
|
| 1190 | + $formatted_number = $prefix.$number.$postfix; |
|
| 1191 | 1191 | |
| 1192 | - return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix ); |
|
| 1192 | + return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | /** |
@@ -1202,17 +1202,17 @@ discard block |
||
| 1202 | 1202 | */ |
| 1203 | 1203 | function give_get_next_payment_number() { |
| 1204 | 1204 | |
| 1205 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
| 1205 | + if ( ! give_get_option('enable_sequential')) { |
|
| 1206 | 1206 | return false; |
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | - $number = get_option( 'give_last_payment_number' ); |
|
| 1210 | - $start = give_get_option( 'sequential_start', 1 ); |
|
| 1209 | + $number = get_option('give_last_payment_number'); |
|
| 1210 | + $start = give_get_option('sequential_start', 1); |
|
| 1211 | 1211 | $increment_number = true; |
| 1212 | 1212 | |
| 1213 | - if ( false !== $number ) { |
|
| 1213 | + if (false !== $number) { |
|
| 1214 | 1214 | |
| 1215 | - if ( empty( $number ) ) { |
|
| 1215 | + if (empty($number)) { |
|
| 1216 | 1216 | |
| 1217 | 1217 | $number = $start; |
| 1218 | 1218 | $increment_number = false; |
@@ -1221,24 +1221,24 @@ discard block |
||
| 1221 | 1221 | } else { |
| 1222 | 1222 | |
| 1223 | 1223 | // This case handles the first addition of the new option, as well as if it get's deleted for any reason. |
| 1224 | - $payments = new Give_Payments_Query( array( |
|
| 1224 | + $payments = new Give_Payments_Query(array( |
|
| 1225 | 1225 | 'number' => 1, |
| 1226 | 1226 | 'order' => 'DESC', |
| 1227 | 1227 | 'orderby' => 'ID', |
| 1228 | 1228 | 'output' => 'posts', |
| 1229 | 1229 | 'fields' => 'ids', |
| 1230 | - ) ); |
|
| 1230 | + )); |
|
| 1231 | 1231 | $last_payment = $payments->get_payments(); |
| 1232 | 1232 | |
| 1233 | - if ( ! empty( $last_payment ) ) { |
|
| 1233 | + if ( ! empty($last_payment)) { |
|
| 1234 | 1234 | |
| 1235 | - $number = give_get_payment_number( $last_payment[0] ); |
|
| 1235 | + $number = give_get_payment_number($last_payment[0]); |
|
| 1236 | 1236 | |
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | - if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) { |
|
| 1239 | + if ( ! empty($number) && $number !== (int) $last_payment[0]) { |
|
| 1240 | 1240 | |
| 1241 | - $number = give_remove_payment_prefix_postfix( $number ); |
|
| 1241 | + $number = give_remove_payment_prefix_postfix($number); |
|
| 1242 | 1242 | |
| 1243 | 1243 | } else { |
| 1244 | 1244 | |
@@ -1247,13 +1247,13 @@ discard block |
||
| 1247 | 1247 | } |
| 1248 | 1248 | }// End if(). |
| 1249 | 1249 | |
| 1250 | - $increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number ); |
|
| 1250 | + $increment_number = apply_filters('give_increment_payment_number', $increment_number, $number); |
|
| 1251 | 1251 | |
| 1252 | - if ( $increment_number ) { |
|
| 1253 | - $number ++; |
|
| 1252 | + if ($increment_number) { |
|
| 1253 | + $number++; |
|
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | - return apply_filters( 'give_get_next_payment_number', $number ); |
|
| 1256 | + return apply_filters('give_get_next_payment_number', $number); |
|
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | 1259 | /** |
@@ -1265,25 +1265,25 @@ discard block |
||
| 1265 | 1265 | * |
| 1266 | 1266 | * @return string The new Payment number without prefix and postfix. |
| 1267 | 1267 | */ |
| 1268 | -function give_remove_payment_prefix_postfix( $number ) { |
|
| 1268 | +function give_remove_payment_prefix_postfix($number) { |
|
| 1269 | 1269 | |
| 1270 | - $prefix = give_get_option( 'sequential_prefix' ); |
|
| 1271 | - $postfix = give_get_option( 'sequential_postfix' ); |
|
| 1270 | + $prefix = give_get_option('sequential_prefix'); |
|
| 1271 | + $postfix = give_get_option('sequential_postfix'); |
|
| 1272 | 1272 | |
| 1273 | 1273 | // Remove prefix. |
| 1274 | - $number = preg_replace( '/' . $prefix . '/', '', $number, 1 ); |
|
| 1274 | + $number = preg_replace('/'.$prefix.'/', '', $number, 1); |
|
| 1275 | 1275 | |
| 1276 | 1276 | // Remove the postfix. |
| 1277 | - $length = strlen( $number ); |
|
| 1278 | - $postfix_pos = strrpos( $number, $postfix ); |
|
| 1279 | - if ( false !== $postfix_pos ) { |
|
| 1280 | - $number = substr_replace( $number, '', $postfix_pos, $length ); |
|
| 1277 | + $length = strlen($number); |
|
| 1278 | + $postfix_pos = strrpos($number, $postfix); |
|
| 1279 | + if (false !== $postfix_pos) { |
|
| 1280 | + $number = substr_replace($number, '', $postfix_pos, $length); |
|
| 1281 | 1281 | } |
| 1282 | 1282 | |
| 1283 | 1283 | // Ensure it's a whole number. |
| 1284 | - $number = intval( $number ); |
|
| 1284 | + $number = intval($number); |
|
| 1285 | 1285 | |
| 1286 | - return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix ); |
|
| 1286 | + return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix); |
|
| 1287 | 1287 | |
| 1288 | 1288 | } |
| 1289 | 1289 | |
@@ -1300,10 +1300,10 @@ discard block |
||
| 1300 | 1300 | * |
| 1301 | 1301 | * @return string $amount Fully formatted payment amount. |
| 1302 | 1302 | */ |
| 1303 | -function give_payment_amount( $payment_id = 0 ) { |
|
| 1304 | - $amount = give_get_payment_amount( $payment_id ); |
|
| 1303 | +function give_payment_amount($payment_id = 0) { |
|
| 1304 | + $amount = give_get_payment_amount($payment_id); |
|
| 1305 | 1305 | |
| 1306 | - return give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment_id ) ); |
|
| 1306 | + return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id)); |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | /** |
@@ -1316,11 +1316,11 @@ discard block |
||
| 1316 | 1316 | * |
| 1317 | 1317 | * @return mixed |
| 1318 | 1318 | */ |
| 1319 | -function give_get_payment_amount( $payment_id ) { |
|
| 1319 | +function give_get_payment_amount($payment_id) { |
|
| 1320 | 1320 | |
| 1321 | - $payment = new Give_Payment( $payment_id ); |
|
| 1321 | + $payment = new Give_Payment($payment_id); |
|
| 1322 | 1322 | |
| 1323 | - return apply_filters( 'give_payment_amount', floatval( $payment->total ), $payment_id ); |
|
| 1323 | + return apply_filters('give_payment_amount', floatval($payment->total), $payment_id); |
|
| 1324 | 1324 | } |
| 1325 | 1325 | |
| 1326 | 1326 | /** |
@@ -1337,10 +1337,10 @@ discard block |
||
| 1337 | 1337 | * |
| 1338 | 1338 | * @return array Fully formatted payment subtotal. |
| 1339 | 1339 | */ |
| 1340 | -function give_payment_subtotal( $payment_id = 0 ) { |
|
| 1341 | - $subtotal = give_get_payment_subtotal( $payment_id ); |
|
| 1340 | +function give_payment_subtotal($payment_id = 0) { |
|
| 1341 | + $subtotal = give_get_payment_subtotal($payment_id); |
|
| 1342 | 1342 | |
| 1343 | - return give_currency_filter( give_format_amount( $subtotal ), give_get_payment_currency_code( $payment_id ) ); |
|
| 1343 | + return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id)); |
|
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | 1346 | /** |
@@ -1354,8 +1354,8 @@ discard block |
||
| 1354 | 1354 | * |
| 1355 | 1355 | * @return float $subtotal Subtotal for payment (non formatted). |
| 1356 | 1356 | */ |
| 1357 | -function give_get_payment_subtotal( $payment_id = 0 ) { |
|
| 1358 | - $payment = new Give_Payment( $payment_id ); |
|
| 1357 | +function give_get_payment_subtotal($payment_id = 0) { |
|
| 1358 | + $payment = new Give_Payment($payment_id); |
|
| 1359 | 1359 | |
| 1360 | 1360 | return $payment->subtotal; |
| 1361 | 1361 | } |
@@ -1369,8 +1369,8 @@ discard block |
||
| 1369 | 1369 | * |
| 1370 | 1370 | * @return string The donation ID. |
| 1371 | 1371 | */ |
| 1372 | -function give_get_payment_transaction_id( $payment_id = 0 ) { |
|
| 1373 | - $payment = new Give_Payment( $payment_id ); |
|
| 1372 | +function give_get_payment_transaction_id($payment_id = 0) { |
|
| 1373 | + $payment = new Give_Payment($payment_id); |
|
| 1374 | 1374 | |
| 1375 | 1375 | return $payment->transaction_id; |
| 1376 | 1376 | } |
@@ -1385,15 +1385,15 @@ discard block |
||
| 1385 | 1385 | * |
| 1386 | 1386 | * @return bool|mixed |
| 1387 | 1387 | */ |
| 1388 | -function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) { |
|
| 1388 | +function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') { |
|
| 1389 | 1389 | |
| 1390 | - if ( empty( $payment_id ) || empty( $transaction_id ) ) { |
|
| 1390 | + if (empty($payment_id) || empty($transaction_id)) { |
|
| 1391 | 1391 | return false; |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | - $transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id ); |
|
| 1394 | + $transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id); |
|
| 1395 | 1395 | |
| 1396 | - return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id ); |
|
| 1396 | + return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id); |
|
| 1397 | 1397 | } |
| 1398 | 1398 | |
| 1399 | 1399 | /** |
@@ -1406,12 +1406,12 @@ discard block |
||
| 1406 | 1406 | * |
| 1407 | 1407 | * @return int $purchase Donation ID. |
| 1408 | 1408 | */ |
| 1409 | -function give_get_purchase_id_by_key( $key ) { |
|
| 1409 | +function give_get_purchase_id_by_key($key) { |
|
| 1410 | 1410 | global $wpdb; |
| 1411 | 1411 | |
| 1412 | - $purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key ) ); |
|
| 1412 | + $purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key)); |
|
| 1413 | 1413 | |
| 1414 | - if ( $purchase != null ) { |
|
| 1414 | + if ($purchase != null) { |
|
| 1415 | 1415 | return $purchase; |
| 1416 | 1416 | } |
| 1417 | 1417 | |
@@ -1429,12 +1429,12 @@ discard block |
||
| 1429 | 1429 | * |
| 1430 | 1430 | * @return int $purchase Donation ID. |
| 1431 | 1431 | */ |
| 1432 | -function give_get_purchase_id_by_transaction_id( $key ) { |
|
| 1432 | +function give_get_purchase_id_by_transaction_id($key) { |
|
| 1433 | 1433 | global $wpdb; |
| 1434 | 1434 | |
| 1435 | - $purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) ); |
|
| 1435 | + $purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key)); |
|
| 1436 | 1436 | |
| 1437 | - if ( $purchase != null ) { |
|
| 1437 | + if ($purchase != null) { |
|
| 1438 | 1438 | return $purchase; |
| 1439 | 1439 | } |
| 1440 | 1440 | |
@@ -1451,23 +1451,23 @@ discard block |
||
| 1451 | 1451 | * |
| 1452 | 1452 | * @return array $notes Donation Notes |
| 1453 | 1453 | */ |
| 1454 | -function give_get_payment_notes( $payment_id = 0, $search = '' ) { |
|
| 1454 | +function give_get_payment_notes($payment_id = 0, $search = '') { |
|
| 1455 | 1455 | |
| 1456 | - if ( empty( $payment_id ) && empty( $search ) ) { |
|
| 1456 | + if (empty($payment_id) && empty($search)) { |
|
| 1457 | 1457 | return false; |
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | - remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 ); |
|
| 1461 | - remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 ); |
|
| 1460 | + remove_action('pre_get_comments', 'give_hide_payment_notes', 10); |
|
| 1461 | + remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10); |
|
| 1462 | 1462 | |
| 1463 | - $notes = get_comments( array( |
|
| 1463 | + $notes = get_comments(array( |
|
| 1464 | 1464 | 'post_id' => $payment_id, |
| 1465 | 1465 | 'order' => 'ASC', |
| 1466 | 1466 | 'search' => $search, |
| 1467 | - ) ); |
|
| 1467 | + )); |
|
| 1468 | 1468 | |
| 1469 | - add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 ); |
|
| 1470 | - add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 ); |
|
| 1469 | + add_action('pre_get_comments', 'give_hide_payment_notes', 10); |
|
| 1470 | + add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2); |
|
| 1471 | 1471 | |
| 1472 | 1472 | return $notes; |
| 1473 | 1473 | } |
@@ -1483,8 +1483,8 @@ discard block |
||
| 1483 | 1483 | * |
| 1484 | 1484 | * @return int The new note ID |
| 1485 | 1485 | */ |
| 1486 | -function give_insert_payment_note( $payment_id = 0, $note = '' ) { |
|
| 1487 | - if ( empty( $payment_id ) ) { |
|
| 1486 | +function give_insert_payment_note($payment_id = 0, $note = '') { |
|
| 1487 | + if (empty($payment_id)) { |
|
| 1488 | 1488 | return false; |
| 1489 | 1489 | } |
| 1490 | 1490 | |
@@ -1496,14 +1496,14 @@ discard block |
||
| 1496 | 1496 | * @param int $payment_id Payment ID. |
| 1497 | 1497 | * @param string $note The note. |
| 1498 | 1498 | */ |
| 1499 | - do_action( 'give_pre_insert_payment_note', $payment_id, $note ); |
|
| 1499 | + do_action('give_pre_insert_payment_note', $payment_id, $note); |
|
| 1500 | 1500 | |
| 1501 | - $note_id = wp_insert_comment( wp_filter_comment( array( |
|
| 1501 | + $note_id = wp_insert_comment(wp_filter_comment(array( |
|
| 1502 | 1502 | 'comment_post_ID' => $payment_id, |
| 1503 | 1503 | 'comment_content' => $note, |
| 1504 | 1504 | 'user_id' => is_admin() ? get_current_user_id() : 0, |
| 1505 | - 'comment_date' => current_time( 'mysql' ), |
|
| 1506 | - 'comment_date_gmt' => current_time( 'mysql', 1 ), |
|
| 1505 | + 'comment_date' => current_time('mysql'), |
|
| 1506 | + 'comment_date_gmt' => current_time('mysql', 1), |
|
| 1507 | 1507 | 'comment_approved' => 1, |
| 1508 | 1508 | 'comment_parent' => 0, |
| 1509 | 1509 | 'comment_author' => '', |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | 'comment_author_email' => '', |
| 1513 | 1513 | 'comment_type' => 'give_payment_note', |
| 1514 | 1514 | |
| 1515 | - ) ) ); |
|
| 1515 | + ))); |
|
| 1516 | 1516 | |
| 1517 | 1517 | /** |
| 1518 | 1518 | * Fires after payment note inserted. |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | * @param int $payment_id Payment ID. |
| 1524 | 1524 | * @param string $note The note. |
| 1525 | 1525 | */ |
| 1526 | - do_action( 'give_insert_payment_note', $note_id, $payment_id, $note ); |
|
| 1526 | + do_action('give_insert_payment_note', $note_id, $payment_id, $note); |
|
| 1527 | 1527 | |
| 1528 | 1528 | return $note_id; |
| 1529 | 1529 | } |
@@ -1538,8 +1538,8 @@ discard block |
||
| 1538 | 1538 | * |
| 1539 | 1539 | * @return bool True on success, false otherwise. |
| 1540 | 1540 | */ |
| 1541 | -function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) { |
|
| 1542 | - if ( empty( $comment_id ) ) { |
|
| 1541 | +function give_delete_payment_note($comment_id = 0, $payment_id = 0) { |
|
| 1542 | + if (empty($comment_id)) { |
|
| 1543 | 1543 | return false; |
| 1544 | 1544 | } |
| 1545 | 1545 | |
@@ -1551,9 +1551,9 @@ discard block |
||
| 1551 | 1551 | * @param int $comment_id Note ID. |
| 1552 | 1552 | * @param int $payment_id Payment ID. |
| 1553 | 1553 | */ |
| 1554 | - do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id ); |
|
| 1554 | + do_action('give_pre_delete_payment_note', $comment_id, $payment_id); |
|
| 1555 | 1555 | |
| 1556 | - $ret = wp_delete_comment( $comment_id, true ); |
|
| 1556 | + $ret = wp_delete_comment($comment_id, true); |
|
| 1557 | 1557 | |
| 1558 | 1558 | /** |
| 1559 | 1559 | * Fires after donation note deleted. |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | * @param int $comment_id Note ID. |
| 1564 | 1564 | * @param int $payment_id Payment ID. |
| 1565 | 1565 | */ |
| 1566 | - do_action( 'give_post_delete_payment_note', $comment_id, $payment_id ); |
|
| 1566 | + do_action('give_post_delete_payment_note', $comment_id, $payment_id); |
|
| 1567 | 1567 | |
| 1568 | 1568 | return $ret; |
| 1569 | 1569 | } |
@@ -1578,32 +1578,32 @@ discard block |
||
| 1578 | 1578 | * |
| 1579 | 1579 | * @return string |
| 1580 | 1580 | */ |
| 1581 | -function give_get_payment_note_html( $note, $payment_id = 0 ) { |
|
| 1581 | +function give_get_payment_note_html($note, $payment_id = 0) { |
|
| 1582 | 1582 | |
| 1583 | - if ( is_numeric( $note ) ) { |
|
| 1584 | - $note = get_comment( $note ); |
|
| 1583 | + if (is_numeric($note)) { |
|
| 1584 | + $note = get_comment($note); |
|
| 1585 | 1585 | } |
| 1586 | 1586 | |
| 1587 | - if ( ! empty( $note->user_id ) ) { |
|
| 1588 | - $user = get_userdata( $note->user_id ); |
|
| 1587 | + if ( ! empty($note->user_id)) { |
|
| 1588 | + $user = get_userdata($note->user_id); |
|
| 1589 | 1589 | $user = $user->display_name; |
| 1590 | 1590 | } else { |
| 1591 | - $user = esc_html__( 'System', 'give' ); |
|
| 1591 | + $user = esc_html__('System', 'give'); |
|
| 1592 | 1592 | } |
| 1593 | 1593 | |
| 1594 | - $date_format = give_date_format() . ', ' . get_option( 'time_format' ); |
|
| 1594 | + $date_format = give_date_format().', '.get_option('time_format'); |
|
| 1595 | 1595 | |
| 1596 | - $delete_note_url = wp_nonce_url( add_query_arg( array( |
|
| 1596 | + $delete_note_url = wp_nonce_url(add_query_arg(array( |
|
| 1597 | 1597 | 'give-action' => 'delete_payment_note', |
| 1598 | 1598 | 'note_id' => $note->comment_ID, |
| 1599 | 1599 | 'payment_id' => $payment_id, |
| 1600 | - ) ), 'give_delete_payment_note_' . $note->comment_ID ); |
|
| 1600 | + )), 'give_delete_payment_note_'.$note->comment_ID); |
|
| 1601 | 1601 | |
| 1602 | - $note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">'; |
|
| 1602 | + $note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">'; |
|
| 1603 | 1603 | $note_html .= '<p>'; |
| 1604 | - $note_html .= '<strong>' . $user . '</strong> – <span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>'; |
|
| 1604 | + $note_html .= '<strong>'.$user.'</strong> – <span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>'; |
|
| 1605 | 1605 | $note_html .= $note->comment_content; |
| 1606 | - $note_html .= ' – <a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . esc_attr__( 'Delete this donation note.', 'give' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
| 1606 | + $note_html .= ' – <a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.esc_attr__('Delete this donation note.', 'give').'">'.esc_html__('Delete', 'give').'</a>'; |
|
| 1607 | 1607 | $note_html .= '</p>'; |
| 1608 | 1608 | $note_html .= '</div>'; |
| 1609 | 1609 | |
@@ -1621,18 +1621,18 @@ discard block |
||
| 1621 | 1621 | * |
| 1622 | 1622 | * @return void |
| 1623 | 1623 | */ |
| 1624 | -function give_hide_payment_notes( $query ) { |
|
| 1625 | - if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) { |
|
| 1626 | - $types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array(); |
|
| 1627 | - if ( ! is_array( $types ) ) { |
|
| 1628 | - $types = array( $types ); |
|
| 1624 | +function give_hide_payment_notes($query) { |
|
| 1625 | + if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) { |
|
| 1626 | + $types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array(); |
|
| 1627 | + if ( ! is_array($types)) { |
|
| 1628 | + $types = array($types); |
|
| 1629 | 1629 | } |
| 1630 | 1630 | $types[] = 'give_payment_note'; |
| 1631 | 1631 | $query->query_vars['type__not_in'] = $types; |
| 1632 | 1632 | } |
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | -add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 ); |
|
| 1635 | +add_action('pre_get_comments', 'give_hide_payment_notes', 10); |
|
| 1636 | 1636 | |
| 1637 | 1637 | /** |
| 1638 | 1638 | * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets |
@@ -1644,15 +1644,15 @@ discard block |
||
| 1644 | 1644 | * |
| 1645 | 1645 | * @return array $clauses Updated comment clauses. |
| 1646 | 1646 | */ |
| 1647 | -function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) { |
|
| 1648 | - if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) { |
|
| 1647 | +function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) { |
|
| 1648 | + if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) { |
|
| 1649 | 1649 | $clauses['where'] .= ' AND comment_type != "give_payment_note"'; |
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | 1652 | return $clauses; |
| 1653 | 1653 | } |
| 1654 | 1654 | |
| 1655 | -add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 ); |
|
| 1655 | +add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2); |
|
| 1656 | 1656 | |
| 1657 | 1657 | |
| 1658 | 1658 | /** |
@@ -1665,15 +1665,15 @@ discard block |
||
| 1665 | 1665 | * |
| 1666 | 1666 | * @return string $where |
| 1667 | 1667 | */ |
| 1668 | -function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) { |
|
| 1668 | +function give_hide_payment_notes_from_feeds($where, $wp_comment_query) { |
|
| 1669 | 1669 | global $wpdb; |
| 1670 | 1670 | |
| 1671 | - $where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' ); |
|
| 1671 | + $where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note'); |
|
| 1672 | 1672 | |
| 1673 | 1673 | return $where; |
| 1674 | 1674 | } |
| 1675 | 1675 | |
| 1676 | -add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 ); |
|
| 1676 | +add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2); |
|
| 1677 | 1677 | |
| 1678 | 1678 | |
| 1679 | 1679 | /** |
@@ -1687,32 +1687,32 @@ discard block |
||
| 1687 | 1687 | * |
| 1688 | 1688 | * @return array Array of comment counts. |
| 1689 | 1689 | */ |
| 1690 | -function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) { |
|
| 1690 | +function give_remove_payment_notes_in_comment_counts($stats, $post_id) { |
|
| 1691 | 1691 | global $wpdb, $pagenow; |
| 1692 | 1692 | |
| 1693 | - if ( 'index.php' != $pagenow ) { |
|
| 1693 | + if ('index.php' != $pagenow) { |
|
| 1694 | 1694 | return $stats; |
| 1695 | 1695 | } |
| 1696 | 1696 | |
| 1697 | 1697 | $post_id = (int) $post_id; |
| 1698 | 1698 | |
| 1699 | - if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) { |
|
| 1699 | + if (apply_filters('give_count_payment_notes_in_comments', false)) { |
|
| 1700 | 1700 | return $stats; |
| 1701 | 1701 | } |
| 1702 | 1702 | |
| 1703 | - $stats = wp_cache_get( "comments-{$post_id}", 'counts' ); |
|
| 1703 | + $stats = wp_cache_get("comments-{$post_id}", 'counts'); |
|
| 1704 | 1704 | |
| 1705 | - if ( false !== $stats ) { |
|
| 1705 | + if (false !== $stats) { |
|
| 1706 | 1706 | return $stats; |
| 1707 | 1707 | } |
| 1708 | 1708 | |
| 1709 | 1709 | $where = 'WHERE comment_type != "give_payment_note"'; |
| 1710 | 1710 | |
| 1711 | - if ( $post_id > 0 ) { |
|
| 1712 | - $where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id ); |
|
| 1711 | + if ($post_id > 0) { |
|
| 1712 | + $where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id); |
|
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | - $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A ); |
|
| 1715 | + $count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A); |
|
| 1716 | 1716 | |
| 1717 | 1717 | $total = 0; |
| 1718 | 1718 | $approved = array( |
@@ -1722,30 +1722,30 @@ discard block |
||
| 1722 | 1722 | 'trash' => 'trash', |
| 1723 | 1723 | 'post-trashed' => 'post-trashed', |
| 1724 | 1724 | ); |
| 1725 | - foreach ( (array) $count as $row ) { |
|
| 1725 | + foreach ((array) $count as $row) { |
|
| 1726 | 1726 | // Don't count post-trashed toward totals. |
| 1727 | - if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) { |
|
| 1727 | + if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) { |
|
| 1728 | 1728 | $total += $row['num_comments']; |
| 1729 | 1729 | } |
| 1730 | - if ( isset( $approved[ $row['comment_approved'] ] ) ) { |
|
| 1731 | - $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments']; |
|
| 1730 | + if (isset($approved[$row['comment_approved']])) { |
|
| 1731 | + $stats[$approved[$row['comment_approved']]] = $row['num_comments']; |
|
| 1732 | 1732 | } |
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | 1735 | $stats['total_comments'] = $total; |
| 1736 | - foreach ( $approved as $key ) { |
|
| 1737 | - if ( empty( $stats[ $key ] ) ) { |
|
| 1738 | - $stats[ $key ] = 0; |
|
| 1736 | + foreach ($approved as $key) { |
|
| 1737 | + if (empty($stats[$key])) { |
|
| 1738 | + $stats[$key] = 0; |
|
| 1739 | 1739 | } |
| 1740 | 1740 | } |
| 1741 | 1741 | |
| 1742 | 1742 | $stats = (object) $stats; |
| 1743 | - wp_cache_set( "comments-{$post_id}", $stats, 'counts' ); |
|
| 1743 | + wp_cache_set("comments-{$post_id}", $stats, 'counts'); |
|
| 1744 | 1744 | |
| 1745 | 1745 | return $stats; |
| 1746 | 1746 | } |
| 1747 | 1747 | |
| 1748 | -add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 ); |
|
| 1748 | +add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2); |
|
| 1749 | 1749 | |
| 1750 | 1750 | |
| 1751 | 1751 | /** |
@@ -1758,9 +1758,9 @@ discard block |
||
| 1758 | 1758 | * |
| 1759 | 1759 | * @return string $where Modified where clause. |
| 1760 | 1760 | */ |
| 1761 | -function give_filter_where_older_than_week( $where = '' ) { |
|
| 1761 | +function give_filter_where_older_than_week($where = '') { |
|
| 1762 | 1762 | // Payments older than one week. |
| 1763 | - $start = date( 'Y-m-d', strtotime( '-7 days' ) ); |
|
| 1763 | + $start = date('Y-m-d', strtotime('-7 days')); |
|
| 1764 | 1764 | $where .= " AND post_date <= '{$start}'"; |
| 1765 | 1765 | |
| 1766 | 1766 | return $where; |
@@ -1780,38 +1780,38 @@ discard block |
||
| 1780 | 1780 | * |
| 1781 | 1781 | * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title. |
| 1782 | 1782 | */ |
| 1783 | -function give_get_payment_form_title( $payment_meta, $only_level = false, $separator = '' ) { |
|
| 1783 | +function give_get_payment_form_title($payment_meta, $only_level = false, $separator = '') { |
|
| 1784 | 1784 | |
| 1785 | - $form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0; |
|
| 1786 | - $price_id = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null; |
|
| 1787 | - $form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : ''; |
|
| 1785 | + $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0; |
|
| 1786 | + $price_id = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null; |
|
| 1787 | + $form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : ''; |
|
| 1788 | 1788 | |
| 1789 | - if ( $only_level == true ) { |
|
| 1789 | + if ($only_level == true) { |
|
| 1790 | 1790 | $form_title = ''; |
| 1791 | 1791 | } |
| 1792 | 1792 | |
| 1793 | 1793 | // If multi-level, append to the form title. |
| 1794 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 1794 | + if (give_has_variable_prices($form_id)) { |
|
| 1795 | 1795 | |
| 1796 | 1796 | // Only add separator if there is a form title. |
| 1797 | - if ( ! empty( $form_title ) ) { |
|
| 1798 | - $form_title .= ' ' . $separator . ' '; |
|
| 1797 | + if ( ! empty($form_title)) { |
|
| 1798 | + $form_title .= ' '.$separator.' '; |
|
| 1799 | 1799 | } |
| 1800 | 1800 | |
| 1801 | 1801 | $form_title .= '<span class="donation-level-text-wrap">'; |
| 1802 | 1802 | |
| 1803 | - if ( $price_id == 'custom' ) { |
|
| 1804 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 1805 | - $form_title .= ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' ); |
|
| 1803 | + if ($price_id == 'custom') { |
|
| 1804 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
| 1805 | + $form_title .= ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give'); |
|
| 1806 | 1806 | } else { |
| 1807 | - $form_title .= give_get_price_option_name( $form_id, $price_id ); |
|
| 1807 | + $form_title .= give_get_price_option_name($form_id, $price_id); |
|
| 1808 | 1808 | } |
| 1809 | 1809 | |
| 1810 | 1810 | $form_title .= '</span>'; |
| 1811 | 1811 | |
| 1812 | 1812 | } |
| 1813 | 1813 | |
| 1814 | - return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta ); |
|
| 1814 | + return apply_filters('give_get_payment_form_title', $form_title, $payment_meta); |
|
| 1815 | 1815 | |
| 1816 | 1816 | } |
| 1817 | 1817 | |
@@ -1825,20 +1825,20 @@ discard block |
||
| 1825 | 1825 | * |
| 1826 | 1826 | * @return string $price_id |
| 1827 | 1827 | */ |
| 1828 | -function give_get_price_id( $form_id, $price ) { |
|
| 1828 | +function give_get_price_id($form_id, $price) { |
|
| 1829 | 1829 | |
| 1830 | 1830 | $price_id = 0; |
| 1831 | 1831 | |
| 1832 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 1832 | + if (give_has_variable_prices($form_id)) { |
|
| 1833 | 1833 | |
| 1834 | - $levels = maybe_unserialize( give_get_meta( $form_id, '_give_donation_levels', true ) ); |
|
| 1834 | + $levels = maybe_unserialize(give_get_meta($form_id, '_give_donation_levels', true)); |
|
| 1835 | 1835 | |
| 1836 | - foreach ( $levels as $level ) { |
|
| 1836 | + foreach ($levels as $level) { |
|
| 1837 | 1837 | |
| 1838 | - $level_amount = (float) give_sanitize_amount( $level['_give_amount'] ); |
|
| 1838 | + $level_amount = (float) give_sanitize_amount($level['_give_amount']); |
|
| 1839 | 1839 | |
| 1840 | 1840 | // Check that this indeed the recurring price. |
| 1841 | - if ( $level_amount == $price ) { |
|
| 1841 | + if ($level_amount == $price) { |
|
| 1842 | 1842 | |
| 1843 | 1843 | $price_id = $level['_give_id']['level_id']; |
| 1844 | 1844 | |
@@ -1863,10 +1863,10 @@ discard block |
||
| 1863 | 1863 | * |
| 1864 | 1864 | * @return string |
| 1865 | 1865 | */ |
| 1866 | -function give_get_form_dropdown( $args = array(), $echo = false ) { |
|
| 1867 | - $form_dropdown_html = Give()->html->forms_dropdown( $args ); |
|
| 1866 | +function give_get_form_dropdown($args = array(), $echo = false) { |
|
| 1867 | + $form_dropdown_html = Give()->html->forms_dropdown($args); |
|
| 1868 | 1868 | |
| 1869 | - if ( ! $echo ) { |
|
| 1869 | + if ( ! $echo) { |
|
| 1870 | 1870 | return $form_dropdown_html; |
| 1871 | 1871 | } |
| 1872 | 1872 | |
@@ -1883,17 +1883,17 @@ discard block |
||
| 1883 | 1883 | * |
| 1884 | 1884 | * @return string|bool |
| 1885 | 1885 | */ |
| 1886 | -function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) { |
|
| 1886 | +function give_get_form_variable_price_dropdown($args = array(), $echo = false) { |
|
| 1887 | 1887 | |
| 1888 | 1888 | // Check for give form id. |
| 1889 | - if ( empty( $args['id'] ) ) { |
|
| 1889 | + if (empty($args['id'])) { |
|
| 1890 | 1890 | return false; |
| 1891 | 1891 | } |
| 1892 | 1892 | |
| 1893 | - $form = new Give_Donate_Form( $args['id'] ); |
|
| 1893 | + $form = new Give_Donate_Form($args['id']); |
|
| 1894 | 1894 | |
| 1895 | 1895 | // Check if form has variable prices or not. |
| 1896 | - if ( ! $form->ID || ! $form->has_variable_prices() ) { |
|
| 1896 | + if ( ! $form->ID || ! $form->has_variable_prices()) { |
|
| 1897 | 1897 | return false; |
| 1898 | 1898 | } |
| 1899 | 1899 | |
@@ -1901,24 +1901,24 @@ discard block |
||
| 1901 | 1901 | $variable_price_options = array(); |
| 1902 | 1902 | |
| 1903 | 1903 | // Check if multi donation form support custom donation or not. |
| 1904 | - if ( $form->is_custom_price_mode() ) { |
|
| 1905 | - $variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' ); |
|
| 1904 | + if ($form->is_custom_price_mode()) { |
|
| 1905 | + $variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give'); |
|
| 1906 | 1906 | } |
| 1907 | 1907 | |
| 1908 | 1908 | // Get variable price and ID from variable price array. |
| 1909 | - foreach ( $variable_prices as $variable_price ) { |
|
| 1910 | - $variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'] ) ); |
|
| 1909 | + foreach ($variable_prices as $variable_price) { |
|
| 1910 | + $variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount'])); |
|
| 1911 | 1911 | } |
| 1912 | 1912 | |
| 1913 | 1913 | // Update options. |
| 1914 | - $args = array_merge( $args, array( |
|
| 1914 | + $args = array_merge($args, array( |
|
| 1915 | 1915 | 'options' => $variable_price_options, |
| 1916 | - ) ); |
|
| 1916 | + )); |
|
| 1917 | 1917 | |
| 1918 | 1918 | // Generate select html. |
| 1919 | - $form_dropdown_html = Give()->html->select( $args ); |
|
| 1919 | + $form_dropdown_html = Give()->html->select($args); |
|
| 1920 | 1920 | |
| 1921 | - if ( ! $echo ) { |
|
| 1921 | + if ( ! $echo) { |
|
| 1922 | 1922 | return $form_dropdown_html; |
| 1923 | 1923 | } |
| 1924 | 1924 | |
@@ -1937,16 +1937,16 @@ discard block |
||
| 1937 | 1937 | * |
| 1938 | 1938 | * @return string |
| 1939 | 1939 | */ |
| 1940 | -function give_get_payment_meta_price_id( $payment_meta ) { |
|
| 1940 | +function give_get_payment_meta_price_id($payment_meta) { |
|
| 1941 | 1941 | |
| 1942 | - if ( isset( $payment_meta['give_price_id'] ) ) { |
|
| 1942 | + if (isset($payment_meta['give_price_id'])) { |
|
| 1943 | 1943 | $price_id = $payment_meta['give_price_id']; |
| 1944 | - } elseif ( isset( $payment_meta['price_id'] ) ) { |
|
| 1944 | + } elseif (isset($payment_meta['price_id'])) { |
|
| 1945 | 1945 | $price_id = $payment_meta['price_id']; |
| 1946 | 1946 | } else { |
| 1947 | - $price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] ); |
|
| 1947 | + $price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']); |
|
| 1948 | 1948 | } |
| 1949 | 1949 | |
| 1950 | - return apply_filters( 'give_get_payment_meta_price_id', $price_id ); |
|
| 1950 | + return apply_filters('give_get_payment_meta_price_id', $price_id); |
|
| 1951 | 1951 | |
| 1952 | 1952 | } |
@@ -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 | |
@@ -27,34 +27,34 @@ discard block |
||
| 27 | 27 | * @return array $form_columns Updated array of forms columns |
| 28 | 28 | * Post Type List Table |
| 29 | 29 | */ |
| 30 | -function give_form_columns( $give_form_columns ) { |
|
| 30 | +function give_form_columns($give_form_columns) { |
|
| 31 | 31 | |
| 32 | 32 | // Standard columns |
| 33 | 33 | $give_form_columns = array( |
| 34 | 34 | 'cb' => '<input type="checkbox"/>', |
| 35 | - 'title' => __( 'Name', 'give' ), |
|
| 36 | - 'form_category' => __( 'Categories', 'give' ), |
|
| 37 | - 'form_tag' => __( 'Tags', 'give' ), |
|
| 38 | - 'price' => __( 'Amount', 'give' ), |
|
| 39 | - 'goal' => __( 'Goal', 'give' ), |
|
| 40 | - 'donations' => __( 'Donations', 'give' ), |
|
| 41 | - 'earnings' => __( 'Income', 'give' ), |
|
| 42 | - 'shortcode' => __( 'Shortcode', 'give' ), |
|
| 43 | - 'date' => __( 'Date', 'give' ), |
|
| 35 | + 'title' => __('Name', 'give'), |
|
| 36 | + 'form_category' => __('Categories', 'give'), |
|
| 37 | + 'form_tag' => __('Tags', 'give'), |
|
| 38 | + 'price' => __('Amount', 'give'), |
|
| 39 | + 'goal' => __('Goal', 'give'), |
|
| 40 | + 'donations' => __('Donations', 'give'), |
|
| 41 | + 'earnings' => __('Income', 'give'), |
|
| 42 | + 'shortcode' => __('Shortcode', 'give'), |
|
| 43 | + 'date' => __('Date', 'give'), |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | // Does the user want categories / tags? |
| 47 | - if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
| 48 | - unset( $give_form_columns['form_category'] ); |
|
| 47 | + if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
| 48 | + unset($give_form_columns['form_category']); |
|
| 49 | 49 | } |
| 50 | - if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
| 51 | - unset( $give_form_columns['form_tag'] ); |
|
| 50 | + if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
| 51 | + unset($give_form_columns['form_tag']); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
| 54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
| 57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Render Give Form Columns |
@@ -66,59 +66,59 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
| 70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
| 69 | +function give_render_form_columns($column_name, $post_id) { |
|
| 70 | + if (get_post_type($post_id) == 'give_forms') { |
|
| 71 | 71 | |
| 72 | - switch ( $column_name ) { |
|
| 72 | + switch ($column_name) { |
|
| 73 | 73 | case 'form_category': |
| 74 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
| 74 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
| 75 | 75 | break; |
| 76 | 76 | case 'form_tag': |
| 77 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
| 77 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
| 78 | 78 | break; |
| 79 | 79 | case 'price': |
| 80 | - if ( give_has_variable_prices( $post_id ) ) { |
|
| 81 | - echo give_price_range( $post_id ); |
|
| 80 | + if (give_has_variable_prices($post_id)) { |
|
| 81 | + echo give_price_range($post_id); |
|
| 82 | 82 | } else { |
| 83 | - echo give_price( $post_id, false ); |
|
| 84 | - echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />'; |
|
| 83 | + echo give_price($post_id, false); |
|
| 84 | + echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />'; |
|
| 85 | 85 | } |
| 86 | 86 | break; |
| 87 | 87 | case 'goal': |
| 88 | - if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) { |
|
| 89 | - echo give_goal( $post_id, false ); |
|
| 88 | + if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) { |
|
| 89 | + echo give_goal($post_id, false); |
|
| 90 | 90 | } else { |
| 91 | - esc_html_e( 'No Goal Set', 'give' ); |
|
| 91 | + esc_html_e('No Goal Set', 'give'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />'; |
|
| 94 | + echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />'; |
|
| 95 | 95 | break; |
| 96 | 96 | case 'donations': |
| 97 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
| 98 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ) . '">'; |
|
| 99 | - echo give_get_form_sales_stats( $post_id ); |
|
| 97 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
| 98 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)).'">'; |
|
| 99 | + echo give_get_form_sales_stats($post_id); |
|
| 100 | 100 | echo '</a>'; |
| 101 | 101 | } else { |
| 102 | 102 | echo '-'; |
| 103 | 103 | } |
| 104 | 104 | break; |
| 105 | 105 | case 'earnings': |
| 106 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
| 107 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ) . '">'; |
|
| 108 | - echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) ); |
|
| 106 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
| 107 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)).'">'; |
|
| 108 | + echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id))); |
|
| 109 | 109 | echo '</a>'; |
| 110 | 110 | } else { |
| 111 | 111 | echo '-'; |
| 112 | 112 | } |
| 113 | 113 | break; |
| 114 | 114 | case 'shortcode': |
| 115 | - echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="' . absint( $post_id ) . '"]">'; |
|
| 115 | + echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="'.absint($post_id).'"]">'; |
|
| 116 | 116 | break; |
| 117 | 117 | }// End switch(). |
| 118 | 118 | }// End if(). |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
| 121 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * Registers the sortable columns in the list table |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return array $columns Array of sortable columns |
| 131 | 131 | */ |
| 132 | -function give_sortable_form_columns( $columns ) { |
|
| 132 | +function give_sortable_form_columns($columns) { |
|
| 133 | 133 | $columns['price'] = 'amount'; |
| 134 | 134 | $columns['sales'] = 'sales'; |
| 135 | 135 | $columns['earnings'] = 'earnings'; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | return $columns; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
| 142 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Sorts Columns in the Forms List Table |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @return array $vars Array of all the sort variables. |
| 152 | 152 | */ |
| 153 | -function give_sort_forms( $vars ) { |
|
| 153 | +function give_sort_forms($vars) { |
|
| 154 | 154 | // Check if we're viewing the "give_forms" post type. |
| 155 | - if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) { |
|
| 155 | + if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) { |
|
| 156 | 156 | return $vars; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - switch ( $vars['orderby'] ) { |
|
| 159 | + switch ($vars['orderby']) { |
|
| 160 | 160 | // Check if 'orderby' is set to "sales". |
| 161 | 161 | case 'sales': |
| 162 | 162 | $vars = array_merge( |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | // Check if "orderby" is set to "price/amount". |
| 183 | 183 | case 'amount': |
| 184 | - $multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
| 184 | + $multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
| 185 | 185 | |
| 186 | 186 | $vars['orderby'] = 'meta_value_num'; |
| 187 | 187 | $vars['meta_query'] = array( |
@@ -233,17 +233,17 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @return array Array of all sort variables. |
| 235 | 235 | */ |
| 236 | -function give_filter_forms( $vars ) { |
|
| 237 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
| 236 | +function give_filter_forms($vars) { |
|
| 237 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
| 238 | 238 | |
| 239 | 239 | // If an author ID was passed, use it |
| 240 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
| 240 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
| 241 | 241 | |
| 242 | 242 | $author_id = $_REQUEST['author']; |
| 243 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
| 244 | - wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 243 | + if ((int) $author_id !== get_current_user_id()) { |
|
| 244 | + wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array( |
|
| 245 | 245 | 'response' => 403, |
| 246 | - ) ); |
|
| 246 | + )); |
|
| 247 | 247 | } |
| 248 | 248 | $vars = array_merge( |
| 249 | 249 | $vars, |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | * @return void |
| 268 | 268 | */ |
| 269 | 269 | function give_forms_load() { |
| 270 | - add_filter( 'request', 'give_sort_forms' ); |
|
| 271 | - add_filter( 'request', 'give_filter_forms' ); |
|
| 270 | + add_filter('request', 'give_sort_forms'); |
|
| 271 | + add_filter('request', 'give_filter_forms'); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
| 274 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
| 275 | 275 | |
| 276 | 276 | /** |
| 277 | 277 | * Remove Forms Month Filter |
@@ -285,17 +285,17 @@ discard block |
||
| 285 | 285 | * @global $typenow The post type we are viewing. |
| 286 | 286 | * @return array Empty array disables the dropdown. |
| 287 | 287 | */ |
| 288 | -function give_remove_month_filter( $dates ) { |
|
| 288 | +function give_remove_month_filter($dates) { |
|
| 289 | 289 | global $typenow; |
| 290 | 290 | |
| 291 | - if ( $typenow == 'give_forms' ) { |
|
| 291 | + if ($typenow == 'give_forms') { |
|
| 292 | 292 | $dates = array(); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | return $dates; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
| 298 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
| 299 | 299 | |
| 300 | 300 | /** |
| 301 | 301 | * Updates price when saving post |
@@ -306,23 +306,23 @@ discard block |
||
| 306 | 306 | * |
| 307 | 307 | * @return int|null |
| 308 | 308 | */ |
| 309 | -function give_price_save_quick_edit( $post_id ) { |
|
| 310 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
| 309 | +function give_price_save_quick_edit($post_id) { |
|
| 310 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
| 311 | 311 | return; |
| 312 | 312 | } |
| 313 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 313 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 314 | 314 | return $post_id; |
| 315 | 315 | } |
| 316 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 316 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
| 317 | 317 | return $post_id; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
| 321 | - give_update_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ); |
|
| 320 | + if (isset($_REQUEST['_give_regprice'])) { |
|
| 321 | + give_update_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice']))); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
| 325 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | 328 | * Process bulk edit actions via AJAX |
@@ -332,18 +332,18 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | function give_save_bulk_edit() { |
| 334 | 334 | |
| 335 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
| 335 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
| 336 | 336 | |
| 337 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
| 338 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
| 339 | - foreach ( $post_ids as $post_id ) { |
|
| 337 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
| 338 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
| 339 | + foreach ($post_ids as $post_id) { |
|
| 340 | 340 | |
| 341 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 341 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 342 | 342 | continue; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if ( ! empty( $price ) ) { |
|
| 346 | - give_update_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) ); |
|
| 345 | + if ( ! empty($price)) { |
|
| 346 | + give_update_meta($post_id, '_give_set_price', give_sanitize_amount($price)); |
|
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | } |
@@ -351,4 +351,4 @@ discard block |
||
| 351 | 351 | die(); |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
| 354 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
|
@@ -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 | |
@@ -25,48 +25,48 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_do_automatic_upgrades() { |
| 27 | 27 | $did_upgrade = false; |
| 28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
| 28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
| 29 | 29 | |
| 30 | - if ( ! $give_version ) { |
|
| 30 | + if ( ! $give_version) { |
|
| 31 | 31 | // 1.0 is the first version to use this option so we must add it. |
| 32 | 32 | $give_version = '1.0'; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - switch ( true ) { |
|
| 35 | + switch (true) { |
|
| 36 | 36 | |
| 37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
| 37 | + case version_compare($give_version, '1.6', '<') : |
|
| 38 | 38 | give_v16_upgrades(); |
| 39 | 39 | $did_upgrade = true; |
| 40 | 40 | |
| 41 | - case version_compare( $give_version, '1.7', '<' ) : |
|
| 41 | + case version_compare($give_version, '1.7', '<') : |
|
| 42 | 42 | give_v17_upgrades(); |
| 43 | 43 | $did_upgrade = true; |
| 44 | 44 | |
| 45 | - case version_compare( $give_version, '1.8', '<' ) : |
|
| 45 | + case version_compare($give_version, '1.8', '<') : |
|
| 46 | 46 | give_v18_upgrades(); |
| 47 | 47 | $did_upgrade = true; |
| 48 | 48 | |
| 49 | - case version_compare( $give_version, '1.8.7', '<' ) : |
|
| 49 | + case version_compare($give_version, '1.8.7', '<') : |
|
| 50 | 50 | give_v187_upgrades(); |
| 51 | 51 | $did_upgrade = true; |
| 52 | 52 | |
| 53 | - case version_compare( $give_version, '1.8.8', '<' ) : |
|
| 53 | + case version_compare($give_version, '1.8.8', '<') : |
|
| 54 | 54 | give_v188_upgrades(); |
| 55 | 55 | $did_upgrade = true; |
| 56 | 56 | |
| 57 | - case version_compare( $give_version, '1.8.9', '<' ) : |
|
| 57 | + case version_compare($give_version, '1.8.9', '<') : |
|
| 58 | 58 | give_v189_upgrades(); |
| 59 | 59 | $did_upgrade = true; |
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if ( $did_upgrade ) { |
|
| 64 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 63 | + if ($did_upgrade) { |
|
| 64 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
| 69 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
| 68 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
| 69 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Display Upgrade Notices |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | -function give_show_upgrade_notices( $give_updates ) { |
|
| 81 | +function give_show_upgrade_notices($give_updates) { |
|
| 82 | 82 | // v1.3.2 Upgrades |
| 83 | 83 | $give_updates->register( |
| 84 | 84 | array( |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | ); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | -add_action( 'give_register_updates', 'give_show_upgrade_notices' ); |
|
| 120 | +add_action('give_register_updates', 'give_show_upgrade_notices'); |
|
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | 123 | * Triggers all upgrade functions |
@@ -129,29 +129,29 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | function give_trigger_upgrades() { |
| 131 | 131 | |
| 132 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 133 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 132 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 133 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 134 | 134 | 'response' => 403, |
| 135 | - ) ); |
|
| 135 | + )); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $give_version = get_option( 'give_version' ); |
|
| 138 | + $give_version = get_option('give_version'); |
|
| 139 | 139 | |
| 140 | - if ( ! $give_version ) { |
|
| 140 | + if ( ! $give_version) { |
|
| 141 | 141 | // 1.0 is the first version to use this option so we must add it. |
| 142 | 142 | $give_version = '1.0'; |
| 143 | - add_option( 'give_version', $give_version ); |
|
| 143 | + add_option('give_version', $give_version); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - update_option( 'give_version', GIVE_VERSION ); |
|
| 147 | - delete_option( 'give_doing_upgrade' ); |
|
| 146 | + update_option('give_version', GIVE_VERSION); |
|
| 147 | + delete_option('give_doing_upgrade'); |
|
| 148 | 148 | |
| 149 | - if ( DOING_AJAX ) { |
|
| 150 | - die( 'complete' ); |
|
| 149 | + if (DOING_AJAX) { |
|
| 150 | + die('complete'); |
|
| 151 | 151 | } // End if(). |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
| 154 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | 157 | * Check if the upgrade routine has been run for a specific action |
@@ -162,15 +162,15 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @return bool If the action has been added to the completed actions array |
| 164 | 164 | */ |
| 165 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
| 165 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
| 166 | 166 | |
| 167 | - if ( empty( $upgrade_action ) ) { |
|
| 167 | + if (empty($upgrade_action)) { |
|
| 168 | 168 | return false; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $completed_upgrades = give_get_completed_upgrades(); |
| 172 | 172 | |
| 173 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
| 173 | + return in_array($upgrade_action, $completed_upgrades); |
|
| 174 | 174 | |
| 175 | 175 | } |
| 176 | 176 | |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
| 183 | 183 | */ |
| 184 | 184 | function give_maybe_resume_upgrade() { |
| 185 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
| 186 | - if ( empty( $doing_upgrade ) ) { |
|
| 185 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
| 186 | + if (empty($doing_upgrade)) { |
|
| 187 | 187 | return false; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @return bool If the function was successfully added |
| 201 | 201 | */ |
| 202 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
| 202 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
| 203 | 203 | |
| 204 | - if ( empty( $upgrade_action ) ) { |
|
| 204 | + if (empty($upgrade_action)) { |
|
| 205 | 205 | return false; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -209,16 +209,16 @@ discard block |
||
| 209 | 209 | $completed_upgrades[] = $upgrade_action; |
| 210 | 210 | |
| 211 | 211 | // Remove any blanks, and only show uniques. |
| 212 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
| 212 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | 215 | * Fire the action when any upgrade set to complete. |
| 216 | 216 | * |
| 217 | 217 | * @since 1.8.12 |
| 218 | 218 | */ |
| 219 | - do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades ); |
|
| 219 | + do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades); |
|
| 220 | 220 | |
| 221 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
| 221 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | function give_get_completed_upgrades() { |
| 231 | 231 | |
| 232 | - return (array) get_option( 'give_completed_upgrades' ); |
|
| 232 | + return (array) get_option('give_completed_upgrades'); |
|
| 233 | 233 | |
| 234 | 234 | } |
| 235 | 235 | |
@@ -246,24 +246,24 @@ discard block |
||
| 246 | 246 | /* @var Give_Updates $give_updates */ |
| 247 | 247 | $give_updates = Give_Updates::get_instance(); |
| 248 | 248 | |
| 249 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 250 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 249 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 250 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 251 | 251 | 'response' => 403, |
| 252 | - ) ); |
|
| 252 | + )); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - ignore_user_abort( true ); |
|
| 255 | + ignore_user_abort(true); |
|
| 256 | 256 | |
| 257 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 258 | - @set_time_limit( 0 ); |
|
| 257 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 258 | + @set_time_limit(0); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | // UPDATE DB METAKEYS. |
| 262 | 262 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
| 263 | - $query = $wpdb->query( $sql ); |
|
| 263 | + $query = $wpdb->query($sql); |
|
| 264 | 264 | |
| 265 | 265 | $give_updates::$percentage = 100; |
| 266 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
| 266 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | |
@@ -287,24 +287,24 @@ discard block |
||
| 287 | 287 | $where .= "AND ( p.post_status = 'abandoned' )"; |
| 288 | 288 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
| 289 | 289 | |
| 290 | - $sql = $select . $join . $where; |
|
| 291 | - $found_payments = $wpdb->get_col( $sql ); |
|
| 290 | + $sql = $select.$join.$where; |
|
| 291 | + $found_payments = $wpdb->get_col($sql); |
|
| 292 | 292 | |
| 293 | - foreach ( $found_payments as $payment ) { |
|
| 293 | + foreach ($found_payments as $payment) { |
|
| 294 | 294 | |
| 295 | 295 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
| 296 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
| 296 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
| 297 | 297 | |
| 298 | 298 | // 1450124863 = 12/10/2015 20:42:25. |
| 299 | - if ( $modified_time >= 1450124863 ) { |
|
| 299 | + if ($modified_time >= 1450124863) { |
|
| 300 | 300 | |
| 301 | - give_update_payment_status( $payment, 'pending' ); |
|
| 301 | + give_update_payment_status($payment, 'pending'); |
|
| 302 | 302 | |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | $give_updates::$percentage = 100; |
| 307 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
| 307 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | |
@@ -317,17 +317,17 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | function give_v152_cleanup_users() { |
| 319 | 319 | |
| 320 | - $give_version = get_option( 'give_version' ); |
|
| 320 | + $give_version = get_option('give_version'); |
|
| 321 | 321 | |
| 322 | - if ( ! $give_version ) { |
|
| 322 | + if ( ! $give_version) { |
|
| 323 | 323 | // 1.0 is the first version to use this option so we must add it. |
| 324 | 324 | $give_version = '1.0'; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
| 327 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
| 328 | 328 | |
| 329 | 329 | // v1.5.2 Upgrades |
| 330 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
| 330 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
| 331 | 331 | |
| 332 | 332 | // Delete all caps with "ss". |
| 333 | 333 | // Also delete all unused "campaign" roles. |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | ); |
| 375 | 375 | |
| 376 | 376 | global $wp_roles; |
| 377 | - foreach ( $delete_caps as $cap ) { |
|
| 378 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
| 379 | - $wp_roles->remove_cap( $role, $cap ); |
|
| 377 | + foreach ($delete_caps as $cap) { |
|
| 378 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
| 379 | + $wp_roles->remove_cap($role, $cap); |
|
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
@@ -386,15 +386,15 @@ discard block |
||
| 386 | 386 | $roles->add_caps(); |
| 387 | 387 | |
| 388 | 388 | // The Update Ran. |
| 389 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 390 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
| 391 | - delete_option( 'give_doing_upgrade' ); |
|
| 389 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 390 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
| 391 | + delete_option('give_doing_upgrade'); |
|
| 392 | 392 | |
| 393 | 393 | }// End if(). |
| 394 | 394 | |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
| 397 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
| 398 | 398 | |
| 399 | 399 | /** |
| 400 | 400 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -437,53 +437,53 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | // Get addons license key. |
| 439 | 439 | $addons = array(); |
| 440 | - foreach ( $give_options as $key => $value ) { |
|
| 441 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
| 442 | - $addons[ $key ] = $value; |
|
| 440 | + foreach ($give_options as $key => $value) { |
|
| 441 | + if (false !== strpos($key, '_license_key')) { |
|
| 442 | + $addons[$key] = $value; |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | // Bailout: We do not have any addon license data to upgrade. |
| 447 | - if ( empty( $addons ) ) { |
|
| 447 | + if (empty($addons)) { |
|
| 448 | 448 | return false; |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - foreach ( $addons as $key => $addon_license ) { |
|
| 451 | + foreach ($addons as $key => $addon_license) { |
|
| 452 | 452 | |
| 453 | 453 | // Get addon shortname. |
| 454 | - $shortname = str_replace( '_license_key', '', $key ); |
|
| 454 | + $shortname = str_replace('_license_key', '', $key); |
|
| 455 | 455 | |
| 456 | 456 | // Addon license option name. |
| 457 | - $addon_license_option_name = $shortname . '_license_active'; |
|
| 457 | + $addon_license_option_name = $shortname.'_license_active'; |
|
| 458 | 458 | |
| 459 | 459 | // bailout if license is empty. |
| 460 | - if ( empty( $addon_license ) ) { |
|
| 461 | - delete_option( $addon_license_option_name ); |
|
| 460 | + if (empty($addon_license)) { |
|
| 461 | + delete_option($addon_license_option_name); |
|
| 462 | 462 | continue; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // Get addon name. |
| 466 | 466 | $addon_name = array(); |
| 467 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
| 468 | - foreach ( $addon_name_parts as $name_part ) { |
|
| 467 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
| 468 | + foreach ($addon_name_parts as $name_part) { |
|
| 469 | 469 | |
| 470 | 470 | // Fix addon name |
| 471 | - switch ( $name_part ) { |
|
| 471 | + switch ($name_part) { |
|
| 472 | 472 | case 'authorizenet' : |
| 473 | 473 | $name_part = 'authorize.net'; |
| 474 | 474 | break; |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - $addon_name[] = ucfirst( $name_part ); |
|
| 477 | + $addon_name[] = ucfirst($name_part); |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - $addon_name = implode( ' ', $addon_name ); |
|
| 480 | + $addon_name = implode(' ', $addon_name); |
|
| 481 | 481 | |
| 482 | 482 | // Data to send to the API |
| 483 | 483 | $api_params = array( |
| 484 | 484 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
| 485 | 485 | 'license' => $addon_license, |
| 486 | - 'item_name' => urlencode( $addon_name ), |
|
| 486 | + 'item_name' => urlencode($addon_name), |
|
| 487 | 487 | 'url' => home_url(), |
| 488 | 488 | ); |
| 489 | 489 | |
@@ -498,17 +498,17 @@ discard block |
||
| 498 | 498 | ); |
| 499 | 499 | |
| 500 | 500 | // Make sure there are no errors. |
| 501 | - if ( is_wp_error( $response ) ) { |
|
| 502 | - delete_option( $addon_license_option_name ); |
|
| 501 | + if (is_wp_error($response)) { |
|
| 502 | + delete_option($addon_license_option_name); |
|
| 503 | 503 | continue; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | // Tell WordPress to look for updates. |
| 507 | - set_site_transient( 'update_plugins', null ); |
|
| 507 | + set_site_transient('update_plugins', null); |
|
| 508 | 508 | |
| 509 | 509 | // Decode license data. |
| 510 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 511 | - update_option( $addon_license_option_name, $license_data ); |
|
| 510 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
| 511 | + update_option($addon_license_option_name, $license_data); |
|
| 512 | 512 | }// End foreach(). |
| 513 | 513 | } |
| 514 | 514 | |
@@ -538,9 +538,9 @@ discard block |
||
| 538 | 538 | ); |
| 539 | 539 | |
| 540 | 540 | global $wp_roles; |
| 541 | - foreach ( $delete_caps as $cap ) { |
|
| 542 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
| 543 | - $wp_roles->remove_cap( $role, $cap ); |
|
| 541 | + foreach ($delete_caps as $cap) { |
|
| 542 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
| 543 | + $wp_roles->remove_cap($role, $cap); |
|
| 544 | 544 | } |
| 545 | 545 | } |
| 546 | 546 | |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | function give_v18_upgrades_core_setting() { |
| 575 | 575 | // Core settings which changes from checkbox to radio. |
| 576 | 576 | $core_setting_names = array_merge( |
| 577 | - array_keys( give_v18_renamed_core_settings() ), |
|
| 577 | + array_keys(give_v18_renamed_core_settings()), |
|
| 578 | 578 | array( |
| 579 | 579 | 'uninstall_on_delete', |
| 580 | 580 | 'scripts_footer', |
@@ -586,48 +586,48 @@ discard block |
||
| 586 | 586 | ); |
| 587 | 587 | |
| 588 | 588 | // Bailout: If not any setting define. |
| 589 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
| 589 | + if ($give_settings = get_option('give_settings')) { |
|
| 590 | 590 | |
| 591 | 591 | $setting_changed = false; |
| 592 | 592 | |
| 593 | 593 | // Loop: check each setting field. |
| 594 | - foreach ( $core_setting_names as $setting_name ) { |
|
| 594 | + foreach ($core_setting_names as $setting_name) { |
|
| 595 | 595 | // New setting name. |
| 596 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
| 596 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
| 597 | 597 | |
| 598 | 598 | // Continue: If setting already set. |
| 599 | 599 | if ( |
| 600 | - array_key_exists( $new_setting_name, $give_settings ) |
|
| 601 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
| 600 | + array_key_exists($new_setting_name, $give_settings) |
|
| 601 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
| 602 | 602 | ) { |
| 603 | 603 | continue; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | // Set checkbox value to radio value. |
| 607 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
| 607 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
| 608 | 608 | |
| 609 | 609 | // @see https://github.com/WordImpress/Give/issues/1063 |
| 610 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
| 610 | + if (false !== strpos($setting_name, 'disable_')) { |
|
| 611 | 611 | |
| 612 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
| 613 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
| 612 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
| 613 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
| 614 | 614 | |
| 615 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
| 615 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | // Tell bot to update core setting to db. |
| 619 | - if ( ! $setting_changed ) { |
|
| 619 | + if ( ! $setting_changed) { |
|
| 620 | 620 | $setting_changed = true; |
| 621 | 621 | } |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | // Update setting only if they changed. |
| 625 | - if ( $setting_changed ) { |
|
| 626 | - update_option( 'give_settings', $give_settings ); |
|
| 625 | + if ($setting_changed) { |
|
| 626 | + update_option('give_settings', $give_settings); |
|
| 627 | 627 | } |
| 628 | 628 | }// End if(). |
| 629 | 629 | |
| 630 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
| 630 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | /** |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | $give_updates = Give_Updates::get_instance(); |
| 642 | 642 | |
| 643 | 643 | // form query |
| 644 | - $forms = new WP_Query( array( |
|
| 644 | + $forms = new WP_Query(array( |
|
| 645 | 645 | 'paged' => $give_updates::$step, |
| 646 | 646 | 'status' => 'any', |
| 647 | 647 | 'order' => 'ASC', |
@@ -650,43 +650,43 @@ discard block |
||
| 650 | 650 | ) |
| 651 | 651 | ); |
| 652 | 652 | |
| 653 | - if ( $forms->have_posts() ) { |
|
| 654 | - $give_updates::$percentage = ( ( $give_updates::$step * 20 ) / $forms->found_posts ) * 100; |
|
| 653 | + if ($forms->have_posts()) { |
|
| 654 | + $give_updates::$percentage = (($give_updates::$step * 20) / $forms->found_posts) * 100; |
|
| 655 | 655 | |
| 656 | - error_log( print_r( "{$give_updates::$step}-{$forms->found_posts}-{$give_updates::$percentage}", true ) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log' ); |
|
| 656 | + error_log(print_r("{$give_updates::$step}-{$forms->found_posts}-{$give_updates::$percentage}", true)."\n", 3, WP_CONTENT_DIR.'/debug_new.log'); |
|
| 657 | 657 | |
| 658 | - while ( $forms->have_posts() ) { |
|
| 658 | + while ($forms->have_posts()) { |
|
| 659 | 659 | $forms->the_post(); |
| 660 | 660 | |
| 661 | 661 | // Form content. |
| 662 | 662 | // Note in version 1.8 display content setting split into display content and content placement setting. |
| 663 | 663 | // You can delete _give_content_option in future |
| 664 | - $show_content = give_get_meta( get_the_ID(), '_give_content_option', true ); |
|
| 665 | - if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
| 666 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
| 667 | - give_update_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
| 664 | + $show_content = give_get_meta(get_the_ID(), '_give_content_option', true); |
|
| 665 | + if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) { |
|
| 666 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
| 667 | + give_update_meta(get_the_ID(), '_give_display_content', $field_value); |
|
| 668 | 668 | |
| 669 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
| 670 | - give_update_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
| 669 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
| 670 | + give_update_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | // "Disable" Guest Donation. Checkbox |
| 674 | 674 | // See: https://github.com/WordImpress/Give/issues/1470 |
| 675 | - $guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
| 676 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
| 677 | - give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
| 675 | + $guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true); |
|
| 676 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
| 677 | + give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
| 678 | 678 | |
| 679 | 679 | // Offline Donations |
| 680 | 680 | // See: https://github.com/WordImpress/Give/issues/1579 |
| 681 | - $offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
| 682 | - if ( 'no' === $offline_donation ) { |
|
| 681 | + $offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
| 682 | + if ('no' === $offline_donation) { |
|
| 683 | 683 | $offline_donation_newval = 'global'; |
| 684 | - } elseif ( 'yes' === $offline_donation ) { |
|
| 684 | + } elseif ('yes' === $offline_donation) { |
|
| 685 | 685 | $offline_donation_newval = 'enabled'; |
| 686 | 686 | } else { |
| 687 | 687 | $offline_donation_newval = 'disabled'; |
| 688 | 688 | } |
| 689 | - give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
| 689 | + give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
| 690 | 690 | |
| 691 | 691 | // Convert yes/no setting field to enabled/disabled. |
| 692 | 692 | $form_radio_settings = array( |
@@ -706,15 +706,15 @@ discard block |
||
| 706 | 706 | '_give_offline_donation_enable_billing_fields_single', |
| 707 | 707 | ); |
| 708 | 708 | |
| 709 | - foreach ( $form_radio_settings as $meta_key ) { |
|
| 709 | + foreach ($form_radio_settings as $meta_key) { |
|
| 710 | 710 | // Get value. |
| 711 | - $field_value = give_get_meta( get_the_ID(), $meta_key, true ); |
|
| 711 | + $field_value = give_get_meta(get_the_ID(), $meta_key, true); |
|
| 712 | 712 | |
| 713 | 713 | // Convert meta value only if it is in yes/no/none. |
| 714 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
| 714 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
| 715 | 715 | |
| 716 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
| 717 | - give_update_meta( get_the_ID(), $meta_key, $field_value ); |
|
| 716 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
| 717 | + give_update_meta(get_the_ID(), $meta_key, $field_value); |
|
| 718 | 718 | } |
| 719 | 719 | } |
| 720 | 720 | }// End while(). |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | |
| 724 | 724 | } else { |
| 725 | 725 | // No more forms found, finish up. |
| 726 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
| 726 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
| 727 | 727 | } |
| 728 | 728 | } |
| 729 | 729 | |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | '_transient_give_stats_', |
| 773 | 773 | 'give_cache', |
| 774 | 774 | '_transient_give_add_ons_feed', |
| 775 | - '_transient__give_ajax_works' . |
|
| 775 | + '_transient__give_ajax_works'. |
|
| 776 | 776 | '_transient_give_total_api_keys', |
| 777 | 777 | '_transient_give_i18n_give_promo_hide', |
| 778 | 778 | '_transient_give_contributors', |
@@ -799,24 +799,24 @@ discard block |
||
| 799 | 799 | ARRAY_A |
| 800 | 800 | ); |
| 801 | 801 | |
| 802 | - if ( ! empty( $user_apikey_options ) ) { |
|
| 803 | - foreach ( $user_apikey_options as $user ) { |
|
| 804 | - $cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] ); |
|
| 805 | - $cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] ); |
|
| 806 | - $cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] ); |
|
| 802 | + if ( ! empty($user_apikey_options)) { |
|
| 803 | + foreach ($user_apikey_options as $user) { |
|
| 804 | + $cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']); |
|
| 805 | + $cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']); |
|
| 806 | + $cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']); |
|
| 807 | 807 | } |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - if ( ! empty( $cached_options ) ) { |
|
| 811 | - foreach ( $cached_options as $option ) { |
|
| 812 | - switch ( true ) { |
|
| 813 | - case ( false !== strpos( $option, 'transient' ) ): |
|
| 814 | - $option = str_replace( '_transient_', '', $option ); |
|
| 815 | - delete_transient( $option ); |
|
| 810 | + if ( ! empty($cached_options)) { |
|
| 811 | + foreach ($cached_options as $option) { |
|
| 812 | + switch (true) { |
|
| 813 | + case (false !== strpos($option, 'transient')): |
|
| 814 | + $option = str_replace('_transient_', '', $option); |
|
| 815 | + delete_transient($option); |
|
| 816 | 816 | break; |
| 817 | 817 | |
| 818 | 818 | default: |
| 819 | - delete_option( $option ); |
|
| 819 | + delete_option($option); |
|
| 820 | 820 | } |
| 821 | 821 | } |
| 822 | 822 | } |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | global $wp_roles; |
| 835 | 835 | |
| 836 | 836 | // Get the role object. |
| 837 | - $give_worker = get_role( 'give_worker' ); |
|
| 837 | + $give_worker = get_role('give_worker'); |
|
| 838 | 838 | |
| 839 | 839 | // A list of capabilities to add for give workers. |
| 840 | 840 | $caps_to_add = array( |
@@ -842,9 +842,9 @@ discard block |
||
| 842 | 842 | 'edit_pages', |
| 843 | 843 | ); |
| 844 | 844 | |
| 845 | - foreach ( $caps_to_add as $cap ) { |
|
| 845 | + foreach ($caps_to_add as $cap) { |
|
| 846 | 846 | // Add the capability. |
| 847 | - $give_worker->add_cap( $cap ); |
|
| 847 | + $give_worker->add_cap($cap); |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | } |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | $give_updates = Give_Updates::get_instance(); |
| 862 | 862 | |
| 863 | 863 | // form query |
| 864 | - $donation_forms = new WP_Query( array( |
|
| 864 | + $donation_forms = new WP_Query(array( |
|
| 865 | 865 | 'paged' => $give_updates::$step, |
| 866 | 866 | 'status' => 'any', |
| 867 | 867 | 'order' => 'ASC', |
@@ -870,10 +870,10 @@ discard block |
||
| 870 | 870 | ) |
| 871 | 871 | ); |
| 872 | 872 | |
| 873 | - if ( $donation_forms->have_posts() ) { |
|
| 874 | - $give_updates::$percentage = ( ( $give_updates::$step * 20 ) / $donation_forms->found_posts ) * 100; |
|
| 873 | + if ($donation_forms->have_posts()) { |
|
| 874 | + $give_updates::$percentage = (($give_updates::$step * 20) / $donation_forms->found_posts) * 100; |
|
| 875 | 875 | |
| 876 | - while ( $donation_forms->have_posts() ) { |
|
| 876 | + while ($donation_forms->have_posts()) { |
|
| 877 | 877 | $donation_forms->the_post(); |
| 878 | 878 | $form_id = get_the_ID(); |
| 879 | 879 | |
@@ -881,41 +881,41 @@ discard block |
||
| 881 | 881 | update_post_meta( |
| 882 | 882 | $form_id, |
| 883 | 883 | '_give_set_price', |
| 884 | - give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) ) |
|
| 884 | + give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true)) |
|
| 885 | 885 | ); |
| 886 | 886 | |
| 887 | 887 | // Remove formatting from _give_custom_amount_minimum |
| 888 | 888 | update_post_meta( |
| 889 | 889 | $form_id, |
| 890 | 890 | '_give_custom_amount_minimum', |
| 891 | - give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) ) |
|
| 891 | + give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true)) |
|
| 892 | 892 | ); |
| 893 | 893 | |
| 894 | 894 | // Bailout. |
| 895 | - if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) { |
|
| 895 | + if ('set' === get_post_meta($form_id, '_give_price_option', true)) { |
|
| 896 | 896 | continue; |
| 897 | 897 | } |
| 898 | 898 | |
| 899 | - $donation_levels = get_post_meta( $form_id, '_give_donation_levels', true ); |
|
| 899 | + $donation_levels = get_post_meta($form_id, '_give_donation_levels', true); |
|
| 900 | 900 | |
| 901 | - if ( ! empty( $donation_levels ) ) { |
|
| 901 | + if ( ! empty($donation_levels)) { |
|
| 902 | 902 | |
| 903 | - foreach ( $donation_levels as $index => $donation_level ) { |
|
| 904 | - if ( isset( $donation_level['_give_amount'] ) ) { |
|
| 905 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] ); |
|
| 903 | + foreach ($donation_levels as $index => $donation_level) { |
|
| 904 | + if (isset($donation_level['_give_amount'])) { |
|
| 905 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']); |
|
| 906 | 906 | } |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | - update_post_meta( $form_id, '_give_donation_levels', $donation_levels ); |
|
| 909 | + update_post_meta($form_id, '_give_donation_levels', $donation_levels); |
|
| 910 | 910 | |
| 911 | - $donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' ); |
|
| 911 | + $donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount'); |
|
| 912 | 912 | |
| 913 | - $min_amount = min( $donation_levels_amounts ); |
|
| 914 | - $max_amount = max( $donation_levels_amounts ); |
|
| 913 | + $min_amount = min($donation_levels_amounts); |
|
| 914 | + $max_amount = max($donation_levels_amounts); |
|
| 915 | 915 | |
| 916 | 916 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
| 917 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
| 918 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 ); |
|
| 917 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
| 918 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | } |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | wp_reset_postdata(); |
| 925 | 925 | } else { |
| 926 | 926 | // The Update Ran. |
| 927 | - give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' ); |
|
| 927 | + give_set_upgrade_complete('v189_upgrades_levels_post_meta'); |
|
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | } |
@@ -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 | |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | ?> |
| 19 | 19 | <div class="wrap" id="poststuff"> |
| 20 | 20 | <div id="give-updates"> |
| 21 | - <h1><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1> |
|
| 21 | + <h1><?php esc_html_e('Give - Updates', 'give'); ?></h1> |
|
| 22 | 22 | <div class="postbox-container"> |
| 23 | 23 | <div class="postbox"> |
| 24 | 24 | <div class="inside"> |
| 25 | 25 | <div class="panel-content"> |
| 26 | - <h2><?php _e( 'You have updates. Please <a href="%s">create a backup</a> of your site before updating. It is important to always stay up-to-date with latest versions of Give core and it\'s add-ons. We regularly release new features, bug fixes, and enhancements. To update add-ons be sure your <a href="%s">license keys</a> are active.', 'give' ); ?></h2> |
|
| 26 | + <h2><?php _e('You have updates. Please <a href="%s">create a backup</a> of your site before updating. It is important to always stay up-to-date with latest versions of Give core and it\'s add-ons. We regularly release new features, bug fixes, and enhancements. To update add-ons be sure your <a href="%s">license keys</a> are active.', 'give'); ?></h2> |
|
| 27 | 27 | </div> |
| 28 | 28 | </div> |
| 29 | 29 | <!-- .inside --> |
@@ -33,18 +33,18 @@ discard block |
||
| 33 | 33 | <?php $update_counter = 1; ?> |
| 34 | 34 | |
| 35 | 35 | <?php $db_updates = $give_updates->get_db_update_count(); ?> |
| 36 | - <?php if ( ! empty( $db_updates ) ) : ?> |
|
| 37 | - <?php $db_update_url = add_query_arg( array( 'type' => 'database' ) ); ?> |
|
| 36 | + <?php if ( ! empty($db_updates)) : ?> |
|
| 37 | + <?php $db_update_url = add_query_arg(array('type' => 'database')); ?> |
|
| 38 | 38 | <div id="give-db-updates"> |
| 39 | 39 | <div class="postbox-container"> |
| 40 | 40 | <div class="postbox"> |
| 41 | - <h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2> |
|
| 41 | + <h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2> |
|
| 42 | 42 | <div class="inside"> |
| 43 | 43 | <div class="panel-content"> |
| 44 | - <p><?php echo sprintf( __( 'Give needs to update the database. <a href="%s">Update now ></a>', 'give' ), $db_update_url ); ?></p> |
|
| 44 | + <p><?php echo sprintf(__('Give needs to update the database. <a href="%s">Update now ></a>', 'give'), $db_update_url); ?></p> |
|
| 45 | 45 | </div> |
| 46 | 46 | <div class="progress-container give-hidden"> |
| 47 | - <strong class="update-message" data-update-count="<?php echo $db_updates; ?>" data-resume-update="<?php echo $give_updates->resume_updates(); ?>"><?php echo sprintf( __( 'Update 1 of %s', 'give' ), $db_updates ); ?></strong> |
|
| 47 | + <strong class="update-message" data-update-count="<?php echo $db_updates; ?>" data-resume-update="<?php echo $give_updates->resume_updates(); ?>"><?php echo sprintf(__('Update 1 of %s', 'give'), $db_updates); ?></strong> |
|
| 48 | 48 | <div class="progress-content"></div> |
| 49 | 49 | </div> |
| 50 | 50 | </div> |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | <?php endif; ?> |
| 56 | 56 | |
| 57 | 57 | <?php $plugin_updates = $give_updates->get_plugin_update_count(); ?> |
| 58 | - <?php if ( ! empty( $plugin_updates ) ) : ?> |
|
| 59 | - <?php $plugin_update_url = add_query_arg( array( 's' => 'Give' ), admin_url( '/plugins.php' ) ); ?> |
|
| 58 | + <?php if ( ! empty($plugin_updates)) : ?> |
|
| 59 | + <?php $plugin_update_url = add_query_arg(array('s' => 'Give'), admin_url('/plugins.php')); ?> |
|
| 60 | 60 | <div id="give-plugin-updates"> |
| 61 | 61 | <div class="postbox-container"> |
| 62 | 62 | <div class="postbox"> |
| 63 | - <h2 class="hndle"><?php _e( 'Plugin Updates', 'give' ); ?></h2> |
|
| 63 | + <h2 class="hndle"><?php _e('Plugin Updates', 'give'); ?></h2> |
|
| 64 | 64 | <!--<h2 class="hndle"><span>--> |
| 65 | 65 | <?php //echo sprintf( __( 'Update 1 of %s', 'give' ), $db_updates ); ?><!--</span></h2>--> |
| 66 | 66 | <div class="inside"> |
| 67 | 67 | <div class="panel-content"> |
| 68 | - <p><?php echo sprintf( __( 'There are %s Give %s that need to be updated. <a href="%s">Update now ></a>', 'give' ), $plugin_updates, _n( 'addon', 'addons', $plugin_updates, 'give' ), $plugin_update_url ); ?></p> |
|
| 68 | + <p><?php echo sprintf(__('There are %s Give %s that need to be updated. <a href="%s">Update now ></a>', 'give'), $plugin_updates, _n('addon', 'addons', $plugin_updates, 'give'), $plugin_update_url); ?></p> |
|
| 69 | 69 | <?php include_once 'plugins-update-section.php'; ?> |
| 70 | 70 | </div> |
| 71 | 71 | </div> |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* @var Give_Updates $give_updates */ |
| 3 | -$plugins = $give_updates->get_updates( 'plugin' ); |
|
| 4 | -if( empty( $plugins ) ) { |
|
| 3 | +$plugins = $give_updates->get_updates('plugin'); |
|
| 4 | +if (empty($plugins)) { |
|
| 5 | 5 | return; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | ob_start(); |
| 9 | -foreach ( $plugins as $plugin_data ) { |
|
| 10 | - if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) { |
|
| 9 | +foreach ($plugins as $plugin_data) { |
|
| 10 | + if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) { |
|
| 11 | 11 | continue; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -15,39 +15,39 @@ discard block |
||
| 15 | 15 | $author_name = $plugin_data['Author']; |
| 16 | 16 | |
| 17 | 17 | // Link the plugin name to the plugin URL if available. |
| 18 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
| 18 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
| 19 | 19 | $plugin_name = sprintf( |
| 20 | 20 | '<a href="%s" title="%s">%s</a>(%s)', |
| 21 | - esc_url( $plugin_data['PluginURI'] ), |
|
| 22 | - esc_attr__( 'Visit plugin homepage' , 'give' ), |
|
| 21 | + esc_url($plugin_data['PluginURI']), |
|
| 22 | + esc_attr__('Visit plugin homepage', 'give'), |
|
| 23 | 23 | $plugin_name, |
| 24 | - esc_html( $plugin_data['Version'] ) |
|
| 24 | + esc_html($plugin_data['Version']) |
|
| 25 | 25 | ); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // Link the author name to the author URL if available. |
| 29 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
| 29 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
| 30 | 30 | $author_name = sprintf( |
| 31 | 31 | '<a href="%s" title="%s">%s</a>', |
| 32 | - esc_url( $plugin_data['AuthorURI'] ), |
|
| 33 | - esc_attr__( 'Visit author homepage' , 'give' ), |
|
| 32 | + esc_url($plugin_data['AuthorURI']), |
|
| 33 | + esc_attr__('Visit author homepage', 'give'), |
|
| 34 | 34 | $author_name |
| 35 | 35 | ); |
| 36 | 36 | } |
| 37 | 37 | ?> |
| 38 | 38 | <tr> |
| 39 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
| 39 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
| 40 | 40 | <td> |
| 41 | 41 | <?php |
| 42 | 42 | echo sprintf( |
| 43 | 43 | '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> %s', |
| 44 | - ( true === $plugin_data['License'] ? __( 'Licensed', 'give' ) : __( 'Unlicensed', 'give' ) ) |
|
| 44 | + (true === $plugin_data['License'] ? __('Licensed', 'give') : __('Unlicensed', 'give')) |
|
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | 47 | echo sprintf( |
| 48 | 48 | ' – %s – %s', |
| 49 | - sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ), |
|
| 50 | - sprintf( __( '( Latest Version: %s )' ), $plugin_data['update']->new_version ) |
|
| 49 | + sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))), |
|
| 50 | + sprintf(__('( Latest Version: %s )'), $plugin_data['update']->new_version) |
|
| 51 | 51 | ); |
| 52 | 52 | ?> |
| 53 | 53 | </td> |