@@ -39,8 +39,8 @@ |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) |
42 | - || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) |
|
43 | - && class_exists( 'WPSEO_Sitemaps_Cache' ) |
|
42 | + || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) |
|
43 | + && class_exists( 'WPSEO_Sitemaps_Cache' ) |
|
44 | 44 | ) { |
45 | 45 | |
46 | 46 | $forms_singular_option = give_get_option( 'forms_singular' ); |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | * @return void |
20 | 20 | */ |
21 | 21 | function give_disable_mandrill_nl2br() { |
22 | - add_filter( 'mandrill_nl2br', '__return_false' ); |
|
22 | + add_filter('mandrill_nl2br', '__return_false'); |
|
23 | 23 | } |
24 | 24 | |
25 | -add_action( 'give_email_send_before', 'give_disable_mandrill_nl2br' ); |
|
25 | +add_action('give_email_send_before', 'give_disable_mandrill_nl2br'); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -34,33 +34,33 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function give_clear_seo_sitemap_cache_on_settings_change() { |
36 | 36 | // Load required file if the fn 'is_plugin_active' doesn't exists. |
37 | - if ( ! function_exists( 'is_plugin_active' ) ) { |
|
38 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
37 | + if ( ! function_exists('is_plugin_active')) { |
|
38 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
39 | 39 | } |
40 | 40 | |
41 | - if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) |
|
42 | - || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) |
|
43 | - && class_exists( 'WPSEO_Sitemaps_Cache' ) |
|
41 | + if ((is_plugin_active('wordpress-seo/wp-seo.php') |
|
42 | + || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) |
|
43 | + && class_exists('WPSEO_Sitemaps_Cache') |
|
44 | 44 | ) { |
45 | 45 | |
46 | - $forms_singular_option = give_get_option( 'forms_singular' ); |
|
47 | - $forms_archive_option = give_get_option( 'forms_singular' ); |
|
46 | + $forms_singular_option = give_get_option('forms_singular'); |
|
47 | + $forms_archive_option = give_get_option('forms_singular'); |
|
48 | 48 | |
49 | 49 | // If there is change detected for Single Form View and Form Archives options then proceed. |
50 | 50 | if ( |
51 | - ( isset( $_POST['forms_singular'] ) && $_POST['forms_singular'] !== $forms_singular_option ) || |
|
52 | - ( isset( $_POST['forms_archives'] ) && $_POST['forms_archives'] !== $forms_archive_option ) |
|
51 | + (isset($_POST['forms_singular']) && $_POST['forms_singular'] !== $forms_singular_option) || |
|
52 | + (isset($_POST['forms_archives']) && $_POST['forms_archives'] !== $forms_archive_option) |
|
53 | 53 | ) { |
54 | 54 | // If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache. |
55 | 55 | $yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache(); |
56 | - if ( method_exists( $yoast_sitemaps_cache, 'clear' ) ) { |
|
56 | + if (method_exists($yoast_sitemaps_cache, 'clear')) { |
|
57 | 57 | WPSEO_Sitemaps_Cache::clear(); |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -add_action( 'give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change' ); |
|
63 | +add_action('give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change'); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * This is support for the plugin Elementor. This function |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * Is the plugin: Elementor activated? |
80 | 80 | */ |
81 | - if ( is_plugin_active( 'elementor/elementor.php' ) ) { |
|
81 | + if (is_plugin_active('elementor/elementor.php')) { |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * Check user is on the Elementor's editor page, then hide Give Shortcodes Button. |
85 | 85 | */ |
86 | - if ( isset( $_GET['action'] ) && 'elementor' === give_clean( $_GET['action'] ) ) { |
|
86 | + if (isset($_GET['action']) && 'elementor' === give_clean($_GET['action'])) { |
|
87 | 87 | return false; |
88 | 88 | } |
89 | 89 | } |
@@ -91,4 +91,4 @@ discard block |
||
91 | 91 | return true; |
92 | 92 | } |
93 | 93 | |
94 | -add_filter( 'give_shortcode_button_condition', 'give_elementor_hide_shortcodes_button', 11 ); |
|
94 | +add_filter('give_shortcode_button_condition', 'give_elementor_hide_shortcodes_button', 11); |
@@ -95,5 +95,8 @@ |
||
95 | 95 | <?php endif; ?> |
96 | 96 | <?php echo $form_close_tag; ?> |
97 | 97 | </div> |
98 | -<?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?> |
|
98 | +<?php else { |
|
99 | + : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
100 | +} |
|
101 | +?> |
|
99 | 102 | <?php endif; ?> |
100 | 103 | \ No newline at end of file |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Admin View: Settings |
4 | 4 | */ |
5 | -if ( ! defined( 'ABSPATH' ) ) { |
|
5 | +if ( ! defined('ABSPATH')) { |
|
6 | 6 | exit; |
7 | 7 | } |
8 | 8 | |
9 | 9 | // Bailout: Do not output anything if setting tab is not defined. |
10 | -if ( ! empty( $tabs ) && array_key_exists( give_get_current_setting_tab(), $tabs ) ) : |
|
10 | +if ( ! empty($tabs) && array_key_exists(give_get_current_setting_tab(), $tabs)) : |
|
11 | 11 | /** |
12 | 12 | * Filter the form action. |
13 | 13 | * |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @since 1.8 |
19 | 19 | */ |
20 | - $form_method = apply_filters( self::$setting_filter_prefix . '_form_method_tab_' . $current_tab, 'post' ); |
|
20 | + $form_method = apply_filters(self::$setting_filter_prefix.'_form_method_tab_'.$current_tab, 'post'); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Filter the main form tab. |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @since 1.8 |
31 | 31 | */ |
32 | - $form_open_tag = apply_filters( self::$setting_filter_prefix . '_open_form', '<form method="' . $form_method . '" id="give-mainform" action="" enctype="multipart/form-data">' ); |
|
33 | - $form_close_tag = apply_filters( self::$setting_filter_prefix . '_close_form', '</form>' ); |
|
32 | + $form_open_tag = apply_filters(self::$setting_filter_prefix.'_open_form', '<form method="'.$form_method.'" id="give-mainform" action="" enctype="multipart/form-data">'); |
|
33 | + $form_close_tag = apply_filters(self::$setting_filter_prefix.'_close_form', '</form>'); |
|
34 | 34 | |
35 | - $wrapper_class = implode( ' ', |
|
35 | + $wrapper_class = implode(' ', |
|
36 | 36 | array( |
37 | - self::$setting_filter_prefix . '-setting-page', |
|
38 | - self::$setting_filter_prefix . '-' . give_get_current_setting_section() . '-section', |
|
39 | - self::$setting_filter_prefix . '-' . give_get_current_setting_tab() . '-tab', |
|
37 | + self::$setting_filter_prefix.'-setting-page', |
|
38 | + self::$setting_filter_prefix.'-'.give_get_current_setting_section().'-section', |
|
39 | + self::$setting_filter_prefix.'-'.give_get_current_setting_tab().'-tab', |
|
40 | 40 | ) |
41 | 41 | ); |
42 | 42 | ?> |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | /* @var Give_Settings_Page $current_setting_obj */ |
48 | 48 | if ( |
49 | - ! empty( $current_setting_obj ) && |
|
50 | - method_exists( $current_setting_obj, 'get_heading_html' ) |
|
49 | + ! empty($current_setting_obj) && |
|
50 | + method_exists($current_setting_obj, 'get_heading_html') |
|
51 | 51 | ) { |
52 | 52 | echo $current_setting_obj->get_heading_html(); |
53 | 53 | } else { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // Backward compatibility. |
56 | 56 | echo sprintf( |
57 | 57 | '<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">', |
58 | - esc_html( $tabs[ $current_tab ] ) |
|
58 | + esc_html($tabs[$current_tab]) |
|
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | ?> |
64 | 64 | <div class="nav-tab-wrapper give-nav-tab-wrapper"> |
65 | 65 | <?php |
66 | - foreach ( $tabs as $name => $label ) { |
|
67 | - echo '<a href="' . admin_url( "edit.php?post_type=give_forms&page=" . self::$setting_filter_prefix . "&tab={$name}" ) . '" class="nav-tab ' . ( $current_tab === $name ? 'nav-tab-active' : 'give-mobile-hidden' ) . '">' . $label . '</a>'; |
|
66 | + foreach ($tabs as $name => $label) { |
|
67 | + echo '<a href="'.admin_url("edit.php?post_type=give_forms&page=".self::$setting_filter_prefix."&tab={$name}").'" class="nav-tab '.($current_tab === $name ? 'nav-tab-active' : 'give-mobile-hidden').'">'.$label.'</a>'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @since 1.8 |
78 | 78 | */ |
79 | - do_action( self::$setting_filter_prefix . '_tabs' ); |
|
79 | + do_action(self::$setting_filter_prefix.'_tabs'); |
|
80 | 80 | ?> |
81 | 81 | <div class="give-sub-nav-tab-wrapper"> |
82 | - <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e( 'View remaining setting tabs', 'give' ); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span> |
|
82 | + <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e('View remaining setting tabs', 'give'); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span> |
|
83 | 83 | </a> |
84 | 84 | <nav class="give-sub-nav-tab give-hidden"></nav> |
85 | 85 | </div> |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @since 1.8 |
97 | 97 | */ |
98 | - do_action( self::$setting_filter_prefix . "_sections_{$current_tab}_page" ); |
|
98 | + do_action(self::$setting_filter_prefix."_sections_{$current_tab}_page"); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Trigger Action. |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @since 1.8 |
108 | 108 | */ |
109 | - do_action( self::$setting_filter_prefix . "_settings_{$current_tab}_page" ); |
|
109 | + do_action(self::$setting_filter_prefix."_settings_{$current_tab}_page"); |
|
110 | 110 | |
111 | - wp_nonce_field( 'give-save-settings', '_give-save-settings' ); |
|
111 | + wp_nonce_field('give-save-settings', '_give-save-settings'); |
|
112 | 112 | |
113 | - if ( empty( $GLOBALS['give_hide_save_button'] ) ) : ?> |
|
113 | + if (empty($GLOBALS['give_hide_save_button'])) : ?> |
|
114 | 114 | <div class="give-submit-wrap"> |
115 | - <input name="save" class="button-primary give-save-button" type="submit" value="<?php _e( 'Save changes', 'give' ); ?>"/> |
|
115 | + <input name="save" class="button-primary give-save-button" type="submit" value="<?php _e('Save changes', 'give'); ?>"/> |
|
116 | 116 | </div> |
117 | 117 | <?php endif; ?> |
118 | 118 | <?php echo $form_close_tag; ?> |
119 | 119 | </div> |
120 | -<?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?> |
|
120 | +<?php else : echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; ?> |
|
121 | 121 | <?php endif; ?> |
122 | 122 | \ No newline at end of file |
@@ -17,23 +17,23 @@ discard block |
||
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div class="give-blank-slate"> |
20 | - <?php if ( ! empty( $content['image_url'] ) ) : ?> |
|
21 | - <img class="give-blank-slate__image" src="<?php echo esc_url( $content['image_url'] ); ?>" alt="<?php echo esc_attr( $content['image_alt'] ); ?>"> |
|
20 | + <?php if ( ! empty($content['image_url'])) : ?> |
|
21 | + <img class="give-blank-slate__image" src="<?php echo esc_url($content['image_url']); ?>" alt="<?php echo esc_attr($content['image_alt']); ?>"> |
|
22 | 22 | <?php endif; ?> |
23 | 23 | |
24 | - <?php if ( ! empty( $content['heading'] ) ) : ?> |
|
25 | - <h2 class="give-blank-slate__heading"><?php esc_html_e( $content['heading'] ); ?></h2> |
|
24 | + <?php if ( ! empty($content['heading'])) : ?> |
|
25 | + <h2 class="give-blank-slate__heading"><?php esc_html_e($content['heading']); ?></h2> |
|
26 | 26 | <?php endif; ?> |
27 | 27 | |
28 | - <?php if ( ! empty( $content['message'] ) ) : ?> |
|
29 | - <p class="give-blank-slate__message"><?php esc_html_e( $content['message'] ); ?></p> |
|
28 | + <?php if ( ! empty($content['message'])) : ?> |
|
29 | + <p class="give-blank-slate__message"><?php esc_html_e($content['message']); ?></p> |
|
30 | 30 | <?php endif; ?> |
31 | 31 | |
32 | - <?php if ( ! empty( $content['cta_text']) && ! empty( $content['cta_link'] ) ) : ?> |
|
33 | - <a class="give-blank-slate__cta button button-primary" href="<?php echo esc_url( $content['cta_link'] ); ?>"><?php esc_html_e( $content['cta_text'] ); ?></a> |
|
32 | + <?php if ( ! empty($content['cta_text']) && ! empty($content['cta_link'])) : ?> |
|
33 | + <a class="give-blank-slate__cta button button-primary" href="<?php echo esc_url($content['cta_link']); ?>"><?php esc_html_e($content['cta_text']); ?></a> |
|
34 | 34 | <?php endif; ?> |
35 | 35 | |
36 | - <?php if ( ! empty( $content['help'] ) ) : ?> |
|
36 | + <?php if ( ! empty($content['help'])) : ?> |
|
37 | 37 | <p class="give-blank-slate__help"> |
38 | 38 | <?php |
39 | 39 | $allowed_html = array( |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'code' => array(), |
48 | 48 | ); |
49 | 49 | |
50 | - echo wp_kses( $content['help'], $allowed_html ); |
|
50 | + echo wp_kses($content['help'], $allowed_html); |
|
51 | 51 | ?> |
52 | 52 | </p> |
53 | 53 | <?php endif; ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @since 1.5 |
21 | 21 | */ |
22 | 22 | function give_register_batch_recount_export_classes() { |
23 | - add_action( 'give_batch_export_class_include', 'give_include_batch_export_class', 10, 1 ); |
|
23 | + add_action('give_batch_export_class_include', 'give_include_batch_export_class', 10, 1); |
|
24 | 24 | } |
25 | 25 | |
26 | -add_action( 'give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10 ); |
|
26 | +add_action('give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10); |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -35,39 +35,39 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return void |
37 | 37 | */ |
38 | -function give_include_batch_export_class( $class ) { |
|
39 | - switch ( $class ) { |
|
38 | +function give_include_batch_export_class($class) { |
|
39 | + switch ($class) { |
|
40 | 40 | |
41 | 41 | case 'Give_Tools_Delete_Donors': |
42 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-test-donors.php'; |
|
42 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-delete-test-donors.php'; |
|
43 | 43 | break; |
44 | 44 | |
45 | 45 | case 'Give_Tools_Import_Donors': |
46 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-import-donors.php'; |
|
46 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-delete-import-donors.php'; |
|
47 | 47 | break; |
48 | 48 | |
49 | 49 | case 'Give_Tools_Delete_Test_Transactions': |
50 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-test-transactions.php'; |
|
50 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-delete-test-transactions.php'; |
|
51 | 51 | break; |
52 | 52 | |
53 | 53 | case 'Give_Tools_Recount_Donor_Stats': |
54 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-donor-stats.php'; |
|
54 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-donor-stats.php'; |
|
55 | 55 | break; |
56 | 56 | |
57 | 57 | case 'Give_Tools_Reset_Stats': |
58 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-reset-stats.php'; |
|
58 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-reset-stats.php'; |
|
59 | 59 | break; |
60 | 60 | |
61 | 61 | case 'Give_Tools_Recount_All_Stats': |
62 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-all-stats.php'; |
|
62 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-all-stats.php'; |
|
63 | 63 | break; |
64 | 64 | |
65 | 65 | case 'Give_Tools_Recount_Form_Stats': |
66 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-form-stats.php'; |
|
66 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-form-stats.php'; |
|
67 | 67 | break; |
68 | 68 | |
69 | 69 | case 'Give_Tools_Recount_Income': |
70 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-income.php'; |
|
70 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-income.php'; |
|
71 | 71 | break; |
72 | 72 | } |
73 | 73 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | * @param array $_data |
82 | 82 | * @param array $options |
83 | 83 | */ |
84 | - public function __construct( $_data, $options = array() ) { |
|
84 | + public function __construct($_data, $options = array()) { |
|
85 | 85 | |
86 | - $this->data = $_data; |
|
86 | + $this->data = $_data; |
|
87 | 87 | |
88 | 88 | // Generate unique ID |
89 | - $this->id = md5( rand() ); |
|
89 | + $this->id = md5(rand()); |
|
90 | 90 | |
91 | 91 | // Setup default options; |
92 | - $this->options = apply_filters( 'give_graph_args', array( |
|
92 | + $this->options = apply_filters('give_graph_args', array( |
|
93 | 93 | 'y_mode' => null, |
94 | 94 | 'x_mode' => null, |
95 | 95 | 'y_decimals' => 0, |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | 'lines' => false, |
108 | 108 | 'points' => true, |
109 | 109 | 'dataType' => array() |
110 | - ) ); |
|
110 | + )); |
|
111 | 111 | |
112 | - $this->options = wp_parse_args( $options, $this->options ); |
|
112 | + $this->options = wp_parse_args($options, $this->options); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @since 1.0 |
122 | 122 | */ |
123 | - public function set( $key, $value ) { |
|
124 | - $this->options[ $key ] = $value; |
|
123 | + public function set($key, $value) { |
|
124 | + $this->options[$key] = $value; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @since 1.0 |
133 | 133 | */ |
134 | - public function get( $key ) { |
|
135 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
134 | + public function get($key) { |
|
135 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @since 1.0 |
142 | 142 | */ |
143 | 143 | public function get_data() { |
144 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
144 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -151,19 +151,19 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function load_scripts() { |
153 | 153 | // Use minified libraries if SCRIPT_DEBUG is turned off |
154 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
154 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
155 | 155 | |
156 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
157 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
156 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
157 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
158 | 158 | |
159 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
160 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
159 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
160 | + wp_enqueue_script('jquery-flot-time'); |
|
161 | 161 | |
162 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
163 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
162 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
163 | + wp_enqueue_script('jquery-flot-resize'); |
|
164 | 164 | |
165 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
166 | - wp_enqueue_script( 'jquery-flot' ); |
|
165 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
166 | + wp_enqueue_script('jquery-flot'); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | [ |
191 | 191 | <?php |
192 | 192 | $order = 0; |
193 | - foreach( $this->get_data() as $label => $data ) : |
|
193 | + foreach ($this->get_data() as $label => $data) : |
|
194 | 194 | ?> |
195 | 195 | { |
196 | - label : "<?php echo esc_attr( $label ); ?>", |
|
197 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
198 | - dataType : '<?php echo ( ! empty( $this->options['dataType'][$order] ) ? $this->options['dataType'][$order] : 'count' ); ?>', |
|
196 | + label : "<?php echo esc_attr($label); ?>", |
|
197 | + id : "<?php echo sanitize_key($label); ?>", |
|
198 | + dataType : '<?php echo ( ! empty($this->options['dataType'][$order]) ? $this->options['dataType'][$order] : 'count'); ?>', |
|
199 | 199 | // data format is: [ point on x, value on y ] |
200 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
200 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
201 | 201 | points: { |
202 | 202 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
203 | 203 | }, |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | fill : true, |
213 | 213 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
214 | 214 | }, |
215 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
215 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
216 | 216 | yaxis : <?php echo $yaxis_count; ?> |
217 | 217 | <?php endif; ?> |
218 | 218 | |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | grid: { |
227 | 227 | show : true, |
228 | 228 | aboveData : false, |
229 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
230 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
231 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
232 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
229 | + color : "<?php echo $this->options['color']; ?>", |
|
230 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
231 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
232 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
233 | 233 | clickable : false, |
234 | 234 | hoverable : true |
235 | 235 | }, |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | mode : "<?php echo $this->options['x_mode']; ?>", |
241 | 241 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
242 | 242 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
243 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
243 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
244 | 244 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
245 | 245 | <?php endif; ?> |
246 | 246 | }, |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | min : 0, |
250 | 250 | mode : "<?php echo $this->options['y_mode']; ?>", |
251 | 251 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
252 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
252 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
253 | 253 | tickDecimals: <?php echo $this->options['y_decimals']; ?>, |
254 | 254 | <?php endif; ?> |
255 | 255 | tickFormatter: function(val) { |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param Give_Graph $this Graph object. |
325 | 325 | */ |
326 | - do_action( 'give_before_graph', $this ); |
|
326 | + do_action('give_before_graph', $this); |
|
327 | 327 | |
328 | 328 | // Build the graph. |
329 | 329 | echo $this->build_graph(); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @param Give_Graph $this Graph object. |
337 | 337 | */ |
338 | - do_action( 'give_after_graph', $this ); |
|
338 | + do_action('give_after_graph', $this); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | } |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | |
455 | 455 | /** |
456 | 456 | * @param $option_value |
457 | - * @param $value |
|
457 | + * @param boolean $value |
|
458 | 458 | * |
459 | 459 | * @return string |
460 | 460 | */ |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @since 1.8.14 |
546 | 546 | * |
547 | - * @param $file_id |
|
547 | + * @param integer $file_id |
|
548 | 548 | * |
549 | 549 | * @return bool|int |
550 | 550 | */ |
@@ -201,13 +201,13 @@ discard block |
||
201 | 201 | id="recount-stats-submit" |
202 | 202 | value=" |
203 | 203 | <?php |
204 | - /** |
|
205 | - * Filter to modify donation importer submit button text. |
|
206 | - * |
|
207 | - * @since 2.1 |
|
208 | - */ |
|
209 | - echo apply_filters( 'give_import_donation_submit_button_text', __( 'Submit', 'give' ) ); |
|
210 | - ?> |
|
204 | + /** |
|
205 | + * Filter to modify donation importer submit button text. |
|
206 | + * |
|
207 | + * @since 2.1 |
|
208 | + */ |
|
209 | + echo apply_filters( 'give_import_donation_submit_button_text', __( 'Submit', 'give' ) ); |
|
210 | + ?> |
|
211 | 211 | "/> |
212 | 212 | </th> |
213 | 213 | <th> |
@@ -1079,8 +1079,8 @@ discard block |
||
1079 | 1079 | */ |
1080 | 1080 | private function is_donations_import_page() { |
1081 | 1081 | return 'import' === give_get_current_setting_tab() && |
1082 | - isset( $_GET['importer-type'] ) && |
|
1083 | - $this->importer_type === give_clean( $_GET['importer-type'] ); |
|
1082 | + isset( $_GET['importer-type'] ) && |
|
1083 | + $this->importer_type === give_clean( $_GET['importer-type'] ); |
|
1084 | 1084 | } |
1085 | 1085 | } |
1086 | 1086 |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | * @since 1.8.14 |
12 | 12 | */ |
13 | 13 | |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; // Exit if accessed directly |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Give_Import_Donations' ) ) { |
|
18 | +if ( ! class_exists('Give_Import_Donations')) { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Give_Import_Donations. |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @access private |
67 | 67 | */ |
68 | 68 | private function __construct() { |
69 | - self::$per_page = ! empty( $_GET['per_page'] ) ? absint( $_GET['per_page'] ) : self::$per_page; |
|
69 | + self::$per_page = ! empty($_GET['per_page']) ? absint($_GET['per_page']) : self::$per_page; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return static |
79 | 79 | */ |
80 | 80 | public static function get_instance() { |
81 | - if ( null === static::$instance ) { |
|
81 | + if (null === static::$instance) { |
|
82 | 82 | self::$instance = new static(); |
83 | 83 | } |
84 | 84 | |
@@ -105,27 +105,27 @@ discard block |
||
105 | 105 | * @return void |
106 | 106 | */ |
107 | 107 | private function setup_hooks() { |
108 | - if ( ! $this->is_donations_import_page() ) { |
|
108 | + if ( ! $this->is_donations_import_page()) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 | |
112 | 112 | // Do not render main import tools page. |
113 | - remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) ); |
|
113 | + remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',)); |
|
114 | 114 | |
115 | 115 | |
116 | 116 | // Render donation import page |
117 | - add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) ); |
|
117 | + add_action('give_admin_field_tools_import', array($this, 'render_page')); |
|
118 | 118 | |
119 | 119 | // Print the HTML. |
120 | - add_action( 'give_tools_import_donations_form_start', array( $this, 'html' ), 10 ); |
|
120 | + add_action('give_tools_import_donations_form_start', array($this, 'html'), 10); |
|
121 | 121 | |
122 | 122 | // Run when form submit. |
123 | - add_action( 'give-tools_save_import', array( $this, 'save' ) ); |
|
123 | + add_action('give-tools_save_import', array($this, 'save')); |
|
124 | 124 | |
125 | - add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 ); |
|
125 | + add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1); |
|
126 | 126 | |
127 | 127 | // Used to add submit button. |
128 | - add_action( 'give_tools_import_donations_form_end', array( $this, 'submit' ), 10 ); |
|
128 | + add_action('give_tools_import_donations_form_end', array($this, 'submit'), 10); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return mixed |
139 | 139 | */ |
140 | - public function update_notices( $messages ) { |
|
141 | - if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) { |
|
142 | - unset( $messages['give-setting-updated'] ); |
|
140 | + public function update_notices($messages) { |
|
141 | + if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) { |
|
142 | + unset($messages['give-setting-updated']); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | return $messages; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @since 1.8.14 |
152 | 152 | */ |
153 | 153 | public function submit() { |
154 | - wp_nonce_field( 'give-save-settings', '_give-save-settings' ); |
|
154 | + wp_nonce_field('give-save-settings', '_give-save-settings'); |
|
155 | 155 | ?> |
156 | 156 | <input type="hidden" class="import-step" id="import-step" name="step" |
157 | 157 | value="<?php echo $this->get_step(); ?>"/> |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | ?> |
173 | 173 | <section> |
174 | 174 | <table |
175 | - class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo( 1 === $step && ! empty( $this->is_csv_valid ) ? 'give-hidden' : '' ); ?> " |
|
175 | + class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo(1 === $step && ! empty($this->is_csv_valid) ? 'give-hidden' : ''); ?> " |
|
176 | 176 | id="<?php echo "step-{$step}"; ?>"> |
177 | 177 | <tbody> |
178 | 178 | <?php |
179 | - switch ( $step ) { |
|
179 | + switch ($step) { |
|
180 | 180 | case 1: |
181 | 181 | $this->render_media_csv(); |
182 | 182 | break; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | case 4: |
193 | 193 | $this->import_success(); |
194 | 194 | } |
195 | - if ( false === $this->check_for_dropdown_or_import() ) { |
|
195 | + if (false === $this->check_for_dropdown_or_import()) { |
|
196 | 196 | ?> |
197 | 197 | <tr valign="top"> |
198 | 198 | <th> |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @since 2.1 |
208 | 208 | */ |
209 | - echo apply_filters( 'give_import_donation_submit_button_text', __( 'Submit', 'give' ) ); |
|
209 | + echo apply_filters('give_import_donation_submit_button_text', __('Submit', 'give')); |
|
210 | 210 | ?> |
211 | 211 | "/> |
212 | 212 | </th> |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @since 2.1 |
219 | 219 | */ |
220 | - do_action( 'give_import_donation_submit_button' ); |
|
220 | + do_action('give_import_donation_submit_button'); |
|
221 | 221 | ?> |
222 | 222 | </th> |
223 | 223 | </tr> |
@@ -237,70 +237,70 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function import_success() { |
239 | 239 | |
240 | - $delete_csv = ( ! empty( $_GET['delete_csv'] ) ? absint( $_GET['delete_csv'] ) : false ); |
|
241 | - $csv = ( ! empty( $_GET['csv'] ) ? absint( $_GET['csv'] ) : false ); |
|
242 | - if ( ! empty( $delete_csv ) && ! empty( $csv ) ) { |
|
243 | - wp_delete_attachment( $csv, true ); |
|
240 | + $delete_csv = ( ! empty($_GET['delete_csv']) ? absint($_GET['delete_csv']) : false); |
|
241 | + $csv = ( ! empty($_GET['csv']) ? absint($_GET['csv']) : false); |
|
242 | + if ( ! empty($delete_csv) && ! empty($csv)) { |
|
243 | + wp_delete_attachment($csv, true); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | $report = give_import_donation_report(); |
247 | 247 | |
248 | 248 | $report_html = array( |
249 | 249 | 'duplicate_donor' => array( |
250 | - __( '%s duplicate %s detected', 'give' ), |
|
251 | - __( '%s duplicate %s will be detected', 'give' ), |
|
252 | - __( 'donor', 'give' ), |
|
253 | - __( 'donors', 'give' ), |
|
250 | + __('%s duplicate %s detected', 'give'), |
|
251 | + __('%s duplicate %s will be detected', 'give'), |
|
252 | + __('donor', 'give'), |
|
253 | + __('donors', 'give'), |
|
254 | 254 | ), |
255 | 255 | 'create_donor' => array( |
256 | - __( '%s %s created', 'give' ), |
|
257 | - __( '%s %s will be going to get created', 'give' ), |
|
258 | - __( 'donor', 'give' ), |
|
259 | - __( 'donors', 'give' ), |
|
256 | + __('%s %s created', 'give'), |
|
257 | + __('%s %s will be going to get created', 'give'), |
|
258 | + __('donor', 'give'), |
|
259 | + __('donors', 'give'), |
|
260 | 260 | ), |
261 | 261 | 'create_form' => array( |
262 | - __( '%s donation %s created', 'give' ), |
|
263 | - __( '%s donation %s will be going to get created', 'give' ), |
|
264 | - __( 'form', 'give' ), |
|
265 | - __( 'forms', 'give' ), |
|
262 | + __('%s donation %s created', 'give'), |
|
263 | + __('%s donation %s will be going to get created', 'give'), |
|
264 | + __('form', 'give'), |
|
265 | + __('forms', 'give'), |
|
266 | 266 | ), |
267 | 267 | 'duplicate_donation' => array( |
268 | - __( '%s duplicate %s detected', 'give' ), |
|
269 | - __( '%s duplicate %s will be detected', 'give' ), |
|
270 | - __( 'donation', 'give' ), |
|
271 | - __( 'donations', 'give' ), |
|
268 | + __('%s duplicate %s detected', 'give'), |
|
269 | + __('%s duplicate %s will be detected', 'give'), |
|
270 | + __('donation', 'give'), |
|
271 | + __('donations', 'give'), |
|
272 | 272 | ), |
273 | 273 | 'create_donation' => array( |
274 | - __( '%s %s imported', 'give' ), |
|
275 | - __( '%s %s will going to get imported', 'give' ), |
|
276 | - __( 'donation', 'give' ), |
|
277 | - __( 'donations', 'give' ), |
|
274 | + __('%s %s imported', 'give'), |
|
275 | + __('%s %s will going to get imported', 'give'), |
|
276 | + __('donation', 'give'), |
|
277 | + __('donations', 'give'), |
|
278 | 278 | ), |
279 | 279 | ); |
280 | - $total = (int) $_GET['total']; |
|
281 | - -- $total; |
|
280 | + $total = (int) $_GET['total']; |
|
281 | + --$total; |
|
282 | 282 | $success = (bool) $_GET['success']; |
283 | - $dry_run = empty( $_GET['dry_run'] ) ? 0 : absint( $_GET['dry_run'] ); |
|
283 | + $dry_run = empty($_GET['dry_run']) ? 0 : absint($_GET['dry_run']); |
|
284 | 284 | ?> |
285 | 285 | <tr valign="top" class="give-import-dropdown"> |
286 | 286 | <th colspan="2"> |
287 | 287 | <h2> |
288 | 288 | <?php |
289 | - if ( $success ) { |
|
290 | - if ( $dry_run ) { |
|
289 | + if ($success) { |
|
290 | + if ($dry_run) { |
|
291 | 291 | printf( |
292 | - _n( 'Dry run import complete! %s donation processed', 'Dry run import complete! %s donations processed', $total, 'give' ), |
|
292 | + _n('Dry run import complete! %s donation processed', 'Dry run import complete! %s donations processed', $total, 'give'), |
|
293 | 293 | "<strong>{$total}</strong>" |
294 | 294 | ); |
295 | 295 | } else { |
296 | 296 | printf( |
297 | - _n( 'Import complete! %s donation processed', 'Import complete! %s donations processed', $total, 'give' ), |
|
297 | + _n('Import complete! %s donation processed', 'Import complete! %s donations processed', $total, 'give'), |
|
298 | 298 | "<strong>{$total}</strong>" |
299 | 299 | ); |
300 | 300 | } |
301 | 301 | } else { |
302 | 302 | printf( |
303 | - _n( 'Failed to import %s donation', 'Failed to import %s donations', $total, 'give' ), |
|
303 | + _n('Failed to import %s donation', 'Failed to import %s donations', $total, 'give'), |
|
304 | 304 | "<strong>{$total}</strong>" |
305 | 305 | ); |
306 | 306 | } |
@@ -308,16 +308,16 @@ discard block |
||
308 | 308 | </h2> |
309 | 309 | |
310 | 310 | <?php |
311 | - $text = __( 'Import Donation', 'give' ); |
|
311 | + $text = __('Import Donation', 'give'); |
|
312 | 312 | $query_arg = array( |
313 | 313 | 'post_type' => 'give_forms', |
314 | 314 | 'page' => 'give-tools', |
315 | 315 | 'tab' => 'import', |
316 | 316 | ); |
317 | - if ( $success ) { |
|
317 | + if ($success) { |
|
318 | 318 | |
319 | 319 | |
320 | - if ( $dry_run ) { |
|
320 | + if ($dry_run) { |
|
321 | 321 | $query_arg = array( |
322 | 322 | 'post_type' => 'give_forms', |
323 | 323 | 'page' => 'give-tools', |
@@ -325,25 +325,25 @@ discard block |
||
325 | 325 | 'importer-type' => 'import_donations', |
326 | 326 | ); |
327 | 327 | |
328 | - $text = __( 'Start Import', 'give' ); |
|
328 | + $text = __('Start Import', 'give'); |
|
329 | 329 | } else { |
330 | 330 | $query_arg = array( |
331 | 331 | 'post_type' => 'give_forms', |
332 | 332 | 'page' => 'give-payment-history', |
333 | 333 | ); |
334 | - $text = __( 'View Donations', 'give' ); |
|
334 | + $text = __('View Donations', 'give'); |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | - foreach ( $report as $key => $value ) { |
|
339 | - if ( array_key_exists( $key, $report_html ) && ! empty( $value ) ) { |
|
340 | - $key_name = $report_html[ $key ][2]; |
|
341 | - if ( $value > 1 ) { |
|
342 | - $key_name = $report_html[ $key ][3]; |
|
338 | + foreach ($report as $key => $value) { |
|
339 | + if (array_key_exists($key, $report_html) && ! empty($value)) { |
|
340 | + $key_name = $report_html[$key][2]; |
|
341 | + if ($value > 1) { |
|
342 | + $key_name = $report_html[$key][3]; |
|
343 | 343 | } |
344 | 344 | ?> |
345 | 345 | <p> |
346 | - <?php printf( $report_html[ $key ][ $dry_run ], $value, $key_name ); ?> |
|
346 | + <?php printf($report_html[$key][$dry_run], $value, $key_name); ?> |
|
347 | 347 | </p> |
348 | 348 | <?php |
349 | 349 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | <p> |
354 | 354 | <a class="button button-large button-secondary" |
355 | - href="<?php echo add_query_arg( $query_arg, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a> |
|
355 | + href="<?php echo add_query_arg($query_arg, admin_url('edit.php')); ?>"><?php echo $text; ?></a> |
|
356 | 356 | </p> |
357 | 357 | </th> |
358 | 358 | </tr> |
@@ -369,26 +369,26 @@ discard block |
||
369 | 369 | give_import_donation_report_reset(); |
370 | 370 | |
371 | 371 | $csv = (int) $_REQUEST['csv']; |
372 | - $delimiter = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' ); |
|
372 | + $delimiter = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv'); |
|
373 | 373 | $index_start = 1; |
374 | 374 | $index_end = 1; |
375 | 375 | $next = true; |
376 | - $total = self::get_csv_total( $csv ); |
|
377 | - if ( self::$per_page < $total ) { |
|
378 | - $total_ajax = ceil( $total / self::$per_page ); |
|
376 | + $total = self::get_csv_total($csv); |
|
377 | + if (self::$per_page < $total) { |
|
378 | + $total_ajax = ceil($total / self::$per_page); |
|
379 | 379 | $index_end = self::$per_page; |
380 | 380 | } else { |
381 | 381 | $total_ajax = 1; |
382 | 382 | $index_end = $total; |
383 | 383 | $next = false; |
384 | 384 | } |
385 | - $current_percentage = 100 / ( $total_ajax + 1 ); |
|
385 | + $current_percentage = 100 / ($total_ajax + 1); |
|
386 | 386 | |
387 | 387 | ?> |
388 | 388 | <tr valign="top" class="give-import-dropdown"> |
389 | 389 | <th colspan="2"> |
390 | - <h2 id="give-import-title"><?php _e( 'Importing', 'give' ) ?></h2> |
|
391 | - <p class="give-field-description"><?php _e( 'Your donations are now being imported...', 'give' ) ?></p> |
|
390 | + <h2 id="give-import-title"><?php _e('Importing', 'give') ?></h2> |
|
391 | + <p class="give-field-description"><?php _e('Your donations are now being imported...', 'give') ?></p> |
|
392 | 392 | </th> |
393 | 393 | </tr> |
394 | 394 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | <div style="width: <?php echo $current_percentage; ?>%"></div> |
408 | 408 | </div> |
409 | 409 | <input type="hidden" value="3" name="step"> |
410 | - <input type="hidden" value='<?php echo maybe_serialize( $_REQUEST['mapto'] ); ?>' name="mapto" |
|
410 | + <input type="hidden" value='<?php echo maybe_serialize($_REQUEST['mapto']); ?>' name="mapto" |
|
411 | 411 | class="mapto"> |
412 | 412 | <input type="hidden" value="<?php echo $_REQUEST['csv']; ?>" name="csv" class="csv"> |
413 | 413 | <input type="hidden" value="<?php echo $_REQUEST['mode']; ?>" name="mode" class="mode"> |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | <input type="hidden" value="<?php echo $_REQUEST['delete_csv']; ?>" name="delete_csv" |
417 | 417 | class="delete_csv"> |
418 | 418 | <input type="hidden" value="<?php echo $delimiter; ?>" name="delimiter"> |
419 | - <input type="hidden" value="<?php echo absint( $_REQUEST['dry_run'] ); ?>" name="dry_run"> |
|
419 | + <input type="hidden" value="<?php echo absint($_REQUEST['dry_run']); ?>" name="dry_run"> |
|
420 | 420 | <input type="hidden" |
421 | - value='<?php echo maybe_serialize( self::get_importer( $csv, 0, $delimiter ) ); ?>' |
|
421 | + value='<?php echo maybe_serialize(self::get_importer($csv, 0, $delimiter)); ?>' |
|
422 | 422 | name="main_key" |
423 | 423 | class="main_key"> |
424 | 424 | </th> |
@@ -433,20 +433,20 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public function check_for_dropdown_or_import() { |
435 | 435 | $return = true; |
436 | - if ( isset( $_REQUEST['mapto'] ) ) { |
|
436 | + if (isset($_REQUEST['mapto'])) { |
|
437 | 437 | $mapto = (array) $_REQUEST['mapto']; |
438 | - if ( false === in_array( 'form_title', $mapto ) && false === in_array( 'form_id', $mapto ) ) { |
|
439 | - Give_Admin_Settings::add_error( 'give-import-csv-form', __( 'In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give' ) ); |
|
438 | + if (false === in_array('form_title', $mapto) && false === in_array('form_id', $mapto)) { |
|
439 | + Give_Admin_Settings::add_error('give-import-csv-form', __('In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give')); |
|
440 | 440 | $return = false; |
441 | 441 | } |
442 | 442 | |
443 | - if ( false === in_array( 'amount', $mapto ) ) { |
|
444 | - Give_Admin_Settings::add_error( 'give-import-csv-amount', __( 'In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give' ) ); |
|
443 | + if (false === in_array('amount', $mapto)) { |
|
444 | + Give_Admin_Settings::add_error('give-import-csv-amount', __('In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give')); |
|
445 | 445 | $return = false; |
446 | 446 | } |
447 | 447 | |
448 | - if ( false === in_array( 'email', $mapto ) && false === in_array( 'donor_id', $mapto ) ) { |
|
449 | - Give_Admin_Settings::add_error( 'give-import-csv-donor', __( 'In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give' ) ); |
|
448 | + if (false === in_array('email', $mapto) && false === in_array('donor_id', $mapto)) { |
|
449 | + Give_Admin_Settings::add_error('give-import-csv-donor', __('In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give')); |
|
450 | 450 | $return = false; |
451 | 451 | } |
452 | 452 | } else { |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public function render_dropdown() { |
465 | 465 | $csv = (int) $_GET['csv']; |
466 | - $delimiter = ( ! empty( $_GET['delimiter'] ) ? give_clean( $_GET['delimiter'] ) : 'csv' ); |
|
466 | + $delimiter = ( ! empty($_GET['delimiter']) ? give_clean($_GET['delimiter']) : 'csv'); |
|
467 | 467 | |
468 | 468 | // TO check if the CSV files that is being add is valid or not if not then redirect to first step again |
469 | - if ( ! $this->is_valid_csv( $csv ) ) { |
|
469 | + if ( ! $this->is_valid_csv($csv)) { |
|
470 | 470 | $url = give_import_page_url(); |
471 | 471 | ?> |
472 | 472 | <input type="hidden" name="csv_not_valid" class="csv_not_valid" value="<?php echo $url; ?>"/> |
@@ -475,11 +475,11 @@ discard block |
||
475 | 475 | ?> |
476 | 476 | <tr valign="top" class="give-import-dropdown"> |
477 | 477 | <th colspan="2"> |
478 | - <h2 id="give-import-title"><?php _e( 'Map CSV fields to donations', 'give' ) ?></h2> |
|
478 | + <h2 id="give-import-title"><?php _e('Map CSV fields to donations', 'give') ?></h2> |
|
479 | 479 | |
480 | - <p class="give-import-donation-required-fields-title"><?php _e( 'Required Fields' ); ?></p> |
|
480 | + <p class="give-import-donation-required-fields-title"><?php _e('Required Fields'); ?></p> |
|
481 | 481 | |
482 | - <p class="give-field-description"><?php _e( 'These fields are required for the import to submitted' ); ?></p> |
|
482 | + <p class="give-field-description"><?php _e('These fields are required for the import to submitted'); ?></p> |
|
483 | 483 | |
484 | 484 | <ul class="give-import-donation-required-fields"> |
485 | 485 | <li class="give-import-donation-required-email" |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | <span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span> |
488 | 488 | <span class="give-import-donation-required-text"> |
489 | 489 | <?php |
490 | - _e( 'Email Address', 'give' ); |
|
490 | + _e('Email Address', 'give'); |
|
491 | 491 | ?> |
492 | 492 | </span> |
493 | 493 | </li> |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | <span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span> |
498 | 498 | <span class="give-import-donation-required-text"> |
499 | 499 | <?php |
500 | - _e( 'First Name', 'give' ); |
|
500 | + _e('First Name', 'give'); |
|
501 | 501 | ?> |
502 | 502 | </span> |
503 | 503 | </li> |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | <span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span> |
508 | 508 | <span class="give-import-donation-required-text"> |
509 | 509 | <?php |
510 | - _e( 'Donation Amount', 'give' ); |
|
510 | + _e('Donation Amount', 'give'); |
|
511 | 511 | ?> |
512 | 512 | </span> |
513 | 513 | </li> |
@@ -517,32 +517,32 @@ discard block |
||
517 | 517 | <span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span> |
518 | 518 | <span class="give-import-donation-required-text"> |
519 | 519 | <?php |
520 | - _e( 'Form Title or ID', 'give' ); |
|
520 | + _e('Form Title or ID', 'give'); |
|
521 | 521 | ?> |
522 | 522 | </span> |
523 | 523 | </li> |
524 | 524 | </ul> |
525 | 525 | |
526 | - <p class="give-field-description"><?php _e( 'Select fields from your CSV file to map against donations fields or to ignore during import.', 'give' ) ?></p> |
|
526 | + <p class="give-field-description"><?php _e('Select fields from your CSV file to map against donations fields or to ignore during import.', 'give') ?></p> |
|
527 | 527 | </th> |
528 | 528 | </tr> |
529 | 529 | |
530 | 530 | <tr valign="top" class="give-import-dropdown"> |
531 | - <th><b><?php _e( 'Column name', 'give' ); ?></b></th> |
|
532 | - <th><b><?php _e( 'Map to field', 'give' ); ?></b></th> |
|
531 | + <th><b><?php _e('Column name', 'give'); ?></b></th> |
|
532 | + <th><b><?php _e('Map to field', 'give'); ?></b></th> |
|
533 | 533 | </tr> |
534 | 534 | |
535 | 535 | <?php |
536 | - $raw_key = $this->get_importer( $csv, 0, $delimiter ); |
|
537 | - $mapto = (array) ( isset( $_REQUEST['mapto'] ) ? $_REQUEST['mapto'] : array() ); |
|
536 | + $raw_key = $this->get_importer($csv, 0, $delimiter); |
|
537 | + $mapto = (array) (isset($_REQUEST['mapto']) ? $_REQUEST['mapto'] : array()); |
|
538 | 538 | |
539 | - foreach ( $raw_key as $index => $value ) { |
|
539 | + foreach ($raw_key as $index => $value) { |
|
540 | 540 | ?> |
541 | 541 | <tr valign="top" class="give-import-option"> |
542 | 542 | <th><?php echo $value; ?></th> |
543 | 543 | <th> |
544 | 544 | <?php |
545 | - $this->get_columns( $index, $value, $mapto ); |
|
545 | + $this->get_columns($index, $value, $mapto); |
|
546 | 546 | ?> |
547 | 547 | </th> |
548 | 548 | </tr> |
@@ -557,14 +557,14 @@ discard block |
||
557 | 557 | * |
558 | 558 | * @return string |
559 | 559 | */ |
560 | - public function selected( $option_value, $value ) { |
|
561 | - $option_value = strtolower( $option_value ); |
|
562 | - $value = strtolower( $value ); |
|
560 | + public function selected($option_value, $value) { |
|
561 | + $option_value = strtolower($option_value); |
|
562 | + $value = strtolower($value); |
|
563 | 563 | |
564 | 564 | $selected = ''; |
565 | - if ( stristr( $value, $option_value ) ) { |
|
565 | + if (stristr($value, $option_value)) { |
|
566 | 566 | $selected = 'selected'; |
567 | - } elseif ( strrpos( $value, 'give_' ) && stristr( $option_value, __( 'Import as Meta', 'give' ) ) ) { |
|
567 | + } elseif (strrpos($value, 'give_') && stristr($option_value, __('Import as Meta', 'give'))) { |
|
568 | 568 | $selected = 'selected'; |
569 | 569 | } |
570 | 570 | |
@@ -583,28 +583,28 @@ discard block |
||
583 | 583 | * |
584 | 584 | * @return void |
585 | 585 | */ |
586 | - private function get_columns( $index, $value = false, $mapto = array() ) { |
|
586 | + private function get_columns($index, $value = false, $mapto = array()) { |
|
587 | 587 | $default = give_import_default_options(); |
588 | - $current_mapto = (string) ( ! empty( $mapto[ $index ] ) ? $mapto[ $index ] : '' ); |
|
588 | + $current_mapto = (string) ( ! empty($mapto[$index]) ? $mapto[$index] : ''); |
|
589 | 589 | ?> |
590 | 590 | <select name="mapto[<?php echo $index; ?>]"> |
591 | - <?php $this->get_dropdown_option_html( $default, $current_mapto, $value ); ?> |
|
591 | + <?php $this->get_dropdown_option_html($default, $current_mapto, $value); ?> |
|
592 | 592 | |
593 | - <optgroup label="<?php _e( 'Donations', 'give' ); ?>"> |
|
593 | + <optgroup label="<?php _e('Donations', 'give'); ?>"> |
|
594 | 594 | <?php |
595 | - $this->get_dropdown_option_html( give_import_donations_options(), $current_mapto, $value ); |
|
595 | + $this->get_dropdown_option_html(give_import_donations_options(), $current_mapto, $value); |
|
596 | 596 | ?> |
597 | 597 | </optgroup> |
598 | 598 | |
599 | - <optgroup label="<?php _e( 'Donors', 'give' ); ?>"> |
|
599 | + <optgroup label="<?php _e('Donors', 'give'); ?>"> |
|
600 | 600 | <?php |
601 | - $this->get_dropdown_option_html( give_import_donor_options(), $current_mapto, $value ); |
|
601 | + $this->get_dropdown_option_html(give_import_donor_options(), $current_mapto, $value); |
|
602 | 602 | ?> |
603 | 603 | </optgroup> |
604 | 604 | |
605 | - <optgroup label="<?php _e( 'Forms', 'give' ); ?>"> |
|
605 | + <optgroup label="<?php _e('Forms', 'give'); ?>"> |
|
606 | 606 | <?php |
607 | - $this->get_dropdown_option_html( give_import_donation_form_options(), $current_mapto, $value ); |
|
607 | + $this->get_dropdown_option_html(give_import_donation_form_options(), $current_mapto, $value); |
|
608 | 608 | ?> |
609 | 609 | </optgroup> |
610 | 610 | |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @since 1.8.15 |
617 | 617 | */ |
618 | - do_action( 'give_import_dropdown_option', $index, $value, $mapto, $current_mapto ); |
|
618 | + do_action('give_import_dropdown_option', $index, $value, $mapto, $current_mapto); |
|
619 | 619 | ?> |
620 | 620 | </select> |
621 | 621 | <?php |
@@ -633,23 +633,23 @@ discard block |
||
633 | 633 | * |
634 | 634 | * @return void |
635 | 635 | */ |
636 | - public function get_dropdown_option_html( $options, $current_mapto, $value = false ) { |
|
636 | + public function get_dropdown_option_html($options, $current_mapto, $value = false) { |
|
637 | 637 | |
638 | - foreach ( $options as $option => $option_value ) { |
|
638 | + foreach ($options as $option => $option_value) { |
|
639 | 639 | $ignore = array(); |
640 | - if ( isset( $option_value['ignore'] ) ) { |
|
640 | + if (isset($option_value['ignore'])) { |
|
641 | 641 | $ignore = $option_value['ignore']; |
642 | - unset( $option_value['ignore'] ); |
|
642 | + unset($option_value['ignore']); |
|
643 | 643 | } |
644 | 644 | |
645 | 645 | $option_value_texts = (array) $option_value; |
646 | 646 | $option_text = $option_value_texts[0]; |
647 | 647 | |
648 | - $checked = ( ( $current_mapto === $option ) ? 'selected' : false ); |
|
649 | - if ( empty( $checked ) && ! in_array( $value, $ignore ) ) { |
|
650 | - foreach ( $option_value_texts as $option_value_text ) { |
|
651 | - $checked = $this->selected( $option_value_text, $value ); |
|
652 | - if ( $checked ) { |
|
648 | + $checked = (($current_mapto === $option) ? 'selected' : false); |
|
649 | + if (empty($checked) && ! in_array($value, $ignore)) { |
|
650 | + foreach ($option_value_texts as $option_value_text) { |
|
651 | + $checked = $this->selected($option_value_text, $value); |
|
652 | + if ($checked) { |
|
653 | 653 | break; |
654 | 654 | } |
655 | 655 | } |
@@ -673,12 +673,12 @@ discard block |
||
673 | 673 | * |
674 | 674 | * @return bool|int |
675 | 675 | */ |
676 | - public function get_csv_total( $file_id ) { |
|
676 | + public function get_csv_total($file_id) { |
|
677 | 677 | $total = false; |
678 | - if ( $file_id ) { |
|
679 | - $file_dir = get_attached_file( $file_id ); |
|
680 | - if ( $file_dir ) { |
|
681 | - $total = $this->get_csv_data_from_file_dir( $file_dir ); |
|
678 | + if ($file_id) { |
|
679 | + $file_dir = get_attached_file($file_id); |
|
680 | + if ($file_dir) { |
|
681 | + $total = $this->get_csv_data_from_file_dir($file_dir); |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | |
@@ -694,11 +694,11 @@ discard block |
||
694 | 694 | * |
695 | 695 | * @return bool|int |
696 | 696 | */ |
697 | - public function get_csv_data_from_file_dir( $file_dir ) { |
|
697 | + public function get_csv_data_from_file_dir($file_dir) { |
|
698 | 698 | $total = false; |
699 | - if ( $file_dir ) { |
|
700 | - $file = new SplFileObject( $file_dir, 'r' ); |
|
701 | - $file->seek( PHP_INT_MAX ); |
|
699 | + if ($file_dir) { |
|
700 | + $file = new SplFileObject($file_dir, 'r'); |
|
701 | + $file->seek(PHP_INT_MAX); |
|
702 | 702 | $total = $file->key() + 1; |
703 | 703 | } |
704 | 704 | |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | * |
717 | 717 | * @return array|bool $raw_data title of the CSV file fields |
718 | 718 | */ |
719 | - public function get_importer( $file_id, $index = 0, $delimiter = 'csv' ) { |
|
719 | + public function get_importer($file_id, $index = 0, $delimiter = 'csv') { |
|
720 | 720 | /** |
721 | 721 | * Filter to modify delimiter of Import. |
722 | 722 | * |
@@ -724,16 +724,16 @@ discard block |
||
724 | 724 | * |
725 | 725 | * Return string $delimiter. |
726 | 726 | */ |
727 | - $delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter ); |
|
727 | + $delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter); |
|
728 | 728 | |
729 | 729 | $raw_data = false; |
730 | - $file_dir = get_attached_file( $file_id ); |
|
731 | - if ( $file_dir ) { |
|
732 | - if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) { |
|
733 | - $raw_data = fgetcsv( $handle, $index, $delimiter ); |
|
730 | + $file_dir = get_attached_file($file_id); |
|
731 | + if ($file_dir) { |
|
732 | + if (false !== ($handle = fopen($file_dir, 'r'))) { |
|
733 | + $raw_data = fgetcsv($handle, $index, $delimiter); |
|
734 | 734 | // Remove BOM signature from the first item. |
735 | - if ( isset( $raw_data[0] ) ) { |
|
736 | - $raw_data[0] = $this->remove_utf8_bom( $raw_data[0] ); |
|
735 | + if (isset($raw_data[0])) { |
|
736 | + $raw_data[0] = $this->remove_utf8_bom($raw_data[0]); |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | } |
@@ -750,9 +750,9 @@ discard block |
||
750 | 750 | * |
751 | 751 | * @return string |
752 | 752 | */ |
753 | - public function remove_utf8_bom( $string ) { |
|
754 | - if ( 'efbbbf' === substr( bin2hex( $string ), 0, 6 ) ) { |
|
755 | - $string = substr( $string, 3 ); |
|
753 | + public function remove_utf8_bom($string) { |
|
754 | + if ('efbbbf' === substr(bin2hex($string), 0, 6)) { |
|
755 | + $string = substr($string, 3); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | return $string; |
@@ -767,17 +767,17 @@ discard block |
||
767 | 767 | $step = $this->get_step(); |
768 | 768 | ?> |
769 | 769 | <ol class="give-progress-steps"> |
770 | - <li class="<?php echo( 1 === $step ? 'active' : '' ); ?>"> |
|
771 | - <?php _e( 'Upload CSV file', 'give' ); ?> |
|
770 | + <li class="<?php echo(1 === $step ? 'active' : ''); ?>"> |
|
771 | + <?php _e('Upload CSV file', 'give'); ?> |
|
772 | 772 | </li> |
773 | - <li class="<?php echo( 2 === $step ? 'active' : '' ); ?>"> |
|
774 | - <?php _e( 'Column mapping', 'give' ); ?> |
|
773 | + <li class="<?php echo(2 === $step ? 'active' : ''); ?>"> |
|
774 | + <?php _e('Column mapping', 'give'); ?> |
|
775 | 775 | </li> |
776 | - <li class="<?php echo( 3 === $step ? 'active' : '' ); ?>"> |
|
777 | - <?php _e( 'Import', 'give' ); ?> |
|
776 | + <li class="<?php echo(3 === $step ? 'active' : ''); ?>"> |
|
777 | + <?php _e('Import', 'give'); ?> |
|
778 | 778 | </li> |
779 | - <li class="<?php echo( 4 === $step ? 'active' : '' ); ?>"> |
|
780 | - <?php _e( 'Done!', 'give' ); ?> |
|
779 | + <li class="<?php echo(4 === $step ? 'active' : ''); ?>"> |
|
780 | + <?php _e('Done!', 'give'); ?> |
|
781 | 781 | </li> |
782 | 782 | </ol> |
783 | 783 | <?php |
@@ -791,16 +791,16 @@ discard block |
||
791 | 791 | * @return int $step on which step doest the import is on. |
792 | 792 | */ |
793 | 793 | public function get_step() { |
794 | - $step = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 ); |
|
794 | + $step = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0); |
|
795 | 795 | $on_step = 1; |
796 | 796 | |
797 | - if ( empty( $step ) || 1 === $step ) { |
|
797 | + if (empty($step) || 1 === $step) { |
|
798 | 798 | $on_step = 1; |
799 | - } elseif ( $this->check_for_dropdown_or_import() ) { |
|
799 | + } elseif ($this->check_for_dropdown_or_import()) { |
|
800 | 800 | $on_step = 3; |
801 | - } elseif ( 2 === $step ) { |
|
801 | + } elseif (2 === $step) { |
|
802 | 802 | $on_step = 2; |
803 | - } elseif ( 4 === $step ) { |
|
803 | + } elseif (4 === $step) { |
|
804 | 804 | $on_step = 4; |
805 | 805 | } |
806 | 806 | |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | * @since 1.8.14 |
814 | 814 | */ |
815 | 815 | public function render_page() { |
816 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-donations.php'; |
|
816 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-donations.php'; |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | /** |
@@ -822,18 +822,18 @@ discard block |
||
822 | 822 | * @since 2.1 |
823 | 823 | */ |
824 | 824 | public function give_import_donation_submit_button_render_media_csv() { |
825 | - $dry_run = isset( $_POST['dry_run'] ) ? absint( $_POST['dry_run'] ) : 1; |
|
825 | + $dry_run = isset($_POST['dry_run']) ? absint($_POST['dry_run']) : 1; |
|
826 | 826 | ?> |
827 | 827 | <div> |
828 | 828 | <label for="dry_run"> |
829 | 829 | <input type="hidden" name="dry_run" value="0"/> |
830 | 830 | <input type="checkbox" name="dry_run" id="dry_run" class="dry_run" |
831 | - value="1" <?php checked( 1, $dry_run ); ?> > |
|
832 | - <strong><?php _e( 'Dry Run', 'give' ); ?></strong> |
|
831 | + value="1" <?php checked(1, $dry_run); ?> > |
|
832 | + <strong><?php _e('Dry Run', 'give'); ?></strong> |
|
833 | 833 | </label> |
834 | 834 | <p class="give-field-description"> |
835 | 835 | <?php |
836 | - _e( 'Preview what the import would look like without making any default changes to your site or your database.', 'give' ); |
|
836 | + _e('Preview what the import would look like without making any default changes to your site or your database.', 'give'); |
|
837 | 837 | ?> |
838 | 838 | </p> |
839 | 839 | </div> |
@@ -849,8 +849,8 @@ discard block |
||
849 | 849 | * |
850 | 850 | * @return string |
851 | 851 | */ |
852 | - function give_import_donation_submit_text_render_media_csv( $text ) { |
|
853 | - return __( 'Begin Import', 'give' ); |
|
852 | + function give_import_donation_submit_text_render_media_csv($text) { |
|
853 | + return __('Begin Import', 'give'); |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | /** |
@@ -862,60 +862,57 @@ discard block |
||
862 | 862 | * @return void |
863 | 863 | */ |
864 | 864 | public function render_media_csv() { |
865 | - add_filter( 'give_import_donation_submit_button_text', array( |
|
865 | + add_filter('give_import_donation_submit_button_text', array( |
|
866 | 866 | $this, |
867 | 867 | 'give_import_donation_submit_text_render_media_csv' |
868 | - ) ); |
|
869 | - add_action( 'give_import_donation_submit_button', array( |
|
868 | + )); |
|
869 | + add_action('give_import_donation_submit_button', array( |
|
870 | 870 | $this, |
871 | 871 | 'give_import_donation_submit_button_render_media_csv' |
872 | - ) ); |
|
872 | + )); |
|
873 | 873 | ?> |
874 | 874 | <tr valign="top"> |
875 | 875 | <th colspan="2"> |
876 | - <h2 id="give-import-title"><?php _e( 'Import donations from a CSV file', 'give' ) ?></h2> |
|
877 | - <p class="give-field-description"><?php _e( 'This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give' ) ?></p> |
|
876 | + <h2 id="give-import-title"><?php _e('Import donations from a CSV file', 'give') ?></h2> |
|
877 | + <p class="give-field-description"><?php _e('This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give') ?></p> |
|
878 | 878 | </th> |
879 | 879 | </tr> |
880 | 880 | <?php |
881 | - $csv = ( isset( $_POST['csv'] ) ? give_clean( $_POST['csv'] ) : '' ); |
|
882 | - $csv_id = ( isset( $_POST['csv_id'] ) ? give_clean( $_POST['csv_id'] ) : '' ); |
|
883 | - $delimiter = ( isset( $_POST['delimiter'] ) ? give_clean( $_POST['delimiter'] ) : 'csv' ); |
|
884 | - $mode = empty( $_POST['mode'] ) ? |
|
885 | - 'disabled' : |
|
886 | - ( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? 'enabled' : 'disabled' ); |
|
887 | - $create_user = empty( $_POST['create_user'] ) ? |
|
888 | - 'disabled' : |
|
889 | - ( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? 'enabled' : 'disabled' ); |
|
890 | - $delete_csv = empty( $_POST['delete_csv'] ) ? |
|
891 | - 'enabled' : |
|
892 | - ( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? 'enabled' : 'disabled' ); |
|
881 | + $csv = (isset($_POST['csv']) ? give_clean($_POST['csv']) : ''); |
|
882 | + $csv_id = (isset($_POST['csv_id']) ? give_clean($_POST['csv_id']) : ''); |
|
883 | + $delimiter = (isset($_POST['delimiter']) ? give_clean($_POST['delimiter']) : 'csv'); |
|
884 | + $mode = empty($_POST['mode']) ? |
|
885 | + 'disabled' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? 'enabled' : 'disabled'); |
|
886 | + $create_user = empty($_POST['create_user']) ? |
|
887 | + 'disabled' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? 'enabled' : 'disabled'); |
|
888 | + $delete_csv = empty($_POST['delete_csv']) ? |
|
889 | + 'enabled' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? 'enabled' : 'disabled'); |
|
893 | 890 | |
894 | 891 | // Reset csv and csv_id if csv |
895 | - if ( empty( $csv_id ) || ! $this->is_valid_csv( $csv_id, $csv ) ) { |
|
892 | + if (empty($csv_id) || ! $this->is_valid_csv($csv_id, $csv)) { |
|
896 | 893 | $csv_id = $csv = ''; |
897 | 894 | } |
898 | - $per_page = isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page; |
|
895 | + $per_page = isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page; |
|
899 | 896 | |
900 | 897 | $sample_file_text = sprintf( |
901 | 898 | '%s <a href="%s">%s</a>.', |
902 | - __( 'Download the sample file', 'give' ), |
|
903 | - esc_url( GIVE_PLUGIN_URL . 'sample-data/sample-data.csv' ), |
|
904 | - __( 'here', 'give' ) |
|
899 | + __('Download the sample file', 'give'), |
|
900 | + esc_url(GIVE_PLUGIN_URL.'sample-data/sample-data.csv'), |
|
901 | + __('here', 'give') |
|
905 | 902 | ); |
906 | 903 | |
907 | 904 | $csv_description = sprintf( |
908 | 905 | '%1$s %2$s', |
909 | - __( 'The file must be a Comma Seperated Version (CSV) file type only.', 'give' ), |
|
906 | + __('The file must be a Comma Seperated Version (CSV) file type only.', 'give'), |
|
910 | 907 | $sample_file_text |
911 | 908 | ); |
912 | 909 | |
913 | 910 | $settings = array( |
914 | 911 | array( |
915 | 912 | 'id' => 'csv', |
916 | - 'name' => __( 'Choose a CSV file:', 'give' ), |
|
913 | + 'name' => __('Choose a CSV file:', 'give'), |
|
917 | 914 | 'type' => 'file', |
918 | - 'attributes' => array( 'editing' => 'false', 'library' => 'text' ), |
|
915 | + 'attributes' => array('editing' => 'false', 'library' => 'text'), |
|
919 | 916 | 'description' => $csv_description, |
920 | 917 | 'fvalue' => 'url', |
921 | 918 | 'default' => $csv, |
@@ -927,62 +924,62 @@ discard block |
||
927 | 924 | ), |
928 | 925 | array( |
929 | 926 | 'id' => 'delimiter', |
930 | - 'name' => __( 'CSV Delimiter:', 'give' ), |
|
931 | - 'description' => __( 'In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give' ), |
|
927 | + 'name' => __('CSV Delimiter:', 'give'), |
|
928 | + 'description' => __('In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give'), |
|
932 | 929 | 'default' => $delimiter, |
933 | 930 | 'type' => 'select', |
934 | 931 | 'options' => array( |
935 | - 'csv' => __( 'Comma', 'give' ), |
|
936 | - 'tab-separated-values' => __( 'Tab', 'give' ), |
|
932 | + 'csv' => __('Comma', 'give'), |
|
933 | + 'tab-separated-values' => __('Tab', 'give'), |
|
937 | 934 | ), |
938 | 935 | ), |
939 | 936 | array( |
940 | 937 | 'id' => 'mode', |
941 | - 'name' => __( 'Test Mode:', 'give' ), |
|
942 | - 'description' => __( 'Select whether you would like these donations to be marked as "test" donations within the database. By default, they will be marked as live donations.', 'give' ), |
|
938 | + 'name' => __('Test Mode:', 'give'), |
|
939 | + 'description' => __('Select whether you would like these donations to be marked as "test" donations within the database. By default, they will be marked as live donations.', 'give'), |
|
943 | 940 | 'default' => $mode, |
944 | 941 | 'type' => 'radio_inline', |
945 | 942 | 'options' => array( |
946 | - 'enabled' => __( 'Enabled', 'give' ), |
|
947 | - 'disabled' => __( 'Disabled', 'give' ), |
|
943 | + 'enabled' => __('Enabled', 'give'), |
|
944 | + 'disabled' => __('Disabled', 'give'), |
|
948 | 945 | ), |
949 | 946 | ), |
950 | 947 | array( |
951 | 948 | 'id' => 'create_user', |
952 | - 'name' => __( 'Create WP users for new donors:', 'give' ), |
|
953 | - 'description' => __( 'The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give' ), |
|
949 | + 'name' => __('Create WP users for new donors:', 'give'), |
|
950 | + 'description' => __('The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give'), |
|
954 | 951 | 'default' => $create_user, |
955 | 952 | 'type' => 'radio_inline', |
956 | 953 | 'options' => array( |
957 | - 'enabled' => __( 'Enabled', 'give' ), |
|
958 | - 'disabled' => __( 'Disabled', 'give' ), |
|
954 | + 'enabled' => __('Enabled', 'give'), |
|
955 | + 'disabled' => __('Disabled', 'give'), |
|
959 | 956 | ), |
960 | 957 | ), |
961 | 958 | array( |
962 | 959 | 'id' => 'delete_csv', |
963 | - 'name' => __( 'Delete CSV after import:', 'give' ), |
|
964 | - 'description' => __( 'Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give' ), |
|
960 | + 'name' => __('Delete CSV after import:', 'give'), |
|
961 | + 'description' => __('Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give'), |
|
965 | 962 | 'default' => $delete_csv, |
966 | 963 | 'type' => 'radio_inline', |
967 | 964 | 'options' => array( |
968 | - 'enabled' => __( 'Enabled', 'give' ), |
|
969 | - 'disabled' => __( 'Disabled', 'give' ), |
|
965 | + 'enabled' => __('Enabled', 'give'), |
|
966 | + 'disabled' => __('Disabled', 'give'), |
|
970 | 967 | ), |
971 | 968 | ), |
972 | 969 | array( |
973 | 970 | 'id' => 'per_page', |
974 | - 'name' => __( 'Process Rows Per Batch:', 'give' ), |
|
971 | + 'name' => __('Process Rows Per Batch:', 'give'), |
|
975 | 972 | 'type' => 'number', |
976 | - 'description' => __( 'Determine how many rows you would like to import per cycle.', 'give' ), |
|
973 | + 'description' => __('Determine how many rows you would like to import per cycle.', 'give'), |
|
977 | 974 | 'default' => $per_page, |
978 | 975 | 'class' => 'give-text-small', |
979 | 976 | ), |
980 | 977 | ); |
981 | 978 | |
982 | - $settings = apply_filters( 'give_import_file_upload_html', $settings ); |
|
979 | + $settings = apply_filters('give_import_file_upload_html', $settings); |
|
983 | 980 | |
984 | - if ( empty( $this->is_csv_valid ) ) { |
|
985 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
981 | + if (empty($this->is_csv_valid)) { |
|
982 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
986 | 983 | } else { |
987 | 984 | ?> |
988 | 985 | <input type="hidden" name="is_csv_valid" class="is_csv_valid" |
@@ -1001,28 +998,25 @@ discard block |
||
1001 | 998 | $step = $this->get_step(); |
1002 | 999 | |
1003 | 1000 | // Validation for first step. |
1004 | - if ( 1 === $step ) { |
|
1005 | - $csv_id = absint( $_POST['csv_id'] ); |
|
1001 | + if (1 === $step) { |
|
1002 | + $csv_id = absint($_POST['csv_id']); |
|
1006 | 1003 | |
1007 | - if ( $this->is_valid_csv( $csv_id, esc_url( $_POST['csv'] ) ) ) { |
|
1004 | + if ($this->is_valid_csv($csv_id, esc_url($_POST['csv']))) { |
|
1008 | 1005 | |
1009 | - $url = give_import_page_url( (array) apply_filters( 'give_import_step_two_url', array( |
|
1006 | + $url = give_import_page_url((array) apply_filters('give_import_step_two_url', array( |
|
1010 | 1007 | 'step' => '2', |
1011 | 1008 | 'importer-type' => $this->importer_type, |
1012 | 1009 | 'csv' => $csv_id, |
1013 | - 'delimiter' => isset( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv', |
|
1014 | - 'mode' => empty( $_POST['mode'] ) ? |
|
1015 | - '0' : |
|
1016 | - ( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? '1' : '0' ), |
|
1017 | - 'create_user' => empty( $_POST['create_user'] ) ? |
|
1018 | - '0' : |
|
1019 | - ( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? '1' : '0' ), |
|
1020 | - 'delete_csv' => empty( $_POST['delete_csv'] ) ? |
|
1021 | - '1' : |
|
1022 | - ( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? '1' : '0' ), |
|
1023 | - 'per_page' => isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page, |
|
1024 | - 'dry_run' => isset( $_POST['dry_run'] ) ? absint( $_POST['dry_run'] ) : 0, |
|
1025 | - ) ) ); |
|
1010 | + 'delimiter' => isset($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv', |
|
1011 | + 'mode' => empty($_POST['mode']) ? |
|
1012 | + '0' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? '1' : '0'), |
|
1013 | + 'create_user' => empty($_POST['create_user']) ? |
|
1014 | + '0' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? '1' : '0'), |
|
1015 | + 'delete_csv' => empty($_POST['delete_csv']) ? |
|
1016 | + '1' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? '1' : '0'), |
|
1017 | + 'per_page' => isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page, |
|
1018 | + 'dry_run' => isset($_POST['dry_run']) ? absint($_POST['dry_run']) : 0, |
|
1019 | + ))); |
|
1026 | 1020 | |
1027 | 1021 | $this->is_csv_valid = $url; |
1028 | 1022 | } |
@@ -1040,25 +1034,25 @@ discard block |
||
1040 | 1034 | * |
1041 | 1035 | * @return bool $has_error CSV is valid or not. |
1042 | 1036 | */ |
1043 | - private function is_valid_csv( $csv = false, $match_url = '' ) { |
|
1037 | + private function is_valid_csv($csv = false, $match_url = '') { |
|
1044 | 1038 | $is_valid_csv = true; |
1045 | 1039 | |
1046 | - if ( $csv ) { |
|
1047 | - $csv_url = wp_get_attachment_url( $csv ); |
|
1040 | + if ($csv) { |
|
1041 | + $csv_url = wp_get_attachment_url($csv); |
|
1048 | 1042 | |
1049 | - $delimiter = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' ); |
|
1043 | + $delimiter = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv'); |
|
1050 | 1044 | |
1051 | 1045 | if ( |
1052 | 1046 | ! $csv_url || |
1053 | - ( ! empty( $match_url ) && ( $csv_url !== $match_url ) ) || |
|
1054 | - ( ( $mime_type = get_post_mime_type( $csv ) ) && ! strpos( $mime_type, $delimiter ) ) |
|
1047 | + ( ! empty($match_url) && ($csv_url !== $match_url)) || |
|
1048 | + (($mime_type = get_post_mime_type($csv)) && ! strpos($mime_type, $delimiter)) |
|
1055 | 1049 | ) { |
1056 | 1050 | $is_valid_csv = false; |
1057 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) ); |
|
1051 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give')); |
|
1058 | 1052 | } |
1059 | 1053 | } else { |
1060 | 1054 | $is_valid_csv = false; |
1061 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) ); |
|
1055 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give')); |
|
1062 | 1056 | } |
1063 | 1057 | |
1064 | 1058 | return $is_valid_csv; |
@@ -1074,8 +1068,8 @@ discard block |
||
1074 | 1068 | * @param $field |
1075 | 1069 | * @param $option_value |
1076 | 1070 | */ |
1077 | - public function render_import_field( $field, $option_value ) { |
|
1078 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php'; |
|
1071 | + public function render_import_field($field, $option_value) { |
|
1072 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php'; |
|
1079 | 1073 | } |
1080 | 1074 | |
1081 | 1075 | /** |
@@ -1086,8 +1080,8 @@ discard block |
||
1086 | 1080 | */ |
1087 | 1081 | private function is_donations_import_page() { |
1088 | 1082 | return 'import' === give_get_current_setting_tab() && |
1089 | - isset( $_GET['importer-type'] ) && |
|
1090 | - $this->importer_type === give_clean( $_GET['importer-type'] ); |
|
1083 | + isset($_GET['importer-type']) && |
|
1084 | + $this->importer_type === give_clean($_GET['importer-type']); |
|
1091 | 1085 | } |
1092 | 1086 | } |
1093 | 1087 |
@@ -1020,9 +1020,12 @@ |
||
1020 | 1020 | } |
1021 | 1021 | ?> |
1022 | 1022 | </select> |
1023 | - <?php else : ?> |
|
1023 | + <?php else { |
|
1024 | + : ?> |
|
1024 | 1025 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
1025 | - placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/> |
|
1026 | + placeholder="<?php echo $label; |
|
1027 | +} |
|
1028 | +?>" value="<?php echo $selected_state; ?>"/> |
|
1026 | 1029 | <?php endif; ?> |
1027 | 1030 | </p> |
1028 | 1031 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @since 1.0 |
23 | 23 | * |
24 | - * @return string Donation form. |
|
24 | + * @return false|null Donation form. |
|
25 | 25 | */ |
26 | 26 | function give_get_donation_form( $args = array() ) { |
27 | 27 | |
@@ -1482,7 +1482,7 @@ discard block |
||
1482 | 1482 | * |
1483 | 1483 | * @param int $form_id The form ID. |
1484 | 1484 | * |
1485 | - * @return bool |
|
1485 | + * @return false|null |
|
1486 | 1486 | */ |
1487 | 1487 | function give_terms_agreement( $form_id ) { |
1488 | 1488 | $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | * @param int $form_id The form ID. |
1677 | 1677 | * @param array $args An array of form arguments. |
1678 | 1678 | * |
1679 | - * @return mixed |
|
1679 | + * @return boolean |
|
1680 | 1680 | */ |
1681 | 1681 | function give_show_goal_progress( $form_id, $args = array() ) { |
1682 | 1682 | |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | * @param int $total Total amount based on shortcode parameter. |
1704 | 1704 | * @param int $total_goal Total Goal amount passed by Admin. |
1705 | 1705 | * |
1706 | - * @return mixed |
|
1706 | + * @return boolean |
|
1707 | 1707 | */ |
1708 | 1708 | function give_show_goal_totals_progress( $total, $total_goal ) { |
1709 | 1709 | |
@@ -1727,7 +1727,7 @@ discard block |
||
1727 | 1727 | * |
1728 | 1728 | * @since 1.8 |
1729 | 1729 | * |
1730 | - * @param $form_id |
|
1730 | + * @param integer $form_id |
|
1731 | 1731 | * @param $args |
1732 | 1732 | * |
1733 | 1733 | * @return mixed|string |
@@ -1768,7 +1768,7 @@ discard block |
||
1768 | 1768 | * @param int $form_id The form ID. |
1769 | 1769 | * @param array $args An array of form arguments. |
1770 | 1770 | * |
1771 | - * @return void|bool |
|
1771 | + * @return false|null |
|
1772 | 1772 | */ |
1773 | 1773 | function give_form_content( $form_id, $args ) { |
1774 | 1774 | |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | * |
2059 | 2059 | * @since 2.1 |
2060 | 2060 | * |
2061 | - * @return array |
|
2061 | + * @return string[] |
|
2062 | 2062 | */ |
2063 | 2063 | function add_class_for_form_grid( $class, $id, $args ) { |
2064 | 2064 | $class[] = 'give-form-grid-wrap'; |
@@ -2069,7 +2069,6 @@ discard block |
||
2069 | 2069 | /** |
2070 | 2070 | * Add hidden field to Form Grid page |
2071 | 2071 | * |
2072 | - * @param int $form_id The form ID. |
|
2073 | 2072 | * @param array $args An array of form arguments. |
2074 | 2073 | * @param Give_Donate_Form $form Form object. |
2075 | 2074 | * |
@@ -996,10 +996,10 @@ discard block |
||
996 | 996 | <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
997 | 997 | > |
998 | 998 | <?php |
999 | - foreach ( $countries as $country_code => $country ) { |
|
1000 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
1001 | - } |
|
1002 | - ?> |
|
999 | + foreach ( $countries as $country_code => $country ) { |
|
1000 | + echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
1001 | + } |
|
1002 | + ?> |
|
1003 | 1003 | </select> |
1004 | 1004 | </p> |
1005 | 1005 | |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | <label for="card_state" class="give-label"> |
1072 | 1072 | <span class="state-label-text"><?php echo $label; ?></span> |
1073 | 1073 | <?php if ( give_field_is_required( 'card_state', $form_id ) ) : |
1074 | - ?> |
|
1074 | + ?> |
|
1075 | 1075 | <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span> |
1076 | 1076 | <?php endif; ?> |
1077 | 1077 | <span class="give-tooltip give-icon give-icon-question" |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | </label> |
1080 | 1080 | <?php |
1081 | 1081 | |
1082 | - if ( ! empty( $states ) ) : ?> |
|
1082 | + if ( ! empty( $states ) ) : ?> |
|
1083 | 1083 | <select |
1084 | 1084 | name="card_state" |
1085 | 1085 | autocomplete="address-level4" |
@@ -1087,10 +1087,10 @@ discard block |
||
1087 | 1087 | class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
1088 | 1088 | <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
1089 | 1089 | <?php |
1090 | - foreach ( $states as $state_code => $state ) { |
|
1091 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
1092 | - } |
|
1093 | - ?> |
|
1090 | + foreach ( $states as $state_code => $state ) { |
|
1091 | + echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
1092 | + } |
|
1093 | + ?> |
|
1094 | 1094 | </select> |
1095 | 1095 | <?php else : ?> |
1096 | 1096 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
@@ -1292,8 +1292,8 @@ discard block |
||
1292 | 1292 | <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
1293 | 1293 | data-action="give_checkout_register"> |
1294 | 1294 | <?php if ( give_logged_in_only( $form_id ) ) { |
1295 | - _e( 'Register as a part of your donation »', 'give' ); |
|
1296 | - } else { |
|
1295 | + _e( 'Register as a part of your donation »', 'give' ); |
|
1296 | + } else { |
|
1297 | 1297 | _e( 'Register or donate as a guest »', 'give' ); |
1298 | 1298 | } ?> |
1299 | 1299 | </a> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,35 +23,35 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string Donation form. |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | static $count = 1; |
30 | 30 | |
31 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
31 | + $form_id = is_object($post) ? $post->ID : 0; |
|
32 | 32 | |
33 | - if ( isset( $args['id'] ) ) { |
|
33 | + if (isset($args['id'])) { |
|
34 | 34 | $form_id = $args['id']; |
35 | 35 | } |
36 | 36 | |
37 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
37 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
38 | 38 | 'form_id' => $form_id, |
39 | - ) ); |
|
39 | + )); |
|
40 | 40 | |
41 | - $args = wp_parse_args( $args, $defaults ); |
|
41 | + $args = wp_parse_args($args, $defaults); |
|
42 | 42 | |
43 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
43 | + $form = new Give_Donate_Form($args['form_id']); |
|
44 | 44 | |
45 | 45 | // Bail out, if no form ID. |
46 | - if ( empty( $form->ID ) ) { |
|
46 | + if (empty($form->ID)) { |
|
47 | 47 | return false; |
48 | 48 | } |
49 | 49 | |
50 | 50 | $args['id_prefix'] = "{$form_id}-{$count}"; |
51 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
51 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
52 | 52 | |
53 | 53 | $form_action = add_query_arg( |
54 | - apply_filters( 'give_form_action_args', array( |
|
54 | + apply_filters('give_form_action_args', array( |
|
55 | 55 | 'payment-mode' => $payment_mode, |
56 | 56 | ) |
57 | 57 | ), |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | |
61 | 61 | // Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
62 | 62 | if ( |
63 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
64 | - || ( 'trash' === $form->post_status ) |
|
63 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
64 | + || ('trash' === $form->post_status) |
|
65 | 65 | ) { |
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
69 | 69 | // Get the form wrap CSS classes. |
70 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
70 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
71 | 71 | |
72 | 72 | // Get the <form> tag wrap CSS classes. |
73 | - $form_classes = $form->get_form_classes( $args ); |
|
73 | + $form_classes = $form->get_form_classes($args); |
|
74 | 74 | |
75 | 75 | ob_start(); |
76 | 76 | |
@@ -82,21 +82,21 @@ discard block |
||
82 | 82 | * @param int $form_id The form ID. |
83 | 83 | * @param array $args An array of form arguments. |
84 | 84 | */ |
85 | - do_action( 'give_pre_form_output', $form->ID, $args, $form ); |
|
85 | + do_action('give_pre_form_output', $form->ID, $args, $form); |
|
86 | 86 | |
87 | 87 | ?> |
88 | 88 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
89 | 89 | <?php |
90 | - if ( $form->is_close_donation_form() ) { |
|
90 | + if ($form->is_close_donation_form()) { |
|
91 | 91 | |
92 | - $form_title = ! is_singular( 'give_forms' ) ? apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ) : ''; |
|
92 | + $form_title = ! is_singular('give_forms') ? apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>') : ''; |
|
93 | 93 | |
94 | 94 | // Get Goal thank you message. |
95 | - $goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
96 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? $form_title . apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
95 | + $goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
96 | + $goal_achieved_message = ! empty($goal_achieved_message) ? $form_title.apply_filters('the_content', $goal_achieved_message) : ''; |
|
97 | 97 | |
98 | 98 | // Print thank you message. |
99 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form ); |
|
99 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form); |
|
100 | 100 | |
101 | 101 | } else { |
102 | 102 | /** |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | * 1. if show_title params set to true |
105 | 105 | * 2. if admin set form display_style to button |
106 | 106 | */ |
107 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
107 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
108 | 108 | if ( |
109 | 109 | ( |
110 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
111 | - || ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) ) |
|
110 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
111 | + || ('button' === get_post_meta($form_id, '_give_payment_display', true)) |
|
112 | 112 | ) |
113 | - && ! doing_action( 'give_single_form_summary' ) |
|
113 | + && ! doing_action('give_single_form_summary') |
|
114 | 114 | ) { |
115 | 115 | echo $form_title; |
116 | 116 | } |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * @param array $args An array of form arguments. |
125 | 125 | * @param Give_Donate_Form $form Form object. |
126 | 126 | */ |
127 | - do_action( 'give_pre_form', $form->ID, $args, $form ); |
|
127 | + do_action('give_pre_form', $form->ID, $args, $form); |
|
128 | 128 | |
129 | 129 | // Set form html tags. |
130 | 130 | $form_html_tags = array( |
131 | 131 | 'id' => "give-form-{$args['id_prefix']}", |
132 | 132 | 'class' => $form_classes, |
133 | - 'action' => esc_url_raw( $form_action ), |
|
133 | + 'action' => esc_url_raw($form_action), |
|
134 | 134 | 'data-id' => $args['id_prefix'], |
135 | 135 | ); |
136 | 136 | |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | * @param array $form_html_tags Array of form html tags. |
143 | 143 | * @param Give_Donate_Form $form Form object. |
144 | 144 | */ |
145 | - $form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form ); |
|
145 | + $form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form); |
|
146 | 146 | ?> |
147 | - <form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post"> |
|
147 | + <form <?php echo give_get_attribute_str($form_html_tags); ?> method="post"> |
|
148 | 148 | <!-- The following field is for robots only, invisible to humans: --> |
149 | 149 | <span class="give-hidden" style="display: none !important;"> |
150 | 150 | <label for="give-form-honeypot-<?php echo $form_id; ?>"></label> |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param array $args An array of form arguments. |
163 | 163 | * @param Give_Donate_Form $form Form object. |
164 | 164 | */ |
165 | - do_action( 'give_donation_form_top', $form->ID, $args, $form ); |
|
165 | + do_action('give_donation_form_top', $form->ID, $args, $form); |
|
166 | 166 | |
167 | 167 | /** |
168 | 168 | * Fires while outputting donation form, for payment gateway fields. |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param array $args An array of form arguments. |
174 | 174 | * @param Give_Donate_Form $form Form object. |
175 | 175 | */ |
176 | - do_action( 'give_payment_mode_select', $form->ID, $args, $form ); |
|
176 | + do_action('give_payment_mode_select', $form->ID, $args, $form); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Fires while outputting donation form, after all other fields. |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param array $args An array of form arguments. |
185 | 185 | * @param Give_Donate_Form $form Form object. |
186 | 186 | */ |
187 | - do_action( 'give_donation_form_bottom', $form->ID, $args, $form ); |
|
187 | + do_action('give_donation_form_bottom', $form->ID, $args, $form); |
|
188 | 188 | |
189 | 189 | ?> |
190 | 190 | </form> |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | * @param array $args An array of form arguments. |
200 | 200 | * @param Give_Donate_Form $form Form object. |
201 | 201 | */ |
202 | - do_action( 'give_post_form', $form->ID, $args, $form ); |
|
202 | + do_action('give_post_form', $form->ID, $args, $form); |
|
203 | 203 | |
204 | 204 | } |
205 | 205 | ?> |
206 | 206 | |
207 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
207 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
208 | 208 | <?php |
209 | 209 | |
210 | 210 | /** |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | * @param int $form_id The form ID. |
216 | 216 | * @param array $args An array of form arguments. |
217 | 217 | */ |
218 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
218 | + do_action('give_post_form_output', $form->ID, $args); |
|
219 | 219 | |
220 | 220 | $final_output = ob_get_clean(); |
221 | - $count ++; |
|
221 | + $count++; |
|
222 | 222 | |
223 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
223 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string |
239 | 239 | */ |
240 | -function give_show_purchase_form( $form_id, $args ) { |
|
240 | +function give_show_purchase_form($form_id, $args) { |
|
241 | 241 | |
242 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
242 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
243 | 243 | |
244 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
244 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
245 | 245 | $form_id = $_POST['give_form_id']; |
246 | 246 | } |
247 | 247 | |
@@ -250,33 +250,33 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @since 1.7 |
252 | 252 | */ |
253 | - do_action( 'give_payment_fields_top', $form_id ); |
|
253 | + do_action('give_payment_fields_top', $form_id); |
|
254 | 254 | |
255 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
255 | + if (give_can_checkout() && isset($form_id)) { |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Fires while displaying donation form, before registration login. |
259 | 259 | * |
260 | 260 | * @since 1.7 |
261 | 261 | */ |
262 | - do_action( 'give_donation_form_before_register_login', $form_id, $args ); |
|
262 | + do_action('give_donation_form_before_register_login', $form_id, $args); |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * Fire when register/login form fields render. |
266 | 266 | * |
267 | 267 | * @since 1.7 |
268 | 268 | */ |
269 | - do_action( 'give_donation_form_register_login_fields', $form_id, $args ); |
|
269 | + do_action('give_donation_form_register_login_fields', $form_id, $args); |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Fire when credit card form fields render. |
273 | 273 | * |
274 | 274 | * @since 1.7 |
275 | 275 | */ |
276 | - do_action( 'give_donation_form_before_cc_form', $form_id, $args ); |
|
276 | + do_action('give_donation_form_before_cc_form', $form_id, $args); |
|
277 | 277 | |
278 | 278 | // Load the credit card form and allow gateways to load their own if they wish. |
279 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
279 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
280 | 280 | /** |
281 | 281 | * Fires while displaying donation form, credit card form fields for a given gateway. |
282 | 282 | * |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @param int $form_id The form ID. |
286 | 286 | */ |
287 | - do_action( "give_{$payment_mode}_cc_form", $form_id, $args ); |
|
287 | + do_action("give_{$payment_mode}_cc_form", $form_id, $args); |
|
288 | 288 | } else { |
289 | 289 | /** |
290 | 290 | * Fires while displaying donation form, credit card form fields. |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @param int $form_id The form ID. |
295 | 295 | */ |
296 | - do_action( 'give_cc_form', $form_id, $args ); |
|
296 | + do_action('give_cc_form', $form_id, $args); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @since 1.7 |
303 | 303 | */ |
304 | - do_action( 'give_donation_form_after_cc_form', $form_id, $args ); |
|
304 | + do_action('give_donation_form_after_cc_form', $form_id, $args); |
|
305 | 305 | |
306 | 306 | } else { |
307 | 307 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @since 1.7 |
311 | 311 | */ |
312 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
312 | + do_action('give_donation_form_no_access', $form_id); |
|
313 | 313 | |
314 | 314 | } |
315 | 315 | |
@@ -318,10 +318,10 @@ discard block |
||
318 | 318 | * |
319 | 319 | * @since 1.7 |
320 | 320 | */ |
321 | - do_action( 'give_payment_fields_bottom', $form_id, $args ); |
|
321 | + do_action('give_payment_fields_bottom', $form_id, $args); |
|
322 | 322 | } |
323 | 323 | |
324 | -add_action( 'give_donation_form', 'give_show_purchase_form', 10, 2 ); |
|
324 | +add_action('give_donation_form', 'give_show_purchase_form', 10, 2); |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * Give Show Login/Register Form Fields. |
@@ -332,11 +332,11 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @return void |
334 | 334 | */ |
335 | -function give_show_register_login_fields( $form_id ) { |
|
335 | +function give_show_register_login_fields($form_id) { |
|
336 | 336 | |
337 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
337 | + $show_register_form = give_show_login_register_option($form_id); |
|
338 | 338 | |
339 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
339 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
340 | 340 | ?> |
341 | 341 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
342 | 342 | <?php |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @since 1.7 |
347 | 347 | */ |
348 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
348 | + do_action('give_donation_form_register_fields', $form_id); |
|
349 | 349 | ?> |
350 | 350 | </div> |
351 | 351 | <?php |
352 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
352 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
353 | 353 | ?> |
354 | 354 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
355 | 355 | <?php |
@@ -358,23 +358,23 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @since 1.7 |
360 | 360 | */ |
361 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
361 | + do_action('give_donation_form_login_fields', $form_id); |
|
362 | 362 | ?> |
363 | 363 | </div> |
364 | 364 | <?php |
365 | 365 | endif; |
366 | 366 | |
367 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
367 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
368 | 368 | /** |
369 | 369 | * Fire when user info render. |
370 | 370 | * |
371 | 371 | * @since 1.7 |
372 | 372 | */ |
373 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
373 | + do_action('give_donation_form_after_user_info', $form_id); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
377 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Donation Amount Field. |
@@ -389,16 +389,16 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @return void |
391 | 391 | */ |
392 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
392 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
393 | 393 | |
394 | 394 | $give_options = give_get_settings(); |
395 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
396 | - $allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
397 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
398 | - $symbol = give_currency_symbol( give_get_currency( $form_id, $args ) ); |
|
399 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
400 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false, 'currency' => give_get_currency( $form_id ) ) ); |
|
401 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
395 | + $variable_pricing = give_has_variable_prices($form_id); |
|
396 | + $allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
397 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
398 | + $symbol = give_currency_symbol(give_get_currency($form_id, $args)); |
|
399 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
400 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false, 'currency' => give_get_currency($form_id))); |
|
401 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
402 | 402 | |
403 | 403 | /** |
404 | 404 | * Fires while displaying donation form, before donation level fields. |
@@ -408,20 +408,20 @@ discard block |
||
408 | 408 | * @param int $form_id The form ID. |
409 | 409 | * @param array $args An array of form arguments. |
410 | 410 | */ |
411 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
411 | + do_action('give_before_donation_levels', $form_id, $args); |
|
412 | 412 | |
413 | 413 | // Set Price, No Custom Amount Allowed means hidden price field. |
414 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
414 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
415 | 415 | ?> |
416 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
416 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
417 | 417 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
418 | 418 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
419 | 419 | <div class="set-price give-donation-amount form-row-wide"> |
420 | - <?php if ( $currency_position == 'before' ) { |
|
420 | + <?php if ($currency_position == 'before') { |
|
421 | 421 | echo $currency_output; |
422 | 422 | } ?> |
423 | 423 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
424 | - <?php if ( $currency_position == 'after' ) { |
|
424 | + <?php if ($currency_position == 'after') { |
|
425 | 425 | echo $currency_output; |
426 | 426 | } ?> |
427 | 427 | </div> |
@@ -431,13 +431,13 @@ discard block |
||
431 | 431 | ?> |
432 | 432 | <div class="give-total-wrap"> |
433 | 433 | <div class="give-donation-amount form-row-wide"> |
434 | - <?php if ( $currency_position == 'before' ) { |
|
434 | + <?php if ($currency_position == 'before') { |
|
435 | 435 | echo $currency_output; |
436 | 436 | } ?> |
437 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
437 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
438 | 438 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
439 | 439 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
440 | - <?php if ( $currency_position == 'after' ) { |
|
440 | + <?php if ($currency_position == 'after') { |
|
441 | 441 | echo $currency_output; |
442 | 442 | } ?> |
443 | 443 | </div> |
@@ -452,16 +452,16 @@ discard block |
||
452 | 452 | * @param int $form_id The form ID. |
453 | 453 | * @param array $args An array of form arguments. |
454 | 454 | */ |
455 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
455 | + do_action('give_after_donation_amount', $form_id, $args); |
|
456 | 456 | |
457 | 457 | // Custom Amount Text |
458 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
458 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
459 | 459 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
460 | 460 | <?php } |
461 | 461 | |
462 | 462 | // Output Variable Pricing Levels. |
463 | - if ( $variable_pricing ) { |
|
464 | - give_output_levels( $form_id ); |
|
463 | + if ($variable_pricing) { |
|
464 | + give_output_levels($form_id); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | * @param int $form_id The form ID. |
473 | 473 | * @param array $args An array of form arguments. |
474 | 474 | */ |
475 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
475 | + do_action('give_after_donation_levels', $form_id, $args); |
|
476 | 476 | } |
477 | 477 | |
478 | -add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
478 | +add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2); |
|
479 | 479 | |
480 | 480 | /** |
481 | 481 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | * |
487 | 487 | * @return string Donation levels. |
488 | 488 | */ |
489 | -function give_output_levels( $form_id ) { |
|
489 | +function give_output_levels($form_id) { |
|
490 | 490 | |
491 | 491 | /** |
492 | 492 | * Filter the variable pricing |
@@ -499,47 +499,47 @@ discard block |
||
499 | 499 | * @param array $prices Array of variable prices. |
500 | 500 | * @param int $form Form ID. |
501 | 501 | */ |
502 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
502 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
503 | 503 | |
504 | 504 | |
505 | - $display_style = give_get_meta( $form_id, '_give_display_style', true ); |
|
506 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
507 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
505 | + $display_style = give_get_meta($form_id, '_give_display_style', true); |
|
506 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
507 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
508 | 508 | |
509 | - if ( empty( $custom_amount_text ) ) { |
|
510 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
509 | + if (empty($custom_amount_text)) { |
|
510 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | $output = ''; |
514 | 514 | |
515 | - switch ( $display_style ) { |
|
515 | + switch ($display_style) { |
|
516 | 516 | case 'buttons': |
517 | 517 | |
518 | 518 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
519 | 519 | |
520 | - foreach ( $prices as $price ) { |
|
521 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
|
522 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( give_is_default_level_id( $price ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
520 | + foreach ($prices as $price) { |
|
521 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price); |
|
522 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.(give_is_default_level_id($price) ? 'give-default-level' : ''), $form_id, $price); |
|
523 | 523 | |
524 | - $formatted_amount = give_format_amount( $price['_give_amount'], array( |
|
524 | + $formatted_amount = give_format_amount($price['_give_amount'], array( |
|
525 | 525 | 'sanitize' => false, |
526 | - 'currency' => give_get_currency( $form_id ), |
|
527 | - ) ); |
|
526 | + 'currency' => give_get_currency($form_id), |
|
527 | + )); |
|
528 | 528 | |
529 | 529 | $output .= sprintf( |
530 | 530 | '<li><button type="button" data-price-id="%1$s" class="%2$s" value="%3$s" data-default="%4$s">%5$s</button></li>', |
531 | 531 | $price['_give_id']['level_id'], |
532 | 532 | $level_classes, |
533 | 533 | $formatted_amount, |
534 | - array_key_exists( '_give_default', $price ) ? 1 : 0, |
|
534 | + array_key_exists('_give_default', $price) ? 1 : 0, |
|
535 | 535 | $level_text |
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |
539 | 539 | // Custom Amount. |
540 | 540 | if ( |
541 | - give_is_setting_enabled( $custom_amount ) |
|
542 | - && ! empty( $custom_amount_text ) |
|
541 | + give_is_setting_enabled($custom_amount) |
|
542 | + && ! empty($custom_amount_text) |
|
543 | 543 | ) { |
544 | 544 | |
545 | 545 | $output .= sprintf( |
@@ -556,30 +556,30 @@ discard block |
||
556 | 556 | |
557 | 557 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
558 | 558 | |
559 | - foreach ( $prices as $price ) { |
|
560 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
|
561 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
559 | + foreach ($prices as $price) { |
|
560 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price); |
|
561 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id, $price); |
|
562 | 562 | |
563 | - $formatted_amount = give_format_amount( $price['_give_amount'], array( |
|
563 | + $formatted_amount = give_format_amount($price['_give_amount'], array( |
|
564 | 564 | 'sanitize' => false, |
565 | - 'currency' => give_get_currency( $form_id ), |
|
566 | - ) ); |
|
565 | + 'currency' => give_get_currency($form_id), |
|
566 | + )); |
|
567 | 567 | |
568 | 568 | $output .= sprintf( |
569 | 569 | '<li><input type="radio" data-price-id="%1$s" class="%2$s" value="%3$s" name="give-radio-donation-level" id="give-radio-level-%1$s" %4$s data-default="%5$s"><label for="give-radio-level-%1$s">%6$s</label></li>', |
570 | 570 | $price['_give_id']['level_id'], |
571 | 571 | $level_classes, |
572 | 572 | $formatted_amount, |
573 | - ( give_is_default_level_id( $price ) ? 'checked="checked"' : '' ), |
|
574 | - array_key_exists( '_give_default', $price ) ? 1 : 0, |
|
573 | + (give_is_default_level_id($price) ? 'checked="checked"' : ''), |
|
574 | + array_key_exists('_give_default', $price) ? 1 : 0, |
|
575 | 575 | $level_text |
576 | 576 | ); |
577 | 577 | } |
578 | 578 | |
579 | 579 | // Custom Amount. |
580 | 580 | if ( |
581 | - give_is_setting_enabled( $custom_amount ) |
|
582 | - && ! empty( $custom_amount_text ) |
|
581 | + give_is_setting_enabled($custom_amount) |
|
582 | + && ! empty($custom_amount_text) |
|
583 | 583 | ) { |
584 | 584 | $output .= sprintf( |
585 | 585 | '<li><input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom"><label for="give-radio-level-custom">%1$s</label></li>', |
@@ -593,33 +593,33 @@ discard block |
||
593 | 593 | |
594 | 594 | case 'dropdown': |
595 | 595 | |
596 | - $output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
597 | - $output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
596 | + $output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
597 | + $output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
598 | 598 | |
599 | 599 | // first loop through prices. |
600 | - foreach ( $prices as $price ) { |
|
601 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
|
602 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, |
|
603 | - $price ); |
|
600 | + foreach ($prices as $price) { |
|
601 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price); |
|
602 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id, |
|
603 | + $price); |
|
604 | 604 | |
605 | - $formatted_amount = give_format_amount( $price['_give_amount'], array( |
|
605 | + $formatted_amount = give_format_amount($price['_give_amount'], array( |
|
606 | 606 | 'sanitize' => false, |
607 | - 'currency' => give_get_currency( $form_id ), |
|
608 | - ) ); |
|
607 | + 'currency' => give_get_currency($form_id), |
|
608 | + )); |
|
609 | 609 | |
610 | 610 | $output .= sprintf( |
611 | 611 | '<option data-price-id="%1$s" class="%2$s" value="%3$s" %4$s data-default="%5$s">%6$s</option>', |
612 | 612 | $price['_give_id']['level_id'], |
613 | 613 | $level_classes, |
614 | 614 | $formatted_amount, |
615 | - ( give_is_default_level_id( $price ) ? 'selected="selected"' : '' ), |
|
616 | - array_key_exists( '_give_default', $price ) ? 1 : 0, |
|
615 | + (give_is_default_level_id($price) ? 'selected="selected"' : ''), |
|
616 | + array_key_exists('_give_default', $price) ? 1 : 0, |
|
617 | 617 | $level_text |
618 | 618 | ); |
619 | 619 | } |
620 | 620 | |
621 | 621 | // Custom Amount. |
622 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
622 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
623 | 623 | $output .= sprintf( |
624 | 624 | '<option data-price-id="custom" class="give-donation-level-custom" value="custom">%1$s</option>', |
625 | 625 | $custom_amount_text |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | break; |
632 | 632 | } |
633 | 633 | |
634 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
634 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | /** |
@@ -646,27 +646,27 @@ discard block |
||
646 | 646 | * |
647 | 647 | * @return string Checkout button. |
648 | 648 | */ |
649 | -function give_display_checkout_button( $form_id, $args ) { |
|
649 | +function give_display_checkout_button($form_id, $args) { |
|
650 | 650 | |
651 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
651 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
652 | 652 | ? $args['display_style'] |
653 | - : give_get_meta( $form_id, '_give_payment_display', true ); |
|
653 | + : give_get_meta($form_id, '_give_payment_display', true); |
|
654 | 654 | |
655 | - if ( 'button' === $display_option ) { |
|
655 | + if ('button' === $display_option) { |
|
656 | 656 | $display_option = 'modal'; |
657 | - } elseif ( $display_option === 'onpage' ) { |
|
657 | + } elseif ($display_option === 'onpage') { |
|
658 | 658 | return ''; |
659 | 659 | } |
660 | 660 | |
661 | - $display_label_field = give_get_meta( $form_id, '_give_reveal_label', true ); |
|
662 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
661 | + $display_label_field = give_get_meta($form_id, '_give_reveal_label', true); |
|
662 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
663 | 663 | |
664 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
664 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
665 | 665 | |
666 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
666 | + echo apply_filters('give_display_checkout_button', $output); |
|
667 | 667 | } |
668 | 668 | |
669 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
669 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
670 | 670 | |
671 | 671 | /** |
672 | 672 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -679,52 +679,52 @@ discard block |
||
679 | 679 | * |
680 | 680 | * @return void |
681 | 681 | */ |
682 | -function give_user_info_fields( $form_id ) { |
|
682 | +function give_user_info_fields($form_id) { |
|
683 | 683 | |
684 | 684 | // Get user info. |
685 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
686 | - $title = ! empty( $give_user_info['give_title'] ) ? $give_user_info['give_title'] : ''; |
|
687 | - $first_name = ! empty( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; |
|
688 | - $last_name = ! empty( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; |
|
689 | - $company_name = ! empty( $give_user_info['company_name'] ) ? $give_user_info['company_name'] : ''; |
|
690 | - $email = ! empty( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; |
|
691 | - $title_prefixes = give_get_name_title_prefixes( $form_id ); |
|
685 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
686 | + $title = ! empty($give_user_info['give_title']) ? $give_user_info['give_title'] : ''; |
|
687 | + $first_name = ! empty($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; |
|
688 | + $last_name = ! empty($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; |
|
689 | + $company_name = ! empty($give_user_info['company_name']) ? $give_user_info['company_name'] : ''; |
|
690 | + $email = ! empty($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; |
|
691 | + $title_prefixes = give_get_name_title_prefixes($form_id); |
|
692 | 692 | |
693 | 693 | /** |
694 | 694 | * Fire before user personal information fields |
695 | 695 | * |
696 | 696 | * @since 1.7 |
697 | 697 | */ |
698 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
698 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
699 | 699 | |
700 | 700 | $title_prefix_classes = ''; |
701 | - if ( give_is_name_title_prefix_enabled( $form_id ) ) { |
|
701 | + if (give_is_name_title_prefix_enabled($form_id)) { |
|
702 | 702 | $title_prefix_classes = 'give-title-prefix-wrap'; |
703 | 703 | } |
704 | 704 | ?> |
705 | - <fieldset id="give_checkout_user_info" class="<?php echo esc_html( $title_prefix_classes ); ?>"> |
|
705 | + <fieldset id="give_checkout_user_info" class="<?php echo esc_html($title_prefix_classes); ?>"> |
|
706 | 706 | <legend> |
707 | - <?php echo esc_html( apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ) ); ?> |
|
707 | + <?php echo esc_html(apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give'))); ?> |
|
708 | 708 | </legend> |
709 | 709 | |
710 | - <?php if ( give_is_name_title_prefix_enabled( $form_id ) && is_array( $title_prefixes ) && count( $title_prefixes ) > 0 ) { ?> |
|
710 | + <?php if (give_is_name_title_prefix_enabled($form_id) && is_array($title_prefixes) && count($title_prefixes) > 0) { ?> |
|
711 | 711 | <p id="give-title-wrap" class="form-row form-row-title form-row-responsive"> |
712 | 712 | <label class="give-label" for="give-title"> |
713 | - <?php esc_attr_e( 'Title', 'give' ); ?> |
|
714 | - <?php if ( give_field_is_required( 'give_title', $form_id ) ) : ?> |
|
713 | + <?php esc_attr_e('Title', 'give'); ?> |
|
714 | + <?php if (give_field_is_required('give_title', $form_id)) : ?> |
|
715 | 715 | <span class="give-required-indicator">*</span> |
716 | 716 | <?php endif ?> |
717 | - <?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?> |
|
717 | + <?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?> |
|
718 | 718 | </label> |
719 | 719 | <select |
720 | 720 | class="give-input required" |
721 | 721 | type="text" |
722 | 722 | name="give_title" |
723 | 723 | id="give-title" |
724 | - <?php echo( give_field_is_required( 'give_title', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
724 | + <?php echo(give_field_is_required('give_title', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
725 | 725 | > |
726 | - <?php foreach ( $title_prefixes as $key => $value ) { ?> |
|
727 | - <option value="<?php echo esc_html( $value ); ?>" <?php selected( $value, $title, true ); ?>><?php echo esc_html( $value ); ?></option> |
|
726 | + <?php foreach ($title_prefixes as $key => $value) { ?> |
|
727 | + <option value="<?php echo esc_html($value); ?>" <?php selected($value, $title, true); ?>><?php echo esc_html($value); ?></option> |
|
728 | 728 | <?php } ?> |
729 | 729 | </select> |
730 | 730 | </p> |
@@ -732,63 +732,63 @@ discard block |
||
732 | 732 | |
733 | 733 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
734 | 734 | <label class="give-label" for="give-first"> |
735 | - <?php esc_attr_e( 'First Name', 'give' ); ?> |
|
736 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
735 | + <?php esc_attr_e('First Name', 'give'); ?> |
|
736 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
737 | 737 | <span class="give-required-indicator">*</span> |
738 | 738 | <?php endif ?> |
739 | - <?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?> |
|
739 | + <?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?> |
|
740 | 740 | </label> |
741 | 741 | <input |
742 | 742 | class="give-input required" |
743 | 743 | type="text" |
744 | 744 | name="give_first" |
745 | 745 | autocomplete="given-name" |
746 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
746 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
747 | 747 | id="give-first" |
748 | - value="<?php echo esc_html( $first_name ); ?>" |
|
749 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
748 | + value="<?php echo esc_html($first_name); ?>" |
|
749 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
750 | 750 | /> |
751 | 751 | </p> |
752 | 752 | |
753 | 753 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
754 | 754 | <label class="give-label" for="give-last"> |
755 | - <?php esc_attr_e( 'Last Name', 'give' ); ?> |
|
756 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
755 | + <?php esc_attr_e('Last Name', 'give'); ?> |
|
756 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
757 | 757 | <span class="give-required-indicator">*</span> |
758 | 758 | <?php endif ?> |
759 | - <?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?> |
|
759 | + <?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?> |
|
760 | 760 | </label> |
761 | 761 | |
762 | 762 | <input |
763 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
763 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
764 | 764 | type="text" |
765 | 765 | name="give_last" |
766 | 766 | autocomplete="family-name" |
767 | 767 | id="give-last" |
768 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
769 | - value="<?php echo esc_html( $last_name ); ?>" |
|
770 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
768 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
769 | + value="<?php echo esc_html($last_name); ?>" |
|
770 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
771 | 771 | /> |
772 | 772 | </p> |
773 | 773 | |
774 | - <?php if ( give_is_company_field_enabled( $form_id ) ) : ?> |
|
775 | - <?php $give_company = give_field_is_required( 'give_company_name', $form_id ); ?> |
|
774 | + <?php if (give_is_company_field_enabled($form_id)) : ?> |
|
775 | + <?php $give_company = give_field_is_required('give_company_name', $form_id); ?> |
|
776 | 776 | <p id="give-company-wrap" class="form-row form-row-wide"> |
777 | 777 | <label class="give-label" for="give-company"> |
778 | - <?php esc_attr_e( 'Company Name', 'give' ); ?> |
|
779 | - <?php if ( $give_company ) : ?> |
|
778 | + <?php esc_attr_e('Company Name', 'give'); ?> |
|
779 | + <?php if ($give_company) : ?> |
|
780 | 780 | <span class="give-required-indicator">*</span> |
781 | 781 | <?php endif; ?> |
782 | - <?php echo Give()->tooltips->render_help( __( 'Donate on behalf of Company', 'give' ) ); ?> |
|
782 | + <?php echo Give()->tooltips->render_help(__('Donate on behalf of Company', 'give')); ?> |
|
783 | 783 | </label> |
784 | 784 | <input |
785 | - class="give-input<?php echo( $give_company ? ' required' : '' ); ?>" |
|
785 | + class="give-input<?php echo($give_company ? ' required' : ''); ?>" |
|
786 | 786 | type="text" |
787 | 787 | name="give_company_name" |
788 | - placeholder="<?php esc_attr_e( 'Company Name', 'give' ); ?>" |
|
788 | + placeholder="<?php esc_attr_e('Company Name', 'give'); ?>" |
|
789 | 789 | id="give-company" |
790 | - value="<?php echo esc_html( $company_name ); ?>" |
|
791 | - <?php echo( $give_company ? ' required aria-required="true" ' : '' ); ?> |
|
790 | + value="<?php echo esc_html($company_name); ?>" |
|
791 | + <?php echo($give_company ? ' required aria-required="true" ' : ''); ?> |
|
792 | 792 | /> |
793 | 793 | </p> |
794 | 794 | <?php endif ?> |
@@ -799,31 +799,31 @@ discard block |
||
799 | 799 | * |
800 | 800 | * @since 1.7 |
801 | 801 | */ |
802 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
802 | + do_action('give_donation_form_before_email', $form_id); |
|
803 | 803 | ?> |
804 | 804 | <p id="give-email-wrap" class="form-row form-row-wide"> |
805 | 805 | <label class="give-label" for="give-email"> |
806 | - <?php esc_attr_e( 'Email Address', 'give' ); ?> |
|
807 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
806 | + <?php esc_attr_e('Email Address', 'give'); ?> |
|
807 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
808 | 808 | <span class="give-required-indicator">*</span> |
809 | 809 | <?php } ?> |
810 | - <?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?> |
|
810 | + <?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?> |
|
811 | 811 | </label> |
812 | 812 | <input |
813 | 813 | class="give-input required" |
814 | 814 | type="email" |
815 | 815 | name="give_email" |
816 | 816 | autocomplete="email" |
817 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
817 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
818 | 818 | id="give-email" |
819 | - value="<?php echo esc_html( $email ); ?>" |
|
820 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
819 | + value="<?php echo esc_html($email); ?>" |
|
820 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
821 | 821 | /> |
822 | 822 | |
823 | 823 | </p> |
824 | 824 | |
825 | - <?php if ( give_is_anonymous_donation_field_enabled( $form_id ) ) : ?> |
|
826 | - <?php $is_anonymous_donation = isset( $_POST['give_anonymous_donation'] ) ? absint( $_POST['give_anonymous_donation'] ) : 0; ?> |
|
825 | + <?php if (give_is_anonymous_donation_field_enabled($form_id)) : ?> |
|
826 | + <?php $is_anonymous_donation = isset($_POST['give_anonymous_donation']) ? absint($_POST['give_anonymous_donation']) : 0; ?> |
|
827 | 827 | <p id="give-anonymous-donation-wrap" class="form-row form-row-wide"> |
828 | 828 | <label class="give-label" for="give-anonymous-donation"> |
829 | 829 | <input |
@@ -832,35 +832,35 @@ discard block |
||
832 | 832 | name="give_anonymous_donation" |
833 | 833 | id="give-anonymous-donation" |
834 | 834 | value="1" |
835 | - <?php echo( give_field_is_required( 'give_anonymous_donation', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
836 | - <?php checked( 1, $is_anonymous_donation ); ?> |
|
835 | + <?php echo(give_field_is_required('give_anonymous_donation', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
836 | + <?php checked(1, $is_anonymous_donation); ?> |
|
837 | 837 | > |
838 | - <?php _e( 'Make this an anonymous donation', 'give' ); ?> |
|
839 | - <?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?> |
|
838 | + <?php _e('Make this an anonymous donation', 'give'); ?> |
|
839 | + <?php if (give_field_is_required('give_comment', $form_id)) { ?> |
|
840 | 840 | <span class="give-required-indicator">*</span> |
841 | 841 | <?php } ?> |
842 | - <?php echo Give()->tooltips->render_help( esc_html__( 'Would you like to prevent this donation from being displayed publicy?', 'give' ) ); ?> |
|
842 | + <?php echo Give()->tooltips->render_help(esc_html__('Would you like to prevent this donation from being displayed publicy?', 'give')); ?> |
|
843 | 843 | </label> |
844 | 844 | </p> |
845 | 845 | <?php endif; ?> |
846 | 846 | |
847 | - <?php if ( give_is_donor_comment_field_enabled( $form_id ) ) : ?> |
|
847 | + <?php if (give_is_donor_comment_field_enabled($form_id)) : ?> |
|
848 | 848 | <p id="give-comment-wrap" class="form-row form-row-wide"> |
849 | 849 | <label class="give-label" for="give-comment"> |
850 | - <?php _e( 'Comment', 'give' ); ?> |
|
851 | - <?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?> |
|
850 | + <?php _e('Comment', 'give'); ?> |
|
851 | + <?php if (give_field_is_required('give_comment', $form_id)) { ?> |
|
852 | 852 | <span class="give-required-indicator">*</span> |
853 | 853 | <?php } ?> |
854 | - <?php echo Give()->tooltips->render_help( __( 'Would you like to add a comment to this donation?', 'give' ) ); ?> |
|
854 | + <?php echo Give()->tooltips->render_help(__('Would you like to add a comment to this donation?', 'give')); ?> |
|
855 | 855 | </label> |
856 | 856 | |
857 | 857 | <textarea |
858 | 858 | class="give-input required" |
859 | 859 | name="give_comment" |
860 | - placeholder="<?php _e( 'Leave a comment', 'give' ); ?>" |
|
860 | + placeholder="<?php _e('Leave a comment', 'give'); ?>" |
|
861 | 861 | id="give-comment" |
862 | - <?php echo( give_field_is_required( 'give_comment', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
863 | - ><?php echo isset( $_POST['give_comment'] ) ? give_clean( $_POST['give_comment'] ) : ''; ?></textarea> |
|
862 | + <?php echo(give_field_is_required('give_comment', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
863 | + ><?php echo isset($_POST['give_comment']) ? give_clean($_POST['give_comment']) : ''; ?></textarea> |
|
864 | 864 | |
865 | 865 | </p> |
866 | 866 | <?php endif; ?> |
@@ -870,14 +870,14 @@ discard block |
||
870 | 870 | * |
871 | 871 | * @since 1.7 |
872 | 872 | */ |
873 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
873 | + do_action('give_donation_form_after_email', $form_id); |
|
874 | 874 | |
875 | 875 | /** |
876 | 876 | * Fire after personal email field |
877 | 877 | * |
878 | 878 | * @since 1.7 |
879 | 879 | */ |
880 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
880 | + do_action('give_donation_form_user_info', $form_id); |
|
881 | 881 | ?> |
882 | 882 | </fieldset> |
883 | 883 | <?php |
@@ -886,11 +886,11 @@ discard block |
||
886 | 886 | * |
887 | 887 | * @since 1.7 |
888 | 888 | */ |
889 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
889 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
890 | 890 | } |
891 | 891 | |
892 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
893 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
892 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
893 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
894 | 894 | |
895 | 895 | /** |
896 | 896 | * Renders the credit card info form. |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | * |
902 | 902 | * @return void |
903 | 903 | */ |
904 | -function give_get_cc_form( $form_id ) { |
|
904 | +function give_get_cc_form($form_id) { |
|
905 | 905 | |
906 | 906 | ob_start(); |
907 | 907 | |
@@ -912,50 +912,50 @@ discard block |
||
912 | 912 | * |
913 | 913 | * @param int $form_id The form ID. |
914 | 914 | */ |
915 | - do_action( 'give_before_cc_fields', $form_id ); |
|
915 | + do_action('give_before_cc_fields', $form_id); |
|
916 | 916 | ?> |
917 | 917 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
918 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
919 | - <?php if ( is_ssl() ) : ?> |
|
918 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
919 | + <?php if (is_ssl()) : ?> |
|
920 | 920 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
921 | 921 | <span class="give-icon padlock"></span> |
922 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
922 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
923 | 923 | </div> |
924 | 924 | <?php endif; ?> |
925 | 925 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
926 | 926 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
927 | - <?php _e( 'Card Number', 'give' ); ?> |
|
927 | + <?php _e('Card Number', 'give'); ?> |
|
928 | 928 | <span class="give-required-indicator">*</span> |
929 | - <?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?> |
|
929 | + <?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?> |
|
930 | 930 | <span class="card-type"></span> |
931 | 931 | </label> |
932 | 932 | |
933 | 933 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
934 | - class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" |
|
934 | + class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" |
|
935 | 935 | required aria-required="true"/> |
936 | 936 | </p> |
937 | 937 | |
938 | 938 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
939 | 939 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
940 | - <?php _e( 'CVC', 'give' ); ?> |
|
940 | + <?php _e('CVC', 'give'); ?> |
|
941 | 941 | <span class="give-required-indicator">*</span> |
942 | - <?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?> |
|
942 | + <?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?> |
|
943 | 943 | </label> |
944 | 944 | |
945 | 945 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
946 | - class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" |
|
946 | + class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" |
|
947 | 947 | required aria-required="true"/> |
948 | 948 | </p> |
949 | 949 | |
950 | 950 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
951 | 951 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
952 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
952 | + <?php _e('Name on the Card', 'give'); ?> |
|
953 | 953 | <span class="give-required-indicator">*</span> |
954 | - <?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?> |
|
954 | + <?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?> |
|
955 | 955 | </label> |
956 | 956 | |
957 | 957 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
958 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
958 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
959 | 959 | required aria-required="true"/> |
960 | 960 | </p> |
961 | 961 | <?php |
@@ -966,19 +966,19 @@ discard block |
||
966 | 966 | * |
967 | 967 | * @param int $form_id The form ID. |
968 | 968 | */ |
969 | - do_action( 'give_before_cc_expiration' ); |
|
969 | + do_action('give_before_cc_expiration'); |
|
970 | 970 | ?> |
971 | 971 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
972 | 972 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
973 | - <?php _e( 'Expiration', 'give' ); ?> |
|
973 | + <?php _e('Expiration', 'give'); ?> |
|
974 | 974 | <span class="give-required-indicator">*</span> |
975 | - <?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?> |
|
975 | + <?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?> |
|
976 | 976 | </label> |
977 | 977 | |
978 | 978 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
979 | 979 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
980 | 980 | |
981 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required aria-required="true"/> |
|
981 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required aria-required="true"/> |
|
982 | 982 | </p> |
983 | 983 | <?php |
984 | 984 | /** |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | * |
989 | 989 | * @param int $form_id The form ID. |
990 | 990 | */ |
991 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
991 | + do_action('give_after_cc_expiration', $form_id); |
|
992 | 992 | ?> |
993 | 993 | </fieldset> |
994 | 994 | <?php |
@@ -999,12 +999,12 @@ discard block |
||
999 | 999 | * |
1000 | 1000 | * @param int $form_id The form ID. |
1001 | 1001 | */ |
1002 | - do_action( 'give_after_cc_fields', $form_id ); |
|
1002 | + do_action('give_after_cc_fields', $form_id); |
|
1003 | 1003 | |
1004 | 1004 | echo ob_get_clean(); |
1005 | 1005 | } |
1006 | 1006 | |
1007 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
1007 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
1008 | 1008 | |
1009 | 1009 | /** |
1010 | 1010 | * Outputs the default credit card address fields. |
@@ -1015,20 +1015,20 @@ discard block |
||
1015 | 1015 | * |
1016 | 1016 | * @return void |
1017 | 1017 | */ |
1018 | -function give_default_cc_address_fields( $form_id ) { |
|
1018 | +function give_default_cc_address_fields($form_id) { |
|
1019 | 1019 | // Get user info. |
1020 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
1020 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
1021 | 1021 | |
1022 | 1022 | $logged_in = is_user_logged_in(); |
1023 | 1023 | |
1024 | - if ( $logged_in ) { |
|
1025 | - $user_address = give_get_donor_address( get_current_user_id() ); |
|
1024 | + if ($logged_in) { |
|
1025 | + $user_address = give_get_donor_address(get_current_user_id()); |
|
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | ob_start(); |
1029 | 1029 | ?> |
1030 | 1030 | <fieldset id="give_cc_address" class="cc-address"> |
1031 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
1031 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
1032 | 1032 | <?php |
1033 | 1033 | /** |
1034 | 1034 | * Fires while rendering credit card billing form, before address fields. |
@@ -1037,36 +1037,36 @@ discard block |
||
1037 | 1037 | * |
1038 | 1038 | * @param int $form_id The form ID. |
1039 | 1039 | */ |
1040 | - do_action( 'give_cc_billing_top' ); |
|
1040 | + do_action('give_cc_billing_top'); |
|
1041 | 1041 | |
1042 | 1042 | // For Country. |
1043 | 1043 | $selected_country = give_get_country(); |
1044 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
1044 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
1045 | 1045 | $selected_country = $give_user_info['billing_country']; |
1046 | 1046 | } |
1047 | 1047 | $countries = give_get_country_list(); |
1048 | 1048 | |
1049 | 1049 | // For state. |
1050 | 1050 | $selected_state = ''; |
1051 | - if ( $selected_country === give_get_country() ) { |
|
1051 | + if ($selected_country === give_get_country()) { |
|
1052 | 1052 | // Get default selected state by admin. |
1053 | 1053 | $selected_state = give_get_state(); |
1054 | 1054 | } |
1055 | 1055 | // Get the last payment made by user states. |
1056 | - if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) { |
|
1056 | + if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) { |
|
1057 | 1057 | $selected_state = $give_user_info['card_state']; |
1058 | 1058 | } |
1059 | 1059 | // Get the country code. |
1060 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
1060 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
1061 | 1061 | $selected_country = $give_user_info['billing_country']; |
1062 | 1062 | } |
1063 | - $label = __( 'State', 'give' ); |
|
1063 | + $label = __('State', 'give'); |
|
1064 | 1064 | $states_label = give_get_states_label(); |
1065 | 1065 | // Check if $country code exists in the array key for states label. |
1066 | - if ( array_key_exists( $selected_country, $states_label ) ) { |
|
1067 | - $label = $states_label[ $selected_country ]; |
|
1066 | + if (array_key_exists($selected_country, $states_label)) { |
|
1067 | + $label = $states_label[$selected_country]; |
|
1068 | 1068 | } |
1069 | - $states = give_get_states( $selected_country ); |
|
1069 | + $states = give_get_states($selected_country); |
|
1070 | 1070 | // Get the country list that do not have any states init. |
1071 | 1071 | $no_states_country = give_no_states_country_list(); |
1072 | 1072 | // Get the country list that does not require states. |
@@ -1074,24 +1074,24 @@ discard block |
||
1074 | 1074 | ?> |
1075 | 1075 | <p id="give-card-country-wrap" class="form-row form-row-wide"> |
1076 | 1076 | <label for="billing_country" class="give-label"> |
1077 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
1078 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
1077 | + <?php esc_html_e('Country', 'give'); ?> |
|
1078 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
1079 | 1079 | <span class="give-required-indicator">*</span> |
1080 | 1080 | <?php endif; ?> |
1081 | 1081 | <span class="give-tooltip give-icon give-icon-question" |
1082 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
1082 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
1083 | 1083 | </label> |
1084 | 1084 | |
1085 | 1085 | <select |
1086 | 1086 | name="billing_country" |
1087 | 1087 | autocomplete="country-name" |
1088 | 1088 | id="billing_country" |
1089 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
1090 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1089 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
1090 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1091 | 1091 | > |
1092 | 1092 | <?php |
1093 | - foreach ( $countries as $country_code => $country ) { |
|
1094 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
1093 | + foreach ($countries as $country_code => $country) { |
|
1094 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
1095 | 1095 | } |
1096 | 1096 | ?> |
1097 | 1097 | </select> |
@@ -1099,12 +1099,12 @@ discard block |
||
1099 | 1099 | |
1100 | 1100 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
1101 | 1101 | <label for="card_address" class="give-label"> |
1102 | - <?php _e( 'Address 1', 'give' ); ?> |
|
1102 | + <?php _e('Address 1', 'give'); ?> |
|
1103 | 1103 | <?php |
1104 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
1104 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
1105 | 1105 | <span class="give-required-indicator">*</span> |
1106 | 1106 | <?php endif; ?> |
1107 | - <?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?> |
|
1107 | + <?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?> |
|
1108 | 1108 | </label> |
1109 | 1109 | |
1110 | 1110 | <input |
@@ -1112,20 +1112,20 @@ discard block |
||
1112 | 1112 | id="card_address" |
1113 | 1113 | name="card_address" |
1114 | 1114 | autocomplete="address-line1" |
1115 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
1116 | - placeholder="<?php _e( 'Address line 1', 'give' ); ?>" |
|
1117 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
1118 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1115 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
1116 | + placeholder="<?php _e('Address line 1', 'give'); ?>" |
|
1117 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
1118 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1119 | 1119 | /> |
1120 | 1120 | </p> |
1121 | 1121 | |
1122 | 1122 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
1123 | 1123 | <label for="card_address_2" class="give-label"> |
1124 | - <?php _e( 'Address 2', 'give' ); ?> |
|
1125 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
1124 | + <?php _e('Address 2', 'give'); ?> |
|
1125 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
1126 | 1126 | <span class="give-required-indicator">*</span> |
1127 | 1127 | <?php endif; ?> |
1128 | - <?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?> |
|
1128 | + <?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?> |
|
1129 | 1129 | </label> |
1130 | 1130 | |
1131 | 1131 | <input |
@@ -1133,56 +1133,56 @@ discard block |
||
1133 | 1133 | id="card_address_2" |
1134 | 1134 | name="card_address_2" |
1135 | 1135 | autocomplete="address-line2" |
1136 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
1137 | - placeholder="<?php _e( 'Address line 2', 'give' ); ?>" |
|
1138 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
1139 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1136 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
1137 | + placeholder="<?php _e('Address line 2', 'give'); ?>" |
|
1138 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
1139 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1140 | 1140 | /> |
1141 | 1141 | </p> |
1142 | 1142 | |
1143 | 1143 | <p id="give-card-city-wrap" class="form-row form-row-wide"> |
1144 | 1144 | <label for="card_city" class="give-label"> |
1145 | - <?php _e( 'City', 'give' ); ?> |
|
1146 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
1145 | + <?php _e('City', 'give'); ?> |
|
1146 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
1147 | 1147 | <span class="give-required-indicator">*</span> |
1148 | 1148 | <?php endif; ?> |
1149 | - <?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?> |
|
1149 | + <?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?> |
|
1150 | 1150 | </label> |
1151 | 1151 | <input |
1152 | 1152 | type="text" |
1153 | 1153 | id="card_city" |
1154 | 1154 | name="card_city" |
1155 | 1155 | autocomplete="address-level3" |
1156 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
1157 | - placeholder="<?php _e( 'City', 'give' ); ?>" |
|
1158 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
1159 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1156 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
1157 | + placeholder="<?php _e('City', 'give'); ?>" |
|
1158 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
1159 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1160 | 1160 | /> |
1161 | 1161 | </p> |
1162 | 1162 | |
1163 | 1163 | <p id="give-card-state-wrap" |
1164 | - class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> "> |
|
1164 | + class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> "> |
|
1165 | 1165 | <label for="card_state" class="give-label"> |
1166 | 1166 | <span class="state-label-text"><?php echo $label; ?></span> |
1167 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : |
|
1167 | + <?php if (give_field_is_required('card_state', $form_id)) : |
|
1168 | 1168 | ?> |
1169 | - <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span> |
|
1169 | + <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span> |
|
1170 | 1170 | <?php endif; ?> |
1171 | 1171 | <span class="give-tooltip give-icon give-icon-question" |
1172 | - data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span> |
|
1172 | + data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span> |
|
1173 | 1173 | </label> |
1174 | 1174 | <?php |
1175 | 1175 | |
1176 | - if ( ! empty( $states ) ) : ?> |
|
1176 | + if ( ! empty($states)) : ?> |
|
1177 | 1177 | <select |
1178 | 1178 | name="card_state" |
1179 | 1179 | autocomplete="address-level4" |
1180 | 1180 | id="card_state" |
1181 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
1182 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
1181 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
1182 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
1183 | 1183 | <?php |
1184 | - foreach ( $states as $state_code => $state ) { |
|
1185 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
1184 | + foreach ($states as $state_code => $state) { |
|
1185 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
1186 | 1186 | } |
1187 | 1187 | ?> |
1188 | 1188 | </select> |
@@ -1194,11 +1194,11 @@ discard block |
||
1194 | 1194 | |
1195 | 1195 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
1196 | 1196 | <label for="card_zip" class="give-label"> |
1197 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
1198 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
1197 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
1198 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
1199 | 1199 | <span class="give-required-indicator">*</span> |
1200 | 1200 | <?php endif; ?> |
1201 | - <?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?> |
|
1201 | + <?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?> |
|
1202 | 1202 | </label> |
1203 | 1203 | |
1204 | 1204 | <input |
@@ -1207,10 +1207,10 @@ discard block |
||
1207 | 1207 | id="card_zip" |
1208 | 1208 | name="card_zip" |
1209 | 1209 | autocomplete="postal-code" |
1210 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
1211 | - placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" |
|
1212 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
1213 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1210 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
1211 | + placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" |
|
1212 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
1213 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1214 | 1214 | /> |
1215 | 1215 | </p> |
1216 | 1216 | <?php |
@@ -1221,14 +1221,14 @@ discard block |
||
1221 | 1221 | * |
1222 | 1222 | * @param int $form_id The form ID. |
1223 | 1223 | */ |
1224 | - do_action( 'give_cc_billing_bottom' ); |
|
1224 | + do_action('give_cc_billing_bottom'); |
|
1225 | 1225 | ?> |
1226 | 1226 | </fieldset> |
1227 | 1227 | <?php |
1228 | 1228 | echo ob_get_clean(); |
1229 | 1229 | } |
1230 | 1230 | |
1231 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
1231 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
1232 | 1232 | |
1233 | 1233 | |
1234 | 1234 | /** |
@@ -1241,15 +1241,15 @@ discard block |
||
1241 | 1241 | * |
1242 | 1242 | * @return string |
1243 | 1243 | */ |
1244 | -function give_get_register_fields( $form_id ) { |
|
1244 | +function give_get_register_fields($form_id) { |
|
1245 | 1245 | |
1246 | 1246 | global $user_ID; |
1247 | 1247 | |
1248 | - if ( is_user_logged_in() ) { |
|
1249 | - $user_data = get_userdata( $user_ID ); |
|
1248 | + if (is_user_logged_in()) { |
|
1249 | + $user_data = get_userdata($user_ID); |
|
1250 | 1250 | } |
1251 | 1251 | |
1252 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1252 | + $show_register_form = give_show_login_register_option($form_id); |
|
1253 | 1253 | |
1254 | 1254 | ob_start(); ?> |
1255 | 1255 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @param int $form_id The form ID. |
1264 | 1264 | */ |
1265 | - do_action( 'give_register_fields_before', $form_id ); |
|
1265 | + do_action('give_register_fields_before', $form_id); |
|
1266 | 1266 | ?> |
1267 | 1267 | |
1268 | 1268 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
@@ -1274,24 +1274,24 @@ discard block |
||
1274 | 1274 | * |
1275 | 1275 | * @param int $form_id The form ID. |
1276 | 1276 | */ |
1277 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
1277 | + do_action('give_register_account_fields_before', $form_id); |
|
1278 | 1278 | |
1279 | - $class = ( 'registration' === $show_register_form) ? 'form-row-wide' : 'form-row-first'; |
|
1279 | + $class = ('registration' === $show_register_form) ? 'form-row-wide' : 'form-row-first'; |
|
1280 | 1280 | ?> |
1281 | - <div id="give-create-account-wrap-<?php echo $form_id; ?>" class="form-row <?php echo esc_attr( $class ); ?> form-row-responsive"> |
|
1281 | + <div id="give-create-account-wrap-<?php echo $form_id; ?>" class="form-row <?php echo esc_attr($class); ?> form-row-responsive"> |
|
1282 | 1282 | <label for="give-create-account-<?php echo $form_id; ?>"> |
1283 | 1283 | <?php |
1284 | 1284 | // Add attributes to checkbox, if Guest Checkout is disabled. |
1285 | - $is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true ); |
|
1286 | - $id = 'give-create-account-' . $form_id; |
|
1287 | - if ( ! give_is_setting_enabled( $is_guest_checkout ) ) { |
|
1285 | + $is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true); |
|
1286 | + $id = 'give-create-account-'.$form_id; |
|
1287 | + if ( ! give_is_setting_enabled($is_guest_checkout)) { |
|
1288 | 1288 | echo Give()->tooltips->render( |
1289 | 1289 | array( |
1290 | 1290 | 'tag_content' => sprintf( |
1291 | 1291 | '<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />', |
1292 | 1292 | $id |
1293 | 1293 | ), |
1294 | - 'label' => __( 'Registration is required to donate.', 'give' ), |
|
1294 | + 'label' => __('Registration is required to donate.', 'give'), |
|
1295 | 1295 | ) ); |
1296 | 1296 | } else { |
1297 | 1297 | ?> |
@@ -1299,22 +1299,22 @@ discard block |
||
1299 | 1299 | <?php |
1300 | 1300 | } |
1301 | 1301 | |
1302 | - _e( 'Create an account', 'give' ); |
|
1303 | - echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) ); |
|
1302 | + _e('Create an account', 'give'); |
|
1303 | + echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give')); |
|
1304 | 1304 | echo str_replace( |
1305 | 1305 | '/>', |
1306 | - 'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>', |
|
1307 | - give_get_nonce_field( "give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false ) |
|
1306 | + 'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>', |
|
1307 | + give_get_nonce_field("give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false) |
|
1308 | 1308 | ); |
1309 | 1309 | ?> |
1310 | 1310 | </label> |
1311 | 1311 | </div> |
1312 | 1312 | |
1313 | - <?php if ( 'both' === $show_register_form ) { ?> |
|
1313 | + <?php if ('both' === $show_register_form) { ?> |
|
1314 | 1314 | <div class="give-login-account-wrap form-row form-row-last form-row-responsive"> |
1315 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
1316 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
1317 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
1315 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
1316 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
1317 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
1318 | 1318 | </p> |
1319 | 1319 | <p class="give-loading-text"> |
1320 | 1320 | <span class="give-loading-animation"></span> |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | * |
1331 | 1331 | * @param int $form_id The form ID. |
1332 | 1332 | */ |
1333 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
1333 | + do_action('give_register_account_fields_after', $form_id); |
|
1334 | 1334 | ?> |
1335 | 1335 | </fieldset> |
1336 | 1336 | |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | * |
1343 | 1343 | * @param int $form_id The form ID. |
1344 | 1344 | */ |
1345 | - do_action( 'give_register_fields_after', $form_id ); |
|
1345 | + do_action('give_register_fields_after', $form_id); |
|
1346 | 1346 | ?> |
1347 | 1347 | |
1348 | 1348 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1353,7 +1353,7 @@ discard block |
||
1353 | 1353 | * |
1354 | 1354 | * @since 1.7 |
1355 | 1355 | */ |
1356 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
1356 | + do_action('give_donation_form_user_info', $form_id); |
|
1357 | 1357 | ?> |
1358 | 1358 | |
1359 | 1359 | </fieldset> |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | echo ob_get_clean(); |
1362 | 1362 | } |
1363 | 1363 | |
1364 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
1364 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
1365 | 1365 | |
1366 | 1366 | /** |
1367 | 1367 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1374,28 +1374,28 @@ discard block |
||
1374 | 1374 | * |
1375 | 1375 | * @return string |
1376 | 1376 | */ |
1377 | -function give_get_login_fields( $form_id ) { |
|
1377 | +function give_get_login_fields($form_id) { |
|
1378 | 1378 | |
1379 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
1380 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1379 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
1380 | + $show_register_form = give_show_login_register_option($form_id); |
|
1381 | 1381 | |
1382 | 1382 | ob_start(); |
1383 | 1383 | ?> |
1384 | 1384 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
1385 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
1386 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1387 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
1385 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
1386 | + if ( ! give_logged_in_only($form_id)) { |
|
1387 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
1388 | 1388 | } ?> |
1389 | 1389 | </legend> |
1390 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1390 | + <?php if ($show_register_form == 'both') { ?> |
|
1391 | 1391 | <p class="give-new-account-link"> |
1392 | - <?php _e( 'Don\'t have an account?', 'give' ); ?> |
|
1393 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
1392 | + <?php _e('Don\'t have an account?', 'give'); ?> |
|
1393 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
1394 | 1394 | data-action="give_checkout_register"> |
1395 | - <?php if ( give_logged_in_only( $form_id ) ) { |
|
1396 | - _e( 'Register as a part of your donation »', 'give' ); |
|
1395 | + <?php if (give_logged_in_only($form_id)) { |
|
1396 | + _e('Register as a part of your donation »', 'give'); |
|
1397 | 1397 | } else { |
1398 | - _e( 'Register or donate as a guest »', 'give' ); |
|
1398 | + _e('Register or donate as a guest »', 'give'); |
|
1399 | 1399 | } ?> |
1400 | 1400 | </a> |
1401 | 1401 | </p> |
@@ -1416,35 +1416,35 @@ discard block |
||
1416 | 1416 | <div class="give-user-login-fields-container"> |
1417 | 1417 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
1418 | 1418 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
1419 | - <?php _e( 'Username', 'give' ); ?> |
|
1420 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1419 | + <?php _e('Username', 'give'); ?> |
|
1420 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1421 | 1421 | <span class="give-required-indicator">*</span> |
1422 | 1422 | <?php } ?> |
1423 | 1423 | </label> |
1424 | 1424 | |
1425 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
1425 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
1426 | 1426 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
1427 | - placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1427 | + placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1428 | 1428 | </div> |
1429 | 1429 | |
1430 | 1430 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
1431 | 1431 | class="give_login_password form-row form-row-last form-row-responsive"> |
1432 | 1432 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
1433 | - <?php _e( 'Password', 'give' ); ?> |
|
1434 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1433 | + <?php _e('Password', 'give'); ?> |
|
1434 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1435 | 1435 | <span class="give-required-indicator">*</span> |
1436 | 1436 | <?php } ?> |
1437 | 1437 | </label> |
1438 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
1438 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
1439 | 1439 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
1440 | - placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1440 | + placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1441 | 1441 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
1442 | 1442 | </div> |
1443 | 1443 | |
1444 | 1444 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
1445 | 1445 | <span class="give-forgot-password "> |
1446 | 1446 | <a href="<?php echo wp_lostpassword_url() ?>" |
1447 | - target="_blank"><?php _e( 'Reset Password', 'give' ) ?></a> |
|
1447 | + target="_blank"><?php _e('Reset Password', 'give') ?></a> |
|
1448 | 1448 | </span> |
1449 | 1449 | </div> |
1450 | 1450 | </div> |
@@ -1452,11 +1452,11 @@ discard block |
||
1452 | 1452 | |
1453 | 1453 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
1454 | 1454 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
1455 | - value="<?php _e( 'Login', 'give' ); ?>"/> |
|
1456 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
1455 | + value="<?php _e('Login', 'give'); ?>"/> |
|
1456 | + <?php if ($show_register_form !== 'login') { ?> |
|
1457 | 1457 | <input type="button" data-action="give_cancel_login" |
1458 | 1458 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
1459 | - value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
1459 | + value="<?php _e('Cancel', 'give'); ?>"/> |
|
1460 | 1460 | <?php } ?> |
1461 | 1461 | <span class="give-loading-animation"></span> |
1462 | 1462 | </div> |
@@ -1468,14 +1468,14 @@ discard block |
||
1468 | 1468 | * |
1469 | 1469 | * @param int $form_id The form ID. |
1470 | 1470 | */ |
1471 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
1471 | + do_action('give_checkout_login_fields_after', $form_id); |
|
1472 | 1472 | ?> |
1473 | 1473 | </fieldset><!--end #give-login-fields--> |
1474 | 1474 | <?php |
1475 | 1475 | echo ob_get_clean(); |
1476 | 1476 | } |
1477 | 1477 | |
1478 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
1478 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
1479 | 1479 | |
1480 | 1480 | /** |
1481 | 1481 | * Payment Mode Select. |
@@ -1491,10 +1491,10 @@ discard block |
||
1491 | 1491 | * |
1492 | 1492 | * @return void |
1493 | 1493 | */ |
1494 | -function give_payment_mode_select( $form_id, $args ) { |
|
1494 | +function give_payment_mode_select($form_id, $args) { |
|
1495 | 1495 | |
1496 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
1497 | - $id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : ''; |
|
1496 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
1497 | + $id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : ''; |
|
1498 | 1498 | |
1499 | 1499 | /** |
1500 | 1500 | * Fires while selecting payment gateways, before the fields. |
@@ -1503,10 +1503,10 @@ discard block |
||
1503 | 1503 | * |
1504 | 1504 | * @param int $form_id The form ID. |
1505 | 1505 | */ |
1506 | - do_action( 'give_payment_mode_top', $form_id ); |
|
1506 | + do_action('give_payment_mode_top', $form_id); |
|
1507 | 1507 | ?> |
1508 | 1508 | |
1509 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
1509 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
1510 | 1510 | echo 'style="display: none;"'; |
1511 | 1511 | } ?>> |
1512 | 1512 | <?php |
@@ -1517,10 +1517,10 @@ discard block |
||
1517 | 1517 | * |
1518 | 1518 | * @param int $form_id The form ID. |
1519 | 1519 | */ |
1520 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
1520 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
1521 | 1521 | ?> |
1522 | 1522 | <legend |
1523 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
1523 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
1524 | 1524 | <span class="give-loading-text"><span |
1525 | 1525 | class="give-loading-animation"></span> |
1526 | 1526 | </span> |
@@ -1533,37 +1533,36 @@ discard block |
||
1533 | 1533 | * |
1534 | 1534 | * @since 1.7 |
1535 | 1535 | */ |
1536 | - do_action( 'give_payment_mode_before_gateways' ) |
|
1536 | + do_action('give_payment_mode_before_gateways') |
|
1537 | 1537 | ?> |
1538 | 1538 | <ul id="give-gateway-radio-list"> |
1539 | 1539 | <?php |
1540 | 1540 | /** |
1541 | 1541 | * Loop through the active payment gateways. |
1542 | 1542 | */ |
1543 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
1543 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
1544 | 1544 | $give_settings = give_get_settings(); |
1545 | - $gateways_label = array_key_exists( 'gateways_label', $give_settings ) ? |
|
1546 | - $give_settings['gateways_label'] : |
|
1547 | - array(); |
|
1545 | + $gateways_label = array_key_exists('gateways_label', $give_settings) ? |
|
1546 | + $give_settings['gateways_label'] : array(); |
|
1548 | 1547 | |
1549 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
1548 | + foreach ($gateways as $gateway_id => $gateway) : |
|
1550 | 1549 | //Determine the default gateway. |
1551 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
1550 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
1552 | 1551 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
1553 | 1552 | <li<?php echo $checked_class ?>> |
1554 | 1553 | <input type="radio" name="payment-mode" class="give-gateway" |
1555 | - id="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>" |
|
1556 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
1554 | + id="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>" |
|
1555 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
1557 | 1556 | |
1558 | 1557 | <?php |
1559 | 1558 | $label = $gateway['checkout_label']; |
1560 | - if ( ! empty( $gateways_label[ $gateway_id ] ) ) { |
|
1561 | - $label = $gateways_label[ $gateway_id ]; |
|
1559 | + if ( ! empty($gateways_label[$gateway_id])) { |
|
1560 | + $label = $gateways_label[$gateway_id]; |
|
1562 | 1561 | } |
1563 | 1562 | ?> |
1564 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>" |
|
1563 | + <label for="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>" |
|
1565 | 1564 | class="give-gateway-option" |
1566 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $label ); ?></label> |
|
1565 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($label); ?></label> |
|
1567 | 1566 | </li> |
1568 | 1567 | <?php |
1569 | 1568 | endforeach; |
@@ -1575,7 +1574,7 @@ discard block |
||
1575 | 1574 | * |
1576 | 1575 | * @since 1.7 |
1577 | 1576 | */ |
1578 | - do_action( 'give_payment_mode_after_gateways' ); |
|
1577 | + do_action('give_payment_mode_after_gateways'); |
|
1579 | 1578 | ?> |
1580 | 1579 | </div> |
1581 | 1580 | <?php |
@@ -1586,7 +1585,7 @@ discard block |
||
1586 | 1585 | * |
1587 | 1586 | * @param int $form_id The form ID. |
1588 | 1587 | */ |
1589 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
1588 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
1590 | 1589 | ?> |
1591 | 1590 | </fieldset> |
1592 | 1591 | |
@@ -1598,7 +1597,7 @@ discard block |
||
1598 | 1597 | * |
1599 | 1598 | * @param int $form_id The form ID. |
1600 | 1599 | */ |
1601 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
1600 | + do_action('give_payment_mode_bottom', $form_id); |
|
1602 | 1601 | ?> |
1603 | 1602 | |
1604 | 1603 | <div id="give_purchase_form_wrap"> |
@@ -1609,7 +1608,7 @@ discard block |
||
1609 | 1608 | * |
1610 | 1609 | * @since 1.7 |
1611 | 1610 | */ |
1612 | - do_action( 'give_donation_form', $form_id, $args ); |
|
1611 | + do_action('give_donation_form', $form_id, $args); |
|
1613 | 1612 | ?> |
1614 | 1613 | |
1615 | 1614 | </div> |
@@ -1620,10 +1619,10 @@ discard block |
||
1620 | 1619 | * |
1621 | 1620 | * @since 1.7 |
1622 | 1621 | */ |
1623 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
1622 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
1624 | 1623 | } |
1625 | 1624 | |
1626 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select', 10, 2 ); |
|
1625 | +add_action('give_payment_mode_select', 'give_payment_mode_select', 10, 2); |
|
1627 | 1626 | |
1628 | 1627 | /** |
1629 | 1628 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1636,22 +1635,22 @@ discard block |
||
1636 | 1635 | * |
1637 | 1636 | * @return bool |
1638 | 1637 | */ |
1639 | -function give_terms_agreement( $form_id ) { |
|
1640 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
1638 | +function give_terms_agreement($form_id) { |
|
1639 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
1641 | 1640 | |
1642 | 1641 | // Bailout if per form and global term and conditions is not setup. |
1643 | 1642 | if ( |
1644 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1645 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1643 | + give_is_setting_enabled($form_option, 'global') |
|
1644 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1646 | 1645 | ) { |
1647 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
1648 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
1649 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
1646 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
1647 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
1648 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
1650 | 1649 | |
1651 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1652 | - $label = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
1653 | - $terms = give_get_meta( $form_id, '_give_agree_text', true ); |
|
1654 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
1650 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1651 | + $label = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
1652 | + $terms = give_get_meta($form_id, '_give_agree_text', true); |
|
1653 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
1655 | 1654 | |
1656 | 1655 | } else { |
1657 | 1656 | return false; |
@@ -1659,9 +1658,9 @@ discard block |
||
1659 | 1658 | |
1660 | 1659 | |
1661 | 1660 | // Bailout: Check if term and conditions text is empty or not. |
1662 | - if ( empty( $terms ) ) { |
|
1663 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
1664 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
1661 | + if (empty($terms)) { |
|
1662 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
1663 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
1665 | 1664 | } |
1666 | 1665 | |
1667 | 1666 | return false; |
@@ -1672,11 +1671,11 @@ discard block |
||
1672 | 1671 | * |
1673 | 1672 | * @since 2.1.5 |
1674 | 1673 | */ |
1675 | - $terms = apply_filters( 'give_the_term_content', wpautop( do_shortcode( $terms ) ), $terms, $form_id ); |
|
1674 | + $terms = apply_filters('give_the_term_content', wpautop(do_shortcode($terms)), $terms, $form_id); |
|
1676 | 1675 | |
1677 | 1676 | ?> |
1678 | 1677 | <fieldset id="give_terms_agreement"> |
1679 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
1678 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
1680 | 1679 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
1681 | 1680 | <?php |
1682 | 1681 | /** |
@@ -1684,7 +1683,7 @@ discard block |
||
1684 | 1683 | * |
1685 | 1684 | * @since 1.0 |
1686 | 1685 | */ |
1687 | - do_action( 'give_before_terms' ); |
|
1686 | + do_action('give_before_terms'); |
|
1688 | 1687 | |
1689 | 1688 | echo $terms; |
1690 | 1689 | /** |
@@ -1692,14 +1691,14 @@ discard block |
||
1692 | 1691 | * |
1693 | 1692 | * @since 1.0 |
1694 | 1693 | */ |
1695 | - do_action( 'give_after_terms' ); |
|
1694 | + do_action('give_after_terms'); |
|
1696 | 1695 | ?> |
1697 | 1696 | </div> |
1698 | 1697 | <div id="give_show_terms"> |
1699 | 1698 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1700 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1699 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1701 | 1700 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1702 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1701 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1703 | 1702 | </div> |
1704 | 1703 | |
1705 | 1704 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1710,7 +1709,7 @@ discard block |
||
1710 | 1709 | <?php |
1711 | 1710 | } |
1712 | 1711 | |
1713 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
1712 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
1714 | 1713 | |
1715 | 1714 | /** |
1716 | 1715 | * Checkout Final Total. |
@@ -1723,15 +1722,14 @@ discard block |
||
1723 | 1722 | * |
1724 | 1723 | * @return void |
1725 | 1724 | */ |
1726 | -function give_checkout_final_total( $form_id ) { |
|
1725 | +function give_checkout_final_total($form_id) { |
|
1727 | 1726 | |
1728 | - $total = isset( $_POST['give_total'] ) ? |
|
1729 | - apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) : |
|
1730 | - give_get_default_form_amount( $form_id ); |
|
1727 | + $total = isset($_POST['give_total']) ? |
|
1728 | + apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id); |
|
1731 | 1729 | |
1732 | 1730 | |
1733 | 1731 | // Only proceed if give_total available. |
1734 | - if ( empty( $total ) ) { |
|
1732 | + if (empty($total)) { |
|
1735 | 1733 | return; |
1736 | 1734 | } |
1737 | 1735 | ?> |
@@ -1742,18 +1740,18 @@ discard block |
||
1742 | 1740 | * |
1743 | 1741 | * @since 2.0.5 |
1744 | 1742 | */ |
1745 | - do_action( 'give_donation_final_total_label_before', $form_id ); |
|
1743 | + do_action('give_donation_final_total_label_before', $form_id); |
|
1746 | 1744 | ?> |
1747 | 1745 | <span class="give-donation-total-label"> |
1748 | - <?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?> |
|
1746 | + <?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?> |
|
1749 | 1747 | </span> |
1750 | 1748 | <span class="give-final-total-amount" |
1751 | - data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>"> |
|
1749 | + data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>"> |
|
1752 | 1750 | <?php |
1753 | - echo give_currency_filter( give_format_amount( $total, array( |
|
1751 | + echo give_currency_filter(give_format_amount($total, array( |
|
1754 | 1752 | 'sanitize' => false, |
1755 | - 'currency' => give_get_currency( $form_id ), |
|
1756 | - ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ); ?> |
|
1753 | + 'currency' => give_get_currency($form_id), |
|
1754 | + )), array('currency_code' => give_get_currency($form_id))); ?> |
|
1757 | 1755 | </span> |
1758 | 1756 | <?php |
1759 | 1757 | /** |
@@ -1761,13 +1759,13 @@ discard block |
||
1761 | 1759 | * |
1762 | 1760 | * @since 2.0.5 |
1763 | 1761 | */ |
1764 | - do_action( 'give_donation_final_total_label_after', $form_id ); |
|
1762 | + do_action('give_donation_final_total_label_after', $form_id); |
|
1765 | 1763 | ?> |
1766 | 1764 | </p> |
1767 | 1765 | <?php |
1768 | 1766 | } |
1769 | 1767 | |
1770 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1768 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
1771 | 1769 | |
1772 | 1770 | /** |
1773 | 1771 | * Renders the Checkout Submit section. |
@@ -1779,7 +1777,7 @@ discard block |
||
1779 | 1777 | * |
1780 | 1778 | * @return void |
1781 | 1779 | */ |
1782 | -function give_checkout_submit( $form_id, $args ) { |
|
1780 | +function give_checkout_submit($form_id, $args) { |
|
1783 | 1781 | ?> |
1784 | 1782 | <fieldset id="give_purchase_submit" class="give-donation-submit"> |
1785 | 1783 | <?php |
@@ -1788,24 +1786,24 @@ discard block |
||
1788 | 1786 | * |
1789 | 1787 | * @since 1.7 |
1790 | 1788 | */ |
1791 | - do_action( 'give_donation_form_before_submit', $form_id, $args ); |
|
1789 | + do_action('give_donation_form_before_submit', $form_id, $args); |
|
1792 | 1790 | |
1793 | - give_checkout_hidden_fields( $form_id ); |
|
1791 | + give_checkout_hidden_fields($form_id); |
|
1794 | 1792 | |
1795 | - echo give_get_donation_form_submit_button( $form_id ); |
|
1793 | + echo give_get_donation_form_submit_button($form_id); |
|
1796 | 1794 | |
1797 | 1795 | /** |
1798 | 1796 | * Fire after donation form submit. |
1799 | 1797 | * |
1800 | 1798 | * @since 1.7 |
1801 | 1799 | */ |
1802 | - do_action( 'give_donation_form_after_submit', $form_id, $args ); |
|
1800 | + do_action('give_donation_form_after_submit', $form_id, $args); |
|
1803 | 1801 | ?> |
1804 | 1802 | </fieldset> |
1805 | 1803 | <?php |
1806 | 1804 | } |
1807 | 1805 | |
1808 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2 ); |
|
1806 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2); |
|
1809 | 1807 | |
1810 | 1808 | /** |
1811 | 1809 | * Give Donation form submit button. |
@@ -1816,10 +1814,10 @@ discard block |
||
1816 | 1814 | * |
1817 | 1815 | * @return string |
1818 | 1816 | */ |
1819 | -function give_get_donation_form_submit_button( $form_id ) { |
|
1817 | +function give_get_donation_form_submit_button($form_id) { |
|
1820 | 1818 | |
1821 | - $display_label_field = give_get_meta( $form_id, '_give_checkout_label', true ); |
|
1822 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1819 | + $display_label_field = give_get_meta($form_id, '_give_checkout_label', true); |
|
1820 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1823 | 1821 | ob_start(); |
1824 | 1822 | ?> |
1825 | 1823 | <div class="give-submit-button-wrap give-clearfix"> |
@@ -1828,7 +1826,7 @@ discard block |
||
1828 | 1826 | <span class="give-loading-animation"></span> |
1829 | 1827 | </div> |
1830 | 1828 | <?php |
1831 | - return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id ); |
|
1829 | + return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id); |
|
1832 | 1830 | } |
1833 | 1831 | |
1834 | 1832 | /** |
@@ -1843,22 +1841,22 @@ discard block |
||
1843 | 1841 | * |
1844 | 1842 | * @return mixed |
1845 | 1843 | */ |
1846 | -function give_show_goal_progress( $form_id, $args = array() ) { |
|
1844 | +function give_show_goal_progress($form_id, $args = array()) { |
|
1847 | 1845 | |
1848 | 1846 | ob_start(); |
1849 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1847 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1850 | 1848 | |
1851 | 1849 | /** |
1852 | 1850 | * Filter progress bar output |
1853 | 1851 | * |
1854 | 1852 | * @since 2.0 |
1855 | 1853 | */ |
1856 | - echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args ); |
|
1854 | + echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args); |
|
1857 | 1855 | |
1858 | 1856 | return true; |
1859 | 1857 | } |
1860 | 1858 | |
1861 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1859 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1862 | 1860 | |
1863 | 1861 | /** |
1864 | 1862 | * Show Give Totals Progress. |
@@ -1870,22 +1868,22 @@ discard block |
||
1870 | 1868 | * |
1871 | 1869 | * @return mixed |
1872 | 1870 | */ |
1873 | -function give_show_goal_totals_progress( $total, $total_goal ) { |
|
1871 | +function give_show_goal_totals_progress($total, $total_goal) { |
|
1874 | 1872 | |
1875 | 1873 | // Bail out if total goal is set as an array. |
1876 | - if ( isset( $total_goal ) && is_array( $total_goal ) ) { |
|
1874 | + if (isset($total_goal) && is_array($total_goal)) { |
|
1877 | 1875 | return false; |
1878 | 1876 | } |
1879 | 1877 | |
1880 | 1878 | ob_start(); |
1881 | - give_get_template( 'shortcode-totals-progress', array( 'total' => $total, 'total_goal' => $total_goal ) ); |
|
1879 | + give_get_template('shortcode-totals-progress', array('total' => $total, 'total_goal' => $total_goal)); |
|
1882 | 1880 | |
1883 | - echo apply_filters( 'give_total_progress_output', ob_get_clean() ); |
|
1881 | + echo apply_filters('give_total_progress_output', ob_get_clean()); |
|
1884 | 1882 | |
1885 | 1883 | return true; |
1886 | 1884 | } |
1887 | 1885 | |
1888 | -add_action( 'give_pre_form', 'give_show_goal_totals_progress', 10, 2 ); |
|
1886 | +add_action('give_pre_form', 'give_show_goal_totals_progress', 10, 2); |
|
1889 | 1887 | |
1890 | 1888 | /** |
1891 | 1889 | * Get form content position. |
@@ -1897,10 +1895,10 @@ discard block |
||
1897 | 1895 | * |
1898 | 1896 | * @return mixed|string |
1899 | 1897 | */ |
1900 | -function give_get_form_content_placement( $form_id, $args ) { |
|
1898 | +function give_get_form_content_placement($form_id, $args) { |
|
1901 | 1899 | $show_content = ''; |
1902 | 1900 | |
1903 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
1901 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
1904 | 1902 | // Content positions. |
1905 | 1903 | $content_placement = array( |
1906 | 1904 | 'above' => 'give_pre_form', |
@@ -1908,18 +1906,18 @@ discard block |
||
1908 | 1906 | ); |
1909 | 1907 | |
1910 | 1908 | // Check if content position already decoded. |
1911 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
1909 | + if (in_array($args['show_content'], $content_placement)) { |
|
1912 | 1910 | return $args['show_content']; |
1913 | 1911 | } |
1914 | 1912 | |
1915 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
1913 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
1916 | 1914 | |
1917 | - } elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) { |
|
1918 | - $show_content = give_get_meta( $form_id, '_give_content_placement', true ); |
|
1915 | + } elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) { |
|
1916 | + $show_content = give_get_meta($form_id, '_give_content_placement', true); |
|
1919 | 1917 | |
1920 | - } elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) { |
|
1918 | + } elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) { |
|
1921 | 1919 | // Backward compatibility for _give_content_option for v18. |
1922 | - $show_content = give_get_meta( $form_id, '_give_content_option', true ); |
|
1920 | + $show_content = give_get_meta($form_id, '_give_content_option', true); |
|
1923 | 1921 | } |
1924 | 1922 | |
1925 | 1923 | return $show_content; |
@@ -1935,20 +1933,20 @@ discard block |
||
1935 | 1933 | * |
1936 | 1934 | * @return void|bool |
1937 | 1935 | */ |
1938 | -function give_form_content( $form_id, $args ) { |
|
1936 | +function give_form_content($form_id, $args) { |
|
1939 | 1937 | |
1940 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1938 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1941 | 1939 | |
1942 | 1940 | // Bailout. |
1943 | - if ( empty( $show_content ) ) { |
|
1941 | + if (empty($show_content)) { |
|
1944 | 1942 | return false; |
1945 | 1943 | } |
1946 | 1944 | |
1947 | 1945 | // Add action according to value. |
1948 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1946 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1949 | 1947 | } |
1950 | 1948 | |
1951 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1949 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1952 | 1950 | |
1953 | 1951 | /** |
1954 | 1952 | * Renders Post Form Content. |
@@ -1962,14 +1960,14 @@ discard block |
||
1962 | 1960 | * |
1963 | 1961 | * @return void |
1964 | 1962 | */ |
1965 | -function give_form_display_content( $form_id, $args ) { |
|
1966 | - $content = give_get_meta( $form_id, '_give_form_content', true ); |
|
1967 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1968 | - |
|
1969 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
1970 | - $content = apply_filters( 'the_content', $content ); |
|
1971 | - } else{ |
|
1972 | - $content = wpautop( do_shortcode( $content ) ); |
|
1963 | +function give_form_display_content($form_id, $args) { |
|
1964 | + $content = give_get_meta($form_id, '_give_form_content', true); |
|
1965 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1966 | + |
|
1967 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
1968 | + $content = apply_filters('the_content', $content); |
|
1969 | + } else { |
|
1970 | + $content = wpautop(do_shortcode($content)); |
|
1973 | 1971 | } |
1974 | 1972 | |
1975 | 1973 | $output = sprintf( |
@@ -1988,11 +1986,11 @@ discard block |
||
1988 | 1986 | * @param int $form_id |
1989 | 1987 | * @param array $args |
1990 | 1988 | */ |
1991 | - echo apply_filters( 'give_form_content_output', $output, $form_id, $args ); |
|
1989 | + echo apply_filters('give_form_content_output', $output, $form_id, $args); |
|
1992 | 1990 | |
1993 | 1991 | // remove action to prevent content output on addition forms on page. |
1994 | 1992 | // @see: https://github.com/WordImpress/Give/issues/634. |
1995 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1993 | + remove_action($show_content, 'give_form_display_content'); |
|
1996 | 1994 | } |
1997 | 1995 | |
1998 | 1996 | /** |
@@ -2004,7 +2002,7 @@ discard block |
||
2004 | 2002 | * |
2005 | 2003 | * @return void |
2006 | 2004 | */ |
2007 | -function give_checkout_hidden_fields( $form_id ) { |
|
2005 | +function give_checkout_hidden_fields($form_id) { |
|
2008 | 2006 | |
2009 | 2007 | /** |
2010 | 2008 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -2013,13 +2011,13 @@ discard block |
||
2013 | 2011 | * |
2014 | 2012 | * @param int $form_id The form ID. |
2015 | 2013 | */ |
2016 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
2014 | + do_action('give_hidden_fields_before', $form_id); |
|
2017 | 2015 | |
2018 | - if ( is_user_logged_in() ) { ?> |
|
2016 | + if (is_user_logged_in()) { ?> |
|
2019 | 2017 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
2020 | 2018 | <?php } ?> |
2021 | 2019 | <input type="hidden" name="give_action" value="purchase"/> |
2022 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
2020 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
2023 | 2021 | <?php |
2024 | 2022 | /** |
2025 | 2023 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -2028,7 +2026,7 @@ discard block |
||
2028 | 2026 | * |
2029 | 2027 | * @param int $form_id The form ID. |
2030 | 2028 | */ |
2031 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
2029 | + do_action('give_hidden_fields_after', $form_id); |
|
2032 | 2030 | |
2033 | 2031 | } |
2034 | 2032 | |
@@ -2043,20 +2041,20 @@ discard block |
||
2043 | 2041 | * |
2044 | 2042 | * @return string $content Filtered content. |
2045 | 2043 | */ |
2046 | -function give_filter_success_page_content( $content ) { |
|
2044 | +function give_filter_success_page_content($content) { |
|
2047 | 2045 | |
2048 | 2046 | $give_options = give_get_settings(); |
2049 | 2047 | |
2050 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
2051 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
2052 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
2048 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
2049 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
2050 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
2053 | 2051 | } |
2054 | 2052 | } |
2055 | 2053 | |
2056 | 2054 | return $content; |
2057 | 2055 | } |
2058 | 2056 | |
2059 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
2057 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
2060 | 2058 | |
2061 | 2059 | /** |
2062 | 2060 | * Test Mode Frontend Warning. |
@@ -2067,12 +2065,12 @@ discard block |
||
2067 | 2065 | */ |
2068 | 2066 | function give_test_mode_frontend_warning() { |
2069 | 2067 | |
2070 | - if ( give_is_test_mode() ) { |
|
2071 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
2068 | + if (give_is_test_mode()) { |
|
2069 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
2072 | 2070 | } |
2073 | 2071 | } |
2074 | 2072 | |
2075 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
2073 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
2076 | 2074 | |
2077 | 2075 | /** |
2078 | 2076 | * Members-only Form. |
@@ -2086,21 +2084,21 @@ discard block |
||
2086 | 2084 | * |
2087 | 2085 | * @return string |
2088 | 2086 | */ |
2089 | -function give_members_only_form( $final_output, $args ) { |
|
2087 | +function give_members_only_form($final_output, $args) { |
|
2090 | 2088 | |
2091 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
2089 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
2092 | 2090 | |
2093 | 2091 | //Sanity Check: Must have form_id & not be logged in. |
2094 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
2092 | + if (empty($form_id) || is_user_logged_in()) { |
|
2095 | 2093 | return $final_output; |
2096 | 2094 | } |
2097 | 2095 | |
2098 | 2096 | //Logged in only and Register / Login set to none. |
2099 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
2097 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
2100 | 2098 | |
2101 | - $final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
2099 | + $final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
2102 | 2100 | |
2103 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
2101 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
2104 | 2102 | |
2105 | 2103 | } |
2106 | 2104 | |
@@ -2108,7 +2106,7 @@ discard block |
||
2108 | 2106 | |
2109 | 2107 | } |
2110 | 2108 | |
2111 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
2109 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
2112 | 2110 | |
2113 | 2111 | |
2114 | 2112 | /** |
@@ -2120,40 +2118,40 @@ discard block |
||
2120 | 2118 | * @param array $args |
2121 | 2119 | * @param Give_Donate_Form $form |
2122 | 2120 | */ |
2123 | -function __give_form_add_donation_hidden_field( $form_id, $args, $form ) { |
|
2124 | - $id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : ''; |
|
2121 | +function __give_form_add_donation_hidden_field($form_id, $args, $form) { |
|
2122 | + $id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : ''; |
|
2125 | 2123 | ?> |
2126 | 2124 | <input type="hidden" name="give-form-id-prefix" value="<?php echo $id_prefix; ?>"/> |
2127 | - <input type="hidden" name="give-form-id" value="<?php echo intval( $form_id ); ?>"/> |
|
2128 | - <input type="hidden" name="give-form-title" value="<?php echo esc_html( $form->post_title ); ?>"/> |
|
2129 | - <input type="hidden" name="give-current-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
2130 | - <input type="hidden" name="give-form-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
2125 | + <input type="hidden" name="give-form-id" value="<?php echo intval($form_id); ?>"/> |
|
2126 | + <input type="hidden" name="give-form-title" value="<?php echo esc_html($form->post_title); ?>"/> |
|
2127 | + <input type="hidden" name="give-current-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
2128 | + <input type="hidden" name="give-form-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
2131 | 2129 | <?php |
2132 | 2130 | // Get the custom option amount. |
2133 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
2131 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
2134 | 2132 | |
2135 | 2133 | // If custom amount enabled. |
2136 | - if ( give_is_setting_enabled( $custom_amount ) ) { |
|
2134 | + if (give_is_setting_enabled($custom_amount)) { |
|
2137 | 2135 | ?> |
2138 | 2136 | <input type="hidden" name="give-form-minimum" |
2139 | - value="<?php echo give_maybe_sanitize_amount( give_get_form_minimum_price( $form_id ) ); ?>"/> |
|
2137 | + value="<?php echo give_maybe_sanitize_amount(give_get_form_minimum_price($form_id)); ?>"/> |
|
2140 | 2138 | <input type="hidden" name="give-form-maximum" |
2141 | - value="<?php echo give_maybe_sanitize_amount( give_get_form_maximum_price( $form_id ) ); ?>"/> |
|
2139 | + value="<?php echo give_maybe_sanitize_amount(give_get_form_maximum_price($form_id)); ?>"/> |
|
2142 | 2140 | <?php |
2143 | 2141 | } |
2144 | 2142 | |
2145 | 2143 | // WP nonce field. |
2146 | 2144 | echo str_replace( |
2147 | 2145 | '/>', |
2148 | - 'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>', |
|
2149 | - give_get_nonce_field( "give_donation_form_nonce_{$form_id}", 'give-form-hash', false ) |
|
2146 | + 'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>', |
|
2147 | + give_get_nonce_field("give_donation_form_nonce_{$form_id}", 'give-form-hash', false) |
|
2150 | 2148 | ); |
2151 | 2149 | |
2152 | 2150 | // Price ID hidden field for variable (multi-level) donation forms. |
2153 | - if ( give_has_variable_prices( $form_id ) ) { |
|
2151 | + if (give_has_variable_prices($form_id)) { |
|
2154 | 2152 | // Get the default price ID. |
2155 | - $default_price = give_form_get_default_level( $form_id ); |
|
2156 | - $price_id = isset( $default_price['_give_id']['level_id'] ) ? $default_price['_give_id']['level_id'] : 0; |
|
2153 | + $default_price = give_form_get_default_level($form_id); |
|
2154 | + $price_id = isset($default_price['_give_id']['level_id']) ? $default_price['_give_id']['level_id'] : 0; |
|
2157 | 2155 | |
2158 | 2156 | echo sprintf( |
2159 | 2157 | '<input type="hidden" name="give-price-id" value="%s"/>', |
@@ -2162,7 +2160,7 @@ discard block |
||
2162 | 2160 | } |
2163 | 2161 | } |
2164 | 2162 | |
2165 | -add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 ); |
|
2163 | +add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3); |
|
2166 | 2164 | |
2167 | 2165 | /** |
2168 | 2166 | * Add currency settings on donation form. |
@@ -2174,20 +2172,20 @@ discard block |
||
2174 | 2172 | * |
2175 | 2173 | * @return array |
2176 | 2174 | */ |
2177 | -function __give_form_add_currency_settings( $form_html_tags, $form ) { |
|
2178 | - $form_currency = give_get_currency( $form->ID ); |
|
2179 | - $currency_settings = give_get_currency_formatting_settings( $form_currency ); |
|
2175 | +function __give_form_add_currency_settings($form_html_tags, $form) { |
|
2176 | + $form_currency = give_get_currency($form->ID); |
|
2177 | + $currency_settings = give_get_currency_formatting_settings($form_currency); |
|
2180 | 2178 | |
2181 | 2179 | // Check if currency exist. |
2182 | - if ( empty( $currency_settings ) ) { |
|
2180 | + if (empty($currency_settings)) { |
|
2183 | 2181 | return $form_html_tags; |
2184 | 2182 | } |
2185 | 2183 | |
2186 | - $form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency ); |
|
2184 | + $form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency); |
|
2187 | 2185 | $form_html_tags['data-currency_code'] = $form_currency; |
2188 | 2186 | |
2189 | - if ( ! empty( $currency_settings ) ) { |
|
2190 | - foreach ( $currency_settings as $key => $value ) { |
|
2187 | + if ( ! empty($currency_settings)) { |
|
2188 | + foreach ($currency_settings as $key => $value) { |
|
2191 | 2189 | $form_html_tags["data-{$key}"] = $value; |
2192 | 2190 | } |
2193 | 2191 | } |
@@ -2195,7 +2193,7 @@ discard block |
||
2195 | 2193 | return $form_html_tags; |
2196 | 2194 | } |
2197 | 2195 | |
2198 | -add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 ); |
|
2196 | +add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2); |
|
2199 | 2197 | |
2200 | 2198 | /** |
2201 | 2199 | * Adds classes to progress bar container. |
@@ -2206,7 +2204,7 @@ discard block |
||
2206 | 2204 | * |
2207 | 2205 | * @return string |
2208 | 2206 | */ |
2209 | -function add_give_goal_progress_class( $class_goal ) { |
|
2207 | +function add_give_goal_progress_class($class_goal) { |
|
2210 | 2208 | $class_goal = 'progress progress-striped active'; |
2211 | 2209 | |
2212 | 2210 | return $class_goal; |
@@ -2221,7 +2219,7 @@ discard block |
||
2221 | 2219 | * |
2222 | 2220 | * @return string |
2223 | 2221 | */ |
2224 | -function add_give_goal_progress_bar_class( $class_bar ) { |
|
2222 | +function add_give_goal_progress_bar_class($class_bar) { |
|
2225 | 2223 | $class_bar = 'bar'; |
2226 | 2224 | |
2227 | 2225 | return $class_bar; |
@@ -2238,12 +2236,12 @@ discard block |
||
2238 | 2236 | * |
2239 | 2237 | * @return array |
2240 | 2238 | */ |
2241 | -function add_class_for_form_grid( $class, $id, $args ) { |
|
2239 | +function add_class_for_form_grid($class, $id, $args) { |
|
2242 | 2240 | $class[] = 'give-form-grid-wrap'; |
2243 | 2241 | |
2244 | - foreach ( $class as $index => $item ) { |
|
2245 | - if( false !== strpos( $item, 'give-display-' ) ) { |
|
2246 | - unset( $class[$index] ); |
|
2242 | + foreach ($class as $index => $item) { |
|
2243 | + if (false !== strpos($item, 'give-display-')) { |
|
2244 | + unset($class[$index]); |
|
2247 | 2245 | } |
2248 | 2246 | } |
2249 | 2247 | |
@@ -2259,7 +2257,7 @@ discard block |
||
2259 | 2257 | * |
2260 | 2258 | * @since 2.1 |
2261 | 2259 | */ |
2262 | -function give_is_form_grid_page_hidden_field( $id, $args, $form ) { |
|
2260 | +function give_is_form_grid_page_hidden_field($id, $args, $form) { |
|
2263 | 2261 | echo '<input type="hidden" name="is-form-grid" value="true" />'; |
2264 | 2262 | } |
2265 | 2263 | |
@@ -2274,28 +2272,28 @@ discard block |
||
2274 | 2272 | * @since 2.1 |
2275 | 2273 | * @return string |
2276 | 2274 | */ |
2277 | -function give_redirect_and_popup_form( $redirect, $args ) { |
|
2275 | +function give_redirect_and_popup_form($redirect, $args) { |
|
2278 | 2276 | |
2279 | 2277 | // Check the page has Form Grid. |
2280 | - $is_form_grid = isset( $_POST['is-form-grid'] ) ? give_clean( $_POST['is-form-grid'] ) : ''; |
|
2278 | + $is_form_grid = isset($_POST['is-form-grid']) ? give_clean($_POST['is-form-grid']) : ''; |
|
2281 | 2279 | |
2282 | - if ( 'true' === $is_form_grid ) { |
|
2280 | + if ('true' === $is_form_grid) { |
|
2283 | 2281 | |
2284 | - $payment_mode = give_clean( $_POST['payment-mode'] ); |
|
2282 | + $payment_mode = give_clean($_POST['payment-mode']); |
|
2285 | 2283 | $form_id = $args['form-id']; |
2286 | 2284 | |
2287 | 2285 | // Get the URL without Query parameters. |
2288 | - $redirect = strtok( $redirect, '?' ); |
|
2286 | + $redirect = strtok($redirect, '?'); |
|
2289 | 2287 | |
2290 | 2288 | // Add query parameters 'form-id' and 'payment-mode'. |
2291 | - $redirect = add_query_arg( array( |
|
2289 | + $redirect = add_query_arg(array( |
|
2292 | 2290 | 'form-id' => $form_id, |
2293 | 2291 | 'payment-mode' => $payment_mode, |
2294 | - ), $redirect ); |
|
2292 | + ), $redirect); |
|
2295 | 2293 | } |
2296 | 2294 | |
2297 | 2295 | // Return the modified URL. |
2298 | 2296 | return $redirect; |
2299 | 2297 | } |
2300 | 2298 | |
2301 | -add_filter( 'give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2 ); |
|
2299 | +add_filter('give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -add_action( 'give_manual_cc_form', '__return_false' ); |
|
23 | +add_action('give_manual_cc_form', '__return_false'); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Processes the donation data and uses the Manual Payment gateway to record |
@@ -32,44 +32,44 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return void |
34 | 34 | */ |
35 | -function give_manual_payment( $purchase_data ) { |
|
35 | +function give_manual_payment($purchase_data) { |
|
36 | 36 | |
37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
38 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
38 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | //Create payment_data array |
42 | 42 | $payment_data = array( |
43 | 43 | 'price' => $purchase_data['price'], |
44 | 44 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
45 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
45 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
46 | 46 | 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
47 | 47 | 'date' => $purchase_data['date'], |
48 | 48 | 'user_email' => $purchase_data['user_email'], |
49 | 49 | 'purchase_key' => $purchase_data['purchase_key'], |
50 | - 'currency' => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ), |
|
50 | + 'currency' => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data), |
|
51 | 51 | 'user_info' => $purchase_data['user_info'], |
52 | 52 | 'status' => 'pending' |
53 | 53 | ); |
54 | 54 | // Record the pending payment |
55 | - $payment = give_insert_payment( $payment_data ); |
|
55 | + $payment = give_insert_payment($payment_data); |
|
56 | 56 | |
57 | - if ( $payment ) { |
|
58 | - give_update_payment_status( $payment, 'publish' ); |
|
57 | + if ($payment) { |
|
58 | + give_update_payment_status($payment, 'publish'); |
|
59 | 59 | give_send_to_success_page(); |
60 | 60 | } else { |
61 | 61 | give_record_gateway_error( |
62 | - esc_html__( 'Payment Error', 'give' ), |
|
62 | + esc_html__('Payment Error', 'give'), |
|
63 | 63 | sprintf( |
64 | 64 | /* translators: %s: payment data */ |
65 | - esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ), |
|
66 | - json_encode( $payment_data ) |
|
65 | + esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'), |
|
66 | + json_encode($payment_data) |
|
67 | 67 | ), |
68 | 68 | $payment |
69 | 69 | ); |
70 | 70 | // If errors are present, send the user back to the donation page so they can be corrected |
71 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
71 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | -add_action( 'give_gateway_manual', 'give_manual_payment' ); |
|
75 | +add_action('give_gateway_manual', 'give_manual_payment'); |
@@ -258,7 +258,7 @@ |
||
258 | 258 | * @access public |
259 | 259 | * @since 1.0 |
260 | 260 | * |
261 | - * @return mixed string If search is present, false otherwise. |
|
261 | + * @return string|false string If search is present, false otherwise. |
|
262 | 262 | */ |
263 | 263 | public function get_search() { |
264 | 264 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | 19 | // Load WP_List_Table if not loaded. |
20 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
21 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
20 | +if ( ! class_exists('WP_List_Table')) { |
|
21 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | public function __construct() { |
62 | 62 | |
63 | 63 | // Set parent defaults. |
64 | - parent::__construct( array( |
|
65 | - 'singular' => __( 'Donor', 'give' ), // Singular name of the listed records. |
|
66 | - 'plural' => __( 'Donors', 'give' ), // Plural name of the listed records. |
|
64 | + parent::__construct(array( |
|
65 | + 'singular' => __('Donor', 'give'), // Singular name of the listed records. |
|
66 | + 'plural' => __('Donors', 'give'), // Plural name of the listed records. |
|
67 | 67 | 'ajax' => false, // Does this table support ajax?. |
68 | - ) ); |
|
68 | + )); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -80,23 +80,23 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return void |
82 | 82 | */ |
83 | - public function search_box( $text, $input_id ) { |
|
84 | - $input_id = $input_id . '-search-input'; |
|
83 | + public function search_box($text, $input_id) { |
|
84 | + $input_id = $input_id.'-search-input'; |
|
85 | 85 | |
86 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
87 | - echo sprintf( '<input type="hidden" name="orderby" value="%1$s" />', esc_attr( $_REQUEST['orderby'] ) ); |
|
86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
87 | + echo sprintf('<input type="hidden" name="orderby" value="%1$s" />', esc_attr($_REQUEST['orderby'])); |
|
88 | 88 | } |
89 | 89 | |
90 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
91 | - echo sprintf( '<input type="hidden" name="order" value="%1$s" />', esc_attr( $_REQUEST['order'] ) ); |
|
90 | + if ( ! empty($_REQUEST['order'])) { |
|
91 | + echo sprintf('<input type="hidden" name="order" value="%1$s" />', esc_attr($_REQUEST['order'])); |
|
92 | 92 | } |
93 | 93 | ?> |
94 | 94 | <p class="search-box" role="search"> |
95 | 95 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
96 | 96 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
97 | - <?php submit_button( $text, 'button', false, false, array( |
|
97 | + <?php submit_button($text, 'button', false, false, array( |
|
98 | 98 | 'ID' => 'search-submit', |
99 | - ) ); ?> |
|
99 | + )); ?> |
|
100 | 100 | </p> |
101 | 101 | <?php |
102 | 102 | } |
@@ -112,32 +112,32 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return string Column Name. |
114 | 114 | */ |
115 | - public function column_default( $donor, $column_name ) { |
|
115 | + public function column_default($donor, $column_name) { |
|
116 | 116 | |
117 | - switch ( $column_name ) { |
|
117 | + switch ($column_name) { |
|
118 | 118 | |
119 | 119 | case 'num_donations' : |
120 | 120 | $value = sprintf( |
121 | 121 | '<a href="%s">%s</a>', |
122 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor['id'] ) ), |
|
123 | - esc_html( $donor['num_donations'] ) |
|
122 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor['id'])), |
|
123 | + esc_html($donor['num_donations']) |
|
124 | 124 | ); |
125 | 125 | break; |
126 | 126 | |
127 | 127 | case 'amount_spent' : |
128 | - $value = give_currency_filter( give_format_amount( $donor[ $column_name ], array( 'sanitize' => false ) ) ); |
|
128 | + $value = give_currency_filter(give_format_amount($donor[$column_name], array('sanitize' => false))); |
|
129 | 129 | break; |
130 | 130 | |
131 | 131 | case 'date_created' : |
132 | - $value = date_i18n( give_date_format(), strtotime( $donor['date_created'] ) ); |
|
132 | + $value = date_i18n(give_date_format(), strtotime($donor['date_created'])); |
|
133 | 133 | break; |
134 | 134 | |
135 | 135 | default: |
136 | - $value = isset( $donor[ $column_name ] ) ? $donor[ $column_name ] : null; |
|
136 | + $value = isset($donor[$column_name]) ? $donor[$column_name] : null; |
|
137 | 137 | break; |
138 | 138 | } |
139 | 139 | |
140 | - return apply_filters( "give_donors_column_{$column_name}", $value, $donor['id'] ); |
|
140 | + return apply_filters("give_donors_column_{$column_name}", $value, $donor['id']); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return string |
153 | 153 | */ |
154 | - public function column_cb( $donor ) { |
|
154 | + public function column_cb($donor) { |
|
155 | 155 | return sprintf( |
156 | 156 | '<input class="donor-selector" type="checkbox" name="%1$s[]" value="%2$d" data-name="%3$s" />', |
157 | 157 | $this->_args['singular'], |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return string |
172 | 172 | */ |
173 | - public function column_name( $donor ) { |
|
174 | - $name = ! empty( $donor['name'] ) ? $donor['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>'; |
|
175 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ); |
|
176 | - $actions = $this->get_row_actions( $donor ); |
|
173 | + public function column_name($donor) { |
|
174 | + $name = ! empty($donor['name']) ? $donor['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>'; |
|
175 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']); |
|
176 | + $actions = $this->get_row_actions($donor); |
|
177 | 177 | |
178 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
178 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | public function get_columns() { |
190 | 190 | $columns = array( |
191 | 191 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
192 | - 'name' => __( 'Name', 'give' ), |
|
193 | - 'email' => __( 'Email', 'give' ), |
|
194 | - 'num_donations' => __( 'Donations', 'give' ), |
|
195 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
196 | - 'date_created' => __( 'Date Created', 'give' ), |
|
192 | + 'name' => __('Name', 'give'), |
|
193 | + 'email' => __('Email', 'give'), |
|
194 | + 'num_donations' => __('Donations', 'give'), |
|
195 | + 'amount_spent' => __('Total Donated', 'give'), |
|
196 | + 'date_created' => __('Date Created', 'give'), |
|
197 | 197 | ); |
198 | 198 | |
199 | - return apply_filters( 'give_list_donors_columns', $columns ); |
|
199 | + return apply_filters('give_list_donors_columns', $columns); |
|
200 | 200 | |
201 | 201 | } |
202 | 202 | |
@@ -210,13 +210,13 @@ discard block |
||
210 | 210 | public function get_sortable_columns() { |
211 | 211 | |
212 | 212 | $columns = array( |
213 | - 'date_created' => array( 'date_created', true ), |
|
214 | - 'name' => array( 'name', true ), |
|
215 | - 'num_donations' => array( 'purchase_count', false ), |
|
216 | - 'amount_spent' => array( 'purchase_value', false ), |
|
213 | + 'date_created' => array('date_created', true), |
|
214 | + 'name' => array('name', true), |
|
215 | + 'num_donations' => array('purchase_count', false), |
|
216 | + 'amount_spent' => array('purchase_value', false), |
|
217 | 217 | ); |
218 | 218 | |
219 | - return apply_filters( 'give_list_donors_sortable_columns', $columns ); |
|
219 | + return apply_filters('give_list_donors_sortable_columns', $columns); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return array An array of action links. |
231 | 231 | */ |
232 | - public function get_row_actions( $donor ) { |
|
232 | + public function get_row_actions($donor) { |
|
233 | 233 | |
234 | 234 | $actions = array( |
235 | - 'view' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ), sprintf( esc_attr__( 'View "%s"', 'give' ), $donor['name'] ), __( 'View Donor', 'give' ) ), |
|
236 | - 'notes' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor['id'] ), sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $donor['name'] ), __( 'Notes', 'give' ) ), |
|
237 | - 'delete' => sprintf( '<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'],sprintf( esc_attr__( 'Delete "%s"', 'give' ), $donor['name'] ), __( 'Delete', 'give' ) ), |
|
235 | + 'view' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']), sprintf(esc_attr__('View "%s"', 'give'), $donor['name']), __('View Donor', 'give')), |
|
236 | + 'notes' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor['id']), sprintf(esc_attr__('Notes for "%s"', 'give'), $donor['name']), __('Notes', 'give')), |
|
237 | + 'delete' => sprintf('<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'], sprintf(esc_attr__('Delete "%s"', 'give'), $donor['name']), __('Delete', 'give')), |
|
238 | 238 | ); |
239 | 239 | |
240 | - return apply_filters( 'give_donor_row_actions', $actions, $donor ); |
|
240 | + return apply_filters('give_donor_row_actions', $actions, $donor); |
|
241 | 241 | |
242 | 242 | } |
243 | 243 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @return int Current page number. |
251 | 251 | */ |
252 | 252 | public function get_paged() { |
253 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
253 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return mixed string If search is present, false otherwise. |
263 | 263 | */ |
264 | 264 | public function get_search() { |
265 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
265 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public function get_bulk_actions() { |
277 | 277 | $actions = array( |
278 | - 'delete' => __( 'Delete', 'give' ), |
|
278 | + 'delete' => __('Delete', 'give'), |
|
279 | 279 | ); |
280 | 280 | return $actions; |
281 | 281 | } |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | * @access protected |
289 | 289 | * @since 1.8.16 |
290 | 290 | */ |
291 | - protected function display_tablenav( $which ) { |
|
292 | - if ( 'top' === $which ) { |
|
293 | - wp_nonce_field( 'bulk-' . $this->_args['plural'], '_wpnonce', false ); |
|
291 | + protected function display_tablenav($which) { |
|
292 | + if ('top' === $which) { |
|
293 | + wp_nonce_field('bulk-'.$this->_args['plural'], '_wpnonce', false); |
|
294 | 294 | } |
295 | 295 | ?> |
296 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
297 | - <?php if ( $this->has_items() ) : ?> |
|
296 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
297 | + <?php if ($this->has_items()) : ?> |
|
298 | 298 | <div class="alignleft actions bulkactions"> |
299 | - <?php $this->bulk_actions( $which ); ?> |
|
299 | + <?php $this->bulk_actions($which); ?> |
|
300 | 300 | </div> |
301 | 301 | <?php endif; |
302 | - $this->extra_tablenav( $which ); |
|
303 | - $this->pagination( $which ); |
|
302 | + $this->extra_tablenav($which); |
|
303 | + $this->pagination($which); |
|
304 | 304 | ?> |
305 | 305 | <br class="clear" /> |
306 | 306 | </div> |
@@ -321,17 +321,17 @@ discard block |
||
321 | 321 | |
322 | 322 | // Get donor query. |
323 | 323 | $args = $this->get_donor_query(); |
324 | - $donors = Give()->donors->get_donors( $args ); |
|
324 | + $donors = Give()->donors->get_donors($args); |
|
325 | 325 | |
326 | - if ( $donors ) { |
|
326 | + if ($donors) { |
|
327 | 327 | |
328 | - foreach ( $donors as $donor ) { |
|
328 | + foreach ($donors as $donor) { |
|
329 | 329 | |
330 | - $user_id = ! empty( $donor->user_id ) ? intval( $donor->user_id ) : 0; |
|
331 | - $title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); |
|
330 | + $user_id = ! empty($donor->user_id) ? intval($donor->user_id) : 0; |
|
331 | + $title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true); |
|
332 | 332 | |
333 | 333 | // If title prefix is set, then update the donor name. |
334 | - $donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name ); |
|
334 | + $donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name); |
|
335 | 335 | |
336 | 336 | $data[] = array( |
337 | 337 | 'id' => $donor->id, |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
348 | - return apply_filters( 'give_donors_column_query_data', $data ); |
|
348 | + return apply_filters('give_donors_column_query_data', $data); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | |
361 | 361 | $_donor_query['number'] = - 1; |
362 | 362 | $_donor_query['offset'] = 0; |
363 | - $donors = Give()->donors->get_donors( $_donor_query ); |
|
363 | + $donors = Give()->donors->get_donors($_donor_query); |
|
364 | 364 | |
365 | - return count( $donors ); |
|
365 | + return count($donors); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -375,10 +375,10 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public function get_donor_query() { |
377 | 377 | $paged = $this->get_paged(); |
378 | - $offset = $this->per_page * ( $paged - 1 ); |
|
378 | + $offset = $this->per_page * ($paged - 1); |
|
379 | 379 | $search = $this->get_search(); |
380 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
381 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
380 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
381 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
382 | 382 | |
383 | 383 | $args = array( |
384 | 384 | 'number' => $this->per_page, |
@@ -387,10 +387,10 @@ discard block |
||
387 | 387 | 'orderby' => $orderby, |
388 | 388 | ); |
389 | 389 | |
390 | - if ( $search ) { |
|
391 | - if ( is_email( $search ) ) { |
|
390 | + if ($search) { |
|
391 | + if (is_email($search)) { |
|
392 | 392 | $args['email'] = $search; |
393 | - } elseif ( is_numeric( $search ) ) { |
|
393 | + } elseif (is_numeric($search)) { |
|
394 | 394 | $args['id'] = $search; |
395 | 395 | } else { |
396 | 396 | $args['name'] = $search; |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | * @since 1.8.17 |
409 | 409 | * @access public |
410 | 410 | */ |
411 | - public function single_row( $item ) { |
|
412 | - echo sprintf( '<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name'] ); |
|
413 | - $this->single_row_columns( $item ); |
|
411 | + public function single_row($item) { |
|
412 | + echo sprintf('<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name']); |
|
413 | + $this->single_row_columns($item); |
|
414 | 414 | echo '</tr>'; |
415 | 415 | } |
416 | 416 | |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | public function display() { |
424 | 424 | $singular = $this->_args['singular']; |
425 | 425 | |
426 | - $this->display_tablenav( 'top' ); |
|
426 | + $this->display_tablenav('top'); |
|
427 | 427 | |
428 | - $this->screen->render_screen_reader_content( 'heading_list' ); |
|
428 | + $this->screen->render_screen_reader_content('heading_list'); |
|
429 | 429 | |
430 | - $get_data = give_clean( $_GET ); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
430 | + $get_data = give_clean($_GET); // WPCS: input var ok, sanitization ok, CSRF ok. |
|
431 | 431 | |
432 | - $search_keyword = ! empty( $get_data['s'] ) ? $get_data['s'] : ''; |
|
433 | - $order = ! empty( $get_data['order'] ) ? $get_data['order'] : 'DESC'; |
|
434 | - $order_by = ! empty( $get_data['orderby'] ) ? $get_data['orderby'] : 'ID'; |
|
432 | + $search_keyword = ! empty($get_data['s']) ? $get_data['s'] : ''; |
|
433 | + $order = ! empty($get_data['order']) ? $get_data['order'] : 'DESC'; |
|
434 | + $order_by = ! empty($get_data['orderby']) ? $get_data['orderby'] : 'ID'; |
|
435 | 435 | ?> |
436 | - <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> |
|
436 | + <table class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>"> |
|
437 | 437 | <thead> |
438 | 438 | <tr> |
439 | 439 | <?php $this->print_column_headers(); ?> |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | </thead> |
442 | 442 | |
443 | 443 | <tbody id="the-list"<?php |
444 | - if ( $singular ) { |
|
444 | + if ($singular) { |
|
445 | 445 | echo " data-wp-lists='list:$singular'"; |
446 | 446 | } ?>> |
447 | 447 | <tr class="hidden"></tr> |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | <td colspan="6" class="colspanchange"> |
450 | 450 | |
451 | 451 | <fieldset class="inline-edit-col-left"> |
452 | - <legend class="inline-edit-legend"><?php esc_attr_e( 'BULK DELETE', 'give' ); ?></legend> |
|
452 | + <legend class="inline-edit-legend"><?php esc_attr_e('BULK DELETE', 'give'); ?></legend> |
|
453 | 453 | <div class="inline-edit-col"> |
454 | 454 | <div id="bulk-titles"> |
455 | 455 | <div id="give-bulk-donors" class="give-bulk-donors"> |
@@ -462,22 +462,22 @@ discard block |
||
462 | 462 | <div class="inline-edit-col"> |
463 | 463 | <label> |
464 | 464 | <input class="give-donor-delete-confirm" type="checkbox" name="give-donor-delete-confirm"/> |
465 | - <?php esc_attr_e( 'Are you sure you want to delete the selected donor(s)?', 'give' ); ?> |
|
465 | + <?php esc_attr_e('Are you sure you want to delete the selected donor(s)?', 'give'); ?> |
|
466 | 466 | </label> |
467 | 467 | <label> |
468 | 468 | <input class="give-donor-delete-records" type="checkbox" name="give-donor-delete-records"/> |
469 | - <?php esc_attr_e( 'Delete all associated donations and records?', 'give' ); ?> |
|
469 | + <?php esc_attr_e('Delete all associated donations and records?', 'give'); ?> |
|
470 | 470 | </label> |
471 | 471 | </div> |
472 | 472 | </fieldset> |
473 | 473 | |
474 | 474 | <p class="submit inline-edit-save"> |
475 | 475 | <input type="hidden" name="give_action" value="delete_bulk_donor"/> |
476 | - <input type="hidden" name="s" value="<?php echo esc_html( $search_keyword ); ?>"/> |
|
477 | - <input type="hidden" name="orderby" value="<?php echo esc_html( $order_by ); ?>"/> |
|
478 | - <input type="hidden" name="order" value="<?php echo esc_html( $order ); ?>"/> |
|
479 | - <button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php esc_attr_e( 'Cancel', 'give' ); ?></button> |
|
480 | - <input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php esc_attr_e( 'Delete', 'give' ); ?>"> |
|
476 | + <input type="hidden" name="s" value="<?php echo esc_html($search_keyword); ?>"/> |
|
477 | + <input type="hidden" name="orderby" value="<?php echo esc_html($order_by); ?>"/> |
|
478 | + <input type="hidden" name="order" value="<?php echo esc_html($order); ?>"/> |
|
479 | + <button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php esc_attr_e('Cancel', 'give'); ?></button> |
|
480 | + <input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php esc_attr_e('Delete', 'give'); ?>"> |
|
481 | 481 | <br class="clear"> |
482 | 482 | </p> |
483 | 483 | </td> |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | |
488 | 488 | <tfoot> |
489 | 489 | <tr> |
490 | - <?php $this->print_column_headers( false ); ?> |
|
490 | + <?php $this->print_column_headers(false); ?> |
|
491 | 491 | </tr> |
492 | 492 | </tfoot> |
493 | 493 | |
494 | 494 | </table> |
495 | 495 | <?php |
496 | - $this->display_tablenav( 'bottom' ); |
|
496 | + $this->display_tablenav('bottom'); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | /** |
@@ -510,16 +510,16 @@ discard block |
||
510 | 510 | $hidden = array(); // No hidden columns. |
511 | 511 | $sortable = $this->get_sortable_columns(); |
512 | 512 | |
513 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
513 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
514 | 514 | |
515 | 515 | $this->items = $this->donor_data(); |
516 | 516 | |
517 | 517 | $this->total = $this->get_donor_count(); |
518 | 518 | |
519 | - $this->set_pagination_args( array( |
|
519 | + $this->set_pagination_args(array( |
|
520 | 520 | 'total_items' => $this->total, |
521 | 521 | 'per_page' => $this->per_page, |
522 | - 'total_pages' => ceil( $this->total / $this->per_page ), |
|
523 | - ) ); |
|
522 | + 'total_pages' => ceil($this->total / $this->per_page), |
|
523 | + )); |
|
524 | 524 | } |
525 | 525 | } |