@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | |
41 | 41 | // Exit if accessed directly. |
42 | -if ( ! defined( 'ABSPATH' ) ) { |
|
42 | +if ( ! defined('ABSPATH')) { |
|
43 | 43 | exit; |
44 | 44 | } |
45 | 45 | |
46 | -if ( ! class_exists( 'Give' ) ) : |
|
46 | +if ( ! class_exists('Give')) : |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Main Give Class |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return Give |
238 | 238 | */ |
239 | 239 | public static function instance() { |
240 | - if ( is_null( self::$_instance ) ) { |
|
240 | + if (is_null(self::$_instance)) { |
|
241 | 241 | self::$_instance = new self(); |
242 | 242 | } |
243 | 243 | |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function __construct() { |
251 | 251 | // PHP version |
252 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
253 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
252 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
253 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // Bailout: Need minimum php version to load plugin. |
257 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
258 | - add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) ); |
|
257 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
258 | + add_action('admin_notices', array($this, 'minmum_phpversion_notice')); |
|
259 | 259 | |
260 | 260 | return; |
261 | 261 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $this->includes(); |
266 | 266 | $this->init_hooks(); |
267 | 267 | |
268 | - do_action( 'give_loaded' ); |
|
268 | + do_action('give_loaded'); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | * @since 1.8.9 |
275 | 275 | */ |
276 | 276 | private function init_hooks() { |
277 | - register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
278 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
277 | + register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
278 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @since 1.8.9 |
292 | 292 | */ |
293 | - do_action( 'before_give_init' ); |
|
293 | + do_action('before_give_init'); |
|
294 | 294 | |
295 | 295 | // Set up localization. |
296 | 296 | $this->load_textdomain(); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @since 1.8.7 |
322 | 322 | */ |
323 | - do_action( 'give_init', $this ); |
|
323 | + do_action('give_init', $this); |
|
324 | 324 | |
325 | 325 | } |
326 | 326 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function __clone() { |
339 | 339 | // Cloning instances of the class is forbidden. |
340 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
340 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function __wakeup() { |
352 | 352 | // Unserializing instances of the class is forbidden. |
353 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
353 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -364,33 +364,33 @@ discard block |
||
364 | 364 | private function setup_constants() { |
365 | 365 | |
366 | 366 | // Plugin version |
367 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
368 | - define( 'GIVE_VERSION', '2.0.1' ); |
|
367 | + if ( ! defined('GIVE_VERSION')) { |
|
368 | + define('GIVE_VERSION', '2.0.1'); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | // Plugin Root File |
372 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
373 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
372 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
373 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | // Plugin Folder Path |
377 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
378 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) ); |
|
377 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
378 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE)); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | // Plugin Folder URL |
382 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
383 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) ); |
|
382 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
383 | + define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE)); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | // Plugin Basename aka: "give/give.php" |
387 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
388 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) ); |
|
387 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
388 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE)); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | // Make sure CAL_GREGORIAN is defined |
392 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
393 | - define( 'CAL_GREGORIAN', 1 ); |
|
392 | + if ( ! defined('CAL_GREGORIAN')) { |
|
393 | + define('CAL_GREGORIAN', 1); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
@@ -408,152 +408,152 @@ discard block |
||
408 | 408 | /** |
409 | 409 | * Load libraries. |
410 | 410 | */ |
411 | - if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
412 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' ); |
|
411 | + if ( ! class_exists('WP_Async_Request')) { |
|
412 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php'); |
|
413 | 413 | } |
414 | 414 | |
415 | - if ( ! class_exists( 'WP_Background_Process' ) ) { |
|
416 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' ); |
|
415 | + if ( ! class_exists('WP_Background_Process')) { |
|
416 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php'); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | /** |
420 | 420 | * Load plugin files |
421 | 421 | */ |
422 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
423 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
422 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
423 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
424 | 424 | $give_options = give_get_settings(); |
425 | 425 | |
426 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
427 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php'; |
|
428 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
429 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
430 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
431 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
432 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
433 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
434 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
435 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
436 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php'; |
|
437 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
438 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php'; |
|
439 | - |
|
440 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
441 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
442 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
443 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
444 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php'; |
|
445 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
446 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
447 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
448 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
449 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
450 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
451 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
452 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
453 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
454 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php'; |
|
455 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php'; |
|
456 | - |
|
457 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
458 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
459 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
460 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
461 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
462 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
463 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
464 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
465 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
466 | - require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php'; |
|
467 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
468 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
469 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
470 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
471 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
472 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
473 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
474 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
475 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
476 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
477 | - |
|
478 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
484 | - |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
487 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
488 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
489 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
490 | - |
|
491 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
492 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
493 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php'; |
|
494 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
495 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
496 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
497 | - |
|
498 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
499 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php'; |
|
500 | - |
|
501 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
502 | - |
|
503 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
504 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
426 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
427 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php'; |
|
428 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
429 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
430 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
431 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
432 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
433 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
434 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
435 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
436 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php'; |
|
437 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
438 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php'; |
|
439 | + |
|
440 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
441 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
442 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
443 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
444 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php'; |
|
445 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
446 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
447 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
448 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
449 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
450 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
451 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
452 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
453 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
454 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php'; |
|
455 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php'; |
|
456 | + |
|
457 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
458 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
459 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
460 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
461 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
462 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
463 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
464 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
465 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
466 | + require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php'; |
|
467 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
468 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
469 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
470 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
471 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
475 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
477 | + |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
484 | + |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
487 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
488 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
489 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
490 | + |
|
491 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
493 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php'; |
|
494 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
495 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
496 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
497 | + |
|
498 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
499 | + require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php'; |
|
500 | + |
|
501 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
502 | + |
|
503 | + if (defined('WP_CLI') && WP_CLI) { |
|
504 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
505 | 505 | } |
506 | 506 | |
507 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
508 | - |
|
509 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
510 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
511 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
512 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
513 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
514 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
515 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
516 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
517 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
518 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
519 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
520 | - |
|
521 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
522 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
523 | - |
|
524 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
525 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
526 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
527 | - |
|
528 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
529 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
530 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
531 | - |
|
532 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
533 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
534 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
535 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
536 | - |
|
537 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
538 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
539 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
540 | - |
|
541 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
542 | - |
|
543 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
544 | - |
|
545 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
546 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
547 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
548 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
549 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
550 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
551 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
552 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
553 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
507 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
508 | + |
|
509 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
510 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
511 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
512 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
513 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
514 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
515 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
516 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
517 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
518 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
519 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
520 | + |
|
521 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
522 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
523 | + |
|
524 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
525 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
526 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
527 | + |
|
528 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
529 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
530 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
531 | + |
|
532 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
533 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
534 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
535 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
536 | + |
|
537 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
538 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
539 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
540 | + |
|
541 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
542 | + |
|
543 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
544 | + |
|
545 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
546 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
547 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
548 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
549 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
550 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
551 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
552 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
553 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
554 | 554 | }// End if(). |
555 | 555 | |
556 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
556 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
557 | 557 | |
558 | 558 | } |
559 | 559 | |
@@ -568,16 +568,16 @@ discard block |
||
568 | 568 | public function load_textdomain() { |
569 | 569 | |
570 | 570 | // Set filter for Give's languages directory |
571 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
572 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
571 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
572 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
573 | 573 | |
574 | 574 | // Traditional WordPress plugin locale filter. |
575 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
576 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
575 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
576 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
577 | 577 | |
578 | - unload_textdomain( 'give' ); |
|
579 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
580 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
578 | + unload_textdomain('give'); |
|
579 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
580 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
581 | 581 | |
582 | 582 | } |
583 | 583 | |
@@ -590,17 +590,17 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function minmum_phpversion_notice() { |
592 | 592 | // Bailout. |
593 | - if ( ! is_admin() ) { |
|
593 | + if ( ! is_admin()) { |
|
594 | 594 | return; |
595 | 595 | } |
596 | 596 | |
597 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
598 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
599 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
600 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
601 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
602 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
603 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
597 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
598 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
599 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
600 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
601 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
602 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
603 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
604 | 604 | |
605 | 605 | echo sprintf( |
606 | 606 | '<div class="notice notice-error">%1$s</div>', |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /* @var WPDB $wpdb */ |
51 | 51 | global $wpdb; |
52 | 52 | |
53 | - $wpdb->formmeta = $this->table_name = $wpdb->prefix . 'give_formmeta'; |
|
53 | + $wpdb->formmeta = $this->table_name = $wpdb->prefix.'give_formmeta'; |
|
54 | 54 | $this->primary_key = 'meta_id'; |
55 | 55 | $this->version = '1.0'; |
56 | 56 | |
@@ -84,6 +84,6 @@ discard block |
||
84 | 84 | * @return bool |
85 | 85 | */ |
86 | 86 | protected function is_custom_meta_table_active() { |
87 | - return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ); |
|
87 | + return give_has_upgrade_completed('v20_move_metadata_into_new_table'); |
|
88 | 88 | } |
89 | 89 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * Setup properties |
54 | 54 | */ |
55 | 55 | |
56 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs.php'; |
|
57 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs-meta.php'; |
|
56 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs.php'; |
|
57 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs-meta.php'; |
|
58 | 58 | $this->log_db = new Give_DB_Logs(); |
59 | 59 | $this->logmeta_db = new Give_DB_Log_Meta(); |
60 | 60 | |
@@ -62,22 +62,22 @@ discard block |
||
62 | 62 | * Setup hooks. |
63 | 63 | */ |
64 | 64 | |
65 | - add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) ); |
|
66 | - add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) ); |
|
67 | - add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) ); |
|
68 | - add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) ); |
|
69 | - add_action( 'update_log_metadata', array( $this, 'bc_200_set_payment_as_log_parent' ), 10, 4 ); |
|
65 | + add_action('save_post_give_payment', array($this, 'background_process_delete_cache')); |
|
66 | + add_action('save_post_give_forms', array($this, 'background_process_delete_cache')); |
|
67 | + add_action('save_post_give_log', array($this, 'background_process_delete_cache')); |
|
68 | + add_action('give_delete_log_cache', array($this, 'delete_cache')); |
|
69 | + add_action('update_log_metadata', array($this, 'bc_200_set_payment_as_log_parent'), 10, 4); |
|
70 | 70 | |
71 | 71 | // Backward compatibility. |
72 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
72 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
73 | 73 | // Create the log post type |
74 | - add_action( 'init', array( $this, 'register_post_type' ), -2 ); |
|
74 | + add_action('init', array($this, 'register_post_type'), -2); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | // Create types taxonomy and default types |
78 | 78 | // @todo: remove this taxonomy, some addon use this taxonomy with there custom log post type for example: recurring |
79 | 79 | // Do not use this taxonomy with your log type because we will remove it in future releases. |
80 | - add_action( 'init', array( $this, 'register_taxonomy' ), -2 ); |
|
80 | + add_action('init', array($this, 'register_taxonomy'), -2); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | /* Logs post type */ |
96 | 96 | $log_args = array( |
97 | 97 | 'labels' => array( |
98 | - 'name' => esc_html__( 'Logs', 'give' ), |
|
98 | + 'name' => esc_html__('Logs', 'give'), |
|
99 | 99 | ), |
100 | 100 | 'public' => false, |
101 | 101 | 'exclude_from_search' => true, |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | 'query_var' => false, |
105 | 105 | 'rewrite' => false, |
106 | 106 | 'capability_type' => 'post', |
107 | - 'supports' => array( 'title', 'editor' ), |
|
107 | + 'supports' => array('title', 'editor'), |
|
108 | 108 | 'can_export' => true, |
109 | 109 | ); |
110 | 110 | |
111 | - register_post_type( 'give_log', $log_args ); |
|
111 | + register_post_type('give_log', $log_args); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | * @return void |
123 | 123 | */ |
124 | 124 | public function register_taxonomy() { |
125 | - register_taxonomy( 'give_log_type', 'give_log', array( |
|
125 | + register_taxonomy('give_log_type', 'give_log', array( |
|
126 | 126 | 'public' => false, |
127 | - ) ); |
|
127 | + )); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | 'update', |
146 | 146 | ); |
147 | 147 | |
148 | - return apply_filters( 'give_log_types', $terms ); |
|
148 | + return apply_filters('give_log_types', $terms); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @return bool Whether log type is valid. |
162 | 162 | */ |
163 | - public function valid_type( $type ) { |
|
164 | - return in_array( $type, $this->log_types() ); |
|
163 | + public function valid_type($type) { |
|
164 | + return in_array($type, $this->log_types()); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return int Log ID. |
182 | 182 | */ |
183 | - public function add( $title = '', $message = '', $parent = 0, $type = '' ) { |
|
183 | + public function add($title = '', $message = '', $parent = 0, $type = '') { |
|
184 | 184 | $log_data = array( |
185 | 185 | 'post_title' => $title, |
186 | 186 | 'post_content' => $message, |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | 'log_type' => $type, |
189 | 189 | ); |
190 | 190 | |
191 | - return $this->insert_log( $log_data ); |
|
191 | + return $this->insert_log($log_data); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return array An array of the connected logs. |
207 | 207 | */ |
208 | - public function get_logs( $object_id = 0, $type = '', $paged = null ) { |
|
209 | - return $this->get_connected_logs( array( |
|
208 | + public function get_logs($object_id = 0, $type = '', $paged = null) { |
|
209 | + return $this->get_connected_logs(array( |
|
210 | 210 | 'log_parent' => $object_id, |
211 | 211 | 'paged' => $paged, |
212 | 212 | 'log_type' => $type, |
213 | - ) ); |
|
213 | + )); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return int The ID of the newly created log item. |
226 | 226 | */ |
227 | - public function insert_log( $log_data = array(), $log_meta = array() ) { |
|
227 | + public function insert_log($log_data = array(), $log_meta = array()) { |
|
228 | 228 | $log_id = 0; |
229 | 229 | |
230 | 230 | $defaults = array( |
@@ -237,28 +237,28 @@ discard block |
||
237 | 237 | 'post_status' => 'publish', |
238 | 238 | ); |
239 | 239 | |
240 | - $args = wp_parse_args( $log_data, $defaults ); |
|
241 | - $this->bc_200_validate_params( $args, $log_meta ); |
|
240 | + $args = wp_parse_args($log_data, $defaults); |
|
241 | + $this->bc_200_validate_params($args, $log_meta); |
|
242 | 242 | |
243 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
243 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
244 | 244 | global $wpdb; |
245 | 245 | |
246 | 246 | // Backward Compatibility. |
247 | - if ( ! $wpdb->get_var( "SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1" ) ) { |
|
248 | - $latest_log_id = $wpdb->get_var( "SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1" ); |
|
249 | - $latest_log_id = empty( $latest_log_id ) ? 1 : ++ $latest_log_id; |
|
247 | + if ( ! $wpdb->get_var("SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1")) { |
|
248 | + $latest_log_id = $wpdb->get_var("SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1"); |
|
249 | + $latest_log_id = empty($latest_log_id) ? 1 : ++ $latest_log_id; |
|
250 | 250 | |
251 | 251 | $args['ID'] = $latest_log_id; |
252 | - $this->log_db->insert( $args ); |
|
252 | + $this->log_db->insert($args); |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - $log_id = $this->log_db->add( $args ); |
|
256 | + $log_id = $this->log_db->add($args); |
|
257 | 257 | |
258 | 258 | // Set log meta, if any |
259 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
260 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
261 | - $this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
259 | + if ($log_id && ! empty($log_meta)) { |
|
260 | + foreach ((array) $log_meta as $key => $meta) { |
|
261 | + $this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return bool|null True if successful, false otherwise. |
282 | 282 | */ |
283 | - public function update_log( $log_data = array(), $log_meta = array() ) { |
|
283 | + public function update_log($log_data = array(), $log_meta = array()) { |
|
284 | 284 | $log_id = 0; |
285 | 285 | |
286 | 286 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @param array $log_data Log entry data. |
292 | 292 | * @param array $log_meta Log entry meta. |
293 | 293 | */ |
294 | - do_action( 'give_pre_update_log', $log_data, $log_meta ); |
|
294 | + do_action('give_pre_update_log', $log_data, $log_meta); |
|
295 | 295 | |
296 | 296 | $defaults = array( |
297 | 297 | 'log_parent' => 0, |
@@ -301,28 +301,28 @@ discard block |
||
301 | 301 | 'post_status' => 'publish', |
302 | 302 | ); |
303 | 303 | |
304 | - $args = wp_parse_args( $log_data, $defaults ); |
|
305 | - $this->bc_200_validate_params( $args, $log_meta ); |
|
304 | + $args = wp_parse_args($log_data, $defaults); |
|
305 | + $this->bc_200_validate_params($args, $log_meta); |
|
306 | 306 | |
307 | 307 | // Store the log entry |
308 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
308 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
309 | 309 | // Backward compatibility. |
310 | - $log_id = wp_update_post( $args ); |
|
310 | + $log_id = wp_update_post($args); |
|
311 | 311 | |
312 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
313 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
314 | - if ( ! empty( $meta ) ) { |
|
315 | - give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
312 | + if ($log_id && ! empty($log_meta)) { |
|
313 | + foreach ((array) $log_meta as $key => $meta) { |
|
314 | + if ( ! empty($meta)) { |
|
315 | + give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | } |
319 | 319 | } else { |
320 | - $log_id = $this->log_db->add( $args ); |
|
320 | + $log_id = $this->log_db->add($args); |
|
321 | 321 | |
322 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
323 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
324 | - if ( ! empty( $meta ) ) { |
|
325 | - $this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
322 | + if ($log_id && ! empty($log_meta)) { |
|
323 | + foreach ((array) $log_meta as $key => $meta) { |
|
324 | + if ( ! empty($meta)) { |
|
325 | + $this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @param array $log_data Log entry data. |
338 | 338 | * @param array $log_meta Log entry meta. |
339 | 339 | */ |
340 | - do_action( 'give_post_update_log', $log_id, $log_data, $log_meta ); |
|
340 | + do_action('give_post_update_log', $log_id, $log_data, $log_meta); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -354,30 +354,30 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return array|false Array if logs were found, false otherwise. |
356 | 356 | */ |
357 | - public function get_connected_logs( $args = array() ) { |
|
357 | + public function get_connected_logs($args = array()) { |
|
358 | 358 | $logs = array(); |
359 | 359 | |
360 | - $defaults = array( |
|
360 | + $defaults = array( |
|
361 | 361 | 'number' => 20, |
362 | - 'paged' => get_query_var( 'paged' ), |
|
362 | + 'paged' => get_query_var('paged'), |
|
363 | 363 | 'log_type' => false, |
364 | 364 | |
365 | 365 | // Backward compatibility. |
366 | 366 | 'post_type' => 'give_log', |
367 | 367 | 'post_status' => 'publish', |
368 | 368 | ); |
369 | - $query_args = wp_parse_args( $args, $defaults ); |
|
370 | - $this->bc_200_validate_params( $query_args ); |
|
369 | + $query_args = wp_parse_args($args, $defaults); |
|
370 | + $this->bc_200_validate_params($query_args); |
|
371 | 371 | |
372 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
372 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
373 | 373 | // Backward compatibility. |
374 | - $logs = get_posts( $query_args ); |
|
375 | - $this->bc_200_add_new_properties( $logs ); |
|
374 | + $logs = get_posts($query_args); |
|
375 | + $this->bc_200_add_new_properties($logs); |
|
376 | 376 | } else { |
377 | - $logs = $this->log_db->get_logs( $query_args ); |
|
377 | + $logs = $this->log_db->get_logs($query_args); |
|
378 | 378 | } |
379 | 379 | |
380 | - return ( ! empty( $logs ) ? $logs : false ); |
|
380 | + return ( ! empty($logs) ? $logs : false); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -395,41 +395,41 @@ discard block |
||
395 | 395 | * |
396 | 396 | * @return int Log count. |
397 | 397 | */ |
398 | - public function get_log_count( $object_id = 0, $type = '', $meta_query = null, $date_query = null ) { |
|
398 | + public function get_log_count($object_id = 0, $type = '', $meta_query = null, $date_query = null) { |
|
399 | 399 | $logs_count = 0; |
400 | 400 | |
401 | 401 | $query_args = array( |
402 | - 'number' => - 1, |
|
402 | + 'number' => -1, |
|
403 | 403 | |
404 | 404 | // Backward comatibility. |
405 | 405 | 'post_type' => 'give_log', |
406 | 406 | 'post_status' => 'publish', |
407 | 407 | ); |
408 | 408 | |
409 | - if ( $object_id ) { |
|
409 | + if ($object_id) { |
|
410 | 410 | $query_args['log_parent'] = $object_id; |
411 | 411 | } |
412 | 412 | |
413 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
413 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
414 | 414 | $query_args['log_type'] = $type; |
415 | 415 | } |
416 | 416 | |
417 | - if ( ! empty( $meta_query ) ) { |
|
417 | + if ( ! empty($meta_query)) { |
|
418 | 418 | $query_args['meta_query'] = $meta_query; |
419 | 419 | } |
420 | 420 | |
421 | - if ( ! empty( $date_query ) ) { |
|
421 | + if ( ! empty($date_query)) { |
|
422 | 422 | $query_args['date_query'] = $date_query; |
423 | 423 | } |
424 | 424 | |
425 | - $this->bc_200_validate_params( $query_args ); |
|
425 | + $this->bc_200_validate_params($query_args); |
|
426 | 426 | |
427 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
427 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
428 | 428 | // Backward compatibility. |
429 | - $logs = new WP_Query( $query_args ); |
|
429 | + $logs = new WP_Query($query_args); |
|
430 | 430 | $logs_count = (int) $logs->post_count; |
431 | 431 | } else { |
432 | - $logs_count = $this->log_db->count( $query_args ); |
|
432 | + $logs_count = $this->log_db->count($query_args); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | return $logs_count; |
@@ -449,10 +449,10 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @return void |
451 | 451 | */ |
452 | - public function delete_logs( $object_id = 0, $type = '', $meta_query = null ) { |
|
452 | + public function delete_logs($object_id = 0, $type = '', $meta_query = null) { |
|
453 | 453 | $query_args = array( |
454 | 454 | 'log_parent' => $object_id, |
455 | - 'number' => - 1, |
|
455 | + 'number' => -1, |
|
456 | 456 | 'fields' => 'ID', |
457 | 457 | |
458 | 458 | // Backward compatibility. |
@@ -460,32 +460,32 @@ discard block |
||
460 | 460 | 'post_status' => 'publish', |
461 | 461 | ); |
462 | 462 | |
463 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
463 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
464 | 464 | $query_args['log_type'] = $type; |
465 | 465 | } |
466 | 466 | |
467 | - if ( ! empty( $meta_query ) ) { |
|
467 | + if ( ! empty($meta_query)) { |
|
468 | 468 | $query_args['meta_query'] = $meta_query; |
469 | 469 | } |
470 | 470 | |
471 | - $this->bc_200_validate_params( $query_args ); |
|
471 | + $this->bc_200_validate_params($query_args); |
|
472 | 472 | |
473 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
473 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
474 | 474 | // Backward compatibility. |
475 | - $logs = get_posts( $query_args ); |
|
475 | + $logs = get_posts($query_args); |
|
476 | 476 | |
477 | - if ( $logs ) { |
|
478 | - foreach ( $logs as $log ) { |
|
479 | - wp_delete_post( $log, true ); |
|
477 | + if ($logs) { |
|
478 | + foreach ($logs as $log) { |
|
479 | + wp_delete_post($log, true); |
|
480 | 480 | } |
481 | 481 | } |
482 | 482 | } else { |
483 | - $logs = $this->log_db->get_logs( $query_args ); |
|
483 | + $logs = $this->log_db->get_logs($query_args); |
|
484 | 484 | |
485 | - if ( $logs ) { |
|
486 | - foreach ( $logs as $log ) { |
|
487 | - if ( $this->log_db->delete( $log->ID ) ) { |
|
488 | - $this->logmeta_db->delete_row( $log->ID ); |
|
485 | + if ($logs) { |
|
486 | + foreach ($logs as $log) { |
|
487 | + if ($this->log_db->delete($log->ID)) { |
|
488 | + $this->logmeta_db->delete_row($log->ID); |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | } |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | * |
503 | 503 | * @param int $post_id |
504 | 504 | */ |
505 | - public function background_process_delete_cache( $post_id ) { |
|
505 | + public function background_process_delete_cache($post_id) { |
|
506 | 506 | // Delete log cache immediately |
507 | - wp_schedule_single_event( time() - 5, 'give_delete_log_cache' ); |
|
507 | + wp_schedule_single_event(time() - 5, 'give_delete_log_cache'); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | /** |
@@ -517,17 +517,17 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function delete_cache() { |
519 | 519 | // Add log related keys to delete. |
520 | - $cache_give_logs = Give_Cache::get_options_like( 'give_logs' ); |
|
521 | - $cache_give_log_count = Give_Cache::get_options_like( 'log_count' ); |
|
520 | + $cache_give_logs = Give_Cache::get_options_like('give_logs'); |
|
521 | + $cache_give_log_count = Give_Cache::get_options_like('log_count'); |
|
522 | 522 | |
523 | - $cache_option_names = array_merge( $cache_give_logs, $cache_give_log_count ); |
|
523 | + $cache_option_names = array_merge($cache_give_logs, $cache_give_log_count); |
|
524 | 524 | |
525 | 525 | // Bailout. |
526 | - if ( empty( $cache_option_names ) ) { |
|
526 | + if (empty($cache_option_names)) { |
|
527 | 527 | return false; |
528 | 528 | } |
529 | 529 | |
530 | - Give_Cache::delete( $cache_option_names ); |
|
530 | + Give_Cache::delete($cache_option_names); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * @param array $log_query |
540 | 540 | * @param array $log_meta |
541 | 541 | */ |
542 | - private function bc_200_validate_params( &$log_query, &$log_meta = array() ) { |
|
542 | + private function bc_200_validate_params(&$log_query, &$log_meta = array()) { |
|
543 | 543 | $query_params = array( |
544 | 544 | 'log_title' => 'post_title', |
545 | 545 | 'log_parent' => 'post_parent', |
@@ -551,41 +551,41 @@ discard block |
||
551 | 551 | 'meta_query' => 'meta_query', |
552 | 552 | ); |
553 | 553 | |
554 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
554 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
555 | 555 | // Set old params. |
556 | - foreach ( $query_params as $new_query_param => $old_query_param ) { |
|
556 | + foreach ($query_params as $new_query_param => $old_query_param) { |
|
557 | 557 | |
558 | - if ( isset( $log_query[ $old_query_param ] ) && empty( $log_query[ $new_query_param ] ) ) { |
|
559 | - $log_query[ $new_query_param ] = $log_query[ $old_query_param ]; |
|
558 | + if (isset($log_query[$old_query_param]) && empty($log_query[$new_query_param])) { |
|
559 | + $log_query[$new_query_param] = $log_query[$old_query_param]; |
|
560 | 560 | continue; |
561 | - } elseif ( ! isset( $log_query[ $new_query_param ] ) ) { |
|
561 | + } elseif ( ! isset($log_query[$new_query_param])) { |
|
562 | 562 | continue; |
563 | - } elseif( empty( $log_query[ $new_query_param ] ) ) { |
|
563 | + } elseif (empty($log_query[$new_query_param])) { |
|
564 | 564 | continue; |
565 | 565 | } |
566 | 566 | |
567 | - switch ( $new_query_param ) { |
|
567 | + switch ($new_query_param) { |
|
568 | 568 | case 'log_type': |
569 | 569 | $log_query['tax_query'] = array( |
570 | 570 | array( |
571 | 571 | 'taxonomy' => 'give_log_type', |
572 | 572 | 'field' => 'slug', |
573 | - 'terms' => $log_query[ $new_query_param ], |
|
573 | + 'terms' => $log_query[$new_query_param], |
|
574 | 574 | ), |
575 | 575 | ); |
576 | 576 | break; |
577 | 577 | |
578 | 578 | case 'meta_query': |
579 | - if( ! empty( $log_query['meta_query'] ) && empty( $log_query['post_parent'] ) ) { |
|
580 | - foreach ( $log_query['meta_query'] as $index => $meta_query ){ |
|
581 | - if( ! is_array( $meta_query ) || empty( $meta_query['key'] ) ) { |
|
579 | + if ( ! empty($log_query['meta_query']) && empty($log_query['post_parent'])) { |
|
580 | + foreach ($log_query['meta_query'] as $index => $meta_query) { |
|
581 | + if ( ! is_array($meta_query) || empty($meta_query['key'])) { |
|
582 | 582 | continue; |
583 | 583 | } |
584 | 584 | |
585 | - switch ( $meta_query['key'] ) { |
|
585 | + switch ($meta_query['key']) { |
|
586 | 586 | case '_give_log_form_id': |
587 | 587 | $log_query['post_parent'] = $meta_query['value']; |
588 | - unset( $log_query['meta_query'][$index] ); |
|
588 | + unset($log_query['meta_query'][$index]); |
|
589 | 589 | break; |
590 | 590 | } |
591 | 591 | } |
@@ -593,40 +593,40 @@ discard block |
||
593 | 593 | break; |
594 | 594 | |
595 | 595 | default: |
596 | - switch( $new_query_param ){ |
|
596 | + switch ($new_query_param) { |
|
597 | 597 | case 'log_parent': |
598 | 598 | $log_query['meta_query'][] = array( |
599 | 599 | 'key' => '_give_log_payment_id', |
600 | - 'value' => $log_query[ $new_query_param ] |
|
600 | + 'value' => $log_query[$new_query_param] |
|
601 | 601 | ); |
602 | 602 | |
603 | 603 | break; |
604 | 604 | |
605 | 605 | default: |
606 | - $log_query[ $old_query_param ] = $log_query[ $new_query_param ]; |
|
606 | + $log_query[$old_query_param] = $log_query[$new_query_param]; |
|
607 | 607 | } |
608 | 608 | } |
609 | 609 | } |
610 | 610 | } else { |
611 | 611 | // Set only old params. |
612 | - $query_params = array_flip( $query_params ); |
|
613 | - foreach ( $query_params as $old_query_param => $new_query_param ) { |
|
614 | - if ( isset( $log_query[ $new_query_param ] ) && empty( $log_query[ $old_query_param ] ) ) { |
|
615 | - $log_query[ $old_query_param ] = $log_query[ $new_query_param ]; |
|
612 | + $query_params = array_flip($query_params); |
|
613 | + foreach ($query_params as $old_query_param => $new_query_param) { |
|
614 | + if (isset($log_query[$new_query_param]) && empty($log_query[$old_query_param])) { |
|
615 | + $log_query[$old_query_param] = $log_query[$new_query_param]; |
|
616 | 616 | continue; |
617 | - } elseif ( ! isset( $log_query[ $old_query_param ] ) ) { |
|
617 | + } elseif ( ! isset($log_query[$old_query_param])) { |
|
618 | 618 | continue; |
619 | 619 | } |
620 | 620 | |
621 | - switch ( $old_query_param ) { |
|
621 | + switch ($old_query_param) { |
|
622 | 622 | case 'tax_query': |
623 | - if ( isset( $log_query[ $old_query_param ][0]['terms'] ) ) { |
|
624 | - $log_query[ $new_query_param ] = $log_query[ $old_query_param ][0]['terms']; |
|
623 | + if (isset($log_query[$old_query_param][0]['terms'])) { |
|
624 | + $log_query[$new_query_param] = $log_query[$old_query_param][0]['terms']; |
|
625 | 625 | } |
626 | 626 | break; |
627 | 627 | |
628 | 628 | default: |
629 | - $log_query[ $new_query_param ] = $log_query[ $old_query_param ]; |
|
629 | + $log_query[$new_query_param] = $log_query[$old_query_param]; |
|
630 | 630 | } |
631 | 631 | } |
632 | 632 | } |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | * |
641 | 641 | * @param array $logs |
642 | 642 | */ |
643 | - private function bc_200_add_new_properties( &$logs ) { |
|
644 | - if ( empty( $logs ) ) { |
|
643 | + private function bc_200_add_new_properties(&$logs) { |
|
644 | + if (empty($logs)) { |
|
645 | 645 | return; |
646 | 646 | } |
647 | 647 | |
@@ -654,30 +654,30 @@ discard block |
||
654 | 654 | 'log_type' => 'give_log_type', |
655 | 655 | ); |
656 | 656 | |
657 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
658 | - foreach ( $logs as $index => $log ) { |
|
659 | - foreach ( $query_params as $new_query_param => $old_query_param ) { |
|
660 | - if ( ! property_exists( $log, $old_query_param ) ) { |
|
657 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
658 | + foreach ($logs as $index => $log) { |
|
659 | + foreach ($query_params as $new_query_param => $old_query_param) { |
|
660 | + if ( ! property_exists($log, $old_query_param)) { |
|
661 | 661 | /** |
662 | 662 | * Set unmatched properties. |
663 | 663 | */ |
664 | 664 | |
665 | 665 | // 1. log_type |
666 | - $term = get_the_terms( $log->ID, 'give_log_type' ); |
|
667 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
666 | + $term = get_the_terms($log->ID, 'give_log_type'); |
|
667 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
668 | 668 | |
669 | - $logs[ $index ]->{$new_query_param} = ! empty( $term ) ? $term->slug : ''; |
|
669 | + $logs[$index]->{$new_query_param} = ! empty($term) ? $term->slug : ''; |
|
670 | 670 | |
671 | 671 | continue; |
672 | 672 | } |
673 | 673 | |
674 | - switch ( $old_query_param ) { |
|
674 | + switch ($old_query_param) { |
|
675 | 675 | case 'post_parent': |
676 | - $logs[ $index ]->{$new_query_param} = give_get_meta( $log->ID, '_give_log_payment_id', true ); |
|
676 | + $logs[$index]->{$new_query_param} = give_get_meta($log->ID, '_give_log_payment_id', true); |
|
677 | 677 | break; |
678 | 678 | |
679 | 679 | default: |
680 | - $logs[ $index ]->{$new_query_param} = $log->{$old_query_param}; |
|
680 | + $logs[$index]->{$new_query_param} = $log->{$old_query_param}; |
|
681 | 681 | } |
682 | 682 | } |
683 | 683 | } |
@@ -697,10 +697,10 @@ discard block |
||
697 | 697 | * |
698 | 698 | * @return mixed |
699 | 699 | */ |
700 | - public function bc_200_set_payment_as_log_parent( $check, $log_id, $meta_key, $meta_value ) { |
|
700 | + public function bc_200_set_payment_as_log_parent($check, $log_id, $meta_key, $meta_value) { |
|
701 | 701 | global $wpdb; |
702 | 702 | $update_status = false; |
703 | - $post_type = get_post_type( $log_id ); |
|
703 | + $post_type = get_post_type($log_id); |
|
704 | 704 | |
705 | 705 | // Bailout. |
706 | 706 | if ( |
@@ -720,9 +720,9 @@ discard block |
||
720 | 720 | ) |
721 | 721 | ); |
722 | 722 | |
723 | - if ( $form_id ) { |
|
724 | - $this->logmeta_db->delete_meta( $log_id, '_give_log_payment_id' ); |
|
725 | - $this->logmeta_db->update_meta( $log_id, '_give_log_form_id', $form_id ); |
|
723 | + if ($form_id) { |
|
724 | + $this->logmeta_db->delete_meta($log_id, '_give_log_payment_id'); |
|
725 | + $this->logmeta_db->update_meta($log_id, '_give_log_form_id', $form_id); |
|
726 | 726 | |
727 | 727 | $update_status = $wpdb->update( |
728 | 728 | $this->log_db->table_name, |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -25,77 +25,77 @@ 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 | - case version_compare( $give_version, '1.8.12', '<' ) : |
|
61 | + case version_compare($give_version, '1.8.12', '<') : |
|
62 | 62 | give_v1812_upgrades(); |
63 | 63 | $did_upgrade = true; |
64 | 64 | |
65 | - case version_compare( $give_version, '1.8.13', '<' ) : |
|
65 | + case version_compare($give_version, '1.8.13', '<') : |
|
66 | 66 | give_v1813_upgrades(); |
67 | 67 | $did_upgrade = true; |
68 | 68 | |
69 | - case version_compare( $give_version, '1.8.17', '<' ) : |
|
69 | + case version_compare($give_version, '1.8.17', '<') : |
|
70 | 70 | give_v1817_upgrades(); |
71 | 71 | $did_upgrade = true; |
72 | 72 | |
73 | - case version_compare( $give_version, '1.8.18', '<' ) : |
|
73 | + case version_compare($give_version, '1.8.18', '<') : |
|
74 | 74 | give_v1818_upgrades(); |
75 | 75 | $did_upgrade = true; |
76 | 76 | |
77 | - case version_compare( $give_version, '2.0', '<' ) : |
|
77 | + case version_compare($give_version, '2.0', '<') : |
|
78 | 78 | give_v20_upgrades(); |
79 | 79 | $did_upgrade = true; |
80 | 80 | |
81 | - case version_compare( $give_version, '2.0.1', '<' ) : |
|
81 | + case version_compare($give_version, '2.0.1', '<') : |
|
82 | 82 | // Do nothing on fresh install. |
83 | - if( ! doing_action( 'give_upgrades' ) ) { |
|
83 | + if ( ! doing_action('give_upgrades')) { |
|
84 | 84 | give_v201_create_tables(); |
85 | - Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() ); |
|
85 | + Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance()); |
|
86 | 86 | Give_Updates::$background_updater->dispatch(); |
87 | 87 | } |
88 | 88 | |
89 | 89 | $did_upgrade = true; |
90 | 90 | } |
91 | 91 | |
92 | - if ( $did_upgrade ) { |
|
93 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
92 | + if ($did_upgrade) { |
|
93 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
98 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
97 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
98 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Display Upgrade Notices. |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return void |
111 | 111 | */ |
112 | -function give_show_upgrade_notices( $give_updates ) { |
|
112 | +function give_show_upgrade_notices($give_updates) { |
|
113 | 113 | // v1.3.2 Upgrades |
114 | 114 | $give_updates->register( |
115 | 115 | array( |
@@ -175,32 +175,32 @@ discard block |
||
175 | 175 | ); |
176 | 176 | |
177 | 177 | // v1.8.17 Upgrades for donations. |
178 | - $give_updates->register( array( |
|
178 | + $give_updates->register(array( |
|
179 | 179 | 'id' => 'v1817_update_donation_iranian_currency_code', |
180 | 180 | 'version' => '1.8.17', |
181 | 181 | 'callback' => 'give_v1817_update_donation_iranian_currency_code', |
182 | - ) ); |
|
182 | + )); |
|
183 | 183 | |
184 | 184 | // v1.8.17 Upgrades for cleanup of user roles. |
185 | - $give_updates->register( array( |
|
185 | + $give_updates->register(array( |
|
186 | 186 | 'id' => 'v1817_cleanup_user_roles', |
187 | 187 | 'version' => '1.8.17', |
188 | 188 | 'callback' => 'give_v1817_cleanup_user_roles', |
189 | - ) ); |
|
189 | + )); |
|
190 | 190 | |
191 | 191 | // v1.8.18 Upgrades for assigning custom amount to existing set donations. |
192 | - $give_updates->register( array( |
|
192 | + $give_updates->register(array( |
|
193 | 193 | 'id' => 'v1818_assign_custom_amount_set_donation', |
194 | 194 | 'version' => '1.8.18', |
195 | 195 | 'callback' => 'give_v1818_assign_custom_amount_set_donation', |
196 | - ) ); |
|
196 | + )); |
|
197 | 197 | |
198 | 198 | // v1.8.18 Cleanup the Give Worker Role Caps. |
199 | - $give_updates->register( array( |
|
199 | + $give_updates->register(array( |
|
200 | 200 | 'id' => 'v1818_give_worker_role_cleanup', |
201 | 201 | 'version' => '1.8.18', |
202 | 202 | 'callback' => 'give_v1818_give_worker_role_cleanup', |
203 | - ) ); |
|
203 | + )); |
|
204 | 204 | |
205 | 205 | // v2.0.0 Upgrades |
206 | 206 | $give_updates->register( |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | 'id' => 'v20_move_metadata_into_new_table', |
255 | 255 | 'version' => '2.0.0', |
256 | 256 | 'callback' => 'give_v20_move_metadata_into_new_table_callback', |
257 | - 'depend' => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ), |
|
257 | + 'depend' => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'), |
|
258 | 258 | ) |
259 | 259 | ); |
260 | 260 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | 'id' => 'v201_move_metadata_into_new_table', |
301 | 301 | 'version' => '2.0.1', |
302 | 302 | 'callback' => 'give_v201_move_metadata_into_new_table_callback', |
303 | - 'depend' => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ), |
|
303 | + 'depend' => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'), |
|
304 | 304 | ) |
305 | 305 | ); |
306 | 306 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | ); |
316 | 316 | } |
317 | 317 | |
318 | -add_action( 'give_register_updates', 'give_show_upgrade_notices' ); |
|
318 | +add_action('give_register_updates', 'give_show_upgrade_notices'); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Triggers all upgrade functions |
@@ -327,29 +327,29 @@ discard block |
||
327 | 327 | */ |
328 | 328 | function give_trigger_upgrades() { |
329 | 329 | |
330 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
331 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
330 | + if ( ! current_user_can('manage_give_settings')) { |
|
331 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
332 | 332 | 'response' => 403, |
333 | - ) ); |
|
333 | + )); |
|
334 | 334 | } |
335 | 335 | |
336 | - $give_version = get_option( 'give_version' ); |
|
336 | + $give_version = get_option('give_version'); |
|
337 | 337 | |
338 | - if ( ! $give_version ) { |
|
338 | + if ( ! $give_version) { |
|
339 | 339 | // 1.0 is the first version to use this option so we must add it. |
340 | 340 | $give_version = '1.0'; |
341 | - add_option( 'give_version', $give_version ); |
|
341 | + add_option('give_version', $give_version); |
|
342 | 342 | } |
343 | 343 | |
344 | - update_option( 'give_version', GIVE_VERSION ); |
|
345 | - delete_option( 'give_doing_upgrade' ); |
|
344 | + update_option('give_version', GIVE_VERSION); |
|
345 | + delete_option('give_doing_upgrade'); |
|
346 | 346 | |
347 | - if ( DOING_AJAX ) { |
|
348 | - die( 'complete' ); |
|
347 | + if (DOING_AJAX) { |
|
348 | + die('complete'); |
|
349 | 349 | } // End if(). |
350 | 350 | } |
351 | 351 | |
352 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
352 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
353 | 353 | |
354 | 354 | |
355 | 355 | /** |
@@ -365,20 +365,20 @@ discard block |
||
365 | 365 | /* @var Give_Updates $give_updates */ |
366 | 366 | $give_updates = Give_Updates::get_instance(); |
367 | 367 | |
368 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
369 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
368 | + if ( ! current_user_can('manage_give_settings')) { |
|
369 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
370 | 370 | 'response' => 403, |
371 | - ) ); |
|
371 | + )); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | give_ignore_user_abort(); |
375 | 375 | |
376 | 376 | // UPDATE DB METAKEYS. |
377 | 377 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
378 | - $query = $wpdb->query( $sql ); |
|
378 | + $query = $wpdb->query($sql); |
|
379 | 379 | |
380 | 380 | $give_updates->percentage = 100; |
381 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
381 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -402,24 +402,24 @@ discard block |
||
402 | 402 | $where .= "AND ( p.post_status = 'abandoned' )"; |
403 | 403 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
404 | 404 | |
405 | - $sql = $select . $join . $where; |
|
406 | - $found_payments = $wpdb->get_col( $sql ); |
|
405 | + $sql = $select.$join.$where; |
|
406 | + $found_payments = $wpdb->get_col($sql); |
|
407 | 407 | |
408 | - foreach ( $found_payments as $payment ) { |
|
408 | + foreach ($found_payments as $payment) { |
|
409 | 409 | |
410 | 410 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
411 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
411 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
412 | 412 | |
413 | 413 | // 1450124863 = 12/10/2015 20:42:25. |
414 | - if ( $modified_time >= 1450124863 ) { |
|
414 | + if ($modified_time >= 1450124863) { |
|
415 | 415 | |
416 | - give_update_payment_status( $payment, 'pending' ); |
|
416 | + give_update_payment_status($payment, 'pending'); |
|
417 | 417 | |
418 | 418 | } |
419 | 419 | } |
420 | 420 | |
421 | 421 | $give_updates->percentage = 100; |
422 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
422 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | |
@@ -432,17 +432,17 @@ discard block |
||
432 | 432 | */ |
433 | 433 | function give_v152_cleanup_users() { |
434 | 434 | |
435 | - $give_version = get_option( 'give_version' ); |
|
435 | + $give_version = get_option('give_version'); |
|
436 | 436 | |
437 | - if ( ! $give_version ) { |
|
437 | + if ( ! $give_version) { |
|
438 | 438 | // 1.0 is the first version to use this option so we must add it. |
439 | 439 | $give_version = '1.0'; |
440 | 440 | } |
441 | 441 | |
442 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
442 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
443 | 443 | |
444 | 444 | // v1.5.2 Upgrades |
445 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
445 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
446 | 446 | |
447 | 447 | // Delete all caps with "ss". |
448 | 448 | // Also delete all unused "campaign" roles. |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | ); |
490 | 490 | |
491 | 491 | global $wp_roles; |
492 | - foreach ( $delete_caps as $cap ) { |
|
493 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
494 | - $wp_roles->remove_cap( $role, $cap ); |
|
492 | + foreach ($delete_caps as $cap) { |
|
493 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
494 | + $wp_roles->remove_cap($role, $cap); |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | |
@@ -501,15 +501,15 @@ discard block |
||
501 | 501 | $roles->add_caps(); |
502 | 502 | |
503 | 503 | // The Update Ran. |
504 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
505 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
506 | - delete_option( 'give_doing_upgrade' ); |
|
504 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
505 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
506 | + delete_option('give_doing_upgrade'); |
|
507 | 507 | |
508 | 508 | }// End if(). |
509 | 509 | |
510 | 510 | } |
511 | 511 | |
512 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
512 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
513 | 513 | |
514 | 514 | /** |
515 | 515 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -552,53 +552,53 @@ discard block |
||
552 | 552 | |
553 | 553 | // Get addons license key. |
554 | 554 | $addons = array(); |
555 | - foreach ( $give_options as $key => $value ) { |
|
556 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
557 | - $addons[ $key ] = $value; |
|
555 | + foreach ($give_options as $key => $value) { |
|
556 | + if (false !== strpos($key, '_license_key')) { |
|
557 | + $addons[$key] = $value; |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | 561 | // Bailout: We do not have any addon license data to upgrade. |
562 | - if ( empty( $addons ) ) { |
|
562 | + if (empty($addons)) { |
|
563 | 563 | return false; |
564 | 564 | } |
565 | 565 | |
566 | - foreach ( $addons as $key => $addon_license ) { |
|
566 | + foreach ($addons as $key => $addon_license) { |
|
567 | 567 | |
568 | 568 | // Get addon shortname. |
569 | - $shortname = str_replace( '_license_key', '', $key ); |
|
569 | + $shortname = str_replace('_license_key', '', $key); |
|
570 | 570 | |
571 | 571 | // Addon license option name. |
572 | - $addon_license_option_name = $shortname . '_license_active'; |
|
572 | + $addon_license_option_name = $shortname.'_license_active'; |
|
573 | 573 | |
574 | 574 | // bailout if license is empty. |
575 | - if ( empty( $addon_license ) ) { |
|
576 | - delete_option( $addon_license_option_name ); |
|
575 | + if (empty($addon_license)) { |
|
576 | + delete_option($addon_license_option_name); |
|
577 | 577 | continue; |
578 | 578 | } |
579 | 579 | |
580 | 580 | // Get addon name. |
581 | 581 | $addon_name = array(); |
582 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
583 | - foreach ( $addon_name_parts as $name_part ) { |
|
582 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
583 | + foreach ($addon_name_parts as $name_part) { |
|
584 | 584 | |
585 | 585 | // Fix addon name |
586 | - switch ( $name_part ) { |
|
586 | + switch ($name_part) { |
|
587 | 587 | case 'authorizenet' : |
588 | 588 | $name_part = 'authorize.net'; |
589 | 589 | break; |
590 | 590 | } |
591 | 591 | |
592 | - $addon_name[] = ucfirst( $name_part ); |
|
592 | + $addon_name[] = ucfirst($name_part); |
|
593 | 593 | } |
594 | 594 | |
595 | - $addon_name = implode( ' ', $addon_name ); |
|
595 | + $addon_name = implode(' ', $addon_name); |
|
596 | 596 | |
597 | 597 | // Data to send to the API. |
598 | 598 | $api_params = array( |
599 | 599 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
600 | 600 | 'license' => $addon_license, |
601 | - 'item_name' => urlencode( $addon_name ), |
|
601 | + 'item_name' => urlencode($addon_name), |
|
602 | 602 | 'url' => home_url(), |
603 | 603 | ); |
604 | 604 | |
@@ -613,17 +613,17 @@ discard block |
||
613 | 613 | ); |
614 | 614 | |
615 | 615 | // Make sure there are no errors. |
616 | - if ( is_wp_error( $response ) ) { |
|
617 | - delete_option( $addon_license_option_name ); |
|
616 | + if (is_wp_error($response)) { |
|
617 | + delete_option($addon_license_option_name); |
|
618 | 618 | continue; |
619 | 619 | } |
620 | 620 | |
621 | 621 | // Tell WordPress to look for updates. |
622 | - set_site_transient( 'update_plugins', null ); |
|
622 | + set_site_transient('update_plugins', null); |
|
623 | 623 | |
624 | 624 | // Decode license data. |
625 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
626 | - update_option( $addon_license_option_name, $license_data ); |
|
625 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
626 | + update_option($addon_license_option_name, $license_data); |
|
627 | 627 | }// End foreach(). |
628 | 628 | } |
629 | 629 | |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | ); |
654 | 654 | |
655 | 655 | global $wp_roles; |
656 | - foreach ( $delete_caps as $cap ) { |
|
657 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
658 | - $wp_roles->remove_cap( $role, $cap ); |
|
656 | + foreach ($delete_caps as $cap) { |
|
657 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
658 | + $wp_roles->remove_cap($role, $cap); |
|
659 | 659 | } |
660 | 660 | } |
661 | 661 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | function give_v18_upgrades_core_setting() { |
690 | 690 | // Core settings which changes from checkbox to radio. |
691 | 691 | $core_setting_names = array_merge( |
692 | - array_keys( give_v18_renamed_core_settings() ), |
|
692 | + array_keys(give_v18_renamed_core_settings()), |
|
693 | 693 | array( |
694 | 694 | 'uninstall_on_delete', |
695 | 695 | 'scripts_footer', |
@@ -701,48 +701,48 @@ discard block |
||
701 | 701 | ); |
702 | 702 | |
703 | 703 | // Bailout: If not any setting define. |
704 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
704 | + if ($give_settings = get_option('give_settings')) { |
|
705 | 705 | |
706 | 706 | $setting_changed = false; |
707 | 707 | |
708 | 708 | // Loop: check each setting field. |
709 | - foreach ( $core_setting_names as $setting_name ) { |
|
709 | + foreach ($core_setting_names as $setting_name) { |
|
710 | 710 | // New setting name. |
711 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
711 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
712 | 712 | |
713 | 713 | // Continue: If setting already set. |
714 | 714 | if ( |
715 | - array_key_exists( $new_setting_name, $give_settings ) |
|
716 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
715 | + array_key_exists($new_setting_name, $give_settings) |
|
716 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
717 | 717 | ) { |
718 | 718 | continue; |
719 | 719 | } |
720 | 720 | |
721 | 721 | // Set checkbox value to radio value. |
722 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
722 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
723 | 723 | |
724 | 724 | // @see https://github.com/WordImpress/Give/issues/1063. |
725 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
725 | + if (false !== strpos($setting_name, 'disable_')) { |
|
726 | 726 | |
727 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
728 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
727 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
728 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
729 | 729 | |
730 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
730 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | // Tell bot to update core setting to db. |
734 | - if ( ! $setting_changed ) { |
|
734 | + if ( ! $setting_changed) { |
|
735 | 735 | $setting_changed = true; |
736 | 736 | } |
737 | 737 | } |
738 | 738 | |
739 | 739 | // Update setting only if they changed. |
740 | - if ( $setting_changed ) { |
|
741 | - update_option( 'give_settings', $give_settings ); |
|
740 | + if ($setting_changed) { |
|
741 | + update_option('give_settings', $give_settings); |
|
742 | 742 | } |
743 | 743 | }// End if(). |
744 | 744 | |
745 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
745 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | /** |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $give_updates = Give_Updates::get_instance(); |
757 | 757 | |
758 | 758 | // form query |
759 | - $forms = new WP_Query( array( |
|
759 | + $forms = new WP_Query(array( |
|
760 | 760 | 'paged' => $give_updates->step, |
761 | 761 | 'status' => 'any', |
762 | 762 | 'order' => 'ASC', |
@@ -765,41 +765,41 @@ discard block |
||
765 | 765 | ) |
766 | 766 | ); |
767 | 767 | |
768 | - if ( $forms->have_posts() ) { |
|
769 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) ); |
|
768 | + if ($forms->have_posts()) { |
|
769 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20)); |
|
770 | 770 | |
771 | - while ( $forms->have_posts() ) { |
|
771 | + while ($forms->have_posts()) { |
|
772 | 772 | $forms->the_post(); |
773 | 773 | |
774 | 774 | // Form content. |
775 | 775 | // Note in version 1.8 display content setting split into display content and content placement setting. |
776 | 776 | // You can delete _give_content_option in future. |
777 | - $show_content = give_get_meta( get_the_ID(), '_give_content_option', true ); |
|
778 | - if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
779 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
780 | - give_update_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
777 | + $show_content = give_get_meta(get_the_ID(), '_give_content_option', true); |
|
778 | + if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) { |
|
779 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
780 | + give_update_meta(get_the_ID(), '_give_display_content', $field_value); |
|
781 | 781 | |
782 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
783 | - give_update_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
782 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
783 | + give_update_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | // "Disable" Guest Donation. Checkbox. |
787 | 787 | // See: https://github.com/WordImpress/Give/issues/1470. |
788 | - $guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
789 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
790 | - give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
788 | + $guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true); |
|
789 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
790 | + give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
791 | 791 | |
792 | 792 | // Offline Donations. |
793 | 793 | // See: https://github.com/WordImpress/Give/issues/1579. |
794 | - $offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
795 | - if ( 'no' === $offline_donation ) { |
|
794 | + $offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
795 | + if ('no' === $offline_donation) { |
|
796 | 796 | $offline_donation_newval = 'global'; |
797 | - } elseif ( 'yes' === $offline_donation ) { |
|
797 | + } elseif ('yes' === $offline_donation) { |
|
798 | 798 | $offline_donation_newval = 'enabled'; |
799 | 799 | } else { |
800 | 800 | $offline_donation_newval = 'disabled'; |
801 | 801 | } |
802 | - give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
802 | + give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
803 | 803 | |
804 | 804 | // Convert yes/no setting field to enabled/disabled. |
805 | 805 | $form_radio_settings = array( |
@@ -819,15 +819,15 @@ discard block |
||
819 | 819 | '_give_offline_donation_enable_billing_fields_single', |
820 | 820 | ); |
821 | 821 | |
822 | - foreach ( $form_radio_settings as $meta_key ) { |
|
822 | + foreach ($form_radio_settings as $meta_key) { |
|
823 | 823 | // Get value. |
824 | - $field_value = give_get_meta( get_the_ID(), $meta_key, true ); |
|
824 | + $field_value = give_get_meta(get_the_ID(), $meta_key, true); |
|
825 | 825 | |
826 | 826 | // Convert meta value only if it is in yes/no/none. |
827 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
827 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
828 | 828 | |
829 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
830 | - give_update_meta( get_the_ID(), $meta_key, $field_value ); |
|
829 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
830 | + give_update_meta(get_the_ID(), $meta_key, $field_value); |
|
831 | 831 | } |
832 | 832 | } |
833 | 833 | }// End while(). |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | |
837 | 837 | } else { |
838 | 838 | // No more forms found, finish up. |
839 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
839 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
840 | 840 | } |
841 | 841 | } |
842 | 842 | |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | '%_transient_give_stats_%', |
904 | 904 | 'give_cache%', |
905 | 905 | '%_transient_give_add_ons_feed%', |
906 | - '%_transient__give_ajax_works' . |
|
906 | + '%_transient__give_ajax_works'. |
|
907 | 907 | '%_transient_give_total_api_keys%', |
908 | 908 | '%_transient_give_i18n_give_promo_hide%', |
909 | 909 | '%_transient_give_contributors%', |
@@ -930,24 +930,24 @@ discard block |
||
930 | 930 | ARRAY_A |
931 | 931 | ); |
932 | 932 | |
933 | - if ( ! empty( $user_apikey_options ) ) { |
|
934 | - foreach ( $user_apikey_options as $user ) { |
|
935 | - $cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] ); |
|
936 | - $cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] ); |
|
937 | - $cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] ); |
|
933 | + if ( ! empty($user_apikey_options)) { |
|
934 | + foreach ($user_apikey_options as $user) { |
|
935 | + $cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']); |
|
936 | + $cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']); |
|
937 | + $cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']); |
|
938 | 938 | } |
939 | 939 | } |
940 | 940 | |
941 | - if ( ! empty( $cached_options ) ) { |
|
942 | - foreach ( $cached_options as $option ) { |
|
943 | - switch ( true ) { |
|
944 | - case ( false !== strpos( $option, 'transient' ) ): |
|
945 | - $option = str_replace( '_transient_', '', $option ); |
|
946 | - delete_transient( $option ); |
|
941 | + if ( ! empty($cached_options)) { |
|
942 | + foreach ($cached_options as $option) { |
|
943 | + switch (true) { |
|
944 | + case (false !== strpos($option, 'transient')): |
|
945 | + $option = str_replace('_transient_', '', $option); |
|
946 | + delete_transient($option); |
|
947 | 947 | break; |
948 | 948 | |
949 | 949 | default: |
950 | - delete_option( $option ); |
|
950 | + delete_option($option); |
|
951 | 951 | } |
952 | 952 | } |
953 | 953 | } |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | global $wp_roles; |
966 | 966 | |
967 | 967 | // Get the role object. |
968 | - $give_worker = get_role( 'give_worker' ); |
|
968 | + $give_worker = get_role('give_worker'); |
|
969 | 969 | |
970 | 970 | // A list of capabilities to add for give workers. |
971 | 971 | $caps_to_add = array( |
@@ -973,9 +973,9 @@ discard block |
||
973 | 973 | 'edit_pages', |
974 | 974 | ); |
975 | 975 | |
976 | - foreach ( $caps_to_add as $cap ) { |
|
976 | + foreach ($caps_to_add as $cap) { |
|
977 | 977 | // Add the capability. |
978 | - $give_worker->add_cap( $cap ); |
|
978 | + $give_worker->add_cap($cap); |
|
979 | 979 | } |
980 | 980 | |
981 | 981 | } |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | $give_updates = Give_Updates::get_instance(); |
993 | 993 | |
994 | 994 | // form query. |
995 | - $donation_forms = new WP_Query( array( |
|
995 | + $donation_forms = new WP_Query(array( |
|
996 | 996 | 'paged' => $give_updates->step, |
997 | 997 | 'status' => 'any', |
998 | 998 | 'order' => 'ASC', |
@@ -1001,10 +1001,10 @@ discard block |
||
1001 | 1001 | ) |
1002 | 1002 | ); |
1003 | 1003 | |
1004 | - if ( $donation_forms->have_posts() ) { |
|
1005 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1004 | + if ($donation_forms->have_posts()) { |
|
1005 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1006 | 1006 | |
1007 | - while ( $donation_forms->have_posts() ) { |
|
1007 | + while ($donation_forms->have_posts()) { |
|
1008 | 1008 | $donation_forms->the_post(); |
1009 | 1009 | $form_id = get_the_ID(); |
1010 | 1010 | |
@@ -1012,41 +1012,41 @@ discard block |
||
1012 | 1012 | update_post_meta( |
1013 | 1013 | $form_id, |
1014 | 1014 | '_give_set_price', |
1015 | - give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) ) |
|
1015 | + give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true)) |
|
1016 | 1016 | ); |
1017 | 1017 | |
1018 | 1018 | // Remove formatting from _give_custom_amount_minimum. |
1019 | 1019 | update_post_meta( |
1020 | 1020 | $form_id, |
1021 | 1021 | '_give_custom_amount_minimum', |
1022 | - give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) ) |
|
1022 | + give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true)) |
|
1023 | 1023 | ); |
1024 | 1024 | |
1025 | 1025 | // Bailout. |
1026 | - if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) { |
|
1026 | + if ('set' === get_post_meta($form_id, '_give_price_option', true)) { |
|
1027 | 1027 | continue; |
1028 | 1028 | } |
1029 | 1029 | |
1030 | - $donation_levels = get_post_meta( $form_id, '_give_donation_levels', true ); |
|
1030 | + $donation_levels = get_post_meta($form_id, '_give_donation_levels', true); |
|
1031 | 1031 | |
1032 | - if ( ! empty( $donation_levels ) ) { |
|
1032 | + if ( ! empty($donation_levels)) { |
|
1033 | 1033 | |
1034 | - foreach ( $donation_levels as $index => $donation_level ) { |
|
1035 | - if ( isset( $donation_level['_give_amount'] ) ) { |
|
1036 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] ); |
|
1034 | + foreach ($donation_levels as $index => $donation_level) { |
|
1035 | + if (isset($donation_level['_give_amount'])) { |
|
1036 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']); |
|
1037 | 1037 | } |
1038 | 1038 | } |
1039 | 1039 | |
1040 | - update_post_meta( $form_id, '_give_donation_levels', $donation_levels ); |
|
1040 | + update_post_meta($form_id, '_give_donation_levels', $donation_levels); |
|
1041 | 1041 | |
1042 | - $donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' ); |
|
1042 | + $donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount'); |
|
1043 | 1043 | |
1044 | - $min_amount = min( $donation_levels_amounts ); |
|
1045 | - $max_amount = max( $donation_levels_amounts ); |
|
1044 | + $min_amount = min($donation_levels_amounts); |
|
1045 | + $max_amount = max($donation_levels_amounts); |
|
1046 | 1046 | |
1047 | 1047 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
1048 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
1049 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 ); |
|
1048 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
1049 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | } |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | wp_reset_postdata(); |
1056 | 1056 | } else { |
1057 | 1057 | // The Update Ran. |
1058 | - give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' ); |
|
1058 | + give_set_upgrade_complete('v189_upgrades_levels_post_meta'); |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | } |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | */ |
1106 | 1106 | function give_v20_upgrades() { |
1107 | 1107 | // Update cache setting. |
1108 | - give_update_option( 'cache', 'enabled' ); |
|
1108 | + give_update_option('cache', 'enabled'); |
|
1109 | 1109 | |
1110 | 1110 | // Upgrade email settings. |
1111 | 1111 | give_v20_upgrades_email_setting(); |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | $all_setting = give_get_settings(); |
1125 | 1125 | |
1126 | 1126 | // Bailout on fresh install. |
1127 | - if ( empty( $all_setting ) ) { |
|
1127 | + if (empty($all_setting)) { |
|
1128 | 1128 | return; |
1129 | 1129 | } |
1130 | 1130 | |
@@ -1143,19 +1143,19 @@ discard block |
||
1143 | 1143 | 'admin_notices' => 'new-donation_notification', |
1144 | 1144 | ); |
1145 | 1145 | |
1146 | - foreach ( $settings as $old_setting => $new_setting ) { |
|
1146 | + foreach ($settings as $old_setting => $new_setting) { |
|
1147 | 1147 | // Do not update already modified |
1148 | - if ( ! is_array( $new_setting ) ) { |
|
1149 | - if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) { |
|
1148 | + if ( ! is_array($new_setting)) { |
|
1149 | + if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) { |
|
1150 | 1150 | continue; |
1151 | 1151 | } |
1152 | 1152 | } |
1153 | 1153 | |
1154 | - switch ( $old_setting ) { |
|
1154 | + switch ($old_setting) { |
|
1155 | 1155 | case 'admin_notices': |
1156 | - $notification_status = give_get_option( $old_setting, 'enabled' ); |
|
1156 | + $notification_status = give_get_option($old_setting, 'enabled'); |
|
1157 | 1157 | |
1158 | - give_update_option( $new_setting, $notification_status ); |
|
1158 | + give_update_option($new_setting, $notification_status); |
|
1159 | 1159 | |
1160 | 1160 | // @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon. |
1161 | 1161 | // give_delete_option( $old_setting ); |
@@ -1166,19 +1166,19 @@ discard block |
||
1166 | 1166 | case 'admin_notice_emails': |
1167 | 1167 | $recipients = give_get_admin_notice_emails(); |
1168 | 1168 | |
1169 | - foreach ( $new_setting as $setting ) { |
|
1169 | + foreach ($new_setting as $setting) { |
|
1170 | 1170 | // bailout if setting already exist. |
1171 | - if ( array_key_exists( $setting, $all_setting ) ) { |
|
1171 | + if (array_key_exists($setting, $all_setting)) { |
|
1172 | 1172 | continue; |
1173 | 1173 | } |
1174 | 1174 | |
1175 | - give_update_option( $setting, $recipients ); |
|
1175 | + give_update_option($setting, $recipients); |
|
1176 | 1176 | } |
1177 | 1177 | break; |
1178 | 1178 | |
1179 | 1179 | default: |
1180 | - give_update_option( $new_setting, give_get_option( $old_setting ) ); |
|
1181 | - give_delete_option( $old_setting ); |
|
1180 | + give_update_option($new_setting, give_get_option($old_setting)); |
|
1181 | + give_delete_option($old_setting); |
|
1182 | 1182 | } |
1183 | 1183 | } |
1184 | 1184 | } |
@@ -1195,22 +1195,22 @@ discard block |
||
1195 | 1195 | $give_settings = give_get_settings(); |
1196 | 1196 | $give_setting_updated = false; |
1197 | 1197 | |
1198 | - if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) { |
|
1198 | + if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) { |
|
1199 | 1199 | $give_settings['number_decimals'] = 0; |
1200 | 1200 | $give_settings['decimal_separator'] = ''; |
1201 | 1201 | $give_setting_updated = true; |
1202 | 1202 | |
1203 | - } elseif ( empty( $give_settings['decimal_separator'] ) ) { |
|
1203 | + } elseif (empty($give_settings['decimal_separator'])) { |
|
1204 | 1204 | $give_settings['number_decimals'] = 0; |
1205 | 1205 | $give_setting_updated = true; |
1206 | 1206 | |
1207 | - } elseif ( 6 < absint( $give_settings['number_decimals'] ) ) { |
|
1207 | + } elseif (6 < absint($give_settings['number_decimals'])) { |
|
1208 | 1208 | $give_settings['number_decimals'] = 5; |
1209 | 1209 | $give_setting_updated = true; |
1210 | 1210 | } |
1211 | 1211 | |
1212 | - if ( $give_setting_updated ) { |
|
1213 | - update_option( 'give_settings', $give_settings ); |
|
1212 | + if ($give_setting_updated) { |
|
1213 | + update_option('give_settings', $give_settings); |
|
1214 | 1214 | } |
1215 | 1215 | } |
1216 | 1216 | |
@@ -1229,69 +1229,69 @@ discard block |
||
1229 | 1229 | $give_updates = Give_Updates::get_instance(); |
1230 | 1230 | |
1231 | 1231 | // form query. |
1232 | - $donation_forms = new WP_Query( array( |
|
1232 | + $donation_forms = new WP_Query(array( |
|
1233 | 1233 | 'paged' => $give_updates->step, |
1234 | 1234 | 'status' => 'any', |
1235 | 1235 | 'order' => 'ASC', |
1236 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1236 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1237 | 1237 | 'posts_per_page' => 20, |
1238 | 1238 | ) |
1239 | 1239 | ); |
1240 | - if ( $donation_forms->have_posts() ) { |
|
1241 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1240 | + if ($donation_forms->have_posts()) { |
|
1241 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1242 | 1242 | |
1243 | - while ( $donation_forms->have_posts() ) { |
|
1243 | + while ($donation_forms->have_posts()) { |
|
1244 | 1244 | $donation_forms->the_post(); |
1245 | 1245 | global $post; |
1246 | 1246 | |
1247 | - $meta = get_post_meta( $post->ID ); |
|
1247 | + $meta = get_post_meta($post->ID); |
|
1248 | 1248 | |
1249 | - switch ( $post->post_type ) { |
|
1249 | + switch ($post->post_type) { |
|
1250 | 1250 | case 'give_forms': |
1251 | 1251 | // _give_set_price. |
1252 | - if ( ! empty( $meta['_give_set_price'][0] ) ) { |
|
1253 | - update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) ); |
|
1252 | + if ( ! empty($meta['_give_set_price'][0])) { |
|
1253 | + update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0])); |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | // _give_custom_amount_minimum. |
1257 | - if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) { |
|
1258 | - update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) ); |
|
1257 | + if ( ! empty($meta['_give_custom_amount_minimum'][0])) { |
|
1258 | + update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0])); |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | // _give_levels_minimum_amount. |
1262 | - if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) { |
|
1263 | - update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) ); |
|
1262 | + if ( ! empty($meta['_give_levels_minimum_amount'][0])) { |
|
1263 | + update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0])); |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | // _give_levels_maximum_amount. |
1267 | - if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) { |
|
1268 | - update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) ); |
|
1267 | + if ( ! empty($meta['_give_levels_maximum_amount'][0])) { |
|
1268 | + update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0])); |
|
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | // _give_set_goal. |
1272 | - if ( ! empty( $meta['_give_set_goal'][0] ) ) { |
|
1273 | - update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) ); |
|
1272 | + if ( ! empty($meta['_give_set_goal'][0])) { |
|
1273 | + update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0])); |
|
1274 | 1274 | } |
1275 | 1275 | |
1276 | 1276 | // _give_form_earnings. |
1277 | - if ( ! empty( $meta['_give_form_earnings'][0] ) ) { |
|
1278 | - update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) ); |
|
1277 | + if ( ! empty($meta['_give_form_earnings'][0])) { |
|
1278 | + update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0])); |
|
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | // _give_custom_amount_minimum. |
1282 | - if ( ! empty( $meta['_give_donation_levels'][0] ) ) { |
|
1283 | - $donation_levels = unserialize( $meta['_give_donation_levels'][0] ); |
|
1282 | + if ( ! empty($meta['_give_donation_levels'][0])) { |
|
1283 | + $donation_levels = unserialize($meta['_give_donation_levels'][0]); |
|
1284 | 1284 | |
1285 | - foreach ( $donation_levels as $index => $level ) { |
|
1286 | - if ( empty( $level['_give_amount'] ) ) { |
|
1285 | + foreach ($donation_levels as $index => $level) { |
|
1286 | + if (empty($level['_give_amount'])) { |
|
1287 | 1287 | continue; |
1288 | 1288 | } |
1289 | 1289 | |
1290 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] ); |
|
1290 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']); |
|
1291 | 1291 | } |
1292 | 1292 | |
1293 | 1293 | $meta['_give_donation_levels'] = $donation_levels; |
1294 | - update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] ); |
|
1294 | + update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']); |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | |
@@ -1299,8 +1299,8 @@ discard block |
||
1299 | 1299 | |
1300 | 1300 | case 'give_payment': |
1301 | 1301 | // _give_payment_total. |
1302 | - if ( ! empty( $meta['_give_payment_total'][0] ) ) { |
|
1303 | - update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) ); |
|
1302 | + if ( ! empty($meta['_give_payment_total'][0])) { |
|
1303 | + update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0])); |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | break; |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | wp_reset_postdata(); |
1312 | 1312 | } else { |
1313 | 1313 | // The Update Ran. |
1314 | - give_set_upgrade_complete( 'v1812_update_amount_values' ); |
|
1314 | + give_set_upgrade_complete('v1812_update_amount_values'); |
|
1315 | 1315 | } |
1316 | 1316 | } |
1317 | 1317 | |
@@ -1331,22 +1331,22 @@ discard block |
||
1331 | 1331 | $offset = 1 === $give_updates->step ? 0 : $give_updates->step * 20; |
1332 | 1332 | |
1333 | 1333 | // form query. |
1334 | - $donors = Give()->donors->get_donors( array( |
|
1334 | + $donors = Give()->donors->get_donors(array( |
|
1335 | 1335 | 'number' => 20, |
1336 | 1336 | 'offset' => $offset, |
1337 | 1337 | ) |
1338 | 1338 | ); |
1339 | 1339 | |
1340 | - if ( ! empty( $donors ) ) { |
|
1341 | - $give_updates->set_percentage( Give()->donors->count(), $offset ); |
|
1340 | + if ( ! empty($donors)) { |
|
1341 | + $give_updates->set_percentage(Give()->donors->count(), $offset); |
|
1342 | 1342 | |
1343 | 1343 | /* @var Object $donor */ |
1344 | - foreach ( $donors as $donor ) { |
|
1345 | - Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) ); |
|
1344 | + foreach ($donors as $donor) { |
|
1345 | + Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value))); |
|
1346 | 1346 | } |
1347 | 1347 | } else { |
1348 | 1348 | // The Update Ran. |
1349 | - give_set_upgrade_complete( 'v1812_update_donor_purchase_values' ); |
|
1349 | + give_set_upgrade_complete('v1812_update_donor_purchase_values'); |
|
1350 | 1350 | } |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1361,25 +1361,25 @@ discard block |
||
1361 | 1361 | $offset = 1 === $give_updates->step ? 0 : $give_updates->step * 20; |
1362 | 1362 | |
1363 | 1363 | // Fetch all the existing donors. |
1364 | - $donors = Give()->donors->get_donors( array( |
|
1364 | + $donors = Give()->donors->get_donors(array( |
|
1365 | 1365 | 'number' => 20, |
1366 | 1366 | 'offset' => $offset, |
1367 | 1367 | ) |
1368 | 1368 | ); |
1369 | 1369 | |
1370 | - if ( ! empty( $donors ) ) { |
|
1371 | - $give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) ); |
|
1370 | + if ( ! empty($donors)) { |
|
1371 | + $give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20)); |
|
1372 | 1372 | |
1373 | 1373 | /* @var Object $donor */ |
1374 | - foreach ( $donors as $donor ) { |
|
1374 | + foreach ($donors as $donor) { |
|
1375 | 1375 | $user_id = $donor->user_id; |
1376 | 1376 | |
1377 | 1377 | // Proceed, if donor is attached with user. |
1378 | - if ( $user_id ) { |
|
1379 | - $user = get_userdata( $user_id ); |
|
1378 | + if ($user_id) { |
|
1379 | + $user = get_userdata($user_id); |
|
1380 | 1380 | |
1381 | 1381 | // Update user role, if user has subscriber role. |
1382 | - if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) { |
|
1382 | + if (is_array($user->roles) && in_array('subscriber', $user->roles)) { |
|
1383 | 1383 | wp_update_user( |
1384 | 1384 | array( |
1385 | 1385 | 'ID' => $user_id, |
@@ -1391,7 +1391,7 @@ discard block |
||
1391 | 1391 | } |
1392 | 1392 | } else { |
1393 | 1393 | // The Update Ran. |
1394 | - give_set_upgrade_complete( 'v1813_update_donor_user_roles' ); |
|
1394 | + give_set_upgrade_complete('v1813_update_donor_user_roles'); |
|
1395 | 1395 | } |
1396 | 1396 | } |
1397 | 1397 | |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | */ |
1404 | 1404 | function give_v1813_upgrades() { |
1405 | 1405 | // Update admin setting. |
1406 | - give_update_option( 'donor_default_user_role', 'give_donor' ); |
|
1406 | + give_update_option('donor_default_user_role', 'give_donor'); |
|
1407 | 1407 | |
1408 | 1408 | // Update Give roles. |
1409 | 1409 | $roles = new Give_Roles(); |
@@ -1421,33 +1421,33 @@ discard block |
||
1421 | 1421 | $give_updates = Give_Updates::get_instance(); |
1422 | 1422 | |
1423 | 1423 | // form query. |
1424 | - $payments = new WP_Query( array( |
|
1424 | + $payments = new WP_Query(array( |
|
1425 | 1425 | 'paged' => $give_updates->step, |
1426 | 1426 | 'status' => 'any', |
1427 | 1427 | 'order' => 'ASC', |
1428 | - 'post_type' => array( 'give_payment' ), |
|
1428 | + 'post_type' => array('give_payment'), |
|
1429 | 1429 | 'posts_per_page' => 100, |
1430 | 1430 | ) |
1431 | 1431 | ); |
1432 | 1432 | |
1433 | - if ( $payments->have_posts() ) { |
|
1434 | - $give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) ); |
|
1433 | + if ($payments->have_posts()) { |
|
1434 | + $give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100)); |
|
1435 | 1435 | |
1436 | - while ( $payments->have_posts() ) { |
|
1436 | + while ($payments->have_posts()) { |
|
1437 | 1437 | $payments->the_post(); |
1438 | 1438 | |
1439 | - $payment_meta = give_get_payment_meta( get_the_ID() ); |
|
1439 | + $payment_meta = give_get_payment_meta(get_the_ID()); |
|
1440 | 1440 | |
1441 | - if ( 'RIAL' === $payment_meta['currency'] ) { |
|
1441 | + if ('RIAL' === $payment_meta['currency']) { |
|
1442 | 1442 | $payment_meta['currency'] = 'IRR'; |
1443 | - give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta ); |
|
1443 | + give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta); |
|
1444 | 1444 | } |
1445 | 1445 | |
1446 | 1446 | } |
1447 | 1447 | |
1448 | 1448 | } else { |
1449 | 1449 | // The Update Ran. |
1450 | - give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' ); |
|
1450 | + give_set_upgrade_complete('v1817_update_donation_iranian_currency_code'); |
|
1451 | 1451 | } |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1460,9 +1460,9 @@ discard block |
||
1460 | 1460 | function give_v1817_upgrades() { |
1461 | 1461 | $give_settings = give_get_settings(); |
1462 | 1462 | |
1463 | - if ( 'RIAL' === $give_settings['currency'] ) { |
|
1463 | + if ('RIAL' === $give_settings['currency']) { |
|
1464 | 1464 | $give_settings['currency'] = 'IRR'; |
1465 | - update_option( 'give_settings', $give_settings ); |
|
1465 | + update_option('give_settings', $give_settings); |
|
1466 | 1466 | } |
1467 | 1467 | } |
1468 | 1468 | |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | |
1476 | 1476 | global $wp_roles; |
1477 | 1477 | |
1478 | - if( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1478 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1479 | 1479 | return; |
1480 | 1480 | } |
1481 | 1481 | |
@@ -1499,15 +1499,15 @@ discard block |
||
1499 | 1499 | ), |
1500 | 1500 | ); |
1501 | 1501 | |
1502 | - foreach ( $add_caps as $role => $caps ) { |
|
1503 | - foreach ( $caps as $cap ) { |
|
1504 | - $wp_roles->add_cap( $role, $cap ); |
|
1502 | + foreach ($add_caps as $role => $caps) { |
|
1503 | + foreach ($caps as $cap) { |
|
1504 | + $wp_roles->add_cap($role, $cap); |
|
1505 | 1505 | } |
1506 | 1506 | } |
1507 | 1507 | |
1508 | - foreach ( $remove_caps as $role => $caps ) { |
|
1509 | - foreach ( $caps as $cap ) { |
|
1510 | - $wp_roles->remove_cap( $role, $cap ); |
|
1508 | + foreach ($remove_caps as $role => $caps) { |
|
1509 | + foreach ($caps as $cap) { |
|
1510 | + $wp_roles->remove_cap($role, $cap); |
|
1511 | 1511 | } |
1512 | 1512 | } |
1513 | 1513 | |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | $roles->add_roles(); |
1532 | 1532 | $roles->add_caps(); |
1533 | 1533 | |
1534 | - give_set_upgrade_complete( 'v1817_cleanup_user_roles' ); |
|
1534 | + give_set_upgrade_complete('v1817_cleanup_user_roles'); |
|
1535 | 1535 | } |
1536 | 1536 | |
1537 | 1537 | /** |
@@ -1542,7 +1542,7 @@ discard block |
||
1542 | 1542 | function give_v1818_upgrades() { |
1543 | 1543 | |
1544 | 1544 | // Remove email_access_installed from give_settings. |
1545 | - give_delete_option( 'email_access_installed' ); |
|
1545 | + give_delete_option('email_access_installed'); |
|
1546 | 1546 | } |
1547 | 1547 | |
1548 | 1548 | /** |
@@ -1553,25 +1553,25 @@ discard block |
||
1553 | 1553 | function give_v1818_assign_custom_amount_set_donation() { |
1554 | 1554 | |
1555 | 1555 | /* @var Give_Updates $give_updates */ |
1556 | - $give_updates = Give_Updates::get_instance(); |
|
1556 | + $give_updates = Give_Updates::get_instance(); |
|
1557 | 1557 | |
1558 | - $donations = new WP_Query( array( |
|
1558 | + $donations = new WP_Query(array( |
|
1559 | 1559 | 'paged' => $give_updates->step, |
1560 | 1560 | 'status' => 'any', |
1561 | 1561 | 'order' => 'ASC', |
1562 | - 'post_type' => array( 'give_payment' ), |
|
1562 | + 'post_type' => array('give_payment'), |
|
1563 | 1563 | 'posts_per_page' => 100, |
1564 | 1564 | ) |
1565 | 1565 | ); |
1566 | 1566 | |
1567 | - if ( $donations->have_posts() ) { |
|
1568 | - $give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 ); |
|
1567 | + if ($donations->have_posts()) { |
|
1568 | + $give_updates->set_percentage($donations->found_posts, $give_updates->step * 100); |
|
1569 | 1569 | |
1570 | - while ( $donations->have_posts() ) { |
|
1570 | + while ($donations->have_posts()) { |
|
1571 | 1571 | $donations->the_post(); |
1572 | 1572 | |
1573 | - $form = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) ); |
|
1574 | - $donation_meta = give_get_payment_meta( get_the_ID() ); |
|
1573 | + $form = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true)); |
|
1574 | + $donation_meta = give_get_payment_meta(get_the_ID()); |
|
1575 | 1575 | |
1576 | 1576 | // Update Donation meta with price_id set as custom, only if it is: |
1577 | 1577 | // 1. Donation Type = Set Donation. |
@@ -1580,19 +1580,19 @@ discard block |
||
1580 | 1580 | if ( |
1581 | 1581 | $form->ID && |
1582 | 1582 | $form->is_set_type_donation_form() && |
1583 | - ( 'custom' !== $donation_meta['price_id'] ) && |
|
1584 | - $form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) ) |
|
1583 | + ('custom' !== $donation_meta['price_id']) && |
|
1584 | + $form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true)) |
|
1585 | 1585 | ) { |
1586 | 1586 | $donation_meta['price_id'] = 'custom'; |
1587 | - give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta ); |
|
1588 | - give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' ); |
|
1587 | + give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta); |
|
1588 | + give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom'); |
|
1589 | 1589 | } |
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | wp_reset_postdata(); |
1593 | 1593 | } else { |
1594 | 1594 | // Update Ran Successfully. |
1595 | - give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' ); |
|
1595 | + give_set_upgrade_complete('v1818_assign_custom_amount_set_donation'); |
|
1596 | 1596 | } |
1597 | 1597 | } |
1598 | 1598 | |
@@ -1603,14 +1603,14 @@ discard block |
||
1603 | 1603 | * |
1604 | 1604 | * @since 1.8.18 |
1605 | 1605 | */ |
1606 | -function give_v1818_give_worker_role_cleanup(){ |
|
1606 | +function give_v1818_give_worker_role_cleanup() { |
|
1607 | 1607 | |
1608 | 1608 | /* @var Give_Updates $give_updates */ |
1609 | 1609 | $give_updates = Give_Updates::get_instance(); |
1610 | 1610 | |
1611 | 1611 | global $wp_roles; |
1612 | 1612 | |
1613 | - if( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1613 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1614 | 1614 | return; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1628,9 +1628,9 @@ discard block |
||
1628 | 1628 | ), |
1629 | 1629 | ); |
1630 | 1630 | |
1631 | - foreach ( $remove_caps as $role => $caps ) { |
|
1632 | - foreach( $caps as $cap ) { |
|
1633 | - $wp_roles->remove_cap( $role, $cap ); |
|
1631 | + foreach ($remove_caps as $role => $caps) { |
|
1632 | + foreach ($caps as $cap) { |
|
1633 | + $wp_roles->remove_cap($role, $cap); |
|
1634 | 1634 | } |
1635 | 1635 | } |
1636 | 1636 | |
@@ -1641,7 +1641,7 @@ discard block |
||
1641 | 1641 | $roles->add_roles(); |
1642 | 1642 | $roles->add_caps(); |
1643 | 1643 | |
1644 | - give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' ); |
|
1644 | + give_set_upgrade_complete('v1818_give_worker_role_cleanup'); |
|
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | /** |
@@ -1655,7 +1655,7 @@ discard block |
||
1655 | 1655 | $give_updates = Give_Updates::get_instance(); |
1656 | 1656 | |
1657 | 1657 | // form query |
1658 | - $forms = new WP_Query( array( |
|
1658 | + $forms = new WP_Query(array( |
|
1659 | 1659 | 'paged' => $give_updates->step, |
1660 | 1660 | 'status' => 'any', |
1661 | 1661 | 'order' => 'ASC', |
@@ -1664,22 +1664,22 @@ discard block |
||
1664 | 1664 | ) |
1665 | 1665 | ); |
1666 | 1666 | |
1667 | - if ( $forms->have_posts() ) { |
|
1668 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) ); |
|
1667 | + if ($forms->have_posts()) { |
|
1668 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100)); |
|
1669 | 1669 | |
1670 | - while ( $forms->have_posts() ) { |
|
1670 | + while ($forms->have_posts()) { |
|
1671 | 1671 | $forms->the_post(); |
1672 | 1672 | global $post; |
1673 | 1673 | |
1674 | 1674 | // Update offline instruction email notification status. |
1675 | - $offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
1676 | - $offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array( |
|
1675 | + $offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
1676 | + $offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array( |
|
1677 | 1677 | 'enabled', |
1678 | 1678 | 'global', |
1679 | - ) ) |
|
1679 | + )) |
|
1680 | 1680 | ? $offline_instruction_notification_status |
1681 | 1681 | : 'global'; |
1682 | - update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status ); |
|
1682 | + update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status); |
|
1683 | 1683 | |
1684 | 1684 | // Update offline instruction email message. |
1685 | 1685 | update_post_meta( |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | wp_reset_postdata(); |
1712 | 1712 | } else { |
1713 | 1713 | // No more forms found, finish up. |
1714 | - give_set_upgrade_complete( 'v20_upgrades_form_metadata' ); |
|
1714 | + give_set_upgrade_complete('v20_upgrades_form_metadata'); |
|
1715 | 1715 | } |
1716 | 1716 | } |
1717 | 1717 | |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | $give_updates = Give_Updates::get_instance(); |
1729 | 1729 | |
1730 | 1730 | // form query |
1731 | - $forms = new WP_Query( array( |
|
1731 | + $forms = new WP_Query(array( |
|
1732 | 1732 | 'paged' => $give_updates->step, |
1733 | 1733 | 'status' => 'any', |
1734 | 1734 | 'order' => 'ASC', |
@@ -1737,19 +1737,19 @@ discard block |
||
1737 | 1737 | ) |
1738 | 1738 | ); |
1739 | 1739 | |
1740 | - if ( $forms->have_posts() ) { |
|
1741 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) ); |
|
1740 | + if ($forms->have_posts()) { |
|
1741 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100)); |
|
1742 | 1742 | |
1743 | - while ( $forms->have_posts() ) { |
|
1743 | + while ($forms->have_posts()) { |
|
1744 | 1744 | $forms->the_post(); |
1745 | 1745 | global $post; |
1746 | 1746 | |
1747 | 1747 | // Split _give_payment_meta meta. |
1748 | 1748 | // @todo Remove _give_payment_meta after releases 2.0 |
1749 | - $payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true ); |
|
1749 | + $payment_meta = give_get_meta($post->ID, '_give_payment_meta', true); |
|
1750 | 1750 | |
1751 | - if ( ! empty( $payment_meta ) ) { |
|
1752 | - _give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta ); |
|
1751 | + if ( ! empty($payment_meta)) { |
|
1752 | + _give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta); |
|
1753 | 1753 | } |
1754 | 1754 | |
1755 | 1755 | $deprecated_meta_keys = array( |
@@ -1758,9 +1758,9 @@ discard block |
||
1758 | 1758 | '_give_payment_user_ip' => '_give_payment_donor_ip', |
1759 | 1759 | ); |
1760 | 1760 | |
1761 | - foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) { |
|
1761 | + foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) { |
|
1762 | 1762 | // Do not add new meta key if already exist. |
1763 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) { |
|
1763 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) { |
|
1764 | 1764 | continue; |
1765 | 1765 | } |
1766 | 1766 | |
@@ -1769,25 +1769,25 @@ discard block |
||
1769 | 1769 | array( |
1770 | 1770 | 'post_id' => $post->ID, |
1771 | 1771 | 'meta_key' => $new_meta_key, |
1772 | - 'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ) |
|
1772 | + 'meta_value' => give_get_meta($post->ID, $old_meta_key, true) |
|
1773 | 1773 | ) |
1774 | 1774 | ); |
1775 | 1775 | } |
1776 | 1776 | |
1777 | 1777 | // Bailout |
1778 | - if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) { |
|
1778 | + if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) { |
|
1779 | 1779 | /* @var Give_Donor $donor */ |
1780 | - $donor = new Give_Donor( $donor_id ); |
|
1780 | + $donor = new Give_Donor($donor_id); |
|
1781 | 1781 | |
1782 | - $address['line1'] = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' ); |
|
1783 | - $address['line2'] = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' ); |
|
1784 | - $address['city'] = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' ); |
|
1785 | - $address['state'] = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' ); |
|
1786 | - $address['zip'] = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' ); |
|
1787 | - $address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' ); |
|
1782 | + $address['line1'] = give_get_meta($post->ID, '_give_donor_billing_address1', true, ''); |
|
1783 | + $address['line2'] = give_get_meta($post->ID, '_give_donor_billing_address2', true, ''); |
|
1784 | + $address['city'] = give_get_meta($post->ID, '_give_donor_billing_city', true, ''); |
|
1785 | + $address['state'] = give_get_meta($post->ID, '_give_donor_billing_state', true, ''); |
|
1786 | + $address['zip'] = give_get_meta($post->ID, '_give_donor_billing_zip', true, ''); |
|
1787 | + $address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, ''); |
|
1788 | 1788 | |
1789 | 1789 | // Save address. |
1790 | - $donor->add_address( 'billing[]', $address ); |
|
1790 | + $donor->add_address('billing[]', $address); |
|
1791 | 1791 | } |
1792 | 1792 | |
1793 | 1793 | }// End while(). |
@@ -1798,7 +1798,7 @@ discard block |
||
1798 | 1798 | // $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) ); |
1799 | 1799 | |
1800 | 1800 | // No more forms found, finish up. |
1801 | - give_set_upgrade_complete( 'v20_upgrades_payment_metadata' ); |
|
1801 | + give_set_upgrade_complete('v20_upgrades_payment_metadata'); |
|
1802 | 1802 | } |
1803 | 1803 | } |
1804 | 1804 | |
@@ -1814,7 +1814,7 @@ discard block |
||
1814 | 1814 | $give_updates = Give_Updates::get_instance(); |
1815 | 1815 | |
1816 | 1816 | // form query |
1817 | - $forms = new WP_Query( array( |
|
1817 | + $forms = new WP_Query(array( |
|
1818 | 1818 | 'paged' => $give_updates->step, |
1819 | 1819 | 'order' => 'DESC', |
1820 | 1820 | 'post_type' => 'give_log', |
@@ -1823,20 +1823,20 @@ discard block |
||
1823 | 1823 | ) |
1824 | 1824 | ); |
1825 | 1825 | |
1826 | - if ( $forms->have_posts() ) { |
|
1827 | - $give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 ); |
|
1826 | + if ($forms->have_posts()) { |
|
1827 | + $give_updates->set_percentage($forms->found_posts, $give_updates->step * 100); |
|
1828 | 1828 | |
1829 | - while ( $forms->have_posts() ) { |
|
1829 | + while ($forms->have_posts()) { |
|
1830 | 1830 | $forms->the_post(); |
1831 | 1831 | global $post; |
1832 | 1832 | |
1833 | - if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) { |
|
1833 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) { |
|
1834 | 1834 | continue; |
1835 | 1835 | } |
1836 | 1836 | |
1837 | - $term = get_the_terms( $post->ID, 'give_log_type' ); |
|
1838 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
1839 | - $term_name = ! empty( $term ) ? $term->slug : ''; |
|
1837 | + $term = get_the_terms($post->ID, 'give_log_type'); |
|
1838 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
1839 | + $term_name = ! empty($term) ? $term->slug : ''; |
|
1840 | 1840 | |
1841 | 1841 | $log_data = array( |
1842 | 1842 | 'ID' => $post->ID, |
@@ -1849,29 +1849,29 @@ discard block |
||
1849 | 1849 | ); |
1850 | 1850 | $log_meta = array(); |
1851 | 1851 | |
1852 | - if ( $old_log_meta = get_post_meta( $post->ID ) ) { |
|
1853 | - foreach ( $old_log_meta as $meta_key => $meta_value ) { |
|
1854 | - switch ( $meta_key ) { |
|
1852 | + if ($old_log_meta = get_post_meta($post->ID)) { |
|
1853 | + foreach ($old_log_meta as $meta_key => $meta_value) { |
|
1854 | + switch ($meta_key) { |
|
1855 | 1855 | case '_give_log_payment_id': |
1856 | - $log_data['log_parent'] = current( $meta_value ); |
|
1856 | + $log_data['log_parent'] = current($meta_value); |
|
1857 | 1857 | $log_meta['_give_log_form_id'] = $post->post_parent; |
1858 | 1858 | break; |
1859 | 1859 | |
1860 | 1860 | default: |
1861 | - $log_meta[ $meta_key ] = current( $meta_value ); |
|
1861 | + $log_meta[$meta_key] = current($meta_value); |
|
1862 | 1862 | } |
1863 | 1863 | } |
1864 | 1864 | } |
1865 | 1865 | |
1866 | - if ( 'api_request' === $term_name ) { |
|
1866 | + if ('api_request' === $term_name) { |
|
1867 | 1867 | $log_meta['_give_log_api_query'] = $post->post_excerpt; |
1868 | 1868 | } |
1869 | 1869 | |
1870 | - $wpdb->insert( "{$wpdb->prefix}give_logs", $log_data ); |
|
1870 | + $wpdb->insert("{$wpdb->prefix}give_logs", $log_data); |
|
1871 | 1871 | |
1872 | - if ( ! empty( $log_meta ) ) { |
|
1873 | - foreach ( $log_meta as $meta_key => $meta_value ) { |
|
1874 | - Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value ); |
|
1872 | + if ( ! empty($log_meta)) { |
|
1873 | + foreach ($log_meta as $meta_key => $meta_value) { |
|
1874 | + Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value); |
|
1875 | 1875 | } |
1876 | 1876 | } |
1877 | 1877 | |
@@ -1913,7 +1913,7 @@ discard block |
||
1913 | 1913 | Give()->logs->delete_cache(); |
1914 | 1914 | |
1915 | 1915 | // No more forms found, finish up. |
1916 | - give_set_upgrade_complete( 'v20_logs_upgrades' ); |
|
1916 | + give_set_upgrade_complete('v20_logs_upgrades'); |
|
1917 | 1917 | } |
1918 | 1918 | } |
1919 | 1919 | |
@@ -1929,19 +1929,19 @@ discard block |
||
1929 | 1929 | $give_updates = Give_Updates::get_instance(); |
1930 | 1930 | |
1931 | 1931 | // form query |
1932 | - $payments = new WP_Query( array( |
|
1932 | + $payments = new WP_Query(array( |
|
1933 | 1933 | 'paged' => $give_updates->step, |
1934 | 1934 | 'status' => 'any', |
1935 | 1935 | 'order' => 'ASC', |
1936 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1936 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1937 | 1937 | 'posts_per_page' => 100, |
1938 | 1938 | ) |
1939 | 1939 | ); |
1940 | 1940 | |
1941 | - if ( $payments->have_posts() ) { |
|
1942 | - $give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 ); |
|
1941 | + if ($payments->have_posts()) { |
|
1942 | + $give_updates->set_percentage($payments->found_posts, $give_updates->step * 100); |
|
1943 | 1943 | |
1944 | - while ( $payments->have_posts() ) { |
|
1944 | + while ($payments->have_posts()) { |
|
1945 | 1945 | $payments->the_post(); |
1946 | 1946 | global $post; |
1947 | 1947 | |
@@ -1953,19 +1953,19 @@ discard block |
||
1953 | 1953 | ARRAY_A |
1954 | 1954 | ); |
1955 | 1955 | |
1956 | - if ( ! empty( $meta_data ) ) { |
|
1957 | - foreach ( $meta_data as $index => $data ) { |
|
1956 | + if ( ! empty($meta_data)) { |
|
1957 | + foreach ($meta_data as $index => $data) { |
|
1958 | 1958 | // Check for duplicate meta values. |
1959 | - if( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) { |
|
1959 | + if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) { |
|
1960 | 1960 | continue; |
1961 | 1961 | } |
1962 | 1962 | |
1963 | - switch ( $post->post_type ) { |
|
1963 | + switch ($post->post_type) { |
|
1964 | 1964 | case 'give_forms': |
1965 | 1965 | $data['form_id'] = $data['post_id']; |
1966 | - unset( $data['post_id'] ); |
|
1966 | + unset($data['post_id']); |
|
1967 | 1967 | |
1968 | - Give()->form_meta->insert( $data ); |
|
1968 | + Give()->form_meta->insert($data); |
|
1969 | 1969 | // @todo: delete form meta from post meta table after releases 2.0. |
1970 | 1970 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
1971 | 1971 | |
@@ -1973,9 +1973,9 @@ discard block |
||
1973 | 1973 | |
1974 | 1974 | case 'give_payment': |
1975 | 1975 | $data['payment_id'] = $data['post_id']; |
1976 | - unset( $data['post_id'] ); |
|
1976 | + unset($data['post_id']); |
|
1977 | 1977 | |
1978 | - Give()->payment_meta->insert( $data ); |
|
1978 | + Give()->payment_meta->insert($data); |
|
1979 | 1979 | |
1980 | 1980 | // @todo: delete donation meta from post meta table after releases 2.0. |
1981 | 1981 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
@@ -1990,7 +1990,7 @@ discard block |
||
1990 | 1990 | wp_reset_postdata(); |
1991 | 1991 | } else { |
1992 | 1992 | // No more forms found, finish up. |
1993 | - give_set_upgrade_complete( 'v20_move_metadata_into_new_table' ); |
|
1993 | + give_set_upgrade_complete('v20_move_metadata_into_new_table'); |
|
1994 | 1994 | } |
1995 | 1995 | |
1996 | 1996 | } |
@@ -2006,44 +2006,44 @@ discard block |
||
2006 | 2006 | /* @var Give_Updates $give_updates */ |
2007 | 2007 | $give_updates = Give_Updates::get_instance(); |
2008 | 2008 | |
2009 | - $donors = Give()->donors->get_donors( array( |
|
2009 | + $donors = Give()->donors->get_donors(array( |
|
2010 | 2010 | 'paged' => $give_updates->step, |
2011 | 2011 | 'number' => 100, |
2012 | - ) ); |
|
2012 | + )); |
|
2013 | 2013 | |
2014 | - if ( $donors ) { |
|
2015 | - $give_updates->set_percentage( count( $donors ), $give_updates->step * 100 ); |
|
2014 | + if ($donors) { |
|
2015 | + $give_updates->set_percentage(count($donors), $give_updates->step * 100); |
|
2016 | 2016 | // Loop through Donors |
2017 | - foreach ( $donors as $donor ) { |
|
2017 | + foreach ($donors as $donor) { |
|
2018 | 2018 | |
2019 | - $donor_name = explode( ' ', $donor->name, 2 ); |
|
2020 | - $donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' ); |
|
2021 | - $donor_last_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' ); |
|
2019 | + $donor_name = explode(' ', $donor->name, 2); |
|
2020 | + $donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name'); |
|
2021 | + $donor_last_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name'); |
|
2022 | 2022 | |
2023 | 2023 | // If first name meta of donor is not created, then create it. |
2024 | - if ( ! $donor_first_name && isset( $donor_name[0] ) ) { |
|
2025 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] ); |
|
2024 | + if ( ! $donor_first_name && isset($donor_name[0])) { |
|
2025 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]); |
|
2026 | 2026 | } |
2027 | 2027 | |
2028 | 2028 | // If last name meta of donor is not created, then create it. |
2029 | - if ( ! $donor_last_name && isset( $donor_name[1] ) ) { |
|
2030 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] ); |
|
2029 | + if ( ! $donor_last_name && isset($donor_name[1])) { |
|
2030 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]); |
|
2031 | 2031 | } |
2032 | 2032 | |
2033 | 2033 | // If Donor is connected with WP User then update user meta. |
2034 | - if ( $donor->user_id ) { |
|
2035 | - if ( isset( $donor_name[0] ) ) { |
|
2036 | - update_user_meta( $donor->user_id, 'first_name', $donor_name[0] ); |
|
2034 | + if ($donor->user_id) { |
|
2035 | + if (isset($donor_name[0])) { |
|
2036 | + update_user_meta($donor->user_id, 'first_name', $donor_name[0]); |
|
2037 | 2037 | } |
2038 | - if ( isset( $donor_name[1] ) ) { |
|
2039 | - update_user_meta( $donor->user_id, 'last_name', $donor_name[1] ); |
|
2038 | + if (isset($donor_name[1])) { |
|
2039 | + update_user_meta($donor->user_id, 'last_name', $donor_name[1]); |
|
2040 | 2040 | } |
2041 | 2041 | } |
2042 | 2042 | } |
2043 | 2043 | |
2044 | 2044 | } else { |
2045 | 2045 | // The Update Ran. |
2046 | - give_set_upgrade_complete( 'v20_upgrades_donor_name' ); |
|
2046 | + give_set_upgrade_complete('v20_upgrades_donor_name'); |
|
2047 | 2047 | } |
2048 | 2048 | |
2049 | 2049 | } |
@@ -2072,15 +2072,15 @@ discard block |
||
2072 | 2072 | |
2073 | 2073 | $users = $user_query->get_results(); |
2074 | 2074 | |
2075 | - if ( $users ) { |
|
2076 | - $give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 ); |
|
2075 | + if ($users) { |
|
2076 | + $give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100); |
|
2077 | 2077 | |
2078 | 2078 | // Loop through Donors |
2079 | - foreach ( $users as $user ) { |
|
2079 | + foreach ($users as $user) { |
|
2080 | 2080 | /* @var Give_Donor $donor */ |
2081 | - $donor = new Give_Donor( $user->ID, true ); |
|
2081 | + $donor = new Give_Donor($user->ID, true); |
|
2082 | 2082 | |
2083 | - if ( ! $donor->id ) { |
|
2083 | + if ( ! $donor->id) { |
|
2084 | 2084 | continue; |
2085 | 2085 | } |
2086 | 2086 | |
@@ -2096,10 +2096,10 @@ discard block |
||
2096 | 2096 | ) |
2097 | 2097 | ); |
2098 | 2098 | |
2099 | - if ( ! empty( $address ) ) { |
|
2100 | - $address = maybe_unserialize( $address ); |
|
2101 | - $donor->add_address( 'personal', $address ); |
|
2102 | - $donor->add_address( 'billing[]', $address ); |
|
2099 | + if ( ! empty($address)) { |
|
2100 | + $address = maybe_unserialize($address); |
|
2101 | + $donor->add_address('personal', $address); |
|
2102 | + $donor->add_address('billing[]', $address); |
|
2103 | 2103 | |
2104 | 2104 | |
2105 | 2105 | // @todo: delete _give_user_address from user meta after releases 2.0. |
@@ -2109,7 +2109,7 @@ discard block |
||
2109 | 2109 | |
2110 | 2110 | } else { |
2111 | 2111 | // The Update Ran. |
2112 | - give_set_upgrade_complete( 'v20_upgrades_user_address' ); |
|
2112 | + give_set_upgrade_complete('v20_upgrades_user_address'); |
|
2113 | 2113 | } |
2114 | 2114 | |
2115 | 2115 | } |
@@ -2133,15 +2133,15 @@ discard block |
||
2133 | 2133 | ); |
2134 | 2134 | |
2135 | 2135 | // Alter customer table |
2136 | - foreach ( $tables as $old_table => $new_table ) { |
|
2136 | + foreach ($tables as $old_table => $new_table) { |
|
2137 | 2137 | if ( |
2138 | - $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) && |
|
2139 | - ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) ) |
|
2138 | + $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) && |
|
2139 | + ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table)) |
|
2140 | 2140 | ) { |
2141 | - $wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" ); |
|
2141 | + $wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}"); |
|
2142 | 2142 | |
2143 | - if ( "{$wpdb->prefix}give_donormeta" === $new_table ) { |
|
2144 | - $wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" ); |
|
2143 | + if ("{$wpdb->prefix}give_donormeta" === $new_table) { |
|
2144 | + $wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)"); |
|
2145 | 2145 | } |
2146 | 2146 | } |
2147 | 2147 | } |
@@ -2149,7 +2149,7 @@ discard block |
||
2149 | 2149 | $give_updates->percentage = 100; |
2150 | 2150 | |
2151 | 2151 | // No more forms found, finish up. |
2152 | - give_set_upgrade_complete( 'v20_rename_donor_tables' ); |
|
2152 | + give_set_upgrade_complete('v20_rename_donor_tables'); |
|
2153 | 2153 | |
2154 | 2154 | // Re initiate donor classes. |
2155 | 2155 | Give()->donors = new Give_DB_Donors(); |
@@ -2164,22 +2164,22 @@ discard block |
||
2164 | 2164 | * @global wpdb $wpdb |
2165 | 2165 | * @return void |
2166 | 2166 | */ |
2167 | -function give_v201_create_tables(){ |
|
2167 | +function give_v201_create_tables() { |
|
2168 | 2168 | global $wpdb; |
2169 | 2169 | |
2170 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) { |
|
2170 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) { |
|
2171 | 2171 | Give()->payment_meta->create_table(); |
2172 | 2172 | } |
2173 | 2173 | |
2174 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) { |
|
2174 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) { |
|
2175 | 2175 | Give()->form_meta->create_table(); |
2176 | 2176 | } |
2177 | 2177 | |
2178 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) { |
|
2178 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) { |
|
2179 | 2179 | Give()->logs->log_db->create_table(); |
2180 | 2180 | } |
2181 | 2181 | |
2182 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) { |
|
2182 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) { |
|
2183 | 2183 | Give()->logs->logmeta_db->create_table(); |
2184 | 2184 | } |
2185 | 2185 | } |
@@ -2196,7 +2196,7 @@ discard block |
||
2196 | 2196 | $give_updates = Give_Updates::get_instance(); |
2197 | 2197 | |
2198 | 2198 | // form query |
2199 | - $forms = new WP_Query( array( |
|
2199 | + $forms = new WP_Query(array( |
|
2200 | 2200 | 'paged' => $give_updates->step, |
2201 | 2201 | 'status' => 'any', |
2202 | 2202 | 'order' => 'ASC', |
@@ -2213,25 +2213,25 @@ discard block |
||
2213 | 2213 | ) |
2214 | 2214 | ); |
2215 | 2215 | |
2216 | - if ( $forms->have_posts() ) { |
|
2217 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) ); |
|
2216 | + if ($forms->have_posts()) { |
|
2217 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100)); |
|
2218 | 2218 | |
2219 | - while ( $forms->have_posts() ) { |
|
2219 | + while ($forms->have_posts()) { |
|
2220 | 2220 | $forms->the_post(); |
2221 | 2221 | global $post; |
2222 | 2222 | |
2223 | 2223 | // Do not add new meta keys if already refactored. |
2224 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) { |
|
2224 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) { |
|
2225 | 2225 | continue; |
2226 | 2226 | } |
2227 | 2227 | |
2228 | 2228 | |
2229 | 2229 | // Split _give_payment_meta meta. |
2230 | 2230 | // @todo Remove _give_payment_meta after releases 2.0 |
2231 | - $payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true ); |
|
2231 | + $payment_meta = give_get_meta($post->ID, '_give_payment_meta', true); |
|
2232 | 2232 | |
2233 | - if ( ! empty( $payment_meta ) ) { |
|
2234 | - _give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta ); |
|
2233 | + if ( ! empty($payment_meta)) { |
|
2234 | + _give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta); |
|
2235 | 2235 | } |
2236 | 2236 | |
2237 | 2237 | $deprecated_meta_keys = array( |
@@ -2240,9 +2240,9 @@ discard block |
||
2240 | 2240 | '_give_payment_user_ip' => '_give_payment_donor_ip', |
2241 | 2241 | ); |
2242 | 2242 | |
2243 | - foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) { |
|
2243 | + foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) { |
|
2244 | 2244 | // Do not add new meta key if already exist. |
2245 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) { |
|
2245 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) { |
|
2246 | 2246 | continue; |
2247 | 2247 | } |
2248 | 2248 | |
@@ -2251,25 +2251,25 @@ discard block |
||
2251 | 2251 | array( |
2252 | 2252 | 'post_id' => $post->ID, |
2253 | 2253 | 'meta_key' => $new_meta_key, |
2254 | - 'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ) |
|
2254 | + 'meta_value' => give_get_meta($post->ID, $old_meta_key, true) |
|
2255 | 2255 | ) |
2256 | 2256 | ); |
2257 | 2257 | } |
2258 | 2258 | |
2259 | 2259 | // Bailout |
2260 | - if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) { |
|
2260 | + if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) { |
|
2261 | 2261 | /* @var Give_Donor $donor */ |
2262 | - $donor = new Give_Donor( $donor_id ); |
|
2262 | + $donor = new Give_Donor($donor_id); |
|
2263 | 2263 | |
2264 | - $address['line1'] = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' ); |
|
2265 | - $address['line2'] = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' ); |
|
2266 | - $address['city'] = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' ); |
|
2267 | - $address['state'] = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' ); |
|
2268 | - $address['zip'] = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' ); |
|
2269 | - $address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' ); |
|
2264 | + $address['line1'] = give_get_meta($post->ID, '_give_donor_billing_address1', true, ''); |
|
2265 | + $address['line2'] = give_get_meta($post->ID, '_give_donor_billing_address2', true, ''); |
|
2266 | + $address['city'] = give_get_meta($post->ID, '_give_donor_billing_city', true, ''); |
|
2267 | + $address['state'] = give_get_meta($post->ID, '_give_donor_billing_state', true, ''); |
|
2268 | + $address['zip'] = give_get_meta($post->ID, '_give_donor_billing_zip', true, ''); |
|
2269 | + $address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, ''); |
|
2270 | 2270 | |
2271 | 2271 | // Save address. |
2272 | - $donor->add_address( 'billing[]', $address ); |
|
2272 | + $donor->add_address('billing[]', $address); |
|
2273 | 2273 | } |
2274 | 2274 | |
2275 | 2275 | }// End while(). |
@@ -2280,7 +2280,7 @@ discard block |
||
2280 | 2280 | // $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) ); |
2281 | 2281 | |
2282 | 2282 | // No more forms found, finish up. |
2283 | - give_set_upgrade_complete( 'v201_upgrades_payment_metadata' ); |
|
2283 | + give_set_upgrade_complete('v201_upgrades_payment_metadata'); |
|
2284 | 2284 | } |
2285 | 2285 | } |
2286 | 2286 | |
@@ -2295,19 +2295,19 @@ discard block |
||
2295 | 2295 | $give_updates = Give_Updates::get_instance(); |
2296 | 2296 | |
2297 | 2297 | // form query |
2298 | - $payments = new WP_Query( array( |
|
2298 | + $payments = new WP_Query(array( |
|
2299 | 2299 | 'paged' => $give_updates->step, |
2300 | 2300 | 'status' => 'any', |
2301 | 2301 | 'order' => 'ASC', |
2302 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
2302 | + 'post_type' => array('give_forms', 'give_payment'), |
|
2303 | 2303 | 'posts_per_page' => 100, |
2304 | 2304 | ) |
2305 | 2305 | ); |
2306 | 2306 | |
2307 | - if ( $payments->have_posts() ) { |
|
2308 | - $give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 ); |
|
2307 | + if ($payments->have_posts()) { |
|
2308 | + $give_updates->set_percentage($payments->found_posts, $give_updates->step * 100); |
|
2309 | 2309 | |
2310 | - while ( $payments->have_posts() ) { |
|
2310 | + while ($payments->have_posts()) { |
|
2311 | 2311 | $payments->the_post(); |
2312 | 2312 | global $post; |
2313 | 2313 | |
@@ -2319,19 +2319,19 @@ discard block |
||
2319 | 2319 | ARRAY_A |
2320 | 2320 | ); |
2321 | 2321 | |
2322 | - if ( ! empty( $meta_data ) ) { |
|
2323 | - foreach ( $meta_data as $index => $data ) { |
|
2322 | + if ( ! empty($meta_data)) { |
|
2323 | + foreach ($meta_data as $index => $data) { |
|
2324 | 2324 | // Check for duplicate meta values. |
2325 | - if( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) { |
|
2325 | + if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) { |
|
2326 | 2326 | continue; |
2327 | 2327 | } |
2328 | 2328 | |
2329 | - switch ( $post->post_type ) { |
|
2329 | + switch ($post->post_type) { |
|
2330 | 2330 | case 'give_forms': |
2331 | 2331 | $data['form_id'] = $data['post_id']; |
2332 | - unset( $data['post_id'] ); |
|
2332 | + unset($data['post_id']); |
|
2333 | 2333 | |
2334 | - Give()->form_meta->insert( $data ); |
|
2334 | + Give()->form_meta->insert($data); |
|
2335 | 2335 | // @todo: delete form meta from post meta table after releases 2.0. |
2336 | 2336 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
2337 | 2337 | |
@@ -2339,9 +2339,9 @@ discard block |
||
2339 | 2339 | |
2340 | 2340 | case 'give_payment': |
2341 | 2341 | $data['payment_id'] = $data['post_id']; |
2342 | - unset( $data['post_id'] ); |
|
2342 | + unset($data['post_id']); |
|
2343 | 2343 | |
2344 | - Give()->payment_meta->insert( $data ); |
|
2344 | + Give()->payment_meta->insert($data); |
|
2345 | 2345 | |
2346 | 2346 | // @todo: delete donation meta from post meta table after releases 2.0. |
2347 | 2347 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
@@ -2356,7 +2356,7 @@ discard block |
||
2356 | 2356 | wp_reset_postdata(); |
2357 | 2357 | } else { |
2358 | 2358 | // No more forms found, finish up. |
2359 | - give_set_upgrade_complete( 'v201_move_metadata_into_new_table' ); |
|
2359 | + give_set_upgrade_complete('v201_move_metadata_into_new_table'); |
|
2360 | 2360 | } |
2361 | 2361 | |
2362 | 2362 | } |
@@ -2372,7 +2372,7 @@ discard block |
||
2372 | 2372 | $give_updates = Give_Updates::get_instance(); |
2373 | 2373 | |
2374 | 2374 | // form query |
2375 | - $forms = new WP_Query( array( |
|
2375 | + $forms = new WP_Query(array( |
|
2376 | 2376 | 'paged' => $give_updates->step, |
2377 | 2377 | 'order' => 'DESC', |
2378 | 2378 | 'post_type' => 'give_log', |
@@ -2381,20 +2381,20 @@ discard block |
||
2381 | 2381 | ) |
2382 | 2382 | ); |
2383 | 2383 | |
2384 | - if ( $forms->have_posts() ) { |
|
2385 | - $give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 ); |
|
2384 | + if ($forms->have_posts()) { |
|
2385 | + $give_updates->set_percentage($forms->found_posts, $give_updates->step * 100); |
|
2386 | 2386 | |
2387 | - while ( $forms->have_posts() ) { |
|
2387 | + while ($forms->have_posts()) { |
|
2388 | 2388 | $forms->the_post(); |
2389 | 2389 | global $post; |
2390 | 2390 | |
2391 | - if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) { |
|
2391 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) { |
|
2392 | 2392 | continue; |
2393 | 2393 | } |
2394 | 2394 | |
2395 | - $term = get_the_terms( $post->ID, 'give_log_type' ); |
|
2396 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
2397 | - $term_name = ! empty( $term ) ? $term->slug : ''; |
|
2395 | + $term = get_the_terms($post->ID, 'give_log_type'); |
|
2396 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
2397 | + $term_name = ! empty($term) ? $term->slug : ''; |
|
2398 | 2398 | |
2399 | 2399 | $log_data = array( |
2400 | 2400 | 'ID' => $post->ID, |
@@ -2407,29 +2407,29 @@ discard block |
||
2407 | 2407 | ); |
2408 | 2408 | $log_meta = array(); |
2409 | 2409 | |
2410 | - if ( $old_log_meta = get_post_meta( $post->ID ) ) { |
|
2411 | - foreach ( $old_log_meta as $meta_key => $meta_value ) { |
|
2412 | - switch ( $meta_key ) { |
|
2410 | + if ($old_log_meta = get_post_meta($post->ID)) { |
|
2411 | + foreach ($old_log_meta as $meta_key => $meta_value) { |
|
2412 | + switch ($meta_key) { |
|
2413 | 2413 | case '_give_log_payment_id': |
2414 | - $log_data['log_parent'] = current( $meta_value ); |
|
2414 | + $log_data['log_parent'] = current($meta_value); |
|
2415 | 2415 | $log_meta['_give_log_form_id'] = $post->post_parent; |
2416 | 2416 | break; |
2417 | 2417 | |
2418 | 2418 | default: |
2419 | - $log_meta[ $meta_key ] = current( $meta_value ); |
|
2419 | + $log_meta[$meta_key] = current($meta_value); |
|
2420 | 2420 | } |
2421 | 2421 | } |
2422 | 2422 | } |
2423 | 2423 | |
2424 | - if ( 'api_request' === $term_name ) { |
|
2424 | + if ('api_request' === $term_name) { |
|
2425 | 2425 | $log_meta['_give_log_api_query'] = $post->post_excerpt; |
2426 | 2426 | } |
2427 | 2427 | |
2428 | - $wpdb->insert( "{$wpdb->prefix}give_logs", $log_data ); |
|
2428 | + $wpdb->insert("{$wpdb->prefix}give_logs", $log_data); |
|
2429 | 2429 | |
2430 | - if ( ! empty( $log_meta ) ) { |
|
2431 | - foreach ( $log_meta as $meta_key => $meta_value ) { |
|
2432 | - Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value ); |
|
2430 | + if ( ! empty($log_meta)) { |
|
2431 | + foreach ($log_meta as $meta_key => $meta_value) { |
|
2432 | + Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value); |
|
2433 | 2433 | } |
2434 | 2434 | } |
2435 | 2435 | |
@@ -2442,7 +2442,7 @@ discard block |
||
2442 | 2442 | Give()->logs->delete_cache(); |
2443 | 2443 | |
2444 | 2444 | // No more forms found, finish up. |
2445 | - give_set_upgrade_complete( 'v201_logs_upgrades' ); |
|
2445 | + give_set_upgrade_complete('v201_logs_upgrades'); |
|
2446 | 2446 | } |
2447 | 2447 | } |
2448 | 2448 | |
@@ -2453,54 +2453,54 @@ discard block |
||
2453 | 2453 | * @since 2.0.1 |
2454 | 2454 | * @return void |
2455 | 2455 | */ |
2456 | -function give_v201_add_missing_donors_callback(){ |
|
2456 | +function give_v201_add_missing_donors_callback() { |
|
2457 | 2457 | global $wpdb; |
2458 | 2458 | |
2459 | - if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) { |
|
2460 | - $customers = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' ); |
|
2461 | - $donors = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' ); |
|
2459 | + if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) { |
|
2460 | + $customers = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id'); |
|
2461 | + $donors = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id'); |
|
2462 | 2462 | $donor_data = array(); |
2463 | 2463 | |
2464 | - if ( $missing_donors = array_diff( $customers, $donors ) ) { |
|
2465 | - foreach ( $missing_donors as $donor_id ) { |
|
2464 | + if ($missing_donors = array_diff($customers, $donors)) { |
|
2465 | + foreach ($missing_donors as $donor_id) { |
|
2466 | 2466 | $donor_data[] = array( |
2467 | - 'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ), |
|
2468 | - 'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ), |
|
2467 | + 'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)), |
|
2468 | + 'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)), |
|
2469 | 2469 | |
2470 | 2470 | ); |
2471 | 2471 | } |
2472 | 2472 | } |
2473 | 2473 | |
2474 | - if( ! empty( $donor_data ) ) { |
|
2474 | + if ( ! empty($donor_data)) { |
|
2475 | 2475 | $donor_table_name = Give()->donors->table_name; |
2476 | 2476 | $donor_meta_table_name = Give()->donor_meta->table_name; |
2477 | 2477 | |
2478 | 2478 | Give()->donors->table_name = "{$wpdb->prefix}give_donors"; |
2479 | 2479 | Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta"; |
2480 | 2480 | |
2481 | - foreach ( $donor_data as $donor ) { |
|
2481 | + foreach ($donor_data as $donor) { |
|
2482 | 2482 | $donor['info'][0] = (array) $donor['info'][0]; |
2483 | 2483 | |
2484 | 2484 | // Prevent duplicate meta id issue. |
2485 | - if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ){ |
|
2485 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) { |
|
2486 | 2486 | continue; |
2487 | 2487 | } |
2488 | 2488 | |
2489 | - $donor_id = Give()->donors->add( $donor['info'][0] ); |
|
2489 | + $donor_id = Give()->donors->add($donor['info'][0]); |
|
2490 | 2490 | |
2491 | - if( ! empty( $donor['meta'] ) ) { |
|
2492 | - foreach ( $donor['meta'] as $donor_meta ) { |
|
2491 | + if ( ! empty($donor['meta'])) { |
|
2492 | + foreach ($donor['meta'] as $donor_meta) { |
|
2493 | 2493 | $donor_meta = (array) $donor_meta; |
2494 | 2494 | |
2495 | 2495 | // Prevent duplicate meta id issue. |
2496 | - if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ){ |
|
2497 | - unset( $donor_meta['meta_id'] ); |
|
2496 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) { |
|
2497 | + unset($donor_meta['meta_id']); |
|
2498 | 2498 | } |
2499 | 2499 | |
2500 | 2500 | $donor_meta['donor_id'] = $donor_meta['customer_id']; |
2501 | - unset( $donor_meta['customer_id'] ); |
|
2501 | + unset($donor_meta['customer_id']); |
|
2502 | 2502 | |
2503 | - Give()->donor_meta->insert( $donor_meta ); |
|
2503 | + Give()->donor_meta->insert($donor_meta); |
|
2504 | 2504 | } |
2505 | 2505 | } |
2506 | 2506 | |
@@ -2519,35 +2519,35 @@ discard block |
||
2519 | 2519 | ) |
2520 | 2520 | ); |
2521 | 2521 | |
2522 | - $donor = new Give_Donor( $donor_id ); |
|
2522 | + $donor = new Give_Donor($donor_id); |
|
2523 | 2523 | |
2524 | - if ( ! empty( $address ) ) { |
|
2525 | - $address = maybe_unserialize( $address ); |
|
2526 | - $donor->add_address( 'personal', $address ); |
|
2527 | - $donor->add_address( 'billing[]', $address ); |
|
2524 | + if ( ! empty($address)) { |
|
2525 | + $address = maybe_unserialize($address); |
|
2526 | + $donor->add_address('personal', $address); |
|
2527 | + $donor->add_address('billing[]', $address); |
|
2528 | 2528 | } |
2529 | 2529 | |
2530 | - $donor_name = explode( ' ', $donor->name, 2 ); |
|
2531 | - $donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' ); |
|
2532 | - $donor_last_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' ); |
|
2530 | + $donor_name = explode(' ', $donor->name, 2); |
|
2531 | + $donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name'); |
|
2532 | + $donor_last_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name'); |
|
2533 | 2533 | |
2534 | 2534 | // If first name meta of donor is not created, then create it. |
2535 | - if ( ! $donor_first_name && isset( $donor_name[0] ) ) { |
|
2536 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] ); |
|
2535 | + if ( ! $donor_first_name && isset($donor_name[0])) { |
|
2536 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]); |
|
2537 | 2537 | } |
2538 | 2538 | |
2539 | 2539 | // If last name meta of donor is not created, then create it. |
2540 | - if ( ! $donor_last_name && isset( $donor_name[1] ) ) { |
|
2541 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] ); |
|
2540 | + if ( ! $donor_last_name && isset($donor_name[1])) { |
|
2541 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]); |
|
2542 | 2542 | } |
2543 | 2543 | |
2544 | 2544 | // If Donor is connected with WP User then update user meta. |
2545 | - if ( $donor->user_id ) { |
|
2546 | - if ( isset( $donor_name[0] ) ) { |
|
2547 | - update_user_meta( $donor->user_id, 'first_name', $donor_name[0] ); |
|
2545 | + if ($donor->user_id) { |
|
2546 | + if (isset($donor_name[0])) { |
|
2547 | + update_user_meta($donor->user_id, 'first_name', $donor_name[0]); |
|
2548 | 2548 | } |
2549 | - if ( isset( $donor_name[1] ) ) { |
|
2550 | - update_user_meta( $donor->user_id, 'last_name', $donor_name[1] ); |
|
2549 | + if (isset($donor_name[1])) { |
|
2550 | + update_user_meta($donor->user_id, 'last_name', $donor_name[1]); |
|
2551 | 2551 | } |
2552 | 2552 | } |
2553 | 2553 | } |
@@ -2558,5 +2558,5 @@ discard block |
||
2558 | 2558 | } |
2559 | 2559 | |
2560 | 2560 | Give_Updates::get_instance()->percentage = 100; |
2561 | - give_set_upgrade_complete('v201_add_missing_donors' ); |
|
2561 | + give_set_upgrade_complete('v201_add_missing_donors'); |
|
2562 | 2562 | } |
2563 | 2563 | \ 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 | |
@@ -18,48 +18,47 @@ discard block |
||
18 | 18 | ?> |
19 | 19 | <div class="wrap" id="poststuff"> |
20 | 20 | <div id="give-updates"> |
21 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1> |
|
21 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1> |
|
22 | 22 | <hr class="wp-header-end"> |
23 | 23 | |
24 | 24 | <div class="give-update-panel-content"> |
25 | - <p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p> |
|
25 | + <p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p> |
|
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <?php $db_updates = $give_updates->get_pending_db_update_count(); ?> |
29 | - <?php if ( ! empty( $db_updates ) ) : ?> |
|
29 | + <?php if ( ! empty($db_updates)) : ?> |
|
30 | 30 | <?php |
31 | 31 | $is_doing_updates = $give_updates->is_doing_updates(); |
32 | - $db_update_url = add_query_arg( array( 'type' => 'database', ) ); |
|
33 | - $resume_updates = get_option( 'give_doing_upgrade' ); |
|
34 | - $width = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0; |
|
32 | + $db_update_url = add_query_arg(array('type' => 'database',)); |
|
33 | + $resume_updates = get_option('give_doing_upgrade'); |
|
34 | + $width = ! empty($resume_updates) ? $resume_updates['percentage'] : 0; |
|
35 | 35 | ?> |
36 | - <div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>"> |
|
36 | + <div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>"> |
|
37 | 37 | <div class="postbox-container"> |
38 | 38 | <div class="postbox"> |
39 | - <h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2> |
|
39 | + <h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2> |
|
40 | 40 | <div class="inside"> |
41 | 41 | <div class="panel-content"> |
42 | 42 | <p class="give-update-button"> |
43 | - <span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
43 | + <span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
44 | 44 | <?php echo sprintf( |
45 | - __( '%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give' ), |
|
45 | + __('%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give'), |
|
46 | 46 | $is_doing_updates ? |
47 | - __( 'Give is currently updating the database in the background.', 'give' ) : |
|
48 | - __( 'Give needs to update the database.', 'give' ), |
|
47 | + __('Give is currently updating the database in the background.', 'give') : __('Give needs to update the database.', 'give'), |
|
49 | 48 | $db_update_url, |
50 | - ( $is_doing_updates ? 'give-hidden' : '' ), |
|
51 | - __( 'Update now', 'give' ) |
|
49 | + ($is_doing_updates ? 'give-hidden' : ''), |
|
50 | + __('Update now', 'give') |
|
52 | 51 | ); |
53 | 52 | ?> |
54 | 53 | </span> |
55 | - <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
54 | + <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
56 | 55 | <?php _e('The updates have been paused.', 'give'); ?> |
57 | 56 | </span> |
58 | 57 | |
59 | - <?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?> |
|
60 | - <button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"><?php _e( 'Restart Upgrades', 'give' ); ?></button> |
|
61 | - <?php elseif( $give_updates->is_doing_updates() ): ?> |
|
62 | - <button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"><?php _e( 'Pause Upgrades', 'give' ); ?></button> |
|
58 | + <?php if (Give_Updates::$background_updater->is_paused_process()) : ?> |
|
59 | + <button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"><?php _e('Restart Upgrades', 'give'); ?></button> |
|
60 | + <?php elseif ($give_updates->is_doing_updates()): ?> |
|
61 | + <button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"><?php _e('Pause Upgrades', 'give'); ?></button> |
|
63 | 62 | <?php endif; ?> |
64 | 63 | |
65 | 64 | <script type="text/javascript"> |
@@ -67,7 +66,7 @@ discard block |
||
67 | 66 | e.preventDefault(); |
68 | 67 | jQuery('.give-doing-update-text-p').hide(); |
69 | 68 | jQuery('.give-update-paused-text-p').show(); |
70 | - if (window.confirm('<?php echo esc_js( __( 'Do you want to stop the update process now?', 'give' ) ); ?>')) { |
|
69 | + if (window.confirm('<?php echo esc_js(__('Do you want to stop the update process now?', 'give')); ?>')) { |
|
71 | 70 | window.location.assign(jQuery(this).data('redirect-url')); |
72 | 71 | } |
73 | 72 | }); |
@@ -75,7 +74,7 @@ discard block |
||
75 | 74 | e.preventDefault(); |
76 | 75 | jQuery('.give-doing-update-text-p').show(); |
77 | 76 | jQuery('.give-update-paused-text-p').hide(); |
78 | - if (window.confirm('<?php echo esc_js( __( 'Do you want to restart the update process?', 'give' ) ); ?>')) { |
|
77 | + if (window.confirm('<?php echo esc_js(__('Do you want to restart the update process?', 'give')); ?>')) { |
|
79 | 78 | window.location.assign(jQuery(this).data('redirect-url')); |
80 | 79 | } |
81 | 80 | }); |
@@ -87,7 +86,7 @@ discard block |
||
87 | 86 | <strong> |
88 | 87 | <?php |
89 | 88 | echo sprintf( |
90 | - __( 'Update %s of %s', 'give' ), |
|
89 | + __('Update %s of %s', 'give'), |
|
91 | 90 | $give_updates->get_running_db_update(), |
92 | 91 | $give_updates->get_total_new_db_update_count() |
93 | 92 | ); |
@@ -95,10 +94,10 @@ discard block |
||
95 | 94 | </strong> |
96 | 95 | </p> |
97 | 96 | <div class="progress-content"> |
98 | - <?php if ( $is_doing_updates ) : ?> |
|
97 | + <?php if ($is_doing_updates) : ?> |
|
99 | 98 | <div class="notice-wrap give-clearfix"> |
100 | 99 | |
101 | - <?php if ( ! Give_Updates::$background_updater->is_paused_process() ) : ?> |
|
100 | + <?php if ( ! Give_Updates::$background_updater->is_paused_process()) : ?> |
|
102 | 101 | <span class="spinner is-active"></span> |
103 | 102 | <?php endif; ?> |
104 | 103 | |
@@ -110,7 +109,7 @@ discard block |
||
110 | 109 | </div> |
111 | 110 | </div> |
112 | 111 | |
113 | - <?php if ( ! $is_doing_updates ) : ?> |
|
112 | + <?php if ( ! $is_doing_updates) : ?> |
|
114 | 113 | <div class="give-run-database-update"></div> |
115 | 114 | <?php endif; ?> |
116 | 115 | </div> |
@@ -121,17 +120,17 @@ discard block |
||
121 | 120 | <?php endif; ?> |
122 | 121 | |
123 | 122 | <?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?> |
124 | - <?php if ( ! empty( $plugin_updates ) ) : ?> |
|
125 | - <?php $plugin_update_url = add_query_arg( array( |
|
123 | + <?php if ( ! empty($plugin_updates)) : ?> |
|
124 | + <?php $plugin_update_url = add_query_arg(array( |
|
126 | 125 | 's' => 'Give', |
127 | - ), admin_url( '/plugins.php' ) ); ?> |
|
126 | + ), admin_url('/plugins.php')); ?> |
|
128 | 127 | <div id="give-plugin-updates"> |
129 | 128 | <div class="postbox-container"> |
130 | 129 | <div class="postbox"> |
131 | - <h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2> |
|
130 | + <h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2> |
|
132 | 131 | <div class="inside"> |
133 | 132 | <div class="panel-content"> |
134 | - <p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url ); ?></p> |
|
133 | + <p><?php echo sprintf(__('There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give'), _n('is', 'are', $plugin_updates, 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), _n('needs', 'need', $plugin_updates, 'give'), $plugin_update_url); ?></p> |
|
135 | 134 | <?php include_once 'plugins-update-section.php'; ?> |
136 | 135 | </div> |
137 | 136 | </div> |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Logs' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Logs')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Logs. |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'logs'; |
37 | - $this->label = __( 'Logs', 'give' ); |
|
37 | + $this->label = __('Logs', 'give'); |
|
38 | 38 | |
39 | 39 | $this->default_tab = 'sales'; |
40 | 40 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function get_settings() { |
52 | 52 | // Get settings. |
53 | - $settings = apply_filters( 'give_settings_logs', array( |
|
53 | + $settings = apply_filters('give_settings_logs', array( |
|
54 | 54 | array( |
55 | 55 | 'id' => 'give_tools_logs', |
56 | 56 | 'type' => 'title', |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ), |
59 | 59 | array( |
60 | 60 | 'id' => 'logs', |
61 | - 'name' => __( 'Log', 'give' ), |
|
61 | + 'name' => __('Log', 'give'), |
|
62 | 62 | 'type' => 'logs', |
63 | 63 | |
64 | 64 | ), |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'type' => 'sectionend', |
68 | 68 | 'table_html' => false, |
69 | 69 | ), |
70 | - ) ); |
|
70 | + )); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Filter the settings. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param array $settings |
78 | 78 | */ |
79 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
79 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
80 | 80 | |
81 | 81 | // Output. |
82 | 82 | return $settings; |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_sections() { |
92 | 92 | $sections = array( |
93 | - 'sales' => __( 'Donations', 'give' ), |
|
94 | - 'gateway_errors' => __( 'Payment Errors', 'give' ), |
|
95 | - 'api_requests' => __( 'API Requests', 'give' ), |
|
96 | - 'updates' => __( 'Updates', 'give' ), |
|
93 | + 'sales' => __('Donations', 'give'), |
|
94 | + 'gateway_errors' => __('Payment Errors', 'give'), |
|
95 | + 'api_requests' => __('API Requests', 'give'), |
|
96 | + 'updates' => __('Updates', 'give'), |
|
97 | 97 | ); |
98 | 98 | |
99 | - $sections = apply_filters( 'give_log_views', $sections ); |
|
99 | + $sections = apply_filters('give_log_views', $sections); |
|
100 | 100 | |
101 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
101 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 |
@@ -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 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_get_logs_tab() { |
24 | 24 | |
25 | - require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' ); |
|
25 | + require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'); |
|
26 | 26 | |
27 | 27 | // Get current section. |
28 | 28 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | - do_action( "give_logs_view_{$current_section}" ); |
|
35 | + do_action("give_logs_view_{$current_section}"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function give_logs_view_sales() { |
48 | 48 | |
49 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
49 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
50 | 50 | |
51 | 51 | $logs_table = new Give_Sales_Log_Table(); |
52 | 52 | $logs_table->prepare_items(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @since 1.8.12 |
61 | 61 | */ |
62 | - do_action( 'give_logs_donations_top' ); |
|
62 | + do_action('give_logs_donations_top'); |
|
63 | 63 | |
64 | 64 | $logs_table->display(); ?> |
65 | 65 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @since 1.8.12 |
75 | 75 | */ |
76 | - do_action( 'give_logs_donations_bottom' ); |
|
76 | + do_action('give_logs_donations_bottom'); |
|
77 | 77 | ?> |
78 | 78 | |
79 | 79 | </div> |
80 | 80 | <?php |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
83 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Update Logs |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @return void |
91 | 91 | */ |
92 | 92 | function give_logs_view_updates() { |
93 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-update-logs-list-table.php' ); |
|
93 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-update-logs-list-table.php'); |
|
94 | 94 | |
95 | 95 | $logs_table = new Give_Update_Log_Table(); |
96 | 96 | $logs_table->prepare_items(); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @since 2.0.1 |
105 | 105 | */ |
106 | - do_action( 'give_logs_update_top' ); |
|
106 | + do_action('give_logs_update_top'); |
|
107 | 107 | |
108 | 108 | $logs_table->display(); ?> |
109 | 109 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @since 2.0.1 |
119 | 119 | */ |
120 | - do_action( 'give_logs_update_bottom' ); |
|
120 | + do_action('give_logs_update_bottom'); |
|
121 | 121 | ?> |
122 | 122 | |
123 | 123 | </div> |
124 | 124 | <?php |
125 | 125 | } |
126 | 126 | |
127 | -add_action( 'give_logs_view_updates', 'give_logs_view_updates' ); |
|
127 | +add_action('give_logs_view_updates', 'give_logs_view_updates'); |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Gateway Error Logs |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @return void |
136 | 136 | */ |
137 | 137 | function give_logs_view_gateway_errors() { |
138 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' ); |
|
138 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php'); |
|
139 | 139 | |
140 | 140 | $logs_table = new Give_Gateway_Error_Log_Table(); |
141 | 141 | $logs_table->prepare_items(); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @since 1.8.12 |
150 | 150 | */ |
151 | - do_action( 'give_logs_payment_error_top' ); |
|
151 | + do_action('give_logs_payment_error_top'); |
|
152 | 152 | |
153 | 153 | $logs_table->display(); ?> |
154 | 154 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @since 1.8.12 |
164 | 164 | */ |
165 | - do_action( 'give_logs_payment_error_bottom' ); |
|
165 | + do_action('give_logs_payment_error_bottom'); |
|
166 | 166 | ?> |
167 | 167 | |
168 | 168 | </div> |
169 | 169 | <?php |
170 | 170 | } |
171 | 171 | |
172 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
172 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
173 | 173 | |
174 | 174 | /** |
175 | 175 | * API Request Logs |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @return void |
181 | 181 | */ |
182 | 182 | function give_logs_view_api_requests() { |
183 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' ); |
|
183 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php'); |
|
184 | 184 | |
185 | 185 | $logs_table = new Give_API_Request_Log_Table(); |
186 | 186 | $logs_table->prepare_items(); |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @since 1.0 |
192 | 192 | */ |
193 | - do_action( 'give_logs_api_requests_top' ); |
|
193 | + do_action('give_logs_api_requests_top'); |
|
194 | 194 | |
195 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
195 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
196 | 196 | $logs_table->display(); |
197 | 197 | ?> |
198 | 198 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @since 1.0 |
208 | 208 | */ |
209 | - do_action( 'give_logs_api_requests_bottom' ); |
|
209 | + do_action('give_logs_api_requests_bottom'); |
|
210 | 210 | } |
211 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
211 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
212 | 212 | |
213 | 213 | /** |
214 | 214 | * Renders the log views drop down. |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | $current_section = give_get_current_setting_section(); |
221 | 221 | |
222 | 222 | // If there are not any event attach to action then do not show form. |
223 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
223 | + if ( ! has_action('give_log_view_actions')) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | ?> |
227 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
227 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
228 | 228 | <?php |
229 | 229 | /** |
230 | 230 | * Fires after displaying the reports page views drop down. |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @since 1.0 |
235 | 235 | */ |
236 | - do_action( 'give_log_view_actions' ); |
|
236 | + do_action('give_log_view_actions'); |
|
237 | 237 | ?> |
238 | 238 | |
239 | 239 | <input type="hidden" name="post_type" value="give_forms"/> |
240 | 240 | <input type="hidden" name="page" value="give-tools"/> |
241 | 241 | <input type="hidden" name="tab" value="logs"/> |
242 | 242 | |
243 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
243 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
244 | 244 | </form> |
245 | 245 | <?php |
246 | 246 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return string |
254 | 254 | */ |
255 | -function give_tools_set_form_method( $method ) { |
|
255 | +function give_tools_set_form_method($method) { |
|
256 | 256 | return 'get'; |
257 | 257 | } |
258 | -add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 ); |
|
258 | +add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10); |
@@ -10,13 +10,13 @@ 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 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | - 'ajax' => false,// Does this table support ajax? |
|
52 | - ) ); |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | + 'ajax' => false, // Does this table support ajax? |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
66 | + public function search_box($text, $input_id) { |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function get_columns() { |
78 | 78 | $columns = array( |
79 | - 'ID' => __( 'Log ID', 'give' ), |
|
80 | - 'date' => __( 'Date', 'give' ), |
|
81 | - 'details' => __( 'Process Details', 'give' ), |
|
79 | + 'ID' => __('Log ID', 'give'), |
|
80 | + 'date' => __('Date', 'give'), |
|
81 | + 'details' => __('Process Details', 'give'), |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | return $columns; |
@@ -95,17 +95,17 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return string Column Name |
97 | 97 | */ |
98 | - public function column_default( $item, $column_name ) { |
|
99 | - switch ( $column_name ) { |
|
98 | + public function column_default($item, $column_name) { |
|
99 | + switch ($column_name) { |
|
100 | 100 | case 'ID': |
101 | 101 | return sprintf( |
102 | 102 | '<span class="give-item-label give-item-label-gray">%1$s</span> %2$s', |
103 | - esc_attr( $item[ $column_name ] ), |
|
104 | - esc_attr( $item['title'] ) |
|
103 | + esc_attr($item[$column_name]), |
|
104 | + esc_attr($item['title']) |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | default: |
108 | - return esc_attr( $item[ $column_name ] ); |
|
108 | + return esc_attr($item[$column_name]); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -119,24 +119,24 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return void |
121 | 121 | */ |
122 | - public function column_details( $item ) { |
|
123 | - echo Give()->tooltips->render_link( array( |
|
124 | - 'label' => __( 'View Update Log', 'give' ), |
|
122 | + public function column_details($item) { |
|
123 | + echo Give()->tooltips->render_link(array( |
|
124 | + 'label' => __('View Update Log', 'give'), |
|
125 | 125 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
126 | 126 | 'link' => "#TB_inline?width=640&inlineId=log-details-{$item['ID']}", |
127 | 127 | 'attributes' => array( |
128 | 128 | 'class' => 'thickbox give-error-log-details-link button button-small', |
129 | 129 | ), |
130 | - ) ); |
|
130 | + )); |
|
131 | 131 | ?> |
132 | 132 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
133 | 133 | <?php |
134 | 134 | |
135 | 135 | // Print Log Content, if not empty. |
136 | - if ( ! empty( $item['log_content'] ) ) { |
|
136 | + if ( ! empty($item['log_content'])) { |
|
137 | 137 | echo sprintf( |
138 | 138 | '<p><pre>%1$s</pre></div>', |
139 | - esc_html( $item['log_content'] ) |
|
139 | + esc_html($item['log_content']) |
|
140 | 140 | ); |
141 | 141 | } |
142 | 142 | ?> |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @param string $which |
159 | 159 | */ |
160 | - protected function display_tablenav( $which ) { |
|
161 | - if ( 'top' === $which ) { |
|
162 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
160 | + protected function display_tablenav($which) { |
|
161 | + if ('top' === $which) { |
|
162 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
163 | 163 | } |
164 | 164 | ?> |
165 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
165 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
166 | 166 | |
167 | 167 | <div class="alignleft actions bulkactions"> |
168 | - <?php $this->bulk_actions( $which ); ?> |
|
168 | + <?php $this->bulk_actions($which); ?> |
|
169 | 169 | </div> |
170 | 170 | <?php |
171 | - $this->extra_tablenav( $which ); |
|
172 | - $this->pagination( $which ); |
|
171 | + $this->extra_tablenav($which); |
|
172 | + $this->pagination($which); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <br class="clear"/> |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @return int Current page number |
187 | 187 | */ |
188 | 188 | public function get_paged() { |
189 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
189 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return void |
201 | 201 | */ |
202 | - function bulk_actions( $which = '' ) { |
|
202 | + function bulk_actions($which = '') { |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | 'posts_per_page' => $this->per_page, |
220 | 220 | ); |
221 | 221 | |
222 | - $logs = Give()->logs->get_connected_logs( $log_query ); |
|
222 | + $logs = Give()->logs->get_connected_logs($log_query); |
|
223 | 223 | |
224 | - if ( $logs ) { |
|
225 | - foreach ( $logs as $log ) { |
|
224 | + if ($logs) { |
|
225 | + foreach ($logs as $log) { |
|
226 | 226 | |
227 | 227 | $logs_data[] = array( |
228 | 228 | 'ID' => $log->ID, |
@@ -254,14 +254,14 @@ discard block |
||
254 | 254 | $columns = $this->get_columns(); |
255 | 255 | $hidden = array(); // No hidden columns |
256 | 256 | $sortable = $this->get_sortable_columns(); |
257 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
257 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
258 | 258 | $this->items = $this->get_logs(); |
259 | - $total_items = Give()->logs->get_log_count( 0, 'update' ); |
|
259 | + $total_items = Give()->logs->get_log_count(0, 'update'); |
|
260 | 260 | |
261 | - $this->set_pagination_args( array( |
|
261 | + $this->set_pagination_args(array( |
|
262 | 262 | 'total_items' => $total_items, |
263 | 263 | 'per_page' => $this->per_page, |
264 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
264 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
265 | 265 | ) |
266 | 266 | ); |
267 | 267 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: System Info |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | ?> |
26 | 26 | |
27 | 27 | <div class="give-debug-report-wrapper"> |
28 | - <p class="give-debug-report-text"><?php echo sprintf(__( 'Please copy and paste this information in your ticket when contacting support:', 'give' )); ?> </p> |
|
28 | + <p class="give-debug-report-text"><?php echo sprintf(__('Please copy and paste this information in your ticket when contacting support:', 'give')); ?> </p> |
|
29 | 29 | <div class="give-debug-report-actions"> |
30 | - <a class="button-primary js-give-debug-report-button" href="#"><?php _e( 'Get System Report', 'give' ); ?></a> |
|
31 | - <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e( 'Understanding the System Report', 'give' ); ?> <span class="dashicons dashicons-external"></span></a> |
|
30 | + <a class="button-primary js-give-debug-report-button" href="#"><?php _e('Get System Report', 'give'); ?></a> |
|
31 | + <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e('Understanding the System Report', 'give'); ?> <span class="dashicons dashicons-external"></span></a> |
|
32 | 32 | </div> |
33 | 33 | <div class="give-debug-report js-give-debug-report"> |
34 | 34 | <textarea readonly="readonly"></textarea> |
@@ -38,56 +38,56 @@ discard block |
||
38 | 38 | <table class="give-status-table widefat" cellspacing="0" id="status"> |
39 | 39 | <thead> |
40 | 40 | <tr> |
41 | - <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e( 'WordPress Environment', 'give' ); ?></h2></th> |
|
41 | + <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e('WordPress Environment', 'give'); ?></h2></th> |
|
42 | 42 | </tr> |
43 | 43 | </thead> |
44 | 44 | <tbody> |
45 | 45 | <tr> |
46 | - <td data-export-label="Home URL"><?php _e( 'Home URL', 'give' ); ?>:</td> |
|
47 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The URL of your site\'s homepage.', 'give' ) ); ?></td> |
|
48 | - <td><?php form_option( 'home' ); ?></td> |
|
46 | + <td data-export-label="Home URL"><?php _e('Home URL', 'give'); ?>:</td> |
|
47 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The URL of your site\'s homepage.', 'give')); ?></td> |
|
48 | + <td><?php form_option('home'); ?></td> |
|
49 | 49 | </tr> |
50 | 50 | <tr> |
51 | - <td data-export-label="Site URL"><?php _e( 'Site URL', 'give' ); ?>:</td> |
|
52 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The root URL of your site.', 'give' ) ); ?></td> |
|
53 | - <td><?php form_option( 'siteurl' ); ?></td> |
|
51 | + <td data-export-label="Site URL"><?php _e('Site URL', 'give'); ?>:</td> |
|
52 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The root URL of your site.', 'give')); ?></td> |
|
53 | + <td><?php form_option('siteurl'); ?></td> |
|
54 | 54 | </tr> |
55 | 55 | <tr> |
56 | - <td data-export-label="WP Version"><?php _e( 'WP Version', 'give' ); ?>:</td> |
|
57 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of WordPress installed on your site.', 'give' ) ); ?></td> |
|
58 | - <td><?php bloginfo( 'version' ); ?></td> |
|
56 | + <td data-export-label="WP Version"><?php _e('WP Version', 'give'); ?>:</td> |
|
57 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of WordPress installed on your site.', 'give')); ?></td> |
|
58 | + <td><?php bloginfo('version'); ?></td> |
|
59 | 59 | </tr> |
60 | 60 | <tr> |
61 | - <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
|
62 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?></td> |
|
63 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
61 | + <td data-export-label="WP Multisite"><?php _e('WP Multisite', 'give'); ?>:</td> |
|
62 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether or not you have WordPress Multisite enabled.', 'give')); ?></td> |
|
63 | + <td><?php if (is_multisite()) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
64 | 64 | |
65 | 65 | </tr> |
66 | 66 | <tr> |
67 | - <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
|
68 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'give' ) ); ?></td> |
|
67 | + <td data-export-label="WP Memory Limit"><?php _e('WP Memory Limit', 'give'); ?>:</td> |
|
68 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The maximum amount of memory (RAM) that your site can use at one time.', 'give')); ?></td> |
|
69 | 69 | <td> |
70 | 70 | <?php |
71 | - $memory = give_let_to_num( WP_MEMORY_LIMIT ); |
|
71 | + $memory = give_let_to_num(WP_MEMORY_LIMIT); |
|
72 | 72 | |
73 | - if ( function_exists( 'memory_get_usage' ) ) { |
|
74 | - $system_memory = give_let_to_num( @ini_get( 'memory_limit' ) ); |
|
75 | - $memory = max( $memory, $system_memory ); |
|
73 | + if (function_exists('memory_get_usage')) { |
|
74 | + $system_memory = give_let_to_num(@ini_get('memory_limit')); |
|
75 | + $memory = max($memory, $system_memory); |
|
76 | 76 | } |
77 | 77 | |
78 | - if ( $memory < 67108864 ) { |
|
79 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend setting memory to at least 64 MB. See: %s', 'give' ), size_format( $memory ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'give' ) . '</a>' ) . '</mark>'; |
|
78 | + if ($memory < 67108864) { |
|
79 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend setting memory to at least 64 MB. See: %s', 'give'), size_format($memory), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">'.__('Increasing memory allocated to PHP', 'give').'</a>').'</mark>'; |
|
80 | 80 | } else { |
81 | - echo '<mark class="yes">' . size_format( $memory ) . '</mark>'; |
|
81 | + echo '<mark class="yes">'.size_format($memory).'</mark>'; |
|
82 | 82 | } |
83 | 83 | ?> |
84 | 84 | </td> |
85 | 85 | </tr> |
86 | 86 | <tr> |
87 | - <td data-export-label="WP Debug Mode"><?php _e( 'WP Debug Mode', 'give' ); ?>:</td> |
|
88 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Displays whether or not WordPress is in Debug Mode.', 'give' ) ); ?></td> |
|
87 | + <td data-export-label="WP Debug Mode"><?php _e('WP Debug Mode', 'give'); ?>:</td> |
|
88 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Displays whether or not WordPress is in Debug Mode.', 'give')); ?></td> |
|
89 | 89 | <td> |
90 | - <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
|
90 | + <?php if (defined('WP_DEBUG') && WP_DEBUG) : ?> |
|
91 | 91 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
92 | 92 | <?php else : ?> |
93 | 93 | <mark class="no">–</mark> |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | </td> |
96 | 96 | </tr> |
97 | 97 | <tr> |
98 | - <td data-export-label="WP Cron"><?php _e( 'WP Cron', 'give' ); ?>:</td> |
|
99 | - <td class="help"><?php echo Give()->tooltips->render( __( 'Displays whether or not WP Cron Jobs are enabled.', 'give' ) ); ?></td> |
|
98 | + <td data-export-label="WP Cron"><?php _e('WP Cron', 'give'); ?>:</td> |
|
99 | + <td class="help"><?php echo Give()->tooltips->render(__('Displays whether or not WP Cron Jobs are enabled.', 'give')); ?></td> |
|
100 | 100 | <td> |
101 | - <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
|
101 | + <?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) : ?> |
|
102 | 102 | <mark class="no">–</mark> |
103 | 103 | <?php else : ?> |
104 | 104 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
@@ -106,60 +106,60 @@ discard block |
||
106 | 106 | </td> |
107 | 107 | </tr> |
108 | 108 | <tr> |
109 | - <td data-export-label="Language"><?php _e( 'Language', 'give' ); ?>:</td> |
|
110 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The current language used by WordPress. Default = English', 'give' ) ); ?></td> |
|
109 | + <td data-export-label="Language"><?php _e('Language', 'give'); ?>:</td> |
|
110 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The current language used by WordPress. Default = English', 'give')); ?></td> |
|
111 | 111 | <td><?php echo get_locale(); ?></td> |
112 | 112 | </tr> |
113 | 113 | <tr> |
114 | - <td data-export-label="Permalink Structure"><?php _e( 'Permalink Structure', 'give' ); ?>:</td> |
|
115 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The permalink structure as defined in Settings.', 'give' ) ); ?></td> |
|
116 | - <td><?php echo esc_html( get_option( 'permalink_structure', __( 'Default', 'give' ) ) ); ?></td> |
|
114 | + <td data-export-label="Permalink Structure"><?php _e('Permalink Structure', 'give'); ?>:</td> |
|
115 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The permalink structure as defined in Settings.', 'give')); ?></td> |
|
116 | + <td><?php echo esc_html(get_option('permalink_structure', __('Default', 'give'))); ?></td> |
|
117 | 117 | </tr> |
118 | 118 | <tr> |
119 | - <td data-export-label="Show on Front"><?php _e( 'Show on Front', 'give' ); ?>:</td> |
|
120 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether your front page is set to show posts or a static page.', 'give' ) ); ?></td> |
|
121 | - <td><?php echo esc_html( get_option( 'show_on_front', '–' ) ); ?></td> |
|
119 | + <td data-export-label="Show on Front"><?php _e('Show on Front', 'give'); ?>:</td> |
|
120 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether your front page is set to show posts or a static page.', 'give')); ?></td> |
|
121 | + <td><?php echo esc_html(get_option('show_on_front', '–')); ?></td> |
|
122 | 122 | </tr> |
123 | - <?php if ( 'page' === get_option( 'show_on_front' ) ) : ?> |
|
123 | + <?php if ('page' === get_option('show_on_front')) : ?> |
|
124 | 124 | <?php |
125 | - $front_page_id = absint( get_option( 'page_on_front' ) ); |
|
126 | - $blog_page_id = absint( get_option( 'page_for_posts' ) ); |
|
125 | + $front_page_id = absint(get_option('page_on_front')); |
|
126 | + $blog_page_id = absint(get_option('page_for_posts')); |
|
127 | 127 | ?> |
128 | 128 | <tr> |
129 | - <td data-export-label="Page on Front"><?php _e( 'Page on Front', 'give' ); ?>:</td> |
|
130 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page set to display as your front page.', 'give' ) ); ?></td> |
|
131 | - <td><?php echo 0 !== $front_page_id ? esc_html( get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
129 | + <td data-export-label="Page on Front"><?php _e('Page on Front', 'give'); ?>:</td> |
|
130 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page set to display as your front page.', 'give')); ?></td> |
|
131 | + <td><?php echo 0 !== $front_page_id ? esc_html(get_the_title($front_page_id).' (#'.$front_page_id.')') : __('Unset', 'give'); ?></td> |
|
132 | 132 | </tr> |
133 | 133 | <tr> |
134 | - <td data-export-label="Page for Posts"><?php _e( 'Page for Posts', 'give' ); ?>:</td> |
|
135 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page set to display your posts.', 'give' ) ); ?></td> |
|
136 | - <td><?php echo 0 !== $blog_page_id ? esc_html( get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
134 | + <td data-export-label="Page for Posts"><?php _e('Page for Posts', 'give'); ?>:</td> |
|
135 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page set to display your posts.', 'give')); ?></td> |
|
136 | + <td><?php echo 0 !== $blog_page_id ? esc_html(get_the_title($blog_page_id).' (#'.$blog_page_id.')') : __('Unset', 'give'); ?></td> |
|
137 | 137 | </tr> |
138 | - <?php endif;?> |
|
138 | + <?php endif; ?> |
|
139 | 139 | <tr> |
140 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix', 'give' ); ?>:</td> |
|
141 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
142 | - <td><?php echo esc_html( $wpdb->prefix ); ?></td> |
|
140 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix', 'give'); ?>:</td> |
|
141 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The table prefix used in your WordPress database.', 'give')); ?></td> |
|
142 | + <td><?php echo esc_html($wpdb->prefix); ?></td> |
|
143 | 143 | </tr> |
144 | 144 | <tr> |
145 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix Length', 'give' ); ?>:</td> |
|
146 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The length of the table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
147 | - <td><?php echo esc_html( strlen( $wpdb->prefix ) ); ?></td> |
|
145 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix Length', 'give'); ?>:</td> |
|
146 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The length of the table prefix used in your WordPress database.', 'give')); ?></td> |
|
147 | + <td><?php echo esc_html(strlen($wpdb->prefix)); ?></td> |
|
148 | 148 | </tr> |
149 | 149 | <tr> |
150 | - <td data-export-label="Table Prefix Status"><?php _e( 'Table Prefix Status', 'give' ); ?>:</td> |
|
151 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The status of the table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
152 | - <td><?php echo strlen( $wpdb->prefix ) > 16 ? esc_html( 'Error: Too long', 'give' ) : esc_html( 'Acceptable', 'give' ); ?></td> |
|
150 | + <td data-export-label="Table Prefix Status"><?php _e('Table Prefix Status', 'give'); ?>:</td> |
|
151 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The status of the table prefix used in your WordPress database.', 'give')); ?></td> |
|
152 | + <td><?php echo strlen($wpdb->prefix) > 16 ? esc_html('Error: Too long', 'give') : esc_html('Acceptable', 'give'); ?></td> |
|
153 | 153 | </tr> |
154 | 154 | <tr> |
155 | - <td data-export-label="Admin AJAX"><?php _e( 'Admin AJAX', 'give' ); ?>:</td> |
|
156 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Admin AJAX is accessible.', 'give' ) ); ?></td> |
|
157 | - <td><?php echo give_test_ajax_works() ? __( 'Accessible', 'give' ) : __( 'Inaccessible', 'give' ); ?></td> |
|
155 | + <td data-export-label="Admin AJAX"><?php _e('Admin AJAX', 'give'); ?>:</td> |
|
156 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether Admin AJAX is accessible.', 'give')); ?></td> |
|
157 | + <td><?php echo give_test_ajax_works() ? __('Accessible', 'give') : __('Inaccessible', 'give'); ?></td> |
|
158 | 158 | </tr> |
159 | 159 | <tr> |
160 | - <td data-export-label="Registered Post Statuses"><?php _e( 'Registered Post Statuses', 'give' ); ?>:</td> |
|
161 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'A list of all registered post statuses.', 'give' ) ); ?></td> |
|
162 | - <td><?php echo esc_html( implode( ', ', get_post_stati() ) ); ?></td> |
|
160 | + <td data-export-label="Registered Post Statuses"><?php _e('Registered Post Statuses', 'give'); ?>:</td> |
|
161 | + <td class="help"><?php echo Give()->tooltips->render_help(__('A list of all registered post statuses.', 'give')); ?></td> |
|
162 | + <td><?php echo esc_html(implode(', ', get_post_stati())); ?></td> |
|
163 | 163 | </tr> |
164 | 164 | </tbody> |
165 | 165 | </table> |
@@ -167,97 +167,97 @@ discard block |
||
167 | 167 | <table class="give-status-table widefat" cellspacing="0"> |
168 | 168 | <thead> |
169 | 169 | <tr> |
170 | - <th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'give' ); ?></h2></th> |
|
170 | + <th colspan="3" data-export-label="Server Environment"><h2><?php _e('Server Environment', 'give'); ?></h2></th> |
|
171 | 171 | </tr> |
172 | 172 | </thead> |
173 | 173 | <tbody> |
174 | 174 | <tr> |
175 | - <td data-export-label="Hosting Provider"><?php _e( 'Hosting Provider', 'give' ); ?>:</td> |
|
176 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The hosting provider for this WordPress installation.', 'give' ) ); ?></td> |
|
177 | - <td><?php echo give_get_host() ? esc_html( give_get_host() ) : __( 'Unknown', 'give' ); ?></td> |
|
175 | + <td data-export-label="Hosting Provider"><?php _e('Hosting Provider', 'give'); ?>:</td> |
|
176 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The hosting provider for this WordPress installation.', 'give')); ?></td> |
|
177 | + <td><?php echo give_get_host() ? esc_html(give_get_host()) : __('Unknown', 'give'); ?></td> |
|
178 | 178 | </tr> |
179 | 179 | <tr> |
180 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Connection', 'give' ); ?>:</td> |
|
181 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give' ) ); ?></td> |
|
180 | + <td data-export-label="TLS Connection"><?php _e('TLS Connection', 'give'); ?>:</td> |
|
181 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give')); ?></td> |
|
182 | 182 | <td> |
183 | 183 | <?php |
184 | - $tls_check = wp_remote_post( 'https://www.howsmyssl.com/a/check' ); |
|
185 | - if ( ! is_wp_error( $tls_check ) ) { |
|
186 | - $tls_check = json_decode( wp_remote_retrieve_body( $tls_check ) ); |
|
184 | + $tls_check = wp_remote_post('https://www.howsmyssl.com/a/check'); |
|
185 | + if ( ! is_wp_error($tls_check)) { |
|
186 | + $tls_check = json_decode(wp_remote_retrieve_body($tls_check)); |
|
187 | 187 | /* translators: %s: SSL connection response */ |
188 | - printf( __('Connection uses %s', 'give'), esc_html( $tls_check->tls_version )) ; |
|
188 | + printf(__('Connection uses %s', 'give'), esc_html($tls_check->tls_version)); |
|
189 | 189 | } |
190 | 190 | ?> |
191 | 191 | </td> |
192 | 192 | </tr> |
193 | 193 | <tr> |
194 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Rating', 'give' ); ?>:</td> |
|
195 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The server\'s connection as rated by https://www.howsmyssl.com/', 'give' ) ); ?></td> |
|
194 | + <td data-export-label="TLS Connection"><?php _e('TLS Rating', 'give'); ?>:</td> |
|
195 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The server\'s connection as rated by https://www.howsmyssl.com/', 'give')); ?></td> |
|
196 | 196 | <td> |
197 | 197 | <?php |
198 | - if ( ! is_wp_error( $tls_check ) ) { |
|
199 | - esc_html_e( $tls_check->rating); |
|
198 | + if ( ! is_wp_error($tls_check)) { |
|
199 | + esc_html_e($tls_check->rating); |
|
200 | 200 | } |
201 | 201 | ?> |
202 | 202 | </td> |
203 | 203 | </tr> |
204 | 204 | <tr> |
205 | - <td data-export-label="Server Info"><?php _e( 'Server Info', 'give' ); ?>:</td> |
|
206 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Information about the web server that is currently hosting your site.', 'give' ) ); ?></td> |
|
207 | - <td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td> |
|
205 | + <td data-export-label="Server Info"><?php _e('Server Info', 'give'); ?>:</td> |
|
206 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Information about the web server that is currently hosting your site.', 'give')); ?></td> |
|
207 | + <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td> |
|
208 | 208 | </tr> |
209 | 209 | <tr> |
210 | - <td data-export-label="PHP Version"><?php _e( 'PHP Version', 'give' ); ?>:</td> |
|
211 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of PHP installed on your hosting server.', 'give' ) ); ?></td> |
|
210 | + <td data-export-label="PHP Version"><?php _e('PHP Version', 'give'); ?>:</td> |
|
211 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of PHP installed on your hosting server.', 'give')); ?></td> |
|
212 | 212 | <td> |
213 | 213 | <?php |
214 | 214 | // Check if phpversion function exists. |
215 | - if ( function_exists( 'phpversion' ) ) { |
|
215 | + if (function_exists('phpversion')) { |
|
216 | 216 | $php_version = phpversion(); |
217 | 217 | |
218 | - if ( version_compare( $php_version, '5.6', '<' ) ) { |
|
219 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum PHP version of 5.6. See: %s', 'give' ), esc_html( $php_version ), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">' . __( 'PHP Requirements in Give', 'give' ) . '</a>' ) . '</mark>'; |
|
218 | + if (version_compare($php_version, '5.6', '<')) { |
|
219 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum PHP version of 5.6. See: %s', 'give'), esc_html($php_version), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">'.__('PHP Requirements in Give', 'give').'</a>').'</mark>'; |
|
220 | 220 | } else { |
221 | - echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>'; |
|
221 | + echo '<mark class="yes">'.esc_html($php_version).'</mark>'; |
|
222 | 222 | } |
223 | 223 | } else { |
224 | - _e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'give' ); |
|
224 | + _e("Couldn't determine PHP version because phpversion() doesn't exist.", 'give'); |
|
225 | 225 | } |
226 | 226 | ?></td> |
227 | 227 | </tr> |
228 | - <?php if ( function_exists( 'ini_get' ) ) : ?> |
|
228 | + <?php if (function_exists('ini_get')) : ?> |
|
229 | 229 | <tr> |
230 | - <td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'give' ); ?>:</td> |
|
231 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be contained in one post.', 'give' ) ); ?></td> |
|
232 | - <td><?php echo size_format( give_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td> |
|
230 | + <td data-export-label="PHP Post Max Size"><?php _e('PHP Post Max Size', 'give'); ?>:</td> |
|
231 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be contained in one post.', 'give')); ?></td> |
|
232 | + <td><?php echo size_format(give_let_to_num(ini_get('post_max_size'))); ?></td> |
|
233 | 233 | </tr> |
234 | 234 | <tr> |
235 | - <td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'give' ); ?>:</td> |
|
236 | - <td class="help"><?php echo Give() ->tooltips->render_help( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give' ) ); ?></td> |
|
237 | - <td><?php echo ini_get( 'max_execution_time' ); ?></td> |
|
235 | + <td data-export-label="PHP Time Limit"><?php _e('PHP Time Limit', 'give'); ?>:</td> |
|
236 | + <td class="help"><?php echo Give() ->tooltips->render_help(__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give')); ?></td> |
|
237 | + <td><?php echo ini_get('max_execution_time'); ?></td> |
|
238 | 238 | </tr> |
239 | 239 | <tr> |
240 | - <td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'give' ); ?>:</td> |
|
241 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'give' ) ); ?></td> |
|
242 | - <td><?php echo ini_get( 'max_input_vars' ); ?></td> |
|
240 | + <td data-export-label="PHP Max Input Vars"><?php _e('PHP Max Input Vars', 'give'); ?>:</td> |
|
241 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The maximum number of variables your server can use for a single function to avoid overloads.', 'give')); ?></td> |
|
242 | + <td><?php echo ini_get('max_input_vars'); ?></td> |
|
243 | 243 | </tr> |
244 | 244 | <tr> |
245 | - <td data-export-label="PHP Max Upload Size"><?php _e( 'PHP Max Upload Size', 'give' ); ?>:</td> |
|
246 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'give' ) ); ?></td> |
|
247 | - <td><?php echo size_format( wp_max_upload_size() ); ?></td> |
|
245 | + <td data-export-label="PHP Max Upload Size"><?php _e('PHP Max Upload Size', 'give'); ?>:</td> |
|
246 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be uploaded to your WordPress installation.', 'give')); ?></td> |
|
247 | + <td><?php echo size_format(wp_max_upload_size()); ?></td> |
|
248 | 248 | </tr> |
249 | 249 | <tr> |
250 | - <td data-export-label="cURL Version"><?php _e( 'cURL Version', 'give' ); ?>:</td> |
|
251 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of cURL installed on your server.', 'give' ) ); ?></td> |
|
250 | + <td data-export-label="cURL Version"><?php _e('cURL Version', 'give'); ?>:</td> |
|
251 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of cURL installed on your server.', 'give')); ?></td> |
|
252 | 252 | <td> |
253 | 253 | <?php |
254 | - if ( function_exists( 'curl_version' ) ) { |
|
254 | + if (function_exists('curl_version')) { |
|
255 | 255 | $curl_version = curl_version(); |
256 | 256 | |
257 | - if ( version_compare( $curl_version['version'], '7.40', '<' ) ) { |
|
258 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum cURL version of 7.40.', 'give' ), esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) ) . '</mark>'; |
|
257 | + if (version_compare($curl_version['version'], '7.40', '<')) { |
|
258 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum cURL version of 7.40.', 'give'), esc_html($curl_version['version'].', '.$curl_version['ssl_version'])).'</mark>'; |
|
259 | 259 | } else { |
260 | - echo '<mark class="yes">' . esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) . '</mark>'; |
|
260 | + echo '<mark class="yes">'.esc_html($curl_version['version'].', '.$curl_version['ssl_version']).'</mark>'; |
|
261 | 261 | } |
262 | 262 | } else { |
263 | 263 | echo '&ndash'; |
@@ -266,42 +266,42 @@ discard block |
||
266 | 266 | </td> |
267 | 267 | </tr> |
268 | 268 | <tr> |
269 | - <td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'give' ); ?>:</td> |
|
270 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give' ) ); ?></td> |
|
271 | - <td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
269 | + <td data-export-label="SUHOSIN Installed"><?php _e('SUHOSIN Installed', 'give'); ?>:</td> |
|
270 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give')); ?></td> |
|
271 | + <td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
272 | 272 | </tr> |
273 | 273 | <?php endif; |
274 | 274 | |
275 | - if ( $wpdb->use_mysqli ) { |
|
276 | - $ver = mysqli_get_server_info( $wpdb->dbh ); |
|
275 | + if ($wpdb->use_mysqli) { |
|
276 | + $ver = mysqli_get_server_info($wpdb->dbh); |
|
277 | 277 | } else { |
278 | 278 | $ver = mysql_get_server_info(); |
279 | 279 | } |
280 | 280 | |
281 | - if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?> |
|
281 | + if ( ! empty($wpdb->is_mysql) && ! stristr($ver, 'MariaDB')) : ?> |
|
282 | 282 | <tr> |
283 | - <td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'give' ); ?>:</td> |
|
284 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of MySQL installed on your hosting server.', 'give' ) ); ?></td> |
|
283 | + <td data-export-label="MySQL Version"><?php _e('MySQL Version', 'give'); ?>:</td> |
|
284 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of MySQL installed on your hosting server.', 'give')); ?></td> |
|
285 | 285 | <td> |
286 | 286 | <?php |
287 | 287 | $mysql_version = $wpdb->db_version(); |
288 | 288 | |
289 | - if ( version_compare( $mysql_version, '5.6', '<' ) ) { |
|
290 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give' ), esc_html( $mysql_version ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'WordPress Requirements', 'give' ) . '</a>' ) . '</mark>'; |
|
289 | + if (version_compare($mysql_version, '5.6', '<')) { |
|
290 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give'), esc_html($mysql_version), '<a href="https://wordpress.org/about/requirements/" target="_blank">'.__('WordPress Requirements', 'give').'</a>').'</mark>'; |
|
291 | 291 | } else { |
292 | - echo '<mark class="yes">' . esc_html( $mysql_version ) . '</mark>'; |
|
292 | + echo '<mark class="yes">'.esc_html($mysql_version).'</mark>'; |
|
293 | 293 | } |
294 | 294 | ?> |
295 | 295 | </td> |
296 | 296 | </tr> |
297 | 297 | <?php endif; ?> |
298 | 298 | <tr> |
299 | - <td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'give' ); ?>:</td> |
|
300 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The default timezone for your server.', 'give' ) ); ?></td> |
|
299 | + <td data-export-label="Default Timezone is UTC"><?php _e('Default Timezone is UTC', 'give'); ?>:</td> |
|
300 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The default timezone for your server.', 'give')); ?></td> |
|
301 | 301 | <td><?php |
302 | 302 | $default_timezone = date_default_timezone_get(); |
303 | - if ( 'UTC' !== $default_timezone ) { |
|
304 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'give' ), $default_timezone ) . '</mark>'; |
|
303 | + if ('UTC' !== $default_timezone) { |
|
304 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('Default timezone is %s - it should be UTC', 'give'), $default_timezone).'</mark>'; |
|
305 | 305 | } else { |
306 | 306 | echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>'; |
307 | 307 | } ?> |
@@ -312,119 +312,119 @@ discard block |
||
312 | 312 | |
313 | 313 | // fsockopen/cURL. |
314 | 314 | $posting['fsockopen_curl']['name'] = 'fsockopen/cURL'; |
315 | - $posting['fsockopen_curl']['help'] = __( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give' ); |
|
315 | + $posting['fsockopen_curl']['help'] = __('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give'); |
|
316 | 316 | |
317 | - if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) { |
|
317 | + if (function_exists('fsockopen') || function_exists('curl_init')) { |
|
318 | 318 | $posting['fsockopen_curl']['success'] = true; |
319 | 319 | } else { |
320 | 320 | $posting['fsockopen_curl']['success'] = false; |
321 | - $posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give' ); |
|
321 | + $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // SOAP. |
325 | 325 | $posting['soap_client']['name'] = 'SoapClient'; |
326 | - $posting['soap_client']['help'] = __( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give' ); |
|
326 | + $posting['soap_client']['help'] = __('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give'); |
|
327 | 327 | |
328 | - if ( class_exists( 'SoapClient' ) ) { |
|
328 | + if (class_exists('SoapClient')) { |
|
329 | 329 | $posting['soap_client']['success'] = true; |
330 | 330 | } else { |
331 | 331 | $posting['soap_client']['success'] = false; |
332 | - $posting['soap_client']['note'] = sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' ); |
|
332 | + $posting['soap_client']['note'] = sprintf(__('Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give'), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>'); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | // DOMDocument. |
336 | 336 | $posting['dom_document']['name'] = 'DOMDocument'; |
337 | - $posting['dom_document']['help'] = __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give' ); |
|
337 | + $posting['dom_document']['help'] = __('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give'); |
|
338 | 338 | |
339 | - if ( class_exists( 'DOMDocument' ) ) { |
|
339 | + if (class_exists('DOMDocument')) { |
|
340 | 340 | $posting['dom_document']['success'] = true; |
341 | 341 | } else { |
342 | 342 | $posting['dom_document']['success'] = false; |
343 | - $posting['dom_document']['note'] = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' ); |
|
343 | + $posting['dom_document']['note'] = sprintf(__('Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give'), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>'); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | // gzip. |
347 | 347 | $posting['gzip']['name'] = 'gzip'; |
348 | - $posting['gzip']['help'] = __( 'gzip is used for file compression and decompression.', 'give' ); |
|
348 | + $posting['gzip']['help'] = __('gzip is used for file compression and decompression.', 'give'); |
|
349 | 349 | |
350 | - if ( is_callable( 'gzopen' ) ) { |
|
350 | + if (is_callable('gzopen')) { |
|
351 | 351 | $posting['gzip']['success'] = true; |
352 | 352 | } else { |
353 | 353 | $posting['gzip']['success'] = false; |
354 | - $posting['gzip']['note'] = sprintf( __( 'Your server does not support the %s function - this is used for file compression and decompression.', 'give' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' ); |
|
354 | + $posting['gzip']['note'] = sprintf(__('Your server does not support the %s function - this is used for file compression and decompression.', 'give'), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
358 | 358 | // GD Graphics Library. |
359 | 359 | $posting['gd']['name'] = 'GD Graphics Library'; |
360 | - $posting['gd']['help'] = __( 'GD Graphics Library is used for dynamically manipulating images.', 'give' ); |
|
361 | - $posting['gd']['success'] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? true : false; |
|
360 | + $posting['gd']['help'] = __('GD Graphics Library is used for dynamically manipulating images.', 'give'); |
|
361 | + $posting['gd']['success'] = extension_loaded('gd') && function_exists('gd_info') ? true : false; |
|
362 | 362 | |
363 | 363 | // Multibyte String. |
364 | 364 | $posting['mbstring']['name'] = 'Multibyte String'; |
365 | - $posting['mbstring']['help'] = __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give' ); |
|
365 | + $posting['mbstring']['help'] = __('Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give'); |
|
366 | 366 | |
367 | - if ( extension_loaded( 'mbstring' ) ) { |
|
367 | + if (extension_loaded('mbstring')) { |
|
368 | 368 | $posting['mbstring']['success'] = true; |
369 | 369 | } else { |
370 | 370 | $posting['mbstring']['success'] = false; |
371 | - $posting['mbstring']['note'] = sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ); |
|
371 | + $posting['mbstring']['note'] = sprintf(__('Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give'), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>'); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | // WP Remote Post Check. |
375 | - $posting['wp_remote_post']['name'] = __( 'Remote Post', 'give' ); |
|
376 | - $posting['wp_remote_post']['help'] = __( 'PayPal uses this method of communicating when sending back transaction information.', 'give' ); |
|
375 | + $posting['wp_remote_post']['name'] = __('Remote Post', 'give'); |
|
376 | + $posting['wp_remote_post']['help'] = __('PayPal uses this method of communicating when sending back transaction information.', 'give'); |
|
377 | 377 | |
378 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
378 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
379 | 379 | 'timeout' => 60, |
380 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
380 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
381 | 381 | 'httpversion' => '1.1', |
382 | 382 | 'body' => array( |
383 | 383 | 'cmd' => '_notify-validate', |
384 | 384 | ), |
385 | - ) ); |
|
385 | + )); |
|
386 | 386 | |
387 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
387 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
388 | 388 | $posting['wp_remote_post']['success'] = true; |
389 | 389 | } else { |
390 | - $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
391 | - if ( is_wp_error( $response ) ) { |
|
392 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), sanitize_text_field( $response->get_error_message() ) ); |
|
390 | + $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give'); |
|
391 | + if (is_wp_error($response)) { |
|
392 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Error: %s', 'give'), sanitize_text_field($response->get_error_message())); |
|
393 | 393 | } else { |
394 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), sanitize_text_field( $response['response']['code'] ) ); |
|
394 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), sanitize_text_field($response['response']['code'])); |
|
395 | 395 | } |
396 | 396 | $posting['wp_remote_post']['success'] = false; |
397 | 397 | } |
398 | 398 | |
399 | 399 | // WP Remote Get Check. |
400 | - $posting['wp_remote_get']['name'] = __( 'Remote Get', 'give' ); |
|
401 | - $posting['wp_remote_get']['help'] = __( 'Give plugins may use this method of communication when checking for plugin updates.', 'give' ); |
|
400 | + $posting['wp_remote_get']['name'] = __('Remote Get', 'give'); |
|
401 | + $posting['wp_remote_get']['help'] = __('Give plugins may use this method of communication when checking for plugin updates.', 'give'); |
|
402 | 402 | |
403 | - $response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) ); |
|
403 | + $response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network='.(is_multisite() ? '1' : '0')); |
|
404 | 404 | |
405 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
405 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
406 | 406 | $posting['wp_remote_get']['success'] = true; |
407 | 407 | } else { |
408 | - $posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
409 | - if ( is_wp_error( $response ) ) { |
|
410 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), give_clean( $response->get_error_message() ) ); |
|
408 | + $posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give'); |
|
409 | + if (is_wp_error($response)) { |
|
410 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Error: %s', 'give'), give_clean($response->get_error_message())); |
|
411 | 411 | } else { |
412 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), give_clean( $response['response']['code'] ) ); |
|
412 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), give_clean($response['response']['code'])); |
|
413 | 413 | } |
414 | 414 | $posting['wp_remote_get']['success'] = false; |
415 | 415 | } |
416 | 416 | |
417 | - $posting = apply_filters( 'give_debug_posting', $posting ); |
|
417 | + $posting = apply_filters('give_debug_posting', $posting); |
|
418 | 418 | |
419 | - foreach ( $posting as $post ) { |
|
420 | - $mark = ! empty( $post['success'] ) ? 'yes' : 'error'; |
|
419 | + foreach ($posting as $post) { |
|
420 | + $mark = ! empty($post['success']) ? 'yes' : 'error'; |
|
421 | 421 | ?> |
422 | 422 | <tr> |
423 | - <td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td> |
|
424 | - <td class="help"><?php echo Give()->tooltips->render_help( esc_attr( isset( $post['help'] ) ? $post['help'] : '' ) ); ?></td> |
|
423 | + <td data-export-label="<?php echo esc_html($post['name']); ?>"><?php echo esc_html($post['name']); ?>:</td> |
|
424 | + <td class="help"><?php echo Give()->tooltips->render_help(esc_attr(isset($post['help']) ? $post['help'] : '')); ?></td> |
|
425 | 425 | <td> |
426 | 426 | <mark class="<?php echo $mark; ?>"> |
427 | - <?php echo ! empty( $post['success'] ) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty( $post['note'] ) ? wp_kses_data( $post['note'] ) : ''; ?> |
|
427 | + <?php echo ! empty($post['success']) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty($post['note']) ? wp_kses_data($post['note']) : ''; ?> |
|
428 | 428 | </mark> |
429 | 429 | </td> |
430 | 430 | </tr> |
@@ -437,47 +437,47 @@ discard block |
||
437 | 437 | <table class="give-status-table widefat" cellspacing="0"> |
438 | 438 | <thead> |
439 | 439 | <tr> |
440 | - <th colspan="3" data-export-label="Give Configuration"><h2><?php _e( 'Give Configuration', 'give' ); ?></h2></th> |
|
440 | + <th colspan="3" data-export-label="Give Configuration"><h2><?php _e('Give Configuration', 'give'); ?></h2></th> |
|
441 | 441 | </tr> |
442 | 442 | </thead> |
443 | 443 | <tbody> |
444 | 444 | <tr> |
445 | - <td data-export-label="Give Version"><?php _e( 'Give Version', 'give' ); ?>:</td> |
|
446 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed on your site.', 'give' ) ); ?></td> |
|
447 | - <td><?php echo esc_html( GIVE_VERSION ); ?></td> |
|
445 | + <td data-export-label="Give Version"><?php _e('Give Version', 'give'); ?>:</td> |
|
446 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed on your site.', 'give')); ?></td> |
|
447 | + <td><?php echo esc_html(GIVE_VERSION); ?></td> |
|
448 | 448 | </tr> |
449 | 449 | <tr> |
450 | - <td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td> |
|
451 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td> |
|
452 | - <td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
450 | + <td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td> |
|
451 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td> |
|
452 | + <td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
453 | 453 | </tr> |
454 | 454 | <tr> |
455 | - <td data-export-label="Database Updates"><?php _e( 'Database Updates', 'give' ); ?>:</td> |
|
456 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'This will show the number of pending database updates.', 'give' ) ); ?></td> |
|
455 | + <td data-export-label="Database Updates"><?php _e('Database Updates', 'give'); ?>:</td> |
|
456 | + <td class="help"><?php echo Give()->tooltips->render_help(__('This will show the number of pending database updates.', 'give')); ?></td> |
|
457 | 457 | <td> |
458 | 458 | <?php |
459 | - $updates_text = __( 'All DB Updates Completed.', 'give' ); |
|
459 | + $updates_text = __('All DB Updates Completed.', 'give'); |
|
460 | 460 | $pending_updates = $give_updates->get_total_new_db_update_count(); |
461 | 461 | $total_updates = $give_updates->get_total_db_update_count(); |
462 | 462 | |
463 | - if( Give_Updates::$background_updater->is_paused_process() ) { |
|
463 | + if (Give_Updates::$background_updater->is_paused_process()) { |
|
464 | 464 | // When all the db updates are pending. |
465 | 465 | $updates_text = sprintf( |
466 | - __( '%1$s updates still need to run. (Paused) ', 'give' ), |
|
467 | - count( $give_updates->get_updates('database', 'new' ) ) |
|
466 | + __('%1$s updates still need to run. (Paused) ', 'give'), |
|
467 | + count($give_updates->get_updates('database', 'new')) |
|
468 | 468 | ); |
469 | - } elseif( $pending_updates === $total_updates ) { |
|
469 | + } elseif ($pending_updates === $total_updates) { |
|
470 | 470 | |
471 | 471 | // When all the db updates are pending. |
472 | 472 | $updates_text = sprintf( |
473 | - __( '%1$s updates still need to run.', 'give' ), |
|
473 | + __('%1$s updates still need to run.', 'give'), |
|
474 | 474 | $total_updates |
475 | 475 | ); |
476 | - } elseif( $pending_updates > 0 ) { |
|
476 | + } elseif ($pending_updates > 0) { |
|
477 | 477 | |
478 | 478 | // When some of the db updates are completed and some are pending. |
479 | 479 | $updates_text = sprintf( |
480 | - __( '%1$s of %2$s updates still need to run.', 'give' ), |
|
480 | + __('%1$s of %2$s updates still need to run.', 'give'), |
|
481 | 481 | $pending_updates, |
482 | 482 | $total_updates |
483 | 483 | ); |
@@ -488,144 +488,143 @@ discard block |
||
488 | 488 | </td> |
489 | 489 | </tr> |
490 | 490 | <tr> |
491 | - <td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td> |
|
492 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td> |
|
493 | - <td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
491 | + <td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td> |
|
492 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td> |
|
493 | + <td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
494 | 494 | </tr> |
495 | 495 | <tr> |
496 | - <td data-export-label="Give Cache"><?php _e( 'Give Emails', 'give' ); ?>:</td> |
|
497 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether emails is enabled in Give settings.', 'give' ) ); ?></td> |
|
496 | + <td data-export-label="Give Cache"><?php _e('Give Emails', 'give'); ?>:</td> |
|
497 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether emails is enabled in Give settings.', 'give')); ?></td> |
|
498 | 498 | <td> |
499 | 499 | <?php |
500 | 500 | /* @var Give_Email_Notification $email_notification */ |
501 | - if( $email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications() ) { |
|
501 | + if ($email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications()) { |
|
502 | 502 | ob_start(); |
503 | 503 | |
504 | - foreach ( Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification ) { |
|
505 | - $status = Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? |
|
506 | - 'yes' : |
|
507 | - 'error'; |
|
504 | + foreach (Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification) { |
|
505 | + $status = Give_Email_Notification_Util::is_email_notification_active($email_notification) ? |
|
506 | + 'yes' : 'error'; |
|
508 | 507 | |
509 | 508 | echo sprintf( |
510 | 509 | '<li><mark class="%1$s"><span class="dashicons dashicons-%2$s"></mark></span>%3$s</li>', |
511 | - Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'error', |
|
512 | - Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'no-alt', |
|
510 | + Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'error', |
|
511 | + Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'no-alt', |
|
513 | 512 | $email_notification->config['label'] |
514 | 513 | ); |
515 | 514 | } |
516 | 515 | |
517 | - echo sprintf( '<ul>%s</ul>', ob_get_clean() ); |
|
516 | + echo sprintf('<ul>%s</ul>', ob_get_clean()); |
|
518 | 517 | } |
519 | 518 | ?> |
520 | 519 | </td> |
521 | 520 | </tr> |
522 | 521 | <tr> |
523 | - <td data-export-label="Upgraded From"><?php _e( 'Upgraded From', 'give' ); ?>:</td> |
|
524 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed prior to the last update.', 'give' ) ); ?></td> |
|
525 | - <td><?php echo esc_html( get_option( 'give_version_upgraded_from', '–' ) ); ?></td> |
|
522 | + <td data-export-label="Upgraded From"><?php _e('Upgraded From', 'give'); ?>:</td> |
|
523 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed prior to the last update.', 'give')); ?></td> |
|
524 | + <td><?php echo esc_html(get_option('give_version_upgraded_from', '–')); ?></td> |
|
526 | 525 | </tr> |
527 | 526 | <tr> |
528 | - <td data-export-label="Test Mode"><?php _e( 'Test Mode', 'give' ); ?>:</td> |
|
529 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Test Mode is enabled in Give settings.', 'give' ) ); ?></td> |
|
530 | - <td><?php echo give_is_test_mode() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
527 | + <td data-export-label="Test Mode"><?php _e('Test Mode', 'give'); ?>:</td> |
|
528 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether Test Mode is enabled in Give settings.', 'give')); ?></td> |
|
529 | + <td><?php echo give_is_test_mode() ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
531 | 530 | </tr> |
532 | 531 | <tr> |
533 | - <td data-export-label="Currency Code"><?php _e( 'Currency Code', 'give' ); ?>:</td> |
|
534 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency code selected in Give settings.', 'give' ) ); ?></td> |
|
535 | - <td><?php echo esc_html( give_get_currency() ); ?></td> |
|
532 | + <td data-export-label="Currency Code"><?php _e('Currency Code', 'give'); ?>:</td> |
|
533 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The currency code selected in Give settings.', 'give')); ?></td> |
|
534 | + <td><?php echo esc_html(give_get_currency()); ?></td> |
|
536 | 535 | </tr> |
537 | 536 | <tr> |
538 | - <td data-export-label="Currency Position"><?php _e( 'Currency Position', 'give' ); ?>:</td> |
|
539 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency position selected in Give settings.', 'give' ) ); ?></td> |
|
540 | - <td><?php echo 'before' === give_get_option( 'currency_position' ) ? __( 'Before', 'give' ) : __( 'After', 'give' ); ?></td> |
|
537 | + <td data-export-label="Currency Position"><?php _e('Currency Position', 'give'); ?>:</td> |
|
538 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The currency position selected in Give settings.', 'give')); ?></td> |
|
539 | + <td><?php echo 'before' === give_get_option('currency_position') ? __('Before', 'give') : __('After', 'give'); ?></td> |
|
541 | 540 | </tr> |
542 | 541 | <tr> |
543 | - <td data-export-label="Decimal Separator"><?php _e( 'Decimal Separator', 'give' ); ?>:</td> |
|
544 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The decimal separator defined in Give settings.', 'give' ) ); ?></td> |
|
545 | - <td><?php echo esc_html( give_get_price_decimal_separator() ); ?></td> |
|
542 | + <td data-export-label="Decimal Separator"><?php _e('Decimal Separator', 'give'); ?>:</td> |
|
543 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The decimal separator defined in Give settings.', 'give')); ?></td> |
|
544 | + <td><?php echo esc_html(give_get_price_decimal_separator()); ?></td> |
|
546 | 545 | </tr> |
547 | 546 | <tr> |
548 | - <td data-export-label="Thousands Separator"><?php _e( 'Thousands Separator', 'give' ); ?>:</td> |
|
549 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The thousands separator defined in Give settings.', 'give' ) ); ?></td> |
|
550 | - <td><?php echo esc_html( give_get_price_thousand_separator() ); ?></td> |
|
547 | + <td data-export-label="Thousands Separator"><?php _e('Thousands Separator', 'give'); ?>:</td> |
|
548 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The thousands separator defined in Give settings.', 'give')); ?></td> |
|
549 | + <td><?php echo esc_html(give_get_price_thousand_separator()); ?></td> |
|
551 | 550 | </tr> |
552 | 551 | <tr> |
553 | - <td data-export-label="Success Page"><?php _e( 'Success Page', 'give' ); ?>:</td> |
|
554 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a successful transaction.', 'give' ) ); ?></td> |
|
555 | - <td><?php echo ! empty( $give_options['success_page'] ) ? esc_url( get_permalink( $give_options['success_page'] ) ) : '–'; ?></td> |
|
552 | + <td data-export-label="Success Page"><?php _e('Success Page', 'give'); ?>:</td> |
|
553 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a successful transaction.', 'give')); ?></td> |
|
554 | + <td><?php echo ! empty($give_options['success_page']) ? esc_url(get_permalink($give_options['success_page'])) : '–'; ?></td> |
|
556 | 555 | </tr> |
557 | 556 | <tr> |
558 | - <td data-export-label="Failure Page"><?php _e( 'Failure Page', 'give' ); ?>:</td> |
|
559 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a failed transaction.', 'give' ) ); ?></td> |
|
560 | - <td><?php echo ! empty( $give_options['failure_page'] ) ? esc_url( get_permalink( $give_options['failure_page'] ) ) : '–'; ?></td> |
|
557 | + <td data-export-label="Failure Page"><?php _e('Failure Page', 'give'); ?>:</td> |
|
558 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a failed transaction.', 'give')); ?></td> |
|
559 | + <td><?php echo ! empty($give_options['failure_page']) ? esc_url(get_permalink($give_options['failure_page'])) : '–'; ?></td> |
|
561 | 560 | </tr> |
562 | 561 | <tr> |
563 | - <td data-export-label="Donation History Page"><?php _e( 'Donation History Page', 'give' ); ?>:</td> |
|
564 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where past donations are listed.', 'give' ) ); ?></td> |
|
565 | - <td><?php echo ! empty( $give_options['history_page'] ) ? esc_url( get_permalink( $give_options['history_page'] ) ) : '–'; ?></td> |
|
562 | + <td data-export-label="Donation History Page"><?php _e('Donation History Page', 'give'); ?>:</td> |
|
563 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where past donations are listed.', 'give')); ?></td> |
|
564 | + <td><?php echo ! empty($give_options['history_page']) ? esc_url(get_permalink($give_options['history_page'])) : '–'; ?></td> |
|
566 | 565 | </tr> |
567 | 566 | <tr> |
568 | - <td data-export-label="Give Forms Slug"><?php _e( 'Give Forms Slug', 'give' ); ?>:</td> |
|
569 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The slug used for Give donation forms.', 'give' ) ); ?></td> |
|
570 | - <td><?php echo esc_html( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . '/' : '/donations/' ); ?></td> |
|
567 | + <td data-export-label="Give Forms Slug"><?php _e('Give Forms Slug', 'give'); ?>:</td> |
|
568 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The slug used for Give donation forms.', 'give')); ?></td> |
|
569 | + <td><?php echo esc_html(defined('GIVE_SLUG') ? '/'.GIVE_SLUG.'/' : '/donations/'); ?></td> |
|
571 | 570 | </tr> |
572 | 571 | <?php |
573 | 572 | $active_gateways = give_get_enabled_payment_gateways(); |
574 | 573 | $enabled_gateways = $default_gateway = ''; |
575 | 574 | |
576 | - if ( $active_gateways ) { |
|
577 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
575 | + if ($active_gateways) { |
|
576 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
578 | 577 | |
579 | - if ( $default_gateway_is_active ) { |
|
580 | - $default_gateway = give_get_default_gateway( null ); |
|
581 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
578 | + if ($default_gateway_is_active) { |
|
579 | + $default_gateway = give_get_default_gateway(null); |
|
580 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
582 | 581 | } else { |
583 | - $default_gateway = __( 'Test Donation', 'give' ); |
|
582 | + $default_gateway = __('Test Donation', 'give'); |
|
584 | 583 | } |
585 | 584 | |
586 | 585 | $gateways = array(); |
587 | 586 | |
588 | - foreach ( $active_gateways as $gateway ) { |
|
587 | + foreach ($active_gateways as $gateway) { |
|
589 | 588 | $gateways[] = $gateway['admin_label']; |
590 | 589 | } |
591 | 590 | |
592 | - $enabled_gateways = implode( ', ', $gateways ); |
|
591 | + $enabled_gateways = implode(', ', $gateways); |
|
593 | 592 | } |
594 | 593 | ?> |
595 | 594 | <tr> |
596 | - <td data-export-label="Enabled Payment Gateways"><?php _e( 'Enabled Payment Gateways', 'give' ); ?>:</td> |
|
597 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'All payment gateways enabled in Give settings.', 'give' ) ); ?></td> |
|
598 | - <td><?php echo esc_html( ! empty( $enabled_gateways ) ? $enabled_gateways : '–' ); ?></td> |
|
595 | + <td data-export-label="Enabled Payment Gateways"><?php _e('Enabled Payment Gateways', 'give'); ?>:</td> |
|
596 | + <td class="help"><?php echo Give()->tooltips->render_help(__('All payment gateways enabled in Give settings.', 'give')); ?></td> |
|
597 | + <td><?php echo esc_html( ! empty($enabled_gateways) ? $enabled_gateways : '–'); ?></td> |
|
599 | 598 | </tr> |
600 | 599 | <tr> |
601 | - <td data-export-label="Default Payment Gateway"><?php _e( 'Default Payment Gateway', 'give' ); ?>:</td> |
|
602 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The default payment gateway selected in Give settings.', 'give' ) ); ?></td> |
|
603 | - <td><?php echo esc_html( ! empty( $default_gateway ) ? $default_gateway : '–' ); ?></td> |
|
600 | + <td data-export-label="Default Payment Gateway"><?php _e('Default Payment Gateway', 'give'); ?>:</td> |
|
601 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The default payment gateway selected in Give settings.', 'give')); ?></td> |
|
602 | + <td><?php echo esc_html( ! empty($default_gateway) ? $default_gateway : '–'); ?></td> |
|
604 | 603 | </tr> |
605 | 604 | <tr> |
606 | - <td data-export-label="PayPal IPN Verification"><?php _e( 'PayPal IPN Verification', 'give' ); ?>:</td> |
|
607 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether admins requires verification of IPN notifications with PayPal.', 'give' ) ); ?></td> |
|
608 | - <td><?php echo 'enabled' === give_get_option( 'paypal_verification' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
605 | + <td data-export-label="PayPal IPN Verification"><?php _e('PayPal IPN Verification', 'give'); ?>:</td> |
|
606 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether admins requires verification of IPN notifications with PayPal.', 'give')); ?></td> |
|
607 | + <td><?php echo 'enabled' === give_get_option('paypal_verification') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
609 | 608 | </tr> |
610 | 609 | <tr> |
611 | - <td data-export-label="PayPal IPN Notifications"><?php _e( 'PayPal IPN Notifications', 'give' ); ?>:</td> |
|
612 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Displays whether when last PayPal IPN is received with which donation or transaction.', 'give' ) ); ?></td> |
|
610 | + <td data-export-label="PayPal IPN Notifications"><?php _e('PayPal IPN Notifications', 'give'); ?>:</td> |
|
611 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Displays whether when last PayPal IPN is received with which donation or transaction.', 'give')); ?></td> |
|
613 | 612 | <td> |
614 | 613 | <?php |
615 | - $last_paypal_ipn_received = get_option( 'give_last_paypal_ipn_received' ); |
|
616 | - if ( is_array( $last_paypal_ipn_received ) && count( $last_paypal_ipn_received ) > 0 ) { |
|
614 | + $last_paypal_ipn_received = get_option('give_last_paypal_ipn_received'); |
|
615 | + if (is_array($last_paypal_ipn_received) && count($last_paypal_ipn_received) > 0) { |
|
617 | 616 | $donation_id = $last_paypal_ipn_received['payment_id']; |
618 | - $ipn_timestamp = give_get_meta( $donation_id, 'give_last_paypal_ipn_received', true ); |
|
619 | - $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' . $last_paypal_ipn_received['transaction_id']; |
|
620 | - $donation_url = site_url() . '/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $donation_id; |
|
617 | + $ipn_timestamp = give_get_meta($donation_id, 'give_last_paypal_ipn_received', true); |
|
618 | + $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='.$last_paypal_ipn_received['transaction_id']; |
|
619 | + $donation_url = site_url().'/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$donation_id; |
|
621 | 620 | echo sprintf( |
622 | - __( 'IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give' ), |
|
621 | + __('IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give'), |
|
623 | 622 | $donation_url, |
624 | 623 | $donation_id, |
625 | 624 | $transaction_url, |
626 | 625 | $last_paypal_ipn_received['transaction_id'], |
627 | - date_i18n( 'm/d/Y', $ipn_timestamp ), |
|
628 | - date_i18n( 'H:i', $ipn_timestamp ), |
|
626 | + date_i18n('m/d/Y', $ipn_timestamp), |
|
627 | + date_i18n('H:i', $ipn_timestamp), |
|
629 | 628 | $last_paypal_ipn_received['auth_status'] |
630 | 629 | ); |
631 | 630 | } else { |
@@ -635,9 +634,9 @@ discard block |
||
635 | 634 | </td> |
636 | 635 | </tr> |
637 | 636 | <tr> |
638 | - <td data-export-label="Donor Email Access"><?php _e( 'Donor Email Access', 'give' ); ?>:</td> |
|
639 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether donors can access their donation history using only email.', 'give' ) ); ?></td> |
|
640 | - <td><?php echo 'enabled' === give_get_option( 'email_access' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
637 | + <td data-export-label="Donor Email Access"><?php _e('Donor Email Access', 'give'); ?>:</td> |
|
638 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether donors can access their donation history using only email.', 'give')); ?></td> |
|
639 | + <td><?php echo 'enabled' === give_get_option('email_access') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
641 | 640 | </tr> |
642 | 641 | </tbody> |
643 | 642 | </table> |
@@ -645,45 +644,45 @@ discard block |
||
645 | 644 | <table class="give-status-table widefat" cellspacing="0"> |
646 | 645 | <thead> |
647 | 646 | <tr> |
648 | - <th colspan="3" data-export-label="Session Configuration"><h2><?php _e( 'Session Configuration', 'give' ); ?></h2></th> |
|
647 | + <th colspan="3" data-export-label="Session Configuration"><h2><?php _e('Session Configuration', 'give'); ?></h2></th> |
|
649 | 648 | </tr> |
650 | 649 | </thead> |
651 | 650 | <tbody> |
652 | 651 | <tr> |
653 | - <td data-export-label="Give Use Sessions"><?php _e( 'Give Use Sessions', 'give' ); ?>:</td> |
|
654 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether PHP sessions are enforced, enabled, or disabled.', 'give' ) ); ?></td> |
|
655 | - <td><?php echo defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? __( 'Enforced', 'give' ) : ( Give()->session->use_php_sessions() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ) ); ?></td> |
|
652 | + <td data-export-label="Give Use Sessions"><?php _e('Give Use Sessions', 'give'); ?>:</td> |
|
653 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether PHP sessions are enforced, enabled, or disabled.', 'give')); ?></td> |
|
654 | + <td><?php echo defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? __('Enforced', 'give') : (Give()->session->use_php_sessions() ? __('Enabled', 'give') : __('Disabled', 'give')); ?></td> |
|
656 | 655 | </tr> |
657 | 656 | <tr> |
658 | - <td data-export-label="Session"><?php _e( 'Session', 'give' ); ?>:</td> |
|
659 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether a PHP session is currently set.', 'give' ) ); ?></td> |
|
660 | - <td><?php echo isset( $_SESSION ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
657 | + <td data-export-label="Session"><?php _e('Session', 'give'); ?>:</td> |
|
658 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether a PHP session is currently set.', 'give')); ?></td> |
|
659 | + <td><?php echo isset($_SESSION) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
661 | 660 | </tr> |
662 | - <?php if ( isset( $_SESSION ) ) { ?> |
|
661 | + <?php if (isset($_SESSION)) { ?> |
|
663 | 662 | <tr> |
664 | - <td data-export-label="Session Name"><?php _e( 'Session Name', 'give' ); ?>:</td> |
|
665 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the current PHP session.', 'give' ) ); ?></td> |
|
666 | - <td><?php echo esc_html( ini_get( 'session.name' ) ); ?></td> |
|
663 | + <td data-export-label="Session Name"><?php _e('Session Name', 'give'); ?>:</td> |
|
664 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the current PHP session.', 'give')); ?></td> |
|
665 | + <td><?php echo esc_html(ini_get('session.name')); ?></td> |
|
667 | 666 | </tr> |
668 | 667 | <tr> |
669 | - <td data-export-label="Cookie Path"><?php _e( 'Cookie Path', 'give' ); ?>:</td> |
|
670 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The cookie path of the current PHP session.', 'give' ) ); ?></td> |
|
671 | - <td><?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?></td> |
|
668 | + <td data-export-label="Cookie Path"><?php _e('Cookie Path', 'give'); ?>:</td> |
|
669 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The cookie path of the current PHP session.', 'give')); ?></td> |
|
670 | + <td><?php echo esc_html(ini_get('session.cookie_path')); ?></td> |
|
672 | 671 | </tr> |
673 | 672 | <tr> |
674 | - <td data-export-label="Save Path"><?php _e( 'Save Path', 'give' ); ?>:</td> |
|
675 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The save path of the current PHP session.', 'give' ) ); ?></td> |
|
676 | - <td><?php echo esc_html( ini_get( 'session.save_path' ) ); ?></td> |
|
673 | + <td data-export-label="Save Path"><?php _e('Save Path', 'give'); ?>:</td> |
|
674 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The save path of the current PHP session.', 'give')); ?></td> |
|
675 | + <td><?php echo esc_html(ini_get('session.save_path')); ?></td> |
|
677 | 676 | </tr> |
678 | 677 | <tr> |
679 | - <td data-export-label="Use Cookies"><?php _e( 'Use Cookies', 'give' ); ?>:</td> |
|
680 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current PHP session is set to use cookies.', 'give' ) ); ?></td> |
|
681 | - <td><?php echo ini_get( 'session.use_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
678 | + <td data-export-label="Use Cookies"><?php _e('Use Cookies', 'give'); ?>:</td> |
|
679 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current PHP session is set to use cookies.', 'give')); ?></td> |
|
680 | + <td><?php echo ini_get('session.use_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
682 | 681 | </tr> |
683 | 682 | <tr> |
684 | - <td data-export-label="Use Only Cookies"><?php _e( 'Use Only Cookies', 'give' ); ?>:</td> |
|
685 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current PHP session is set to use only cookies.', 'give' ) ); ?></td> |
|
686 | - <td><?php echo ini_get( 'session.use_only_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
683 | + <td data-export-label="Use Only Cookies"><?php _e('Use Only Cookies', 'give'); ?>:</td> |
|
684 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current PHP session is set to use only cookies.', 'give')); ?></td> |
|
685 | + <td><?php echo ini_get('session.use_only_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
687 | 686 | </tr> |
688 | 687 | <?php } ?> |
689 | 688 | </tbody> |
@@ -692,13 +691,13 @@ discard block |
||
692 | 691 | <table class="give-status-table widefat" cellspacing="0"> |
693 | 692 | <thead> |
694 | 693 | <tr> |
695 | - <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e( 'Active Give Add-ons', 'give' ); ?></h2></th> |
|
694 | + <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e('Active Give Add-ons', 'give'); ?></h2></th> |
|
696 | 695 | </tr> |
697 | 696 | </thead> |
698 | 697 | <tbody> |
699 | 698 | <?php |
700 | - foreach ( $plugins as $plugin_data ) { |
|
701 | - if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) { |
|
699 | + foreach ($plugins as $plugin_data) { |
|
700 | + if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) { |
|
702 | 701 | continue; |
703 | 702 | } |
704 | 703 | |
@@ -706,40 +705,40 @@ discard block |
||
706 | 705 | $author_name = $plugin_data['Author']; |
707 | 706 | |
708 | 707 | // Link the plugin name to the plugin URL if available. |
709 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
708 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
710 | 709 | $plugin_name = sprintf( |
711 | 710 | '<a href="%s" title="%s">%s</a>', |
712 | - esc_url( $plugin_data['PluginURI'] ), |
|
713 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
711 | + esc_url($plugin_data['PluginURI']), |
|
712 | + esc_attr__('Visit plugin homepage', 'give'), |
|
714 | 713 | $plugin_name |
715 | 714 | ); |
716 | 715 | } |
717 | 716 | |
718 | 717 | // Link the author name to the author URL if available. |
719 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
718 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
720 | 719 | $author_name = sprintf( |
721 | 720 | '<a href="%s" title="%s">%s</a>', |
722 | - esc_url( $plugin_data['AuthorURI'] ), |
|
723 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
721 | + esc_url($plugin_data['AuthorURI']), |
|
722 | + esc_attr__('Visit author homepage', 'give'), |
|
724 | 723 | $author_name |
725 | 724 | ); |
726 | 725 | } |
727 | 726 | ?> |
728 | 727 | <tr> |
729 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
728 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
730 | 729 | <td class="help"> </td> |
731 | 730 | <td> |
732 | 731 | <?php |
733 | - if ( true === $plugin_data['License'] ) { |
|
734 | - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> ' . __( 'Licensed', 'give' ); |
|
732 | + if (true === $plugin_data['License']) { |
|
733 | + echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> '.__('Licensed', 'give'); |
|
735 | 734 | } else { |
736 | - echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> ' . __( 'Unlicensed', 'give' ); |
|
735 | + echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> '.__('Unlicensed', 'give'); |
|
737 | 736 | } |
738 | 737 | |
739 | 738 | echo ' – ' |
740 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
739 | + . sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))) |
|
741 | 740 | . ' – ' |
742 | - . esc_html( $plugin_data['Version'] ); |
|
741 | + . esc_html($plugin_data['Version']); |
|
743 | 742 | ?> |
744 | 743 | </td> |
745 | 744 | </tr> |
@@ -752,18 +751,18 @@ discard block |
||
752 | 751 | <table class="give-status-table widefat" cellspacing="0"> |
753 | 752 | <thead> |
754 | 753 | <tr> |
755 | - <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e( 'Other Active Plugins', 'give' ); ?></h2></th> |
|
754 | + <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e('Other Active Plugins', 'give'); ?></h2></th> |
|
756 | 755 | </tr> |
757 | 756 | </thead> |
758 | 757 | <tbody> |
759 | 758 | <?php |
760 | - foreach ( $plugins as $plugin_data ) { |
|
761 | - if ( 'active' != $plugin_data['Status'] || 'other' != $plugin_data['Type'] ) { |
|
759 | + foreach ($plugins as $plugin_data) { |
|
760 | + if ('active' != $plugin_data['Status'] || 'other' != $plugin_data['Type']) { |
|
762 | 761 | continue; |
763 | 762 | } |
764 | 763 | |
765 | 764 | // Do not show Give core plugin. |
766 | - if ( 'Give - Donation Plugin' === $plugin_data['Name'] ) { |
|
765 | + if ('Give - Donation Plugin' === $plugin_data['Name']) { |
|
767 | 766 | continue; |
768 | 767 | } |
769 | 768 | |
@@ -771,29 +770,29 @@ discard block |
||
771 | 770 | $author_name = $plugin_data['Author']; |
772 | 771 | |
773 | 772 | // Link the plugin name to the plugin URL if available. |
774 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
773 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
775 | 774 | $plugin_name = sprintf( |
776 | 775 | '<a href="%s" title="%s">%s</a>', |
777 | - esc_url( $plugin_data['PluginURI'] ), |
|
778 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
776 | + esc_url($plugin_data['PluginURI']), |
|
777 | + esc_attr__('Visit plugin homepage', 'give'), |
|
779 | 778 | $plugin_name |
780 | 779 | ); |
781 | 780 | } |
782 | 781 | |
783 | 782 | // Link the author name to the author URL if available. |
784 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
783 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
785 | 784 | $author_name = sprintf( |
786 | 785 | '<a href="%s" title="%s">%s</a>', |
787 | - esc_url( $plugin_data['AuthorURI'] ), |
|
788 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
786 | + esc_url($plugin_data['AuthorURI']), |
|
787 | + esc_attr__('Visit author homepage', 'give'), |
|
789 | 788 | $author_name |
790 | 789 | ); |
791 | 790 | } |
792 | 791 | ?> |
793 | 792 | <tr> |
794 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
793 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
795 | 794 | <td class="help"> </td> |
796 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
795 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
797 | 796 | </tr> |
798 | 797 | <?php |
799 | 798 | } |
@@ -804,13 +803,13 @@ discard block |
||
804 | 803 | <table class="give-status-table widefat" cellspacing="0"> |
805 | 804 | <thead> |
806 | 805 | <tr> |
807 | - <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e( 'Inactive Plugins', 'give' ); ?></h2></th> |
|
806 | + <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e('Inactive Plugins', 'give'); ?></h2></th> |
|
808 | 807 | </tr> |
809 | 808 | </thead> |
810 | 809 | <tbody> |
811 | 810 | <?php |
812 | - foreach ( $plugins as $plugin_data ) { |
|
813 | - if ( 'inactive' != $plugin_data['Status'] ) { |
|
811 | + foreach ($plugins as $plugin_data) { |
|
812 | + if ('inactive' != $plugin_data['Status']) { |
|
814 | 813 | continue; |
815 | 814 | } |
816 | 815 | |
@@ -818,29 +817,29 @@ discard block |
||
818 | 817 | $author_name = $plugin_data['Author']; |
819 | 818 | |
820 | 819 | // Link the plugin name to the plugin URL if available. |
821 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
820 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
822 | 821 | $plugin_name = sprintf( |
823 | 822 | '<a href="%s" title="%s">%s</a>', |
824 | - esc_url( $plugin_data['PluginURI'] ), |
|
825 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
823 | + esc_url($plugin_data['PluginURI']), |
|
824 | + esc_attr__('Visit plugin homepage', 'give'), |
|
826 | 825 | $plugin_name |
827 | 826 | ); |
828 | 827 | } |
829 | 828 | |
830 | 829 | // Link the author name to the author URL if available. |
831 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
830 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
832 | 831 | $author_name = sprintf( |
833 | 832 | '<a href="%s" title="%s">%s</a>', |
834 | - esc_url( $plugin_data['AuthorURI'] ), |
|
835 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
833 | + esc_url($plugin_data['AuthorURI']), |
|
834 | + esc_attr__('Visit author homepage', 'give'), |
|
836 | 835 | $author_name |
837 | 836 | ); |
838 | 837 | } |
839 | 838 | ?> |
840 | 839 | <tr> |
841 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
840 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
842 | 841 | <td class="help"> </td> |
843 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
842 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
844 | 843 | </tr> |
845 | 844 | <?php |
846 | 845 | } |
@@ -850,38 +849,38 @@ discard block |
||
850 | 849 | |
851 | 850 | <?php |
852 | 851 | $active_mu_plugins = (array) get_mu_plugins(); |
853 | -if ( ! empty( $active_mu_plugins ) ) { |
|
852 | +if ( ! empty($active_mu_plugins)) { |
|
854 | 853 | ?> |
855 | 854 | <table class="give-status-table widefat" cellspacing="0"> |
856 | 855 | <thead> |
857 | 856 | <tr> |
858 | - <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e( 'Active MU Plugins', 'give' ); ?></h2></th> |
|
857 | + <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e('Active MU Plugins', 'give'); ?></h2></th> |
|
859 | 858 | </tr> |
860 | 859 | </thead> |
861 | 860 | <tbody> |
862 | 861 | <?php |
863 | 862 | |
864 | - foreach ( $active_mu_plugins as $mu_plugin_data ) { |
|
865 | - if ( ! empty( $mu_plugin_data['Name'] ) ) { |
|
863 | + foreach ($active_mu_plugins as $mu_plugin_data) { |
|
864 | + if ( ! empty($mu_plugin_data['Name'])) { |
|
866 | 865 | // Link the plugin name to the plugin URL if available. |
867 | - $plugin_name = esc_html( $mu_plugin_data['Name'] ); |
|
866 | + $plugin_name = esc_html($mu_plugin_data['Name']); |
|
868 | 867 | |
869 | - if ( ! empty( $mu_plugin_data['PluginURI'] ) ) { |
|
868 | + if ( ! empty($mu_plugin_data['PluginURI'])) { |
|
870 | 869 | $plugin_name = sprintf( |
871 | 870 | '<a href="%s" title="%s">%s</a>', |
872 | - esc_url( $mu_plugin_data['PluginURI'] ), |
|
873 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
871 | + esc_url($mu_plugin_data['PluginURI']), |
|
872 | + esc_attr__('Visit plugin homepage', 'give'), |
|
874 | 873 | $plugin_name |
875 | 874 | ); |
876 | 875 | } |
877 | 876 | |
878 | 877 | // Link the author name to the author URL if available. |
879 | - $author_name = esc_html( $mu_plugin_data['Author'] ); |
|
878 | + $author_name = esc_html($mu_plugin_data['Author']); |
|
880 | 879 | |
881 | - if ( ! empty( $mu_plugin_data['AuthorURI'] ) ) { |
|
880 | + if ( ! empty($mu_plugin_data['AuthorURI'])) { |
|
882 | 881 | $author_name = sprintf( |
883 | 882 | '<a href="%s">%s</a>', |
884 | - esc_url( $mu_plugin_data['AuthorURI'] ), |
|
883 | + esc_url($mu_plugin_data['AuthorURI']), |
|
885 | 884 | $author_name |
886 | 885 | ); |
887 | 886 | } |
@@ -889,7 +888,7 @@ discard block |
||
889 | 888 | <tr> |
890 | 889 | <td><?php echo $plugin_name; ?></td> |
891 | 890 | <td class="help"> </td> |
892 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), $author_name ) . ' – ' . esc_html( $mu_plugin_data['Version'] ); ?></td> |
|
891 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), $author_name).' – '.esc_html($mu_plugin_data['Version']); ?></td> |
|
893 | 892 | </tr> |
894 | 893 | <?php |
895 | 894 | } |
@@ -902,53 +901,53 @@ discard block |
||
902 | 901 | <table class="give-status-table widefat" cellspacing="0"> |
903 | 902 | <thead> |
904 | 903 | <tr> |
905 | - <th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'give' ); ?></h2></th> |
|
904 | + <th colspan="3" data-export-label="Theme"><h2><?php _e('Theme', 'give'); ?></h2></th> |
|
906 | 905 | </tr> |
907 | 906 | </thead> |
908 | 907 | <?php |
909 | - include_once( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
908 | + include_once(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
910 | 909 | $active_theme = wp_get_theme(); |
911 | 910 | ?> |
912 | 911 | <tbody> |
913 | 912 | <tr> |
914 | - <td data-export-label="Name"><?php _e( 'Name', 'give' ); ?>:</td> |
|
915 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the current active theme.', 'give' ) ); ?></td> |
|
916 | - <td><?php echo esc_html( $active_theme->Name ); ?></td> |
|
913 | + <td data-export-label="Name"><?php _e('Name', 'give'); ?>:</td> |
|
914 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the current active theme.', 'give')); ?></td> |
|
915 | + <td><?php echo esc_html($active_theme->Name); ?></td> |
|
917 | 916 | </tr> |
918 | 917 | <tr> |
919 | - <td data-export-label="Version"><?php _e( 'Version', 'give' ); ?>:</td> |
|
920 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the current active theme.', 'give' ) ); ?></td> |
|
921 | - <td><?php echo esc_html( $active_theme->Version ); ?></td> |
|
918 | + <td data-export-label="Version"><?php _e('Version', 'give'); ?>:</td> |
|
919 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the current active theme.', 'give')); ?></td> |
|
920 | + <td><?php echo esc_html($active_theme->Version); ?></td> |
|
922 | 921 | </tr> |
923 | 922 | <tr> |
924 | - <td data-export-label="Author URL"><?php _e( 'Author URL', 'give' ); ?>:</td> |
|
925 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The theme developer\'s URL.', 'give' ) ); ?></td> |
|
923 | + <td data-export-label="Author URL"><?php _e('Author URL', 'give'); ?>:</td> |
|
924 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The theme developer\'s URL.', 'give')); ?></td> |
|
926 | 925 | <td><?php echo $active_theme->{'Author URI'}; ?></td> |
927 | 926 | </tr> |
928 | 927 | <tr> |
929 | - <td data-export-label="Child Theme"><?php _e( 'Child Theme', 'give' ); ?>:</td> |
|
930 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current theme is a child theme.', 'give' ) ); ?></td> |
|
928 | + <td data-export-label="Child Theme"><?php _e('Child Theme', 'give'); ?>:</td> |
|
929 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current theme is a child theme.', 'give')); ?></td> |
|
931 | 930 | <td><?php |
932 | - echo is_child_theme() ? __( 'Yes', 'give' ) : __( 'No', 'give' ) . ' – ' . sprintf( __( 'If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give' ), 'https://codex.wordpress.org/Child_Themes' ); |
|
931 | + echo is_child_theme() ? __('Yes', 'give') : __('No', 'give').' – '.sprintf(__('If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give'), 'https://codex.wordpress.org/Child_Themes'); |
|
933 | 932 | ?></td> |
934 | 933 | </tr> |
935 | 934 | <?php |
936 | - if( is_child_theme() ) { |
|
937 | - $parent_theme = wp_get_theme( $active_theme->Template ); |
|
935 | + if (is_child_theme()) { |
|
936 | + $parent_theme = wp_get_theme($active_theme->Template); |
|
938 | 937 | ?> |
939 | 938 | <tr> |
940 | - <td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'give' ); ?>:</td> |
|
941 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the parent theme.', 'give' ) ); ?></td> |
|
942 | - <td><?php echo esc_html( $parent_theme->Name ); ?></td> |
|
939 | + <td data-export-label="Parent Theme Name"><?php _e('Parent Theme Name', 'give'); ?>:</td> |
|
940 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the parent theme.', 'give')); ?></td> |
|
941 | + <td><?php echo esc_html($parent_theme->Name); ?></td> |
|
943 | 942 | </tr> |
944 | 943 | <tr> |
945 | - <td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'give' ); ?>:</td> |
|
946 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the parent theme.', 'give' ) ); ?></td> |
|
947 | - <td><?php echo esc_html( $parent_theme->Version ); ?></td> |
|
944 | + <td data-export-label="Parent Theme Version"><?php _e('Parent Theme Version', 'give'); ?>:</td> |
|
945 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the parent theme.', 'give')); ?></td> |
|
946 | + <td><?php echo esc_html($parent_theme->Version); ?></td> |
|
948 | 947 | </tr> |
949 | 948 | <tr> |
950 | - <td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'give' ); ?>:</td> |
|
951 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The parent theme developers URL.', 'give' ) ); ?></td> |
|
949 | + <td data-export-label="Parent Theme Author URL"><?php _e('Parent Theme Author URL', 'give'); ?>:</td> |
|
950 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The parent theme developers URL.', 'give')); ?></td> |
|
952 | 951 | <td><?php echo $parent_theme->{'Author URI'}; ?></td> |
953 | 952 | </tr> |
954 | 953 | <?php } ?> |