@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_register_dashboard_widgets() { |
24 | - if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
25 | - wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); |
|
24 | + if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
25 | + wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); |
|
29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sales Summary Dashboard Widget |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function give_dashboard_sales_widget() { |
40 | 40 | |
41 | - if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
41 | + if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | $stats = new Give_Payment_Stats; ?> |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | <div class="give-dashboard-widget"> |
47 | 47 | |
48 | 48 | <div class="give-dashboard-today give-clearfix"> |
49 | - <h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3> |
|
49 | + <h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3> |
|
50 | 50 | |
51 | - <p class="give-dashboard-happy-day"><?php printf( __( 'Happy %1$s!', 'give' ), date( 'l', current_time( 'timestamp' ) ) ); ?></p> |
|
51 | + <p class="give-dashboard-happy-day"><?php printf(__('Happy %1$s!', 'give'), date('l', current_time('timestamp'))); ?></p> |
|
52 | 52 | |
53 | - <?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?> |
|
53 | + <?php $earnings_today = $stats->get_earnings(0, 'today', false); ?> |
|
54 | 54 | |
55 | - <p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p> |
|
55 | + <p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p> |
|
56 | 56 | |
57 | - <p class="give-orders-today"><?php $donations_today = $stats->get_sales( 0, 'today', false, array( |
|
57 | + <p class="give-orders-today"><?php $donations_today = $stats->get_sales(0, 'today', false, array( |
|
58 | 58 | 'publish', |
59 | 59 | 'revoked' |
60 | - ) ); ?><?php echo give_format_amount( $donations_today, false ); ?> |
|
61 | - <span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span> |
|
60 | + )); ?><?php echo give_format_amount($donations_today, false); ?> |
|
61 | + <span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span> |
|
62 | 62 | </p> |
63 | 63 | |
64 | 64 | |
@@ -68,34 +68,34 @@ discard block |
||
68 | 68 | <table class="give-table-stats"> |
69 | 69 | <thead style="display: none;"> |
70 | 70 | <tr> |
71 | - <th><?php _e( 'This Week', 'give' ); ?></th> |
|
72 | - <th><?php _e( 'This Month', 'give' ); ?></th> |
|
73 | - <th><?php _e( 'Past 30 Days', 'give' ); ?></th> |
|
71 | + <th><?php _e('This Week', 'give'); ?></th> |
|
72 | + <th><?php _e('This Month', 'give'); ?></th> |
|
73 | + <th><?php _e('Past 30 Days', 'give'); ?></th> |
|
74 | 74 | </tr> |
75 | 75 | </thead> |
76 | 76 | <tbody> |
77 | 77 | <tr id="give-table-stats-tr-1"> |
78 | 78 | <td> |
79 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p> |
|
79 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p> |
|
80 | 80 | |
81 | - <p class="give-dashboard-stat-total-label"><?php _e( 'this week', 'give' ); ?></p> |
|
81 | + <p class="give-dashboard-stat-total-label"><?php _e('this week', 'give'); ?></p> |
|
82 | 82 | </td> |
83 | 83 | <td> |
84 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p> |
|
84 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p> |
|
85 | 85 | |
86 | - <p class="give-dashboard-stat-total-label"><?php _e( 'this month', 'give' ); ?></p> |
|
86 | + <p class="give-dashboard-stat-total-label"><?php _e('this month', 'give'); ?></p> |
|
87 | 87 | </td> |
88 | 88 | </tr> |
89 | 89 | <tr id="give-table-stats-tr-2"> |
90 | 90 | <td> |
91 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p> |
|
91 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p> |
|
92 | 92 | |
93 | - <p class="give-dashboard-stat-total-label"><?php _e( 'last month', 'give' ); ?></p> |
|
93 | + <p class="give-dashboard-stat-total-label"><?php _e('last month', 'give'); ?></p> |
|
94 | 94 | </td> |
95 | 95 | <td> |
96 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p> |
|
96 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p> |
|
97 | 97 | |
98 | - <p class="give-dashboard-stat-total-label"><?php _e( 'this year', 'give' ); ?></p> |
|
98 | + <p class="give-dashboard-stat-total-label"><?php _e('this year', 'give'); ?></p> |
|
99 | 99 | </td> |
100 | 100 | </tr> |
101 | 101 | </tbody> |
@@ -112,18 +112,18 @@ discard block |
||
112 | 112 | * @since 1.0 |
113 | 113 | * @return void |
114 | 114 | */ |
115 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
116 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
115 | +function give_dashboard_at_a_glance_widget($items) { |
|
116 | + $num_posts = wp_count_posts('give_forms'); |
|
117 | 117 | |
118 | - if ( $num_posts && $num_posts->publish ) { |
|
119 | - $text = sprintf( _n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ), $num_posts->publish, give_get_forms_label_singular(), give_get_forms_label_plural() ); |
|
118 | + if ($num_posts && $num_posts->publish) { |
|
119 | + $text = sprintf(_n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'), $num_posts->publish, give_get_forms_label_singular(), give_get_forms_label_plural()); |
|
120 | 120 | |
121 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
121 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
122 | 122 | |
123 | - if ( current_user_can( 'edit_give_forms', get_the_ID() ) ) { |
|
124 | - $text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text ); |
|
123 | + if (current_user_can('edit_give_forms', get_the_ID())) { |
|
124 | + $text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text); |
|
125 | 125 | } else { |
126 | - $text = sprintf( '<span class="give-forms-count">%1$s</span>', $text ); |
|
126 | + $text = sprintf('<span class="give-forms-count">%1$s</span>', $text); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | $items[] = $text; |
@@ -132,4 +132,4 @@ discard block |
||
132 | 132 | return $items; |
133 | 133 | } |
134 | 134 | |
135 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
|
135 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $goal = give_get_form_goal( $post_id ); |
|
31 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
32 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $goal = give_get_form_goal($post_id); |
|
31 | + $variable_pricing = give_has_variable_prices($post_id); |
|
32 | + $prices = give_get_variable_prices($post_id); |
|
33 | 33 | |
34 | 34 | //No empty prices - min. 1.00 for new forms |
35 | - if ( empty( $price ) ) { |
|
36 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
35 | + if (empty($price)) { |
|
36 | + $price = esc_attr(give_format_amount('1.00')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Start with an underscore to hide fields from custom fields list |
@@ -42,275 +42,275 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Repeatable Field Groups |
44 | 44 | */ |
45 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
45 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
46 | 46 | 'id' => 'form_field_options', |
47 | - 'title' => __( 'Donation Options', 'give' ), |
|
48 | - 'object_types' => array( 'give_forms' ), |
|
47 | + 'title' => __('Donation Options', 'give'), |
|
48 | + 'object_types' => array('give_forms'), |
|
49 | 49 | 'context' => 'normal', |
50 | 50 | 'priority' => 'high', //Show above Content WYSIWYG |
51 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
51 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
52 | 52 | //Donation Option |
53 | 53 | array( |
54 | - 'name' => __( 'Donation Option', 'give' ), |
|
55 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give' ), |
|
56 | - 'id' => $prefix . 'price_option', |
|
54 | + 'name' => __('Donation Option', 'give'), |
|
55 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give'), |
|
56 | + 'id' => $prefix.'price_option', |
|
57 | 57 | 'type' => 'radio_inline', |
58 | 58 | 'default' => 'set', |
59 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
60 | - 'set' => __( 'Set Donation', 'give' ), |
|
61 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
62 | - ) ), |
|
59 | + 'options' => apply_filters('give_forms_price_options', array( |
|
60 | + 'set' => __('Set Donation', 'give'), |
|
61 | + 'multi' => __('Multi-level Donation', 'give'), |
|
62 | + )), |
|
63 | 63 | ), |
64 | 64 | array( |
65 | - 'name' => __( 'Set Donation', 'give' ), |
|
66 | - 'description' => __( 'This is the set donation amount for this form.', 'give' ), |
|
67 | - 'id' => $prefix . 'set_price', |
|
65 | + 'name' => __('Set Donation', 'give'), |
|
66 | + 'description' => __('This is the set donation amount for this form.', 'give'), |
|
67 | + 'id' => $prefix.'set_price', |
|
68 | 68 | 'type' => 'text_small', |
69 | 69 | 'row_classes' => 'give-subfield', |
70 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
71 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
70 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
71 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
72 | 72 | 'attributes' => array( |
73 | - 'placeholder' => give_format_amount( '1.00' ), |
|
73 | + 'placeholder' => give_format_amount('1.00'), |
|
74 | 74 | 'value' => $price, |
75 | 75 | 'class' => 'cmb-type-text-small give-money-field', |
76 | 76 | ), |
77 | 77 | ), |
78 | 78 | //Donation levels: Header |
79 | 79 | array( |
80 | - 'id' => $prefix . 'levels_header', |
|
80 | + 'id' => $prefix.'levels_header', |
|
81 | 81 | 'type' => 'levels_repeater_header', |
82 | 82 | ), |
83 | 83 | //Donation Levels: Repeatable CMB2 Group |
84 | 84 | array( |
85 | - 'id' => $prefix . 'donation_levels', |
|
85 | + 'id' => $prefix.'donation_levels', |
|
86 | 86 | 'type' => 'group', |
87 | 87 | 'row_classes' => 'give-subfield', |
88 | 88 | 'options' => array( |
89 | - 'add_button' => __( 'Add Level', 'give' ), |
|
90 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
89 | + 'add_button' => __('Add Level', 'give'), |
|
90 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'), |
|
91 | 91 | 'sortable' => true, // beta |
92 | 92 | ), |
93 | 93 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
94 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
94 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
95 | 95 | array( |
96 | - 'name' => __( 'ID', 'give' ), |
|
97 | - 'id' => $prefix . 'id', |
|
96 | + 'name' => __('ID', 'give'), |
|
97 | + 'id' => $prefix.'id', |
|
98 | 98 | 'type' => 'levels_id', |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'Amount', 'give' ), |
|
102 | - 'id' => $prefix . 'amount', |
|
101 | + 'name' => __('Amount', 'give'), |
|
102 | + 'id' => $prefix.'amount', |
|
103 | 103 | 'type' => 'text_small', |
104 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
105 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
104 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
105 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
106 | 106 | 'attributes' => array( |
107 | - 'placeholder' => give_format_amount( '1.00' ), |
|
107 | + 'placeholder' => give_format_amount('1.00'), |
|
108 | 108 | 'class' => 'cmb-type-text-small give-money-field', |
109 | 109 | ), |
110 | 110 | 'before' => 'give_format_admin_multilevel_amount', |
111 | 111 | ), |
112 | 112 | array( |
113 | - 'name' => __( 'Text', 'give' ), |
|
114 | - 'id' => $prefix . 'text', |
|
113 | + 'name' => __('Text', 'give'), |
|
114 | + 'id' => $prefix.'text', |
|
115 | 115 | 'type' => 'text', |
116 | 116 | 'attributes' => array( |
117 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
117 | + 'placeholder' => __('Donation Level', 'give'), |
|
118 | 118 | 'rows' => 3, |
119 | 119 | ), |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Default', 'give' ), |
|
123 | - 'id' => $prefix . 'default', |
|
122 | + 'name' => __('Default', 'give'), |
|
123 | + 'id' => $prefix.'default', |
|
124 | 124 | 'type' => 'give_default_radio_inline' |
125 | 125 | ), |
126 | - ) ), |
|
126 | + )), |
|
127 | 127 | ), |
128 | 128 | //Display Style |
129 | 129 | array( |
130 | - 'name' => __( 'Display Style', 'give' ), |
|
131 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
132 | - 'id' => $prefix . 'display_style', |
|
130 | + 'name' => __('Display Style', 'give'), |
|
131 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
132 | + 'id' => $prefix.'display_style', |
|
133 | 133 | 'type' => 'radio_inline', |
134 | 134 | 'default' => 'buttons', |
135 | 135 | 'options' => array( |
136 | - 'buttons' => __( 'Buttons', 'give' ), |
|
137 | - 'radios' => __( 'Radios', 'give' ), |
|
138 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
136 | + 'buttons' => __('Buttons', 'give'), |
|
137 | + 'radios' => __('Radios', 'give'), |
|
138 | + 'dropdown' => __('Dropdown', 'give'), |
|
139 | 139 | ), |
140 | 140 | ), |
141 | 141 | //Custom Amount |
142 | 142 | array( |
143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
145 | - 'id' => $prefix . 'custom_amount', |
|
143 | + 'name' => __('Custom Amount', 'give'), |
|
144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
145 | + 'id' => $prefix.'custom_amount', |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'no', |
148 | 148 | 'options' => array( |
149 | - 'yes' => __( 'Yes', 'give' ), |
|
150 | - 'no' => __( 'No', 'give' ), |
|
149 | + 'yes' => __('Yes', 'give'), |
|
150 | + 'no' => __('No', 'give'), |
|
151 | 151 | ), |
152 | 152 | ), |
153 | 153 | array( |
154 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
155 | - 'description' => __( 'This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give' ), |
|
156 | - 'id' => $prefix . 'custom_amount_text', |
|
154 | + 'name' => __('Custom Amount Text', 'give'), |
|
155 | + 'description' => __('This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give'), |
|
156 | + 'id' => $prefix.'custom_amount_text', |
|
157 | 157 | 'type' => 'text', |
158 | 158 | 'row_classes' => 'give-subfield', |
159 | 159 | 'attributes' => array( |
160 | 160 | 'rows' => 3, |
161 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
161 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
162 | 162 | ), |
163 | 163 | ), |
164 | 164 | //Goals |
165 | 165 | array( |
166 | - 'name' => __( 'Set Goal?', 'give' ), |
|
167 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
168 | - 'id' => $prefix . 'goal_option', |
|
166 | + 'name' => __('Set Goal?', 'give'), |
|
167 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
168 | + 'id' => $prefix.'goal_option', |
|
169 | 169 | 'type' => 'radio_inline', |
170 | 170 | 'default' => 'no', |
171 | 171 | 'options' => array( |
172 | - 'yes' => __( 'Yes', 'give' ), |
|
173 | - 'no' => __( 'No', 'give' ), |
|
172 | + 'yes' => __('Yes', 'give'), |
|
173 | + 'no' => __('No', 'give'), |
|
174 | 174 | ), |
175 | 175 | ), |
176 | 176 | array( |
177 | - 'name' => __( 'Set Goal', 'give' ), |
|
178 | - 'description' => __( 'This is the goal you want to achieve for this form.', 'give' ), |
|
179 | - 'id' => $prefix . 'set_goal', |
|
177 | + 'name' => __('Set Goal', 'give'), |
|
178 | + 'description' => __('This is the goal you want to achieve for this form.', 'give'), |
|
179 | + 'id' => $prefix.'set_goal', |
|
180 | 180 | 'type' => 'text_small', |
181 | 181 | 'row_classes' => 'give-subfield', |
182 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
183 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
182 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
183 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
184 | 184 | 'attributes' => array( |
185 | - 'placeholder' => give_format_amount( '0.00' ), |
|
186 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
185 | + 'placeholder' => give_format_amount('0.00'), |
|
186 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
187 | 187 | 'class' => 'cmb-type-text-small give-money-field', |
188 | 188 | ), |
189 | 189 | ), |
190 | 190 | array( |
191 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
192 | - 'id' => $prefix . 'goal_color', |
|
191 | + 'name' => __('Goal Progress Bar Color', 'give'), |
|
192 | + 'id' => $prefix.'goal_color', |
|
193 | 193 | 'type' => 'colorpicker', |
194 | 194 | 'row_classes' => 'give-subfield', |
195 | 195 | 'default' => '#2bc253', |
196 | 196 | ), |
197 | 197 | ) |
198 | 198 | ) |
199 | - ) ); |
|
199 | + )); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Content Field |
204 | 204 | */ |
205 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
205 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
206 | 206 | 'id' => 'form_content_options', |
207 | - 'title' => __( 'Form Content', 'give' ), |
|
208 | - 'object_types' => array( 'give_forms' ), |
|
207 | + 'title' => __('Form Content', 'give'), |
|
208 | + 'object_types' => array('give_forms'), |
|
209 | 209 | 'context' => 'normal', |
210 | 210 | 'priority' => 'high', //Show above Content WYSIWYG |
211 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
211 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
212 | 212 | //Donation Option |
213 | 213 | array( |
214 | - 'name' => __( 'Display Content', 'give' ), |
|
215 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
216 | - 'id' => $prefix . 'content_option', |
|
214 | + 'name' => __('Display Content', 'give'), |
|
215 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
216 | + 'id' => $prefix.'content_option', |
|
217 | 217 | 'type' => 'select', |
218 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
219 | - 'none' => __( 'No content', 'give' ), |
|
220 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
221 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
218 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
219 | + 'none' => __('No content', 'give'), |
|
220 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'), |
|
221 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'), |
|
222 | 222 | ) |
223 | 223 | ), |
224 | 224 | 'default' => 'none', |
225 | 225 | ), |
226 | 226 | array( |
227 | - 'name' => __( 'Content', 'give' ), |
|
228 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
229 | - 'id' => $prefix . 'form_content', |
|
227 | + 'name' => __('Content', 'give'), |
|
228 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
229 | + 'id' => $prefix.'form_content', |
|
230 | 230 | 'row_classes' => 'give-subfield', |
231 | 231 | 'type' => 'wysiwyg' |
232 | 232 | ), |
233 | 233 | ) |
234 | 234 | ) |
235 | - ) ); |
|
235 | + )); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | /** |
239 | 239 | * Display Options |
240 | 240 | */ |
241 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
241 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
242 | 242 | 'id' => 'form_display_options', |
243 | - 'title' => __( 'Form Display Options', 'give' ), |
|
244 | - 'object_types' => array( 'give_forms' ), |
|
243 | + 'title' => __('Form Display Options', 'give'), |
|
244 | + 'object_types' => array('give_forms'), |
|
245 | 245 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
246 | 246 | 'priority' => 'high', //Show above Content WYSIWYG |
247 | 247 | 'show_names' => true, // Show field names on the left |
248 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
248 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
249 | 249 | array( |
250 | - 'name' => __( 'Payment Fields', 'give' ), |
|
251 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
252 | - 'id' => $prefix . 'payment_display', |
|
250 | + 'name' => __('Payment Fields', 'give'), |
|
251 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
252 | + 'id' => $prefix.'payment_display', |
|
253 | 253 | 'type' => 'select', |
254 | 254 | 'options' => array( |
255 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
256 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
257 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
255 | + 'onpage' => __('Show on Page', 'give'), |
|
256 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
257 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
258 | 258 | ), |
259 | 259 | 'default' => 'onpage', |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'id' => $prefix . 'reveal_label', |
|
263 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
264 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
262 | + 'id' => $prefix.'reveal_label', |
|
263 | + 'name' => __('Reveal / Modal Open Text', 'give'), |
|
264 | + 'desc' => __('The button label for completing the donation.', 'give'), |
|
265 | 265 | 'type' => 'text_small', |
266 | 266 | 'row_classes' => 'give-subfield', |
267 | 267 | 'attributes' => array( |
268 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
268 | + 'placeholder' => __('Donate Now', 'give'), |
|
269 | 269 | ), |
270 | 270 | ), |
271 | 271 | array( |
272 | - 'id' => $prefix . 'checkout_label', |
|
273 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
274 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
272 | + 'id' => $prefix.'checkout_label', |
|
273 | + 'name' => __('Complete Donation Text', 'give'), |
|
274 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
275 | 275 | 'type' => 'text_small', |
276 | 276 | 'attributes' => array( |
277 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
277 | + 'placeholder' => __('Donate Now', 'give'), |
|
278 | 278 | ), |
279 | 279 | ), |
280 | 280 | array( |
281 | - 'name' => __( 'Default Gateway', 'give' ), |
|
282 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
283 | - 'id' => $prefix . 'default_gateway', |
|
281 | + 'name' => __('Default Gateway', 'give'), |
|
282 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
283 | + 'id' => $prefix.'default_gateway', |
|
284 | 284 | 'type' => 'default_gateway' |
285 | 285 | ), |
286 | 286 | array( |
287 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
288 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
289 | - 'id' => $prefix . 'logged_in_only', |
|
287 | + 'name' => __('Disable Guest Donations', 'give'), |
|
288 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'), |
|
289 | + 'id' => $prefix.'logged_in_only', |
|
290 | 290 | 'type' => 'checkbox' |
291 | 291 | ), |
292 | 292 | array( |
293 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
294 | - 'desc' => __( 'Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give' ), |
|
295 | - 'id' => $prefix . 'show_register_form', |
|
293 | + 'name' => __('Register / Login Form', 'give'), |
|
294 | + 'desc' => __('Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give'), |
|
295 | + 'id' => $prefix.'show_register_form', |
|
296 | 296 | 'type' => 'select', |
297 | 297 | 'options' => array( |
298 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
299 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
300 | - 'login' => __( 'Login Form Only', 'give' ), |
|
301 | - 'none' => __( 'None', 'give' ), |
|
298 | + 'both' => __('Registration and Login Forms', 'give'), |
|
299 | + 'registration' => __('Registration Form Only', 'give'), |
|
300 | + 'login' => __('Login Form Only', 'give'), |
|
301 | + 'none' => __('None', 'give'), |
|
302 | 302 | ), |
303 | 303 | 'default' => 'none', |
304 | 304 | ), |
305 | 305 | array( |
306 | - 'name' => __( 'Floating Labels', 'give' ), |
|
307 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
308 | - 'id' => $prefix . 'form_floating_labels', |
|
306 | + 'name' => __('Floating Labels', 'give'), |
|
307 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), |
|
308 | + 'id' => $prefix.'form_floating_labels', |
|
309 | 309 | 'type' => 'select', |
310 | 310 | 'options' => array( |
311 | - '' => __( 'Use the global setting', 'give' ), |
|
312 | - 'enabled' => __( 'Enabled', 'give' ), |
|
313 | - 'disabled' => __( 'Disabled', 'give' ), |
|
311 | + '' => __('Use the global setting', 'give'), |
|
312 | + 'enabled' => __('Enabled', 'give'), |
|
313 | + 'disabled' => __('Disabled', 'give'), |
|
314 | 314 | ), |
315 | 315 | 'default' => 'none', |
316 | 316 | ) |
@@ -322,47 +322,47 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * Terms & Conditions |
324 | 324 | */ |
325 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
325 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
326 | 326 | 'id' => 'form_terms_options', |
327 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
328 | - 'object_types' => array( 'give_forms' ), |
|
327 | + 'title' => __('Terms and Conditions', 'give'), |
|
328 | + 'object_types' => array('give_forms'), |
|
329 | 329 | 'context' => 'normal', |
330 | 330 | 'priority' => 'high', //Show above Content WYSIWYG |
331 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
331 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
332 | 332 | //Donation Option |
333 | 333 | array( |
334 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
335 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
336 | - 'id' => $prefix . 'terms_option', |
|
334 | + 'name' => __('Terms and Conditions', 'give'), |
|
335 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
336 | + 'id' => $prefix.'terms_option', |
|
337 | 337 | 'type' => 'select', |
338 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
339 | - 'none' => __( 'No', 'give' ), |
|
340 | - 'yes' => __( 'Yes', 'give' ), |
|
338 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
339 | + 'none' => __('No', 'give'), |
|
340 | + 'yes' => __('Yes', 'give'), |
|
341 | 341 | ) |
342 | 342 | ), |
343 | 343 | 'default' => 'none', |
344 | 344 | ), |
345 | 345 | array( |
346 | - 'id' => $prefix . 'agree_label', |
|
347 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
348 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
346 | + 'id' => $prefix.'agree_label', |
|
347 | + 'name' => __('Agree to Terms Label', 'give'), |
|
348 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
349 | 349 | 'type' => 'text', |
350 | 350 | 'row_classes' => 'give-subfield', |
351 | 351 | 'size' => 'regular', |
352 | 352 | 'attributes' => array( |
353 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
353 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
354 | 354 | ), |
355 | 355 | ), |
356 | 356 | array( |
357 | - 'id' => $prefix . 'agree_text', |
|
357 | + 'id' => $prefix.'agree_text', |
|
358 | 358 | 'row_classes' => 'give-subfield', |
359 | - 'name' => __( 'Agreement Text', 'give' ), |
|
360 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
359 | + 'name' => __('Agreement Text', 'give'), |
|
360 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
361 | 361 | 'type' => 'wysiwyg' |
362 | 362 | ), |
363 | 363 | ) |
364 | 364 | ) |
365 | - ) ); |
|
365 | + )); |
|
366 | 366 | |
367 | 367 | return $meta_boxes; |
368 | 368 | |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | /** |
372 | 372 | * Repeatable Levels Custom Field |
373 | 373 | */ |
374 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
374 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
375 | 375 | function give_cmb_render_levels_repeater_header() { |
376 | 376 | ?> |
377 | 377 | |
378 | 378 | <div class="table-container"> |
379 | 379 | <div class="table-row"> |
380 | - <div class="table-cell col-id"><?php _e( 'ID', 'give' ); ?></div> |
|
381 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
382 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
383 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
384 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
385 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
380 | + <div class="table-cell col-id"><?php _e('ID', 'give'); ?></div> |
|
381 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div> |
|
382 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div> |
|
383 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div> |
|
384 | + <?php do_action('give_donation_levels_table_head'); ?> |
|
385 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div> |
|
386 | 386 | |
387 | 387 | </div> |
388 | 388 | </div> |
@@ -397,22 +397,22 @@ discard block |
||
397 | 397 | * @description: Custom CMB2 incremental Levels ID Field |
398 | 398 | * @since 1.0 |
399 | 399 | */ |
400 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
401 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
400 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
401 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
402 | 402 | |
403 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
403 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
404 | 404 | |
405 | 405 | $field_options_array = array( |
406 | 406 | 'class' => 'give-hidden give-level-id-input', |
407 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
408 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
407 | + 'name' => $field_type_object->_name('[level_id]'), |
|
408 | + 'id' => $field_type_object->_id('_level_id'), |
|
409 | 409 | 'value' => $escaped_value, |
410 | 410 | 'type' => 'number', |
411 | 411 | 'desc' => '', |
412 | 412 | ); |
413 | 413 | |
414 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
415 | - echo $field_type_object->input( $field_options_array ); |
|
414 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
415 | + echo $field_type_object->input($field_options_array); |
|
416 | 416 | |
417 | 417 | } |
418 | 418 | |
@@ -420,10 +420,10 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * CMB2 Repeatable Default ID Field |
422 | 422 | */ |
423 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
424 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
425 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
426 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
423 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
424 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
425 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
426 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
427 | 427 | |
428 | 428 | } |
429 | 429 | |
@@ -435,20 +435,20 @@ discard block |
||
435 | 435 | */ |
436 | 436 | function give_add_shortcode_to_publish_metabox() { |
437 | 437 | |
438 | - if ( 'give_forms' !== get_post_type() ) { |
|
438 | + if ('give_forms' !== get_post_type()) { |
|
439 | 439 | return false; |
440 | 440 | } |
441 | 441 | |
442 | 442 | global $post; |
443 | 443 | |
444 | 444 | //Only enqueue scripts for CPT on post type screen |
445 | - if ( 'give_forms' === $post->post_type ) { |
|
445 | + if ('give_forms' === $post->post_type) { |
|
446 | 446 | //Shortcode column with select all input |
447 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
448 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
447 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
448 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
449 | 449 | |
450 | 450 | } |
451 | 451 | |
452 | 452 | } |
453 | 453 | |
454 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
454 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -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,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( __( 'Donation ID not supplied. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(__('Donation ID not supplied. Please try again', 'give'), __('Error', 'give')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$number = give_get_payment_number( $payment_id ); |
|
30 | -$item = get_post( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$number = give_get_payment_number($payment_id); |
|
30 | +$item = get_post($payment_id); |
|
31 | 31 | |
32 | 32 | // Sanity check... fail if purchase ID is invalid |
33 | -if ( ! is_object( $item ) || $item->post_type != 'give_payment' ) { |
|
34 | - wp_die( __( 'The specified ID does not belong to a payment. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
33 | +if ( ! is_object($item) || $item->post_type != 'give_payment') { |
|
34 | + wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give')); |
|
35 | 35 | } |
36 | 36 | |
37 | -$payment_meta = give_get_payment_meta( $payment_id ); |
|
38 | -$transaction_id = esc_attr( give_get_payment_transaction_id( $payment_id ) ); |
|
39 | -$user_id = give_get_payment_user_id( $payment_id ); |
|
40 | -$donor_id = give_get_payment_customer_id( $payment_id ); |
|
41 | -$payment_date = strtotime( $item->post_date ); |
|
42 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
43 | -$address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( |
|
37 | +$payment_meta = give_get_payment_meta($payment_id); |
|
38 | +$transaction_id = esc_attr(give_get_payment_transaction_id($payment_id)); |
|
39 | +$user_id = give_get_payment_user_id($payment_id); |
|
40 | +$donor_id = give_get_payment_customer_id($payment_id); |
|
41 | +$payment_date = strtotime($item->post_date); |
|
42 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
43 | +$address = ! empty($user_info['address']) ? $user_info['address'] : array( |
|
44 | 44 | 'line1' => '', |
45 | 45 | 'line2' => '', |
46 | 46 | 'city' => '', |
@@ -48,72 +48,72 @@ discard block |
||
48 | 48 | 'state' => '', |
49 | 49 | 'zip' => '' |
50 | 50 | ); |
51 | -$gateway = give_get_payment_gateway( $payment_id ); |
|
52 | -$currency_code = give_get_payment_currency_code( $payment_id ); |
|
51 | +$gateway = give_get_payment_gateway($payment_id); |
|
52 | +$currency_code = give_get_payment_currency_code($payment_id); |
|
53 | 53 | ?> |
54 | 54 | <div class="wrap give-wrap"> |
55 | - <h2><?php printf( __( 'Payment %s', 'give' ), $number ); ?></h2> |
|
56 | - <?php do_action( 'give_view_order_details_before', $payment_id ); ?> |
|
55 | + <h2><?php printf(__('Payment %s', 'give'), $number); ?></h2> |
|
56 | + <?php do_action('give_view_order_details_before', $payment_id); ?> |
|
57 | 57 | <form id="give-edit-order-form" method="post"> |
58 | - <?php do_action( 'give_view_order_details_form_top', $payment_id ); ?> |
|
58 | + <?php do_action('give_view_order_details_form_top', $payment_id); ?> |
|
59 | 59 | <div id="poststuff"> |
60 | 60 | <div id="give-dashboard-widgets-wrap"> |
61 | 61 | <div id="post-body" class="metabox-holder columns-2"> |
62 | 62 | <div id="postbox-container-1" class="postbox-container"> |
63 | 63 | <div id="side-sortables" class="meta-box-sortables ui-sortable"> |
64 | 64 | |
65 | - <?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?> |
|
65 | + <?php do_action('give_view_order_details_sidebar_before', $payment_id); ?> |
|
66 | 66 | |
67 | 67 | |
68 | 68 | <div id="give-order-update" class="postbox give-order-data"> |
69 | 69 | |
70 | 70 | <h3 class="hndle"> |
71 | - <span><?php _e( 'Update Payment', 'give' ); ?></span> |
|
71 | + <span><?php _e('Update Payment', 'give'); ?></span> |
|
72 | 72 | </h3> |
73 | 73 | |
74 | 74 | <div class="inside"> |
75 | 75 | <div class="give-admin-box"> |
76 | 76 | |
77 | - <?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?> |
|
77 | + <?php do_action('give_view_order_details_totals_before', $payment_id); ?> |
|
78 | 78 | |
79 | 79 | <div class="give-admin-box-inside"> |
80 | 80 | <p> |
81 | - <span class="label"><?php _e( 'Status:', 'give' ); ?></span> |
|
81 | + <span class="label"><?php _e('Status:', 'give'); ?></span> |
|
82 | 82 | <select name="give-payment-status" class="medium-text"> |
83 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
84 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( give_get_payment_status( $item, true ), $status ); ?>><?php echo esc_html( $status ); ?></option> |
|
83 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
84 | + <option value="<?php echo esc_attr($key); ?>"<?php selected(give_get_payment_status($item, true), $status); ?>><?php echo esc_html($status); ?></option> |
|
85 | 85 | <?php endforeach; ?> |
86 | 86 | </select> |
87 | - <span class="give-donation-status status-<?php echo sanitize_title( give_get_payment_status( $item, true ) ); ?>"><span class="give-donation-status-icon"></span></span> |
|
87 | + <span class="give-donation-status status-<?php echo sanitize_title(give_get_payment_status($item, true)); ?>"><span class="give-donation-status-icon"></span></span> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | |
91 | 91 | <div class="give-admin-box-inside"> |
92 | 92 | <p> |
93 | - <span class="label"><?php _e( 'Date:', 'give' ); ?></span> |
|
94 | - <input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker" /> |
|
93 | + <span class="label"><?php _e('Date:', 'give'); ?></span> |
|
94 | + <input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker" /> |
|
95 | 95 | </p> |
96 | 96 | </div> |
97 | 97 | |
98 | 98 | <div class="give-admin-box-inside"> |
99 | 99 | <p> |
100 | - <span class="label"><?php _e( 'Time:', 'give' ); ?></span> |
|
101 | - <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour" /> : |
|
102 | - <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min" /> |
|
100 | + <span class="label"><?php _e('Time:', 'give'); ?></span> |
|
101 | + <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour" /> : |
|
102 | + <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min" /> |
|
103 | 103 | </p> |
104 | 104 | </div> |
105 | 105 | |
106 | - <?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
106 | + <?php do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
107 | 107 | |
108 | 108 | <?php |
109 | - $fees = give_get_payment_fees( $payment_id ); |
|
110 | - if ( ! empty( $fees ) ) : ?> |
|
109 | + $fees = give_get_payment_fees($payment_id); |
|
110 | + if ( ! empty($fees)) : ?> |
|
111 | 111 | <div class="give-order-fees give-admin-box-inside"> |
112 | - <p class="strong"><?php _e( 'Fees', 'give' ); ?>:</p> |
|
112 | + <p class="strong"><?php _e('Fees', 'give'); ?>:</p> |
|
113 | 113 | <ul class="give-payment-fees"> |
114 | - <?php foreach ( $fees as $fee ) : ?> |
|
114 | + <?php foreach ($fees as $fee) : ?> |
|
115 | 115 | <li> |
116 | - <span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr( $fee['amount'] ) . '">' . give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
116 | + <span class="fee-label"><?php echo $fee['label'].':</span> '.'<span class="fee-amount" data-fee="'.esc_attr($fee['amount']).'">'.give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
117 | 117 | </li> |
118 | 118 | <?php endforeach; ?> |
119 | 119 | </ul> |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | |
124 | 124 | <div class="give-order-payment give-admin-box-inside"> |
125 | 125 | <p> |
126 | - <span class="label"><?php _e( 'Total Donation', 'give' ); ?>:</span> |
|
127 | - <?php echo give_currency_symbol( $payment_meta['currency'] ); ?> <input name="give-payment-total" type="text" class="small-text" value="<?php echo esc_attr( give_format_amount( give_get_payment_amount( $payment_id ) ) ); ?>" /> |
|
126 | + <span class="label"><?php _e('Total Donation', 'give'); ?>:</span> |
|
127 | + <?php echo give_currency_symbol($payment_meta['currency']); ?> <input name="give-payment-total" type="text" class="small-text" value="<?php echo esc_attr(give_format_amount(give_get_payment_amount($payment_id))); ?>" /> |
|
128 | 128 | </p> |
129 | 129 | </div> |
130 | 130 | |
131 | - <?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?> |
|
131 | + <?php do_action('give_view_order_details_totals_after', $payment_id); ?> |
|
132 | 132 | |
133 | 133 | </div> |
134 | 134 | <!-- /.give-admin-box --> |
@@ -137,20 +137,20 @@ discard block |
||
137 | 137 | <!-- /.inside --> |
138 | 138 | |
139 | 139 | <div class="give-order-update-box give-admin-box"> |
140 | - <?php do_action( 'give_view_order_details_update_before', $payment_id ); ?> |
|
140 | + <?php do_action('give_view_order_details_update_before', $payment_id); ?> |
|
141 | 141 | <div id="major-publishing-actions"> |
142 | 142 | <div id="publishing-action"> |
143 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>" /> |
|
144 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
145 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
143 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>" /> |
|
144 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
145 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
146 | 146 | 'give-action' => 'email_links', |
147 | 147 | 'purchase_id' => $payment_id |
148 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e( 'Resend Receipt', 'give' ); ?></a> |
|
148 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e('Resend Receipt', 'give'); ?></a> |
|
149 | 149 | <?php endif; ?> |
150 | 150 | </div> |
151 | 151 | <div class="clear"></div> |
152 | 152 | </div> |
153 | - <?php do_action( 'give_view_order_details_update_after', $payment_id ); ?> |
|
153 | + <?php do_action('give_view_order_details_update_after', $payment_id); ?> |
|
154 | 154 | </div> |
155 | 155 | <!-- /.give-order-update-box --> |
156 | 156 | |
@@ -160,55 +160,55 @@ discard block |
||
160 | 160 | <div id="give-order-details" class="postbox give-order-data"> |
161 | 161 | |
162 | 162 | <h3 class="hndle"> |
163 | - <span><?php _e( 'Payment Meta', 'give' ); ?></span> |
|
163 | + <span><?php _e('Payment Meta', 'give'); ?></span> |
|
164 | 164 | </h3> |
165 | 165 | |
166 | 166 | <div class="inside"> |
167 | 167 | <div class="give-admin-box"> |
168 | 168 | |
169 | - <?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?> |
|
169 | + <?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?> |
|
170 | 170 | |
171 | 171 | <?php |
172 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
173 | - if ( $gateway ) : ?> |
|
172 | + $gateway = give_get_payment_gateway($payment_id); |
|
173 | + if ($gateway) : ?> |
|
174 | 174 | <div class="give-order-gateway give-admin-box-inside"> |
175 | 175 | <p> |
176 | - <span class="label"><?php _e( 'Gateway:', 'give' ); ?></span> |
|
177 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
176 | + <span class="label"><?php _e('Gateway:', 'give'); ?></span> |
|
177 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
178 | 178 | </p> |
179 | 179 | </div> |
180 | 180 | <?php endif; ?> |
181 | 181 | |
182 | 182 | <div class="give-order-payment-key give-admin-box-inside"> |
183 | 183 | <p> |
184 | - <span class="label"><?php _e( 'Key:', 'give' ); ?></span> |
|
185 | - <span><?php echo give_get_payment_key( $payment_id ); ?></span> |
|
184 | + <span class="label"><?php _e('Key:', 'give'); ?></span> |
|
185 | + <span><?php echo give_get_payment_key($payment_id); ?></span> |
|
186 | 186 | </p> |
187 | 187 | </div> |
188 | 188 | |
189 | 189 | <div class="give-order-ip give-admin-box-inside"> |
190 | 190 | <p> |
191 | - <span class="label"><?php _e( 'IP:', 'give' ); ?></span> |
|
192 | - <span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span> |
|
191 | + <span class="label"><?php _e('IP:', 'give'); ?></span> |
|
192 | + <span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span> |
|
193 | 193 | </p> |
194 | 194 | </div> |
195 | 195 | |
196 | - <?php if ( $transaction_id ) : ?> |
|
196 | + <?php if ($transaction_id) : ?> |
|
197 | 197 | <div class="give-order-tx-id give-admin-box-inside"> |
198 | 198 | <p> |
199 | - <span class="label"><?php _e( 'Transaction ID:', 'give' ); ?></span> |
|
200 | - <span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span> |
|
199 | + <span class="label"><?php _e('Transaction ID:', 'give'); ?></span> |
|
200 | + <span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span> |
|
201 | 201 | </p> |
202 | 202 | </div> |
203 | 203 | <?php endif; ?> |
204 | 204 | |
205 | 205 | <div class="give-admin-box-inside"> |
206 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . esc_attr( give_get_payment_user_email( $payment_id ) ) ); ?> |
|
207 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor', 'give' ); ?> »</a> |
|
206 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.esc_attr(give_get_payment_user_email($payment_id))); ?> |
|
207 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor', 'give'); ?> »</a> |
|
208 | 208 | </p> |
209 | 209 | </div> |
210 | 210 | |
211 | - <?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?> |
|
211 | + <?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?> |
|
212 | 212 | |
213 | 213 | </div> |
214 | 214 | <!-- /.column-container --> |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | </div> |
220 | 220 | <!-- /#give-order-data --> |
221 | 221 | |
222 | - <?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?> |
|
222 | + <?php do_action('give_view_order_details_sidebar_after', $payment_id); ?> |
|
223 | 223 | |
224 | 224 | </div> |
225 | 225 | <!-- /#side-sortables --> |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | |
231 | 231 | <div id="normal-sortables" class="meta-box-sortables ui-sortable"> |
232 | 232 | |
233 | - <?php do_action( 'give_view_order_details_main_before', $payment_id ); ?> |
|
233 | + <?php do_action('give_view_order_details_main_before', $payment_id); ?> |
|
234 | 234 | |
235 | 235 | <?php $column_count = 'columns-3'; ?> |
236 | 236 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
237 | 237 | <h3 class="hndle"> |
238 | - <span><?php _e( 'Donation Information', 'give' ); ?></span> |
|
238 | + <span><?php _e('Donation Information', 'give'); ?></span> |
|
239 | 239 | </h3> |
240 | 240 | |
241 | 241 | <div class="inside"> |
@@ -243,25 +243,25 @@ discard block |
||
243 | 243 | <table style="width:100%;text-align:left;"> |
244 | 244 | <thead> |
245 | 245 | <tr> |
246 | - <?php do_action( 'give_donation_details_thead_before', $payment_id ); ?> |
|
247 | - <th><?php _e( 'Form ID', 'give' ) ?></th> |
|
248 | - <th><?php _e( 'Form Title', 'give' ) ?></th> |
|
249 | - <th><?php _e( 'Date and Time', 'give' ) ?></th> |
|
250 | - <th><?php _e( 'Total Donation', 'give' ) ?></th> |
|
251 | - <?php do_action( 'give_donation_details_thead_after', $payment_id ); ?> |
|
246 | + <?php do_action('give_donation_details_thead_before', $payment_id); ?> |
|
247 | + <th><?php _e('Form ID', 'give') ?></th> |
|
248 | + <th><?php _e('Form Title', 'give') ?></th> |
|
249 | + <th><?php _e('Date and Time', 'give') ?></th> |
|
250 | + <th><?php _e('Total Donation', 'give') ?></th> |
|
251 | + <?php do_action('give_donation_details_thead_after', $payment_id); ?> |
|
252 | 252 | </tr> |
253 | 253 | </thead> |
254 | 254 | <tr> |
255 | - <?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?> |
|
255 | + <?php do_action('give_donation_details_tbody_before', $payment_id); ?> |
|
256 | 256 | <td> |
257 | 257 | <?php echo $payment_meta['form_id']; ?> |
258 | 258 | </td> |
259 | 259 | <td> |
260 | - <a href="<?php echo get_permalink( $payment_meta['form_id'] ); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
260 | + <a href="<?php echo get_permalink($payment_meta['form_id']); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
261 | 261 | </td> |
262 | - <td><?php echo date( 'm/d/Y', $payment_date ) . ' ' . date_i18n( 'H:i', $payment_date ); ?></td> |
|
263 | - <td><?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td> |
|
264 | - <?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?> |
|
262 | + <td><?php echo date('m/d/Y', $payment_date).' '.date_i18n('H:i', $payment_date); ?></td> |
|
263 | + <td><?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td> |
|
264 | + <?php do_action('give_donation_details_tbody_after', $payment_id); ?> |
|
265 | 265 | |
266 | 266 | </tr> |
267 | 267 | </table> |
@@ -273,64 +273,64 @@ discard block |
||
273 | 273 | </div> |
274 | 274 | <!-- /#give-donation-overview --> |
275 | 275 | |
276 | - <?php do_action( 'give_view_order_details_files_after', $payment_id ); ?> |
|
276 | + <?php do_action('give_view_order_details_files_after', $payment_id); ?> |
|
277 | 277 | |
278 | - <?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?> |
|
278 | + <?php do_action('give_view_order_details_billing_before', $payment_id); ?> |
|
279 | 279 | |
280 | 280 | |
281 | 281 | <div id="give-customer-details" class="postbox"> |
282 | 282 | <h3 class="hndle"> |
283 | - <span><?php _e( 'Donor Details', 'give' ); ?></span> |
|
283 | + <span><?php _e('Donor Details', 'give'); ?></span> |
|
284 | 284 | </h3> |
285 | 285 | |
286 | 286 | <div class="inside give-clearfix"> |
287 | 287 | |
288 | - <?php $customer = new Give_Customer( give_get_payment_customer_id( $payment_id ) ); ?> |
|
288 | + <?php $customer = new Give_Customer(give_get_payment_customer_id($payment_id)); ?> |
|
289 | 289 | |
290 | 290 | <div class="column-container customer-info"> |
291 | 291 | <div class="column"> |
292 | - <?php echo Give()->html->donor_dropdown( array( |
|
292 | + <?php echo Give()->html->donor_dropdown(array( |
|
293 | 293 | 'selected' => $customer->id, |
294 | 294 | 'name' => 'customer-id' |
295 | - ) ); ?> |
|
295 | + )); ?> |
|
296 | 296 | </div> |
297 | 297 | <div class="column"> |
298 | 298 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>" /> |
299 | 299 | </div> |
300 | 300 | <div class="column"> |
301 | - <?php if ( ! empty( $customer->id ) ) : ?> |
|
302 | - <?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?> |
|
303 | - <a href="<?php echo $customer_url; ?>" title="<?php _e( 'View Donor Details', 'give' ); ?>"><?php _e( 'View Donor Details', 'give' ); ?></a> |
|
301 | + <?php if ( ! empty($customer->id)) : ?> |
|
302 | + <?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?> |
|
303 | + <a href="<?php echo $customer_url; ?>" title="<?php _e('View Donor Details', 'give'); ?>"><?php _e('View Donor Details', 'give'); ?></a> |
|
304 | 304 | | |
305 | 305 | <?php endif; ?> |
306 | - <a href="#new" class="give-payment-new-customer" title="<?php _e( 'New Donor', 'give' ); ?>"><?php _e( 'New Donor', 'give' ); ?></a> |
|
306 | + <a href="#new" class="give-payment-new-customer" title="<?php _e('New Donor', 'give'); ?>"><?php _e('New Donor', 'give'); ?></a> |
|
307 | 307 | </div> |
308 | 308 | </div> |
309 | 309 | |
310 | 310 | <div class="column-container new-customer" style="display: none"> |
311 | 311 | <div class="column"> |
312 | - <strong><?php _e( 'Name:', 'give' ); ?></strong> |
|
312 | + <strong><?php _e('Name:', 'give'); ?></strong> |
|
313 | 313 | <input type="text" name="give-new-customer-name" value="" class="medium-text" /> |
314 | 314 | </div> |
315 | 315 | <div class="column"> |
316 | - <strong><?php _e( 'Email:', 'give' ); ?></strong> |
|
316 | + <strong><?php _e('Email:', 'give'); ?></strong> |
|
317 | 317 | <input type="email" name="give-new-customer-email" value="" class="medium-text" /> |
318 | 318 | </div> |
319 | 319 | <div class="column"> |
320 | 320 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0" /> |
321 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
321 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
322 | 322 | </div> |
323 | 323 | <div class="column"> |
324 | 324 | <small> |
325 | - <em>*<?php _e( 'Click "Save Payment" to create new donor', 'give' ); ?></em> |
|
325 | + <em>*<?php _e('Click "Save Payment" to create new donor', 'give'); ?></em> |
|
326 | 326 | </small> |
327 | 327 | </div> |
328 | 328 | </div> |
329 | 329 | |
330 | 330 | <?php |
331 | 331 | // The give_payment_personal_details_list hook is left here for backwards compatibility |
332 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
333 | - do_action( 'give_payment_view_details', $payment_id ); |
|
332 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
333 | + do_action('give_payment_view_details', $payment_id); |
|
334 | 334 | ?> |
335 | 335 | |
336 | 336 | </div> |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | <div id="give-billing-details" class="postbox"> |
343 | 343 | <h3 class="hndle"> |
344 | - <span><?php _e( 'Billing Address', 'give' ); ?></span> |
|
344 | + <span><?php _e('Billing Address', 'give'); ?></span> |
|
345 | 345 | </h3> |
346 | 346 | |
347 | 347 | <div class="inside give-clearfix"> |
@@ -352,62 +352,62 @@ discard block |
||
352 | 352 | <div class="data column-container"> |
353 | 353 | <div class="column"> |
354 | 354 | <p> |
355 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 1:', 'give' ); ?></strong><br /> |
|
356 | - <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text" /> |
|
355 | + <strong class="order-data-address-line"><?php _e('Street Address Line 1:', 'give'); ?></strong><br /> |
|
356 | + <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text" /> |
|
357 | 357 | </p> |
358 | 358 | |
359 | 359 | <p> |
360 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 2:', 'give' ); ?></strong><br /> |
|
361 | - <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text" /> |
|
360 | + <strong class="order-data-address-line"><?php _e('Street Address Line 2:', 'give'); ?></strong><br /> |
|
361 | + <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text" /> |
|
362 | 362 | </p> |
363 | 363 | |
364 | 364 | </div> |
365 | 365 | <div class="column"> |
366 | 366 | <p> |
367 | - <strong class="order-data-address-line"><?php echo _x( 'City:', 'Address City', 'give' ); ?></strong><br /> |
|
368 | - <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text" /> |
|
367 | + <strong class="order-data-address-line"><?php echo _x('City:', 'Address City', 'give'); ?></strong><br /> |
|
368 | + <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text" /> |
|
369 | 369 | |
370 | 370 | </p> |
371 | 371 | |
372 | 372 | <p> |
373 | - <strong class="order-data-address-line"><?php echo _x( 'Zip / Postal Code:', 'Zip / Postal code of address', 'give' ); ?></strong><br /> |
|
374 | - <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text" /> |
|
373 | + <strong class="order-data-address-line"><?php echo _x('Zip / Postal Code:', 'Zip / Postal code of address', 'give'); ?></strong><br /> |
|
374 | + <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text" /> |
|
375 | 375 | |
376 | 376 | </p> |
377 | 377 | </div> |
378 | 378 | <div class="column"> |
379 | 379 | <p id="give-order-address-country-wrap"> |
380 | - <strong class="order-data-address-line"><?php echo _x( 'Country:', 'Address country', 'give' ); ?></strong><br /> |
|
380 | + <strong class="order-data-address-line"><?php echo _x('Country:', 'Address country', 'give'); ?></strong><br /> |
|
381 | 381 | <?php |
382 | - echo Give()->html->select( array( |
|
382 | + echo Give()->html->select(array( |
|
383 | 383 | 'options' => give_get_country_list(), |
384 | 384 | 'name' => 'give-payment-address[0][country]', |
385 | 385 | 'selected' => $address['country'], |
386 | 386 | 'show_option_all' => false, |
387 | 387 | 'show_option_none' => false, |
388 | 388 | 'chosen' => true, |
389 | - 'placeholder' => __( 'Select a country', 'give' ) |
|
390 | - ) ); |
|
389 | + 'placeholder' => __('Select a country', 'give') |
|
390 | + )); |
|
391 | 391 | ?> |
392 | 392 | </p> |
393 | 393 | |
394 | 394 | <p id="give-order-address-state-wrap"> |
395 | - <strong class="order-data-address-line"><?php echo _x( 'State / Province:', 'State / province of address', 'give' ); ?></strong><br /> |
|
395 | + <strong class="order-data-address-line"><?php echo _x('State / Province:', 'State / province of address', 'give'); ?></strong><br /> |
|
396 | 396 | <?php |
397 | - $states = give_get_states( $address['country'] ); |
|
398 | - if ( ! empty( $states ) ) { |
|
399 | - echo Give()->html->select( array( |
|
397 | + $states = give_get_states($address['country']); |
|
398 | + if ( ! empty($states)) { |
|
399 | + echo Give()->html->select(array( |
|
400 | 400 | 'options' => $states, |
401 | 401 | 'name' => 'give-payment-address[0][state]', |
402 | 402 | 'selected' => $address['state'], |
403 | 403 | 'show_option_all' => false, |
404 | 404 | 'show_option_none' => false, |
405 | 405 | 'chosen' => true, |
406 | - 'placeholder' => __( 'Select a state', 'give' ) |
|
407 | - ) ); |
|
406 | + 'placeholder' => __('Select a state', 'give') |
|
407 | + )); |
|
408 | 408 | } else { |
409 | 409 | ?> |
410 | - <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text" /> |
|
410 | + <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text" /> |
|
411 | 411 | <?php |
412 | 412 | } ?> |
413 | 413 | </p> |
@@ -417,39 +417,39 @@ discard block |
||
417 | 417 | </div> |
418 | 418 | <!-- /#give-order-address --> |
419 | 419 | |
420 | - <?php do_action( 'give_payment_billing_details', $payment_id ); ?> |
|
420 | + <?php do_action('give_payment_billing_details', $payment_id); ?> |
|
421 | 421 | |
422 | 422 | </div> |
423 | 423 | <!-- /.inside --> |
424 | 424 | </div> |
425 | 425 | <!-- /#give-billing-details --> |
426 | 426 | |
427 | - <?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?> |
|
427 | + <?php do_action('give_view_order_details_billing_after', $payment_id); ?> |
|
428 | 428 | |
429 | 429 | <div id="give-payment-notes" class="postbox"> |
430 | - <h3 class="hndle"><span><?php _e( 'Payment Notes', 'give' ); ?></span></h3> |
|
430 | + <h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?></span></h3> |
|
431 | 431 | |
432 | 432 | <div class="inside"> |
433 | 433 | <div id="give-payment-notes-inner"> |
434 | 434 | <?php |
435 | - $notes = give_get_payment_notes( $payment_id ); |
|
436 | - if ( ! empty( $notes ) ) : |
|
435 | + $notes = give_get_payment_notes($payment_id); |
|
436 | + if ( ! empty($notes)) : |
|
437 | 437 | $no_notes_display = ' style="display:none;"'; |
438 | - foreach ( $notes as $note ) : |
|
438 | + foreach ($notes as $note) : |
|
439 | 439 | |
440 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
440 | + echo give_get_payment_note_html($note, $payment_id); |
|
441 | 441 | |
442 | 442 | endforeach; |
443 | 443 | else : |
444 | 444 | $no_notes_display = ''; |
445 | 445 | endif; |
446 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; |
|
446 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.__('No payment notes', 'give').'</p>'; |
|
447 | 447 | ?> |
448 | 448 | </div> |
449 | 449 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
450 | 450 | |
451 | 451 | <p class="give-clearfix"> |
452 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
452 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
453 | 453 | </p> |
454 | 454 | |
455 | 455 | <div class="clear"></div> |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | </div> |
459 | 459 | <!-- /#give-payment-notes --> |
460 | 460 | |
461 | - <?php do_action( 'give_view_order_details_main_after', $payment_id ); ?> |
|
461 | + <?php do_action('give_view_order_details_main_after', $payment_id); ?> |
|
462 | 462 | </div> |
463 | 463 | <!-- /#normal-sortables --> |
464 | 464 | </div> |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | <!-- #give-dashboard-widgets-wrap --> |
470 | 470 | </div> |
471 | 471 | <!-- /#post-stuff --> |
472 | - <?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?> |
|
473 | - <?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?> |
|
474 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>" /> |
|
472 | + <?php do_action('give_view_order_details_form_bottom', $payment_id); ?> |
|
473 | + <?php wp_nonce_field('give_update_payment_details_nonce'); ?> |
|
474 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>" /> |
|
475 | 475 | <input type="hidden" name="give_action" value="update_payment_details" /> |
476 | 476 | </form> |
477 | - <?php do_action( 'give_view_order_details_after', $payment_id ); ?> |
|
477 | + <?php do_action('give_view_order_details_after', $payment_id); ?> |
|
478 | 478 | </div><!-- /.wrap --> |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | |
46 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
46 | + add_action('admin_init', array($this, 'init')); |
|
47 | 47 | |
48 | 48 | //Customize CMB2 URL |
49 | - add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) ); |
|
49 | + add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url')); |
|
50 | 50 | |
51 | 51 | //Custom CMB2 Settings Fields |
52 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
54 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
55 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
56 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
57 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
58 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
59 | - add_action( "cmb2_save_options-page_fields", array( $this, 'settings_notices' ), 10, 3 ); |
|
52 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
53 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
54 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
55 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
56 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
57 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
58 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
59 | + add_action("cmb2_save_options-page_fields", array($this, 'settings_notices'), 10, 3); |
|
60 | 60 | |
61 | 61 | // Include CMB CSS in the head to avoid FOUC |
62 | - add_action( "admin_print_styles-give_forms_page_give-settings", array( 'CMB2_hookup', 'enqueue_cmb_css' ) ); |
|
62 | + add_action("admin_print_styles-give_forms_page_give-settings", array('CMB2_hookup', 'enqueue_cmb_css')); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | 70 | public function init() { |
71 | - register_setting( $this->key, $this->key ); |
|
71 | + register_setting($this->key, $this->key); |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return mixed |
84 | 84 | */ |
85 | - public function give_update_cmb_meta_box_url( $url ) { |
|
85 | + public function give_update_cmb_meta_box_url($url) { |
|
86 | 86 | //Path to Give's CMB |
87 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
87 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function give_get_settings_tabs() { |
98 | 98 | |
99 | - $settings = $this->give_settings( null ); |
|
99 | + $settings = $this->give_settings(null); |
|
100 | 100 | |
101 | 101 | $tabs = array(); |
102 | - $tabs['general'] = __( 'General', 'give' ); |
|
103 | - $tabs['gateways'] = __( 'Payment Gateways', 'give' ); |
|
104 | - $tabs['display'] = __( 'Display Options', 'give' ); |
|
105 | - $tabs['emails'] = __( 'Emails', 'give' ); |
|
102 | + $tabs['general'] = __('General', 'give'); |
|
103 | + $tabs['gateways'] = __('Payment Gateways', 'give'); |
|
104 | + $tabs['display'] = __('Display Options', 'give'); |
|
105 | + $tabs['emails'] = __('Emails', 'give'); |
|
106 | 106 | |
107 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
108 | - $tabs['addons'] = __( 'Add-ons', 'give' ); |
|
107 | + if ( ! empty($settings['addons']['fields'])) { |
|
108 | + $tabs['addons'] = __('Add-ons', 'give'); |
|
109 | 109 | } |
110 | 110 | |
111 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
112 | - $tabs['licenses'] = __( 'Licenses', 'give' ); |
|
111 | + if ( ! empty($settings['licenses']['fields'])) { |
|
112 | + $tabs['licenses'] = __('Licenses', 'give'); |
|
113 | 113 | } |
114 | 114 | |
115 | - $tabs['advanced'] = __( 'Advanced', 'give' ); |
|
116 | - $tabs['api'] = __( 'API', 'give' ); |
|
117 | - $tabs['system_info'] = __( 'System Info', 'give' ); |
|
115 | + $tabs['advanced'] = __('Advanced', 'give'); |
|
116 | + $tabs['api'] = __('API', 'give'); |
|
117 | + $tabs['system_info'] = __('System Info', 'give'); |
|
118 | 118 | |
119 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
119 | + return apply_filters('give_settings_tabs', $tabs); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -126,31 +126,31 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function admin_page_display() { |
128 | 128 | |
129 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
129 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
130 | 130 | |
131 | 131 | ?> |
132 | 132 | |
133 | 133 | <div class="wrap give_settings_page cmb2_options_page <?php echo $this->key; ?>"> |
134 | 134 | <h1 class="nav-tab-wrapper"> |
135 | 135 | <?php |
136 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
136 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
137 | 137 | |
138 | - $tab_url = esc_url( add_query_arg( array( |
|
138 | + $tab_url = esc_url(add_query_arg(array( |
|
139 | 139 | 'settings-updated' => false, |
140 | 140 | 'tab' => $tab_id |
141 | - ) ) ); |
|
141 | + ))); |
|
142 | 142 | |
143 | 143 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
144 | 144 | |
145 | - echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">'; |
|
146 | - echo esc_html( $tab_name ); |
|
145 | + echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'">'; |
|
146 | + echo esc_html($tab_name); |
|
147 | 147 | |
148 | 148 | echo '</a>'; |
149 | 149 | } |
150 | 150 | ?> |
151 | 151 | </h1> |
152 | 152 | |
153 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
153 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
154 | 154 | |
155 | 155 | </div><!-- .wrap --> |
156 | 156 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return array |
168 | 168 | */ |
169 | - public function give_settings( $active_tab ) { |
|
169 | + public function give_settings($active_tab) { |
|
170 | 170 | |
171 | 171 | $give_settings = array( |
172 | 172 | /** |
@@ -174,60 +174,60 @@ discard block |
||
174 | 174 | */ |
175 | 175 | 'general' => array( |
176 | 176 | 'id' => 'options_page', |
177 | - 'give_title' => __( 'General Settings', 'give' ), |
|
178 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
179 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
177 | + 'give_title' => __('General Settings', 'give'), |
|
178 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
179 | + 'fields' => apply_filters('give_settings_general', array( |
|
180 | 180 | array( |
181 | - 'name' => __( 'General Settings', 'give' ), |
|
181 | + 'name' => __('General Settings', 'give'), |
|
182 | 182 | 'desc' => '<hr>', |
183 | 183 | 'type' => 'give_title', |
184 | 184 | 'id' => 'give_title_general_settings_1' |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => __( 'Success Page', 'give' ), |
|
188 | - 'desc' => __( 'This is the page donators are sent to after completing their donations. The <code>[give_receipt]</code> shortcode should be on this page.', 'give' ), |
|
187 | + 'name' => __('Success Page', 'give'), |
|
188 | + 'desc' => __('This is the page donators are sent to after completing their donations. The <code>[give_receipt]</code> shortcode should be on this page.', 'give'), |
|
189 | 189 | 'id' => 'success_page', |
190 | 190 | 'type' => 'select', |
191 | - 'options' => give_cmb2_get_post_options( array( |
|
191 | + 'options' => give_cmb2_get_post_options(array( |
|
192 | 192 | 'post_type' => 'page', |
193 | - 'numberposts' => - 1 |
|
194 | - ) ), |
|
193 | + 'numberposts' => -1 |
|
194 | + )), |
|
195 | 195 | ), |
196 | 196 | array( |
197 | - 'name' => __( 'Failed Transaction Page', 'give' ), |
|
198 | - 'desc' => __( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ), |
|
197 | + 'name' => __('Failed Transaction Page', 'give'), |
|
198 | + 'desc' => __('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'), |
|
199 | 199 | 'id' => 'failure_page', |
200 | 200 | 'type' => 'select', |
201 | - 'options' => give_cmb2_get_post_options( array( |
|
201 | + 'options' => give_cmb2_get_post_options(array( |
|
202 | 202 | 'post_type' => 'page', |
203 | - 'numberposts' => - 1 |
|
204 | - ) ), |
|
203 | + 'numberposts' => -1 |
|
204 | + )), |
|
205 | 205 | ), |
206 | 206 | array( |
207 | - 'name' => __( 'Donation History Page', 'give' ), |
|
208 | - 'desc' => __( 'This page shows a complete donation history for the current user. The <code>[donation_history]</code> shortcode should be on this page.', 'give' ), |
|
207 | + 'name' => __('Donation History Page', 'give'), |
|
208 | + 'desc' => __('This page shows a complete donation history for the current user. The <code>[donation_history]</code> shortcode should be on this page.', 'give'), |
|
209 | 209 | 'id' => 'history_page', |
210 | 210 | 'type' => 'select', |
211 | - 'options' => give_cmb2_get_post_options( array( |
|
211 | + 'options' => give_cmb2_get_post_options(array( |
|
212 | 212 | 'post_type' => 'page', |
213 | - 'numberposts' => - 1 |
|
214 | - ) ), |
|
213 | + 'numberposts' => -1 |
|
214 | + )), |
|
215 | 215 | ), |
216 | 216 | array( |
217 | - 'name' => __( 'Base Country', 'give' ), |
|
218 | - 'desc' => __( 'Where does your site operate from?', 'give' ), |
|
217 | + 'name' => __('Base Country', 'give'), |
|
218 | + 'desc' => __('Where does your site operate from?', 'give'), |
|
219 | 219 | 'id' => 'base_country', |
220 | 220 | 'type' => 'select', |
221 | 221 | 'options' => give_get_country_list(), |
222 | 222 | ), |
223 | 223 | array( |
224 | - 'name' => __( 'Currency Settings', 'give' ), |
|
224 | + 'name' => __('Currency Settings', 'give'), |
|
225 | 225 | 'desc' => '<hr>', |
226 | 226 | 'type' => 'give_title', |
227 | 227 | 'id' => 'give_title_general_settings_2' |
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => __( 'Currency', 'give' ), |
|
230 | + 'name' => __('Currency', 'give'), |
|
231 | 231 | 'desc' => 'Choose your currency. Note that some payment gateways have currency restrictions.', |
232 | 232 | 'id' => 'currency', |
233 | 233 | 'type' => 'select', |
@@ -235,26 +235,26 @@ discard block |
||
235 | 235 | 'default' => 'USD', |
236 | 236 | ), |
237 | 237 | array( |
238 | - 'name' => __( 'Currency Position', 'give' ), |
|
238 | + 'name' => __('Currency Position', 'give'), |
|
239 | 239 | 'desc' => 'Choose the position of the currency sign.', |
240 | 240 | 'id' => 'currency_position', |
241 | 241 | 'type' => 'select', |
242 | 242 | 'options' => array( |
243 | - 'before' => __( 'Before - $10', 'give' ), |
|
244 | - 'after' => __( 'After - 10$', 'give' ) |
|
243 | + 'before' => __('Before - $10', 'give'), |
|
244 | + 'after' => __('After - 10$', 'give') |
|
245 | 245 | ), |
246 | 246 | 'default' => 'before', |
247 | 247 | ), |
248 | 248 | array( |
249 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
250 | - 'desc' => __( 'The symbol (typically , or .) to separate thousands', 'give' ), |
|
249 | + 'name' => __('Thousands Separator', 'give'), |
|
250 | + 'desc' => __('The symbol (typically , or .) to separate thousands', 'give'), |
|
251 | 251 | 'id' => 'thousands_separator', |
252 | 252 | 'type' => 'text_small', |
253 | 253 | 'default' => ',', |
254 | 254 | ), |
255 | 255 | array( |
256 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
257 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'give' ), |
|
256 | + 'name' => __('Decimal Separator', 'give'), |
|
257 | + 'desc' => __('The symbol (usually , or .) to separate decimal points', 'give'), |
|
258 | 258 | 'id' => 'decimal_separator', |
259 | 259 | 'type' => 'text_small', |
260 | 260 | 'default' => '.', |
@@ -267,83 +267,83 @@ discard block |
||
267 | 267 | */ |
268 | 268 | 'gateways' => array( |
269 | 269 | 'id' => 'options_page', |
270 | - 'give_title' => __( 'Payment Gateways', 'give' ), |
|
271 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
272 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
270 | + 'give_title' => __('Payment Gateways', 'give'), |
|
271 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
272 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
273 | 273 | array( |
274 | - 'name' => __( 'Gateways Settings', 'give' ), |
|
274 | + 'name' => __('Gateways Settings', 'give'), |
|
275 | 275 | 'desc' => '<hr>', |
276 | 276 | 'id' => 'give_title_gateway_settings_1', |
277 | 277 | 'type' => 'give_title' |
278 | 278 | ), |
279 | 279 | array( |
280 | - 'name' => __( 'Test Mode', 'give' ), |
|
281 | - 'desc' => __( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
280 | + 'name' => __('Test Mode', 'give'), |
|
281 | + 'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
282 | 282 | 'id' => 'test_mode', |
283 | 283 | 'type' => 'checkbox' |
284 | 284 | ), |
285 | 285 | array( |
286 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
287 | - 'desc' => __( 'Choose the payment gateways you would like enabled.', 'give' ), |
|
286 | + 'name' => __('Enabled Gateways', 'give'), |
|
287 | + 'desc' => __('Choose the payment gateways you would like enabled.', 'give'), |
|
288 | 288 | 'id' => 'gateways', |
289 | 289 | 'type' => 'enabled_gateways' |
290 | 290 | ), |
291 | 291 | array( |
292 | - 'name' => __( 'Default Gateway', 'give' ), |
|
293 | - 'desc' => __( 'This is the gateway that will be selected by default.', 'give' ), |
|
292 | + 'name' => __('Default Gateway', 'give'), |
|
293 | + 'desc' => __('This is the gateway that will be selected by default.', 'give'), |
|
294 | 294 | 'id' => 'default_gateway', |
295 | 295 | 'type' => 'default_gateway' |
296 | 296 | ), |
297 | 297 | array( |
298 | - 'name' => __( 'PayPal Standard', 'give' ), |
|
298 | + 'name' => __('PayPal Standard', 'give'), |
|
299 | 299 | 'desc' => '<hr>', |
300 | 300 | 'type' => 'give_title', |
301 | 301 | 'id' => 'give_title_gateway_settings_2', |
302 | 302 | ), |
303 | 303 | array( |
304 | - 'name' => __( 'PayPal Email', 'give' ), |
|
305 | - 'desc' => __( 'Enter your PayPal account\'s email', 'give' ), |
|
304 | + 'name' => __('PayPal Email', 'give'), |
|
305 | + 'desc' => __('Enter your PayPal account\'s email', 'give'), |
|
306 | 306 | 'id' => 'paypal_email', |
307 | 307 | 'type' => 'text_email', |
308 | 308 | ), |
309 | 309 | array( |
310 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
311 | - 'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default', 'give' ), |
|
310 | + 'name' => __('PayPal Page Style', 'give'), |
|
311 | + 'desc' => __('Enter the name of the page style to use, or leave blank to use the default', 'give'), |
|
312 | 312 | 'id' => 'paypal_page_style', |
313 | 313 | 'type' => 'text', |
314 | 314 | ), |
315 | 315 | array( |
316 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
317 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
316 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
317 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
318 | 318 | 'id' => 'paypal_button_type', |
319 | 319 | 'type' => 'radio_inline', |
320 | 320 | 'options' => array( |
321 | - 'donation' => __( 'Donation', 'give' ), |
|
322 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
321 | + 'donation' => __('Donation', 'give'), |
|
322 | + 'standard' => __('Standard Transaction', 'give') |
|
323 | 323 | ), |
324 | 324 | 'default' => 'donation', |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => __( 'Disable PayPal IPN Verification', 'give' ), |
|
328 | - 'desc' => __( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ), |
|
327 | + 'name' => __('Disable PayPal IPN Verification', 'give'), |
|
328 | + 'desc' => __('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'), |
|
329 | 329 | 'id' => 'disable_paypal_verification', |
330 | 330 | 'type' => 'checkbox' |
331 | 331 | ), |
332 | 332 | array( |
333 | - 'name' => __( 'Offline Donations', 'give' ), |
|
333 | + 'name' => __('Offline Donations', 'give'), |
|
334 | 334 | 'desc' => '<hr>', |
335 | 335 | 'type' => 'give_title', |
336 | 336 | 'id' => 'give_title_gateway_settings_3', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
340 | - 'desc' => __( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ), |
|
339 | + 'name' => __('Collect Billing Details', 'give'), |
|
340 | + 'desc' => __('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'), |
|
341 | 341 | 'id' => 'give_offline_donation_enable_billing_fields', |
342 | 342 | 'type' => 'checkbox' |
343 | 343 | ), |
344 | 344 | array( |
345 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
346 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
345 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
346 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
347 | 347 | 'id' => 'global_offline_donation_content', |
348 | 348 | 'default' => give_get_default_offline_donation_content(), |
349 | 349 | 'type' => 'wysiwyg', |
@@ -352,15 +352,15 @@ discard block |
||
352 | 352 | ) |
353 | 353 | ), |
354 | 354 | array( |
355 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
356 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
355 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
356 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
357 | 357 | 'id' => 'offline_donation_subject', |
358 | - 'default' => __( '{donation} - Offline Donation Instructions', 'give' ), |
|
358 | + 'default' => __('{donation} - Offline Donation Instructions', 'give'), |
|
359 | 359 | 'type' => 'text' |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
363 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
362 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
363 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
364 | 364 | 'id' => 'global_offline_donation_email', |
365 | 365 | 'default' => give_get_default_offline_donation_email_content(), |
366 | 366 | 'type' => 'wysiwyg', |
@@ -374,84 +374,84 @@ discard block |
||
374 | 374 | /** Display Settings */ |
375 | 375 | 'display' => array( |
376 | 376 | 'id' => 'options_page', |
377 | - 'give_title' => __( 'Display Settings', 'give' ), |
|
378 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
379 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
377 | + 'give_title' => __('Display Settings', 'give'), |
|
378 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
379 | + 'fields' => apply_filters('give_settings_display', array( |
|
380 | 380 | array( |
381 | - 'name' => __( 'Display Settings', 'give' ), |
|
381 | + 'name' => __('Display Settings', 'give'), |
|
382 | 382 | 'desc' => '<hr>', |
383 | 383 | 'id' => 'give_title_display_settings_1', |
384 | 384 | 'type' => 'give_title' |
385 | 385 | ), |
386 | 386 | array( |
387 | - 'name' => __( 'Disable CSS', 'give' ), |
|
388 | - 'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
387 | + 'name' => __('Disable CSS', 'give'), |
|
388 | + 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
389 | 389 | 'id' => 'disable_css', |
390 | 390 | 'type' => 'checkbox' |
391 | 391 | ), |
392 | 392 | array( |
393 | - 'name' => __( 'Enable Floating Labels', 'give' ), |
|
394 | - 'desc' => sprintf( __( 'Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
393 | + 'name' => __('Enable Floating Labels', 'give'), |
|
394 | + 'desc' => sprintf(__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), |
|
395 | 395 | 'id' => 'enable_floatlabels', |
396 | 396 | 'type' => 'checkbox' |
397 | 397 | ), |
398 | 398 | array( |
399 | - 'name' => __( 'Disable Welcome Screen', 'give' ), |
|
400 | - 'desc' => sprintf( __( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen <a href="%s">here</a> if you want in the future.', 'give' ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
399 | + 'name' => __('Disable Welcome Screen', 'give'), |
|
400 | + 'desc' => sprintf(__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen <a href="%s">here</a> if you want in the future.', 'give'), esc_url(admin_url('index.php?page=give-about'))), |
|
401 | 401 | 'id' => 'disable_welcome', |
402 | 402 | 'type' => 'checkbox' |
403 | 403 | ), |
404 | 404 | array( |
405 | - 'name' => __( 'Post Types', 'give' ), |
|
405 | + 'name' => __('Post Types', 'give'), |
|
406 | 406 | 'desc' => '<hr>', |
407 | 407 | 'id' => 'give_title_display_settings_2', |
408 | 408 | 'type' => 'give_title' |
409 | 409 | ), |
410 | 410 | array( |
411 | - 'name' => __( 'Disable Form Single Views', 'give' ), |
|
412 | - 'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
411 | + 'name' => __('Disable Form Single Views', 'give'), |
|
412 | + 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
413 | 413 | 'id' => 'disable_forms_singular', |
414 | 414 | 'type' => 'checkbox' |
415 | 415 | ), |
416 | 416 | array( |
417 | - 'name' => __( 'Disable Form Archives', 'give' ), |
|
418 | - 'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
417 | + 'name' => __('Disable Form Archives', 'give'), |
|
418 | + 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
419 | 419 | 'id' => 'disable_forms_archives', |
420 | 420 | 'type' => 'checkbox' |
421 | 421 | ), |
422 | 422 | array( |
423 | - 'name' => __( 'Disable Form Excerpts', 'give' ), |
|
424 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
423 | + 'name' => __('Disable Form Excerpts', 'give'), |
|
424 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
425 | 425 | 'id' => 'disable_forms_excerpt', |
426 | 426 | 'type' => 'checkbox' |
427 | 427 | ), |
428 | 428 | array( |
429 | - 'name' => __( 'Disable Form Featured Image', 'give' ), |
|
430 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for donation form. The display of this image is largely up to the theme. If you do not wish to use the featured image you can disable it using this option.', 'give' ), |
|
429 | + 'name' => __('Disable Form Featured Image', 'give'), |
|
430 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for donation form. The display of this image is largely up to the theme. If you do not wish to use the featured image you can disable it using this option.', 'give'), |
|
431 | 431 | 'id' => 'disable_form_featured_img', |
432 | 432 | 'type' => 'checkbox' |
433 | 433 | ), |
434 | 434 | array( |
435 | - 'name' => __( 'Disable Single Form Sidebar', 'give' ), |
|
436 | - 'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
435 | + 'name' => __('Disable Single Form Sidebar', 'give'), |
|
436 | + 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
437 | 437 | 'id' => 'disable_form_sidebar', |
438 | 438 | 'type' => 'checkbox' |
439 | 439 | ), |
440 | 440 | array( |
441 | - 'name' => __( 'Taxonomies', 'give' ), |
|
441 | + 'name' => __('Taxonomies', 'give'), |
|
442 | 442 | 'desc' => '<hr>', |
443 | 443 | 'id' => 'give_title_display_settings_3', |
444 | 444 | 'type' => 'give_title' |
445 | 445 | ), |
446 | 446 | array( |
447 | - 'name' => __( 'Enable Form Categories', 'give' ), |
|
448 | - 'desc' => __( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ), |
|
447 | + 'name' => __('Enable Form Categories', 'give'), |
|
448 | + 'desc' => __('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'), |
|
449 | 449 | 'id' => 'enable_categories', |
450 | 450 | 'type' => 'checkbox' |
451 | 451 | ), |
452 | 452 | array( |
453 | - 'name' => __( 'Enable Form Tags', 'give' ), |
|
454 | - 'desc' => __( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ), |
|
453 | + 'name' => __('Enable Form Tags', 'give'), |
|
454 | + 'desc' => __('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'), |
|
455 | 455 | 'id' => 'enable_tags', |
456 | 456 | 'type' => 'checkbox' |
457 | 457 | ), |
@@ -464,93 +464,93 @@ discard block |
||
464 | 464 | */ |
465 | 465 | 'emails' => array( |
466 | 466 | 'id' => 'options_page', |
467 | - 'give_title' => __( 'Give Email Settings', 'give' ), |
|
468 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
469 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
467 | + 'give_title' => __('Give Email Settings', 'give'), |
|
468 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
469 | + 'fields' => apply_filters('give_settings_emails', array( |
|
470 | 470 | array( |
471 | - 'name' => __( 'Email Settings', 'give' ), |
|
471 | + 'name' => __('Email Settings', 'give'), |
|
472 | 472 | 'desc' => '<hr>', |
473 | 473 | 'id' => 'give_title_email_settings_1', |
474 | 474 | 'type' => 'give_title' |
475 | 475 | ), |
476 | 476 | array( |
477 | 477 | 'id' => 'email_template', |
478 | - 'name' => __( 'Email Template', 'give' ), |
|
479 | - 'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
478 | + 'name' => __('Email Template', 'give'), |
|
479 | + 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
480 | 480 | 'type' => 'select', |
481 | 481 | 'options' => give_get_email_templates() |
482 | 482 | ), |
483 | 483 | array( |
484 | 484 | 'id' => 'email_logo', |
485 | - 'name' => __( 'Logo', 'give' ), |
|
486 | - 'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
485 | + 'name' => __('Logo', 'give'), |
|
486 | + 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
487 | 487 | 'type' => 'file' |
488 | 488 | ), |
489 | 489 | array( |
490 | 490 | 'id' => 'from_name', |
491 | - 'name' => __( 'From Name', 'give' ), |
|
492 | - 'desc' => __( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ), |
|
493 | - 'default' => get_bloginfo( 'name' ), |
|
491 | + 'name' => __('From Name', 'give'), |
|
492 | + 'desc' => __('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'), |
|
493 | + 'default' => get_bloginfo('name'), |
|
494 | 494 | 'type' => 'text' |
495 | 495 | ), |
496 | 496 | array( |
497 | 497 | 'id' => 'from_email', |
498 | - 'name' => __( 'From Email', 'give' ), |
|
499 | - 'desc' => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
500 | - 'default' => get_bloginfo( 'admin_email' ), |
|
498 | + 'name' => __('From Email', 'give'), |
|
499 | + 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
500 | + 'default' => get_bloginfo('admin_email'), |
|
501 | 501 | 'type' => 'text' |
502 | 502 | ), |
503 | 503 | array( |
504 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
504 | + 'name' => __('Donation Receipt', 'give'), |
|
505 | 505 | 'desc' => '<hr>', |
506 | 506 | 'id' => 'give_title_email_settings_2', |
507 | 507 | 'type' => 'give_title' |
508 | 508 | ), |
509 | 509 | array( |
510 | 510 | 'id' => 'donation_subject', |
511 | - 'name' => __( 'Donation Email Subject', 'give' ), |
|
512 | - 'desc' => __( 'Enter the subject line for the donation receipt email', 'give' ), |
|
513 | - 'default' => __( 'Donation Receipt', 'give' ), |
|
511 | + 'name' => __('Donation Email Subject', 'give'), |
|
512 | + 'desc' => __('Enter the subject line for the donation receipt email', 'give'), |
|
513 | + 'default' => __('Donation Receipt', 'give'), |
|
514 | 514 | 'type' => 'text' |
515 | 515 | ), |
516 | 516 | array( |
517 | 517 | 'id' => 'donation_receipt', |
518 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
519 | - 'desc' => __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(), |
|
518 | + 'name' => __('Donation Receipt', 'give'), |
|
519 | + 'desc' => __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(), |
|
520 | 520 | 'type' => 'wysiwyg', |
521 | - 'default' => __( "Dear", "give" ) . " {name},\n\n" . __( "Thank you for your donation. Your generosity is appreciated! Please click on the link below to view your receipt.", "give" ) . "\n\n{receipt_link}\n\nSincerely,\n{sitename}" |
|
521 | + 'default' => __("Dear", "give")." {name},\n\n".__("Thank you for your donation. Your generosity is appreciated! Please click on the link below to view your receipt.", "give")."\n\n{receipt_link}\n\nSincerely,\n{sitename}" |
|
522 | 522 | ), |
523 | 523 | array( |
524 | - 'name' => __( 'New Donation Notification', 'give' ), |
|
524 | + 'name' => __('New Donation Notification', 'give'), |
|
525 | 525 | 'desc' => '<hr>', |
526 | 526 | 'id' => 'give_title_email_settings_3', |
527 | 527 | 'type' => 'give_title' |
528 | 528 | ), |
529 | 529 | array( |
530 | 530 | 'id' => 'donation_notification_subject', |
531 | - 'name' => __( 'Donation Notification Subject', 'give' ), |
|
532 | - 'desc' => __( 'Enter the subject line for the donation notification email', 'give' ), |
|
531 | + 'name' => __('Donation Notification Subject', 'give'), |
|
532 | + 'desc' => __('Enter the subject line for the donation notification email', 'give'), |
|
533 | 533 | 'type' => 'text', |
534 | - 'default' => __( 'New Donation - #{payment_id}', 'give' ) |
|
534 | + 'default' => __('New Donation - #{payment_id}', 'give') |
|
535 | 535 | ), |
536 | 536 | array( |
537 | 537 | 'id' => 'donation_notification', |
538 | - 'name' => __( 'Donation Notification', 'give' ), |
|
539 | - 'desc' => __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(), |
|
538 | + 'name' => __('Donation Notification', 'give'), |
|
539 | + 'desc' => __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(), |
|
540 | 540 | 'type' => 'wysiwyg', |
541 | 541 | 'default' => give_get_default_donation_notification_email() |
542 | 542 | ), |
543 | 543 | array( |
544 | 544 | 'id' => 'admin_notice_emails', |
545 | - 'name' => __( 'Donation Notification Emails', 'give' ), |
|
546 | - 'desc' => sprintf( __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give' ), '<span class="give-underline">', '</span>' ), |
|
545 | + 'name' => __('Donation Notification Emails', 'give'), |
|
546 | + 'desc' => sprintf(__('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give'), '<span class="give-underline">', '</span>'), |
|
547 | 547 | 'type' => 'textarea', |
548 | - 'default' => get_bloginfo( 'admin_email' ) |
|
548 | + 'default' => get_bloginfo('admin_email') |
|
549 | 549 | ), |
550 | 550 | array( |
551 | 551 | 'id' => 'disable_admin_notices', |
552 | - 'name' => __( 'Disable Admin Notifications', 'give' ), |
|
553 | - 'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
552 | + 'name' => __('Disable Admin Notifications', 'give'), |
|
553 | + 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
554 | 554 | 'type' => 'checkbox' |
555 | 555 | ) |
556 | 556 | ) |
@@ -559,76 +559,76 @@ discard block |
||
559 | 559 | /** Extension Settings */ |
560 | 560 | 'addons' => array( |
561 | 561 | 'id' => 'options_page', |
562 | - 'give_title' => __( 'Give Add-ons Settings', 'give' ), |
|
563 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
564 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
562 | + 'give_title' => __('Give Add-ons Settings', 'give'), |
|
563 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
564 | + 'fields' => apply_filters('give_settings_addons', array() |
|
565 | 565 | ) |
566 | 566 | ), |
567 | 567 | /** Licenses Settings */ |
568 | 568 | 'licenses' => array( |
569 | 569 | 'id' => 'options_page', |
570 | - 'give_title' => __( 'Give Licenses', 'give' ), |
|
571 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
572 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
570 | + 'give_title' => __('Give Licenses', 'give'), |
|
571 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
572 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
573 | 573 | ) |
574 | 574 | ), |
575 | 575 | /** Advanced Options */ |
576 | 576 | 'advanced' => array( |
577 | 577 | 'id' => 'options_page', |
578 | - 'give_title' => __( 'Advanced Options', 'give' ), |
|
579 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
580 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
578 | + 'give_title' => __('Advanced Options', 'give'), |
|
579 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
580 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
581 | 581 | array( |
582 | - 'name' => __( 'Session Control', 'give' ), |
|
582 | + 'name' => __('Session Control', 'give'), |
|
583 | 583 | 'desc' => '<hr>', |
584 | 584 | 'id' => 'give_title_session_control_1', |
585 | 585 | 'type' => 'give_title' |
586 | 586 | ), |
587 | 587 | array( |
588 | 588 | 'id' => 'session_lifetime', |
589 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
590 | - 'desc' => __( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in.', 'give' ), |
|
589 | + 'name' => __('Session Lifetime', 'give'), |
|
590 | + 'desc' => __('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in.', 'give'), |
|
591 | 591 | 'type' => 'select', |
592 | 592 | 'options' => array( |
593 | - '86400' => __( '24 Hours', 'give' ), |
|
594 | - '172800' => __( '48 Hours', 'give' ), |
|
595 | - '259200' => __( '72 Hours', 'give' ), |
|
596 | - '604800' => __( '1 Week', 'give' ), |
|
593 | + '86400' => __('24 Hours', 'give'), |
|
594 | + '172800' => __('48 Hours', 'give'), |
|
595 | + '259200' => __('72 Hours', 'give'), |
|
596 | + '604800' => __('1 Week', 'give'), |
|
597 | 597 | ) |
598 | 598 | ), |
599 | 599 | array( |
600 | - 'name' => __( 'Data Control', 'give' ), |
|
600 | + 'name' => __('Data Control', 'give'), |
|
601 | 601 | 'desc' => '<hr>', |
602 | 602 | 'id' => 'give_title_data_control_2', |
603 | 603 | 'type' => 'give_title' |
604 | 604 | ), |
605 | 605 | array( |
606 | - 'name' => __( 'Remove All Data on Uninstall?', 'give' ), |
|
607 | - 'desc' => __( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ), |
|
606 | + 'name' => __('Remove All Data on Uninstall?', 'give'), |
|
607 | + 'desc' => __('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'), |
|
608 | 608 | 'id' => 'uninstall_on_delete', |
609 | 609 | 'type' => 'checkbox' |
610 | 610 | ), |
611 | 611 | array( |
612 | - 'name' => __( 'Filter Control', 'give' ), |
|
612 | + 'name' => __('Filter Control', 'give'), |
|
613 | 613 | 'desc' => '<hr>', |
614 | 614 | 'id' => 'give_title_filter_control', |
615 | 615 | 'type' => 'give_title' |
616 | 616 | ), |
617 | 617 | array( |
618 | - 'name' => __( 'Disable <code>the_content</code> filter', 'give' ), |
|
619 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ) ), |
|
618 | + 'name' => __('Disable <code>the_content</code> filter', 'give'), |
|
619 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content')), |
|
620 | 620 | 'id' => 'disable_the_content_filter', |
621 | 621 | 'type' => 'checkbox' |
622 | 622 | ), |
623 | 623 | array( |
624 | - 'name' => __( 'Script Loading', 'give' ), |
|
624 | + 'name' => __('Script Loading', 'give'), |
|
625 | 625 | 'desc' => '<hr>', |
626 | 626 | 'id' => 'give_title_script_control', |
627 | 627 | 'type' => 'give_title' |
628 | 628 | ), |
629 | 629 | array( |
630 | - 'name' => __( 'Load Scripts in Footer?', 'give' ), |
|
631 | - 'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
630 | + 'name' => __('Load Scripts in Footer?', 'give'), |
|
631 | + 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
632 | 632 | 'id' => 'scripts_footer', |
633 | 633 | 'type' => 'checkbox' |
634 | 634 | ) |
@@ -638,13 +638,13 @@ discard block |
||
638 | 638 | /** API Settings */ |
639 | 639 | 'api' => array( |
640 | 640 | 'id' => 'options_page', |
641 | - 'give_title' => __( 'API', 'give' ), |
|
642 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
641 | + 'give_title' => __('API', 'give'), |
|
642 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
643 | 643 | 'show_names' => false, // Hide field names on the left |
644 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
644 | + 'fields' => apply_filters('give_settings_system', array( |
|
645 | 645 | array( |
646 | 646 | 'id' => 'api', |
647 | - 'name' => __( 'API', 'give' ), |
|
647 | + 'name' => __('API', 'give'), |
|
648 | 648 | 'type' => 'api' |
649 | 649 | ) |
650 | 650 | ) |
@@ -653,13 +653,13 @@ discard block |
||
653 | 653 | /** Licenses Settings */ |
654 | 654 | 'system_info' => array( |
655 | 655 | 'id' => 'options_page', |
656 | - 'give_title' => __( 'System Info', 'give' ), |
|
657 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
658 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
656 | + 'give_title' => __('System Info', 'give'), |
|
657 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
658 | + 'fields' => apply_filters('give_settings_system', array( |
|
659 | 659 | array( |
660 | 660 | 'id' => 'system_info', |
661 | - 'name' => __( 'System Info', 'give' ), |
|
662 | - 'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
661 | + 'name' => __('System Info', 'give'), |
|
662 | + 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
663 | 663 | 'type' => 'system_info' |
664 | 664 | ) |
665 | 665 | ) |
@@ -668,12 +668,12 @@ discard block |
||
668 | 668 | ); |
669 | 669 | |
670 | 670 | //Return all settings array if necessary |
671 | - if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) { |
|
672 | - return apply_filters( 'give_registered_settings', $give_settings ); |
|
671 | + if ($active_tab === null || ! isset($give_settings[$active_tab])) { |
|
672 | + return apply_filters('give_registered_settings', $give_settings); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | // Add other tabs and settings fields as needed |
676 | - return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] ); |
|
676 | + return apply_filters('give_registered_settings', $give_settings[$active_tab]); |
|
677 | 677 | |
678 | 678 | } |
679 | 679 | |
@@ -684,18 +684,18 @@ discard block |
||
684 | 684 | * @param $updated |
685 | 685 | * @param $cmb |
686 | 686 | */ |
687 | - public function settings_notices( $object_id, $updated, $cmb ) { |
|
687 | + public function settings_notices($object_id, $updated, $cmb) { |
|
688 | 688 | |
689 | 689 | //Sanity check |
690 | - if ( $object_id !== $this->key ) { |
|
690 | + if ($object_id !== $this->key) { |
|
691 | 691 | return; |
692 | 692 | } |
693 | 693 | |
694 | - if ( did_action( 'cmb2_save_options-page_fields' ) === 1 ) { |
|
695 | - settings_errors( 'give-notices' ); |
|
694 | + if (did_action('cmb2_save_options-page_fields') === 1) { |
|
695 | + settings_errors('give-notices'); |
|
696 | 696 | } |
697 | 697 | |
698 | - add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' ); |
|
698 | + add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated'); |
|
699 | 699 | |
700 | 700 | } |
701 | 701 | |
@@ -709,17 +709,17 @@ discard block |
||
709 | 709 | * |
710 | 710 | * @return mixed Field value or exception is thrown |
711 | 711 | */ |
712 | - public function __get( $field ) { |
|
712 | + public function __get($field) { |
|
713 | 713 | |
714 | 714 | // Allowed fields to retrieve |
715 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
715 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
716 | 716 | return $this->{$field}; |
717 | 717 | } |
718 | - if ( 'option_metabox' === $field ) { |
|
718 | + if ('option_metabox' === $field) { |
|
719 | 719 | return $this->option_metabox(); |
720 | 720 | } |
721 | 721 | |
722 | - throw new Exception( 'Invalid property: ' . $field ); |
|
722 | + throw new Exception('Invalid property: '.$field); |
|
723 | 723 | } |
724 | 724 | |
725 | 725 | |
@@ -736,12 +736,12 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @return mixed Option value |
738 | 738 | */ |
739 | -function give_get_option( $key = '', $default = false ) { |
|
739 | +function give_get_option($key = '', $default = false) { |
|
740 | 740 | global $give_options; |
741 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
742 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
741 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
742 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
743 | 743 | |
744 | - return apply_filters( 'give_get_option_' . $key, $value, $key, $default ); |
|
744 | + return apply_filters('give_get_option_'.$key, $value, $key, $default); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -759,33 +759,33 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @return boolean True if updated, false if not. |
761 | 761 | */ |
762 | -function give_update_option( $key = '', $value = false ) { |
|
762 | +function give_update_option($key = '', $value = false) { |
|
763 | 763 | |
764 | 764 | // If no key, exit |
765 | - if ( empty( $key ) ) { |
|
765 | + if (empty($key)) { |
|
766 | 766 | return false; |
767 | 767 | } |
768 | 768 | |
769 | - if ( empty( $value ) ) { |
|
770 | - $remove_option = give_delete_option( $key ); |
|
769 | + if (empty($value)) { |
|
770 | + $remove_option = give_delete_option($key); |
|
771 | 771 | |
772 | 772 | return $remove_option; |
773 | 773 | } |
774 | 774 | |
775 | 775 | // First let's grab the current settings |
776 | - $options = get_option( 'give_settings' ); |
|
776 | + $options = get_option('give_settings'); |
|
777 | 777 | |
778 | 778 | // Let's let devs alter that value coming in |
779 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
779 | + $value = apply_filters('give_update_option', $value, $key); |
|
780 | 780 | |
781 | 781 | // Next let's try to update the value |
782 | - $options[ $key ] = $value; |
|
783 | - $did_update = update_option( 'give_settings', $options ); |
|
782 | + $options[$key] = $value; |
|
783 | + $did_update = update_option('give_settings', $options); |
|
784 | 784 | |
785 | 785 | // If it updated, let's update the global variable |
786 | - if ( $did_update ) { |
|
786 | + if ($did_update) { |
|
787 | 787 | global $give_options; |
788 | - $give_options[ $key ] = $value; |
|
788 | + $give_options[$key] = $value; |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | return $did_update; |
@@ -802,27 +802,27 @@ discard block |
||
802 | 802 | * |
803 | 803 | * @return boolean True if updated, false if not. |
804 | 804 | */ |
805 | -function give_delete_option( $key = '' ) { |
|
805 | +function give_delete_option($key = '') { |
|
806 | 806 | |
807 | 807 | // If no key, exit |
808 | - if ( empty( $key ) ) { |
|
808 | + if (empty($key)) { |
|
809 | 809 | return false; |
810 | 810 | } |
811 | 811 | |
812 | 812 | // First let's grab the current settings |
813 | - $options = get_option( 'give_settings' ); |
|
813 | + $options = get_option('give_settings'); |
|
814 | 814 | |
815 | 815 | // Next let's try to update the value |
816 | - if ( isset( $options[ $key ] ) ) { |
|
816 | + if (isset($options[$key])) { |
|
817 | 817 | |
818 | - unset( $options[ $key ] ); |
|
818 | + unset($options[$key]); |
|
819 | 819 | |
820 | 820 | } |
821 | 821 | |
822 | - $did_update = update_option( 'give_settings', $options ); |
|
822 | + $did_update = update_option('give_settings', $options); |
|
823 | 823 | |
824 | 824 | // If it updated, let's update the global variable |
825 | - if ( $did_update ) { |
|
825 | + if ($did_update) { |
|
826 | 826 | global $give_options; |
827 | 827 | $give_options = $options; |
828 | 828 | } |
@@ -841,9 +841,9 @@ discard block |
||
841 | 841 | */ |
842 | 842 | function give_get_settings() { |
843 | 843 | |
844 | - $settings = get_option( 'give_settings' ); |
|
844 | + $settings = get_option('give_settings'); |
|
845 | 845 | |
846 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
846 | + return (array) apply_filters('give_get_settings', $settings); |
|
847 | 847 | |
848 | 848 | } |
849 | 849 | |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | * @global $give_options Array of all the Give Options |
858 | 858 | * @return void |
859 | 859 | */ |
860 | -function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
860 | +function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
861 | 861 | |
862 | 862 | $id = $field_type_object->field->args['id']; |
863 | 863 | $field_description = $field_type_object->field->args['desc']; |
@@ -865,21 +865,21 @@ discard block |
||
865 | 865 | |
866 | 866 | echo '<ul class="cmb2-checkbox-list cmb2-list">'; |
867 | 867 | |
868 | - foreach ( $gateways as $key => $option ) : |
|
868 | + foreach ($gateways as $key => $option) : |
|
869 | 869 | |
870 | - if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) { |
|
870 | + if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) { |
|
871 | 871 | $enabled = '1'; |
872 | 872 | } else { |
873 | 873 | $enabled = null; |
874 | 874 | } |
875 | 875 | |
876 | - echo '<li><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
877 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
876 | + echo '<li><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
877 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
878 | 878 | |
879 | 879 | endforeach; |
880 | 880 | |
881 | - if ( $field_description ) { |
|
882 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
881 | + if ($field_description) { |
|
882 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | echo '</ul>'; |
@@ -898,31 +898,31 @@ discard block |
||
898 | 898 | * |
899 | 899 | * @return void |
900 | 900 | */ |
901 | -function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
901 | +function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
902 | 902 | |
903 | 903 | $id = $field_type_object->field->args['id']; |
904 | 904 | $field_description = $field_type_object->field->args['desc']; |
905 | 905 | $gateways = give_get_enabled_payment_gateways(); |
906 | 906 | |
907 | - echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">'; |
|
907 | + echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">'; |
|
908 | 908 | |
909 | 909 | //Add a field to the Give Form admin single post view of this field |
910 | - if ( $field_type_object->field->object_type === 'post' ) { |
|
911 | - echo '<option value="global">' . __( 'Global Default', 'give' ) . '</option>'; |
|
910 | + if ($field_type_object->field->object_type === 'post') { |
|
911 | + echo '<option value="global">'.__('Global Default', 'give').'</option>'; |
|
912 | 912 | } |
913 | 913 | |
914 | - foreach ( $gateways as $key => $option ) : |
|
914 | + foreach ($gateways as $key => $option) : |
|
915 | 915 | |
916 | - $selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : ''; |
|
916 | + $selected = isset($escaped_value) ? selected($key, $escaped_value, false) : ''; |
|
917 | 917 | |
918 | 918 | |
919 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
919 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
920 | 920 | |
921 | 921 | endforeach; |
922 | 922 | |
923 | 923 | echo '</select>'; |
924 | 924 | |
925 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
925 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | * |
938 | 938 | * @return void |
939 | 939 | */ |
940 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
940 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
941 | 941 | |
942 | 942 | $id = $field_type_object->field->args['id']; |
943 | 943 | $title = $field_type_object->field->args['name']; |
@@ -956,25 +956,25 @@ discard block |
||
956 | 956 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
957 | 957 | * @return array An array of options that matches the CMB2 options array |
958 | 958 | */ |
959 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
959 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
960 | 960 | |
961 | - $post_options = array( '' => '' ); // Blank option |
|
961 | + $post_options = array('' => ''); // Blank option |
|
962 | 962 | |
963 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
963 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
964 | 964 | return $post_options; |
965 | 965 | } |
966 | 966 | |
967 | - $args = wp_parse_args( $query_args, array( |
|
967 | + $args = wp_parse_args($query_args, array( |
|
968 | 968 | 'post_type' => 'page', |
969 | 969 | 'numberposts' => 10, |
970 | - ) ); |
|
970 | + )); |
|
971 | 971 | |
972 | - $posts = get_posts( $args ); |
|
972 | + $posts = get_posts($args); |
|
973 | 973 | |
974 | - if ( $posts ) { |
|
975 | - foreach ( $posts as $post ) { |
|
974 | + if ($posts) { |
|
975 | + foreach ($posts as $post) { |
|
976 | 976 | |
977 | - $post_options[ $post->ID ] = $post->post_title; |
|
977 | + $post_options[$post->ID] = $post->post_title; |
|
978 | 978 | |
979 | 979 | } |
980 | 980 | } |
@@ -991,14 +991,14 @@ discard block |
||
991 | 991 | * @since 1.0 |
992 | 992 | */ |
993 | 993 | |
994 | -add_filter( 'cmb2_get_metabox_form_format', 'give_modify_cmb2_form_output', 10, 3 ); |
|
994 | +add_filter('cmb2_get_metabox_form_format', 'give_modify_cmb2_form_output', 10, 3); |
|
995 | 995 | |
996 | -function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
996 | +function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
997 | 997 | |
998 | 998 | //only modify the give settings form |
999 | - if ( 'give_settings' == $object_id && 'options_page' == $cmb->cmb_id ) { |
|
999 | + if ('give_settings' == $object_id && 'options_page' == $cmb->cmb_id) { |
|
1000 | 1000 | |
1001 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
1001 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | return $form_format; |
@@ -1016,35 +1016,35 @@ discard block |
||
1016 | 1016 | * |
1017 | 1017 | * @return void |
1018 | 1018 | */ |
1019 | -if ( ! function_exists( 'give_license_key_callback' ) ) { |
|
1020 | - function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1019 | +if ( ! function_exists('give_license_key_callback')) { |
|
1020 | + function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1021 | 1021 | |
1022 | 1022 | $id = $field_type_object->field->args['id']; |
1023 | 1023 | $field_description = $field_type_object->field->args['desc']; |
1024 | - $license_status = get_option( $field_type_object->field->args['options']['is_valid_license_option'] ); |
|
1024 | + $license_status = get_option($field_type_object->field->args['options']['is_valid_license_option']); |
|
1025 | 1025 | $field_classes = 'regular-text give-license-field'; |
1026 | - $type = empty( $escaped_value ) ? 'text' : 'password'; |
|
1026 | + $type = empty($escaped_value) ? 'text' : 'password'; |
|
1027 | 1027 | |
1028 | - if ( $license_status === 'valid' ) { |
|
1028 | + if ($license_status === 'valid') { |
|
1029 | 1029 | $field_classes .= ' give-license-active'; |
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $html = $field_type_object->input( array( |
|
1032 | + $html = $field_type_object->input(array( |
|
1033 | 1033 | 'class' => $field_classes, |
1034 | 1034 | 'type' => $type |
1035 | - ) ); |
|
1035 | + )); |
|
1036 | 1036 | |
1037 | 1037 | //License is active so show deactivate button |
1038 | - if ( $license_status === 'valid' ) { |
|
1039 | - $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . __( 'Deactivate License', 'give' ) . '"/>'; |
|
1038 | + if ($license_status === 'valid') { |
|
1039 | + $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.__('Deactivate License', 'give').'"/>'; |
|
1040 | 1040 | } else { |
1041 | 1041 | //This license is not valid so delete it |
1042 | - give_delete_option( $id ); |
|
1042 | + give_delete_option($id); |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | - $html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1045 | + $html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1046 | 1046 | |
1047 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1047 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1048 | 1048 | |
1049 | 1049 | echo $html; |
1050 | 1050 | } |
@@ -1059,13 +1059,13 @@ discard block |
||
1059 | 1059 | */ |
1060 | 1060 | function give_api_callback() { |
1061 | 1061 | |
1062 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1062 | + if ( ! current_user_can('manage_give_settings')) { |
|
1063 | 1063 | return; |
1064 | 1064 | } |
1065 | 1065 | |
1066 | - do_action( 'give_tools_api_keys_before' ); |
|
1066 | + do_action('give_tools_api_keys_before'); |
|
1067 | 1067 | |
1068 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1068 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1069 | 1069 | |
1070 | 1070 | $api_keys_table = new Give_API_Keys_Table(); |
1071 | 1071 | $api_keys_table->prepare_items(); |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | ?> |
1074 | 1074 | <p> |
1075 | 1075 | <?php printf( |
1076 | - __( 'API keys allow users to use the <a href="%s">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%s">Zapier</a>.', 'give' ), |
|
1076 | + __('API keys allow users to use the <a href="%s">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%s">Zapier</a>.', 'give'), |
|
1077 | 1077 | 'https://givewp.com/documentation/give-api-reference/', |
1078 | 1078 | 'https://givewp.com/addons/zapier/' |
1079 | 1079 | ); ?> |
@@ -1086,10 +1086,10 @@ discard block |
||
1086 | 1086 | </style> |
1087 | 1087 | <?php |
1088 | 1088 | |
1089 | - do_action( 'give_tools_api_keys_after' ); |
|
1089 | + do_action('give_tools_api_keys_after'); |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1092 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1093 | 1093 | |
1094 | 1094 | /** |
1095 | 1095 | * Hook Callback |
@@ -1102,8 +1102,8 @@ discard block |
||
1102 | 1102 | * |
1103 | 1103 | * @return void |
1104 | 1104 | */ |
1105 | -function give_hook_callback( $args ) { |
|
1106 | - do_action( 'give_' . $args['id'] ); |
|
1105 | +function give_hook_callback($args) { |
|
1106 | + do_action('give_'.$args['id']); |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | /** |
@@ -1113,10 +1113,10 @@ discard block |
||
1113 | 1113 | * |
1114 | 1114 | */ |
1115 | 1115 | |
1116 | -if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1117 | - require_once WP_PLUGIN_DIR . '/cmb2/init.php'; |
|
1118 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1119 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php'; |
|
1120 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1121 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php'; |
|
1116 | +if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1117 | + require_once WP_PLUGIN_DIR.'/cmb2/init.php'; |
|
1118 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1119 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php'; |
|
1120 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) { |
|
1121 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php'; |
|
1122 | 1122 | } |
1123 | 1123 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -51,38 +51,38 @@ discard block |
||
51 | 51 | public function admin_menus() { |
52 | 52 | // About Page |
53 | 53 | add_dashboard_page( |
54 | - __( 'Welcome to Give', 'give' ), |
|
55 | - __( 'Welcome to Give', 'give' ), |
|
54 | + __('Welcome to Give', 'give'), |
|
55 | + __('Welcome to Give', 'give'), |
|
56 | 56 | $this->minimum_capability, |
57 | 57 | 'give-about', |
58 | - array( $this, 'about_screen' ) |
|
58 | + array($this, 'about_screen') |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | // Changelog Page |
62 | 62 | add_dashboard_page( |
63 | - __( 'Give Changelog', 'give' ), |
|
64 | - __( 'Give Changelog', 'give' ), |
|
63 | + __('Give Changelog', 'give'), |
|
64 | + __('Give Changelog', 'give'), |
|
65 | 65 | $this->minimum_capability, |
66 | 66 | 'give-changelog', |
67 | - array( $this, 'changelog_screen' ) |
|
67 | + array($this, 'changelog_screen') |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | // Getting Started Page |
71 | 71 | add_dashboard_page( |
72 | - __( 'Getting started with Give', 'give' ), |
|
73 | - __( 'Getting started with Give', 'give' ), |
|
72 | + __('Getting started with Give', 'give'), |
|
73 | + __('Getting started with Give', 'give'), |
|
74 | 74 | $this->minimum_capability, |
75 | 75 | 'give-getting-started', |
76 | - array( $this, 'getting_started_screen' ) |
|
76 | + array($this, 'getting_started_screen') |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | // Credits Page |
80 | 80 | add_dashboard_page( |
81 | - __( 'The people that build Give', 'give' ), |
|
82 | - __( 'The people that build Give', 'give' ), |
|
81 | + __('The people that build Give', 'give'), |
|
82 | + __('The people that build Give', 'give'), |
|
83 | 83 | $this->minimum_capability, |
84 | 84 | 'give-credits', |
85 | - array( $this, 'credits_screen' ) |
|
85 | + array($this, 'credits_screen') |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 | |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function admin_head() { |
97 | 97 | |
98 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
99 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
100 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
101 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
98 | + remove_submenu_page('index.php', 'give-about'); |
|
99 | + remove_submenu_page('index.php', 'give-changelog'); |
|
100 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
101 | + remove_submenu_page('index.php', 'give-credits'); |
|
102 | 102 | |
103 | 103 | // Badge for welcome page |
104 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
104 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
105 | 105 | |
106 | 106 | ?> |
107 | 107 | <style type="text/css" media="screen"> |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * @return void |
216 | 216 | */ |
217 | 217 | public function tabs() { |
218 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
218 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
219 | 219 | ?> |
220 | 220 | <h1 class="nav-tab-wrapper"> |
221 | - <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
222 | - <?php _e( "About Give", 'give' ); ?> |
|
221 | + <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
222 | + <?php _e("About Give", 'give'); ?> |
|
223 | 223 | </a> |
224 | - <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
225 | - <?php _e( 'Getting Started', 'give' ); ?> |
|
224 | + <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
225 | + <?php _e('Getting Started', 'give'); ?> |
|
226 | 226 | </a> |
227 | - <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
228 | - <?php _e( 'Credits', 'give' ); ?> |
|
227 | + <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
228 | + <?php _e('Credits', 'give'); ?> |
|
229 | 229 | </a> |
230 | - <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | - <?php _e( 'Add-ons', 'give' ); ?> |
|
230 | + <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | + <?php _e('Add-ons', 'give'); ?> |
|
232 | 232 | </a> |
233 | 233 | </h1> |
234 | 234 | <?php |
@@ -242,20 +242,20 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | public function about_screen() { |
245 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
245 | + list($display_version) = explode('-', GIVE_VERSION); |
|
246 | 246 | ?> |
247 | 247 | <div class="wrap about-wrap"> |
248 | - <h1 class="welcome-h1"><?php printf( __( 'Welcome to Give %s', 'give' ), $display_version ); ?></h1> |
|
248 | + <h1 class="welcome-h1"><?php printf(__('Welcome to Give %s', 'give'), $display_version); ?></h1> |
|
249 | 249 | |
250 | 250 | <?php give_social_media_elements() ?> |
251 | 251 | |
252 | - <div class="about-text"><?php printf( __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%s" title="View the Give plugin documentation online" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), 'https://givewp.com/documenation/' ); ?></div> |
|
252 | + <div class="about-text"><?php printf(__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%s" title="View the Give plugin documentation online" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), 'https://givewp.com/documenation/'); ?></div> |
|
253 | 253 | |
254 | - <p class="newsletter-intro"><?php _e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
254 | + <p class="newsletter-intro"><?php _e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
255 | 255 | |
256 | 256 | <?php give_get_newsletter() ?> |
257 | 257 | |
258 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
258 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
259 | 259 | |
260 | 260 | |
261 | 261 | |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | <div class="feature-section clearfix introduction"> |
265 | 265 | |
266 | 266 | <div class="video feature-section-item"> |
267 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form"> |
|
267 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form"> |
|
268 | 268 | |
269 | 269 | </div> |
270 | 270 | |
271 | 271 | <div class="content feature-section-item last-feature"> |
272 | 272 | |
273 | - <h3><?php _e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
273 | + <h3><?php _e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
274 | 274 | |
275 | - <p><?php _e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
275 | + <p><?php _e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
276 | 276 | <a href="https://givewp.com" target="_blank" class="button-secondary" title="Visit the Give Website">Learn More |
277 | 277 | <span class="dashicons dashicons-external"></span></a> |
278 | 278 | |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | |
286 | 286 | <div class="content feature-section-item"> |
287 | 287 | |
288 | - <h3><?php _e( 'Getting to Know Give', 'give' ); ?></h3> |
|
288 | + <h3><?php _e('Getting to Know Give', 'give'); ?></h3> |
|
289 | 289 | |
290 | - <p><?php _e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
290 | + <p><?php _e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
291 | 291 | <a href="https://givewp.com/documentation" target="_blank" class="button-secondary" title="Visit the Give Website">View Documentation |
292 | 292 | <span class="dashicons dashicons-external"></span></a> |
293 | 293 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | <div class="content feature-section-item last-feature"> |
297 | 297 | |
298 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give"> |
|
298 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give"> |
|
299 | 299 | |
300 | 300 | </div> |
301 | 301 | |
@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | * @return void |
316 | 316 | */ |
317 | 317 | public function changelog_screen() { |
318 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
318 | + list($display_version) = explode('-', GIVE_VERSION); |
|
319 | 319 | ?> |
320 | 320 | <div class="wrap about-wrap"> |
321 | - <h1><?php _e( 'Give Changelog', 'give' ); ?></h1> |
|
321 | + <h1><?php _e('Give Changelog', 'give'); ?></h1> |
|
322 | 322 | |
323 | - <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), $display_version ); ?></div> |
|
324 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
323 | + <div class="about-text"><?php printf(__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), $display_version); ?></div> |
|
324 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
325 | 325 | |
326 | 326 | <?php $this->tabs(); ?> |
327 | 327 | |
328 | 328 | <div class="changelog"> |
329 | - <h3><?php _e( 'Full Changelog', 'give' ); ?></h3> |
|
329 | + <h3><?php _e('Full Changelog', 'give'); ?></h3> |
|
330 | 330 | |
331 | 331 | <div class="feature-section"> |
332 | 332 | <?php echo $this->parse_readme(); ?> |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | </div> |
335 | 335 | |
336 | 336 | <div class="return-to-dashboard"> |
337 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
337 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
338 | 338 | 'post_type' => 'give_forms', |
339 | 339 | 'page' => 'give-settings' |
340 | - ), 'edit.php' ) ) ); ?>"><?php _e( 'Go to Give Settings', 'give' ); ?></a> |
|
340 | + ), 'edit.php'))); ?>"><?php _e('Go to Give Settings', 'give'); ?></a> |
|
341 | 341 | </div> |
342 | 342 | </div> |
343 | 343 | <?php |
@@ -351,35 +351,35 @@ discard block |
||
351 | 351 | * @return void |
352 | 352 | */ |
353 | 353 | public function getting_started_screen() { |
354 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
354 | + list($display_version) = explode('-', GIVE_VERSION); |
|
355 | 355 | ?> |
356 | 356 | <div class="wrap about-wrap get-started"> |
357 | - <h1 class="welcome-h1"><?php printf( __( 'Give %s - Getting Started Guide', 'give' ), $display_version ); ?></h1> |
|
357 | + <h1 class="welcome-h1"><?php printf(__('Give %s - Getting Started Guide', 'give'), $display_version); ?></h1> |
|
358 | 358 | |
359 | 359 | <?php give_social_media_elements() ?> |
360 | 360 | |
361 | - <div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div> |
|
361 | + <div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div> |
|
362 | 362 | |
363 | - <p class="newsletter-intro"><?php _e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?>.</p> |
|
363 | + <p class="newsletter-intro"><?php _e('Don\'t forget to sign up for the newsletter!', 'give'); ?>.</p> |
|
364 | 364 | |
365 | 365 | <?php give_get_newsletter() ?> |
366 | 366 | |
367 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
367 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
368 | 368 | |
369 | 369 | <?php $this->tabs(); ?> |
370 | 370 | |
371 | 371 | |
372 | - <div class="about-text"><?php printf( __( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></div> |
|
372 | + <div class="about-text"><?php printf(__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></div> |
|
373 | 373 | |
374 | 374 | |
375 | 375 | <div class="feature-section clearfix"> |
376 | 376 | |
377 | 377 | <div class="content feature-section-item"> |
378 | - <h3><?php _e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
378 | + <h3><?php _e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
379 | 379 | |
380 | - <p><?php _e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p> |
|
380 | + <p><?php _e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p> |
|
381 | 381 | |
382 | - <p><?php _e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p> |
|
382 | + <p><?php _e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p> |
|
383 | 383 | </div> |
384 | 384 | |
385 | 385 | <div class="content feature-section-item last-feature"> |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | </div> |
397 | 397 | |
398 | 398 | <div class="content feature-section-item last-feature"> |
399 | - <h3><?php _e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3> |
|
399 | + <h3><?php _e('STEP 2: Choose Your Levels', 'give'); ?></h3> |
|
400 | 400 | |
401 | - <p><?php _e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p> |
|
401 | + <p><?php _e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p> |
|
402 | 402 | </div> |
403 | 403 | |
404 | 404 | </div> |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | <div class="feature-section clearfix"> |
408 | 408 | |
409 | 409 | <div class="content feature-section-item add-content"> |
410 | - <h3><?php _e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3> |
|
410 | + <h3><?php _e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3> |
|
411 | 411 | |
412 | - <p><?php _e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p> |
|
412 | + <p><?php _e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p> |
|
413 | 413 | |
414 | - <p><?php _e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
414 | + <p><?php _e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
415 | 415 | </div> |
416 | 416 | |
417 | 417 | <div class="content feature-section-item last-feature"> |
@@ -428,9 +428,9 @@ discard block |
||
428 | 428 | </div> |
429 | 429 | |
430 | 430 | <div class="content feature-section-item last-feature"> |
431 | - <h3><?php _e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
431 | + <h3><?php _e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
432 | 432 | |
433 | - <p><?php _e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p> |
|
433 | + <p><?php _e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p> |
|
434 | 434 | </div> |
435 | 435 | |
436 | 436 | |
@@ -450,26 +450,26 @@ discard block |
||
450 | 450 | * @return void |
451 | 451 | */ |
452 | 452 | public function credits_screen() { |
453 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
453 | + list($display_version) = explode('-', GIVE_VERSION); |
|
454 | 454 | ?> |
455 | 455 | <div class="wrap about-wrap"> |
456 | - <h1 class="welcome-h1"><?php printf( __( 'Give %s - Credits', 'give' ), $display_version ); ?></h1> |
|
456 | + <h1 class="welcome-h1"><?php printf(__('Give %s - Credits', 'give'), $display_version); ?></h1> |
|
457 | 457 | |
458 | 458 | <?php give_social_media_elements() ?> |
459 | 459 | |
460 | - <div class="about-text"><?php printf( __( 'Thanks to all those who have contributed code directly or indirectly. ', 'give' ), $display_version ); ?></div> |
|
460 | + <div class="about-text"><?php printf(__('Thanks to all those who have contributed code directly or indirectly. ', 'give'), $display_version); ?></div> |
|
461 | 461 | |
462 | - <div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div> |
|
462 | + <div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div> |
|
463 | 463 | |
464 | 464 | <p class="newsletter-intro">Be sure to sign up for the Give newsletter below to stay informed of important updates and news.</p> |
465 | 465 | |
466 | 466 | <?php give_get_newsletter() ?> |
467 | 467 | |
468 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
468 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
469 | 469 | |
470 | 470 | <?php $this->tabs(); ?> |
471 | 471 | |
472 | - <p class="about-description"><?php _e( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give' ); ?></p> |
|
472 | + <p class="about-description"><?php _e('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give'); ?></p> |
|
473 | 473 | |
474 | 474 | <?php echo $this->contributors(); ?> |
475 | 475 | </div> |
@@ -484,21 +484,21 @@ discard block |
||
484 | 484 | * @return string $readme HTML formatted readme file |
485 | 485 | */ |
486 | 486 | public function parse_readme() { |
487 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
487 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null; |
|
488 | 488 | |
489 | - if ( ! $file ) { |
|
490 | - $readme = '<p>' . __( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
489 | + if ( ! $file) { |
|
490 | + $readme = '<p>'.__('No valid changlog was found.', 'give').'</p>'; |
|
491 | 491 | } else { |
492 | - $readme = file_get_contents( $file ); |
|
493 | - $readme = nl2br( esc_html( $readme ) ); |
|
494 | - $readme = explode( '== Changelog ==', $readme ); |
|
495 | - $readme = end( $readme ); |
|
496 | - |
|
497 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
498 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
499 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
500 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
501 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
492 | + $readme = file_get_contents($file); |
|
493 | + $readme = nl2br(esc_html($readme)); |
|
494 | + $readme = explode('== Changelog ==', $readme); |
|
495 | + $readme = end($readme); |
|
496 | + |
|
497 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
498 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
499 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
500 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
501 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | return $readme; |
@@ -515,21 +515,21 @@ discard block |
||
515 | 515 | public function contributors() { |
516 | 516 | $contributors = $this->get_contributors(); |
517 | 517 | |
518 | - if ( empty( $contributors ) ) { |
|
518 | + if (empty($contributors)) { |
|
519 | 519 | return ''; |
520 | 520 | } |
521 | 521 | |
522 | 522 | $contributor_list = '<ul class="wp-people-group">'; |
523 | 523 | |
524 | - foreach ( $contributors as $contributor ) { |
|
524 | + foreach ($contributors as $contributor) { |
|
525 | 525 | $contributor_list .= '<li class="wp-person">'; |
526 | - $contributor_list .= sprintf( '<a href="%s" title="%s">', |
|
527 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
528 | - esc_html( sprintf( __( 'View %s', 'give' ), $contributor->login ) ) |
|
526 | + $contributor_list .= sprintf('<a href="%s" title="%s">', |
|
527 | + esc_url('https://github.com/'.$contributor->login), |
|
528 | + esc_html(sprintf(__('View %s', 'give'), $contributor->login)) |
|
529 | 529 | ); |
530 | - $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) ); |
|
530 | + $contributor_list .= sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login)); |
|
531 | 531 | $contributor_list .= '</a>'; |
532 | - $contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) ); |
|
532 | + $contributor_list .= sprintf('<a class="web" href="%s">%s</a>', esc_url('https://github.com/'.$contributor->login), esc_html($contributor->login)); |
|
533 | 533 | $contributor_list .= '</a>'; |
534 | 534 | $contributor_list .= '</li>'; |
535 | 535 | } |
@@ -547,25 +547,25 @@ discard block |
||
547 | 547 | * @return array $contributors List of contributors |
548 | 548 | */ |
549 | 549 | public function get_contributors() { |
550 | - $contributors = get_transient( 'give_contributors' ); |
|
550 | + $contributors = get_transient('give_contributors'); |
|
551 | 551 | |
552 | - if ( false !== $contributors ) { |
|
552 | + if (false !== $contributors) { |
|
553 | 553 | return $contributors; |
554 | 554 | } |
555 | 555 | |
556 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
556 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
557 | 557 | |
558 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
558 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
559 | 559 | return array(); |
560 | 560 | } |
561 | 561 | |
562 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
562 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
563 | 563 | |
564 | - if ( ! is_array( $contributors ) ) { |
|
564 | + if ( ! is_array($contributors)) { |
|
565 | 565 | return array(); |
566 | 566 | } |
567 | 567 | |
568 | - set_transient( 'give_contributors', $contributors, 3600 ); |
|
568 | + set_transient('give_contributors', $contributors, 3600); |
|
569 | 569 | |
570 | 570 | return $contributors; |
571 | 571 | } |
@@ -584,24 +584,24 @@ discard block |
||
584 | 584 | |
585 | 585 | |
586 | 586 | // Bail if no activation redirect |
587 | - if ( ! get_transient( '_give_activation_redirect' ) ) { |
|
587 | + if ( ! get_transient('_give_activation_redirect')) { |
|
588 | 588 | return; |
589 | 589 | } |
590 | 590 | |
591 | 591 | // Delete the redirect transient |
592 | - delete_transient( '_give_activation_redirect' ); |
|
592 | + delete_transient('_give_activation_redirect'); |
|
593 | 593 | |
594 | 594 | // Bail if activating from network, or bulk |
595 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
595 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
596 | 596 | return; |
597 | 597 | } |
598 | 598 | |
599 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
599 | + $upgrade = get_option('give_version_upgraded_from'); |
|
600 | 600 | |
601 | - if ( ! $upgrade ) { // First time install |
|
602 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
601 | + if ( ! $upgrade) { // First time install |
|
602 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
603 | 603 | exit; |
604 | - } elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings |
|
604 | + } elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings |
|
605 | 605 | |
606 | 606 | } else { // Welcome is NOT disabled in settings |
607 | 607 | wp_safe_redirect(admin_url('index.php?page=give-about')); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,34 +25,34 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_process_purchase_form() { |
27 | 27 | |
28 | - do_action( 'give_pre_process_purchase' ); |
|
28 | + do_action('give_pre_process_purchase'); |
|
29 | 29 | |
30 | 30 | // Validate the form $_POST data |
31 | 31 | $valid_data = give_purchase_form_validate_fields(); |
32 | 32 | |
33 | 33 | // Allow themes and plugins to hook to errors |
34 | - do_action( 'give_checkout_error_checks', $valid_data, $_POST ); |
|
34 | + do_action('give_checkout_error_checks', $valid_data, $_POST); |
|
35 | 35 | |
36 | - $is_ajax = isset( $_POST['give_ajax'] ); |
|
36 | + $is_ajax = isset($_POST['give_ajax']); |
|
37 | 37 | |
38 | 38 | // Process the login form |
39 | - if ( isset( $_POST['give_login_submit'] ) ) { |
|
39 | + if (isset($_POST['give_login_submit'])) { |
|
40 | 40 | give_process_form_login(); |
41 | 41 | } |
42 | 42 | |
43 | 43 | // Validate the user |
44 | - $user = give_get_purchase_form_user( $valid_data ); |
|
44 | + $user = give_get_purchase_form_user($valid_data); |
|
45 | 45 | |
46 | - if ( give_get_errors() || ! $user ) { |
|
47 | - if ( $is_ajax ) { |
|
48 | - do_action( 'give_ajax_checkout_errors' ); |
|
46 | + if (give_get_errors() || ! $user) { |
|
47 | + if ($is_ajax) { |
|
48 | + do_action('give_ajax_checkout_errors'); |
|
49 | 49 | give_die(); |
50 | 50 | } else { |
51 | 51 | return false; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - if ( $is_ajax ) { |
|
55 | + if ($is_ajax) { |
|
56 | 56 | echo 'success'; |
57 | 57 | give_die(); |
58 | 58 | } |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | 'address' => $user['address'] |
67 | 67 | ); |
68 | 68 | |
69 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
69 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
70 | 70 | |
71 | 71 | // Setup purchase information |
72 | 72 | $purchase_data = array( |
73 | - 'price' => ( isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00' ), |
|
74 | - 'purchase_key' => strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ), |
|
73 | + 'price' => (isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00'), |
|
74 | + 'purchase_key' => strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true))), |
|
75 | 75 | 'user_email' => $user['user_email'], |
76 | - 'date' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ), |
|
77 | - 'user_info' => stripslashes_deep( $user_info ), |
|
76 | + 'date' => date('Y-m-d H:i:s', current_time('timestamp')), |
|
77 | + 'user_info' => stripslashes_deep($user_info), |
|
78 | 78 | 'post_data' => $_POST, |
79 | 79 | 'gateway' => $valid_data['gateway'], |
80 | 80 | 'card_info' => $valid_data['cc_info'] |
@@ -84,36 +84,36 @@ discard block |
||
84 | 84 | $valid_data['user'] = $user; |
85 | 85 | |
86 | 86 | // Allow themes and plugins to hook before the gateway |
87 | - do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data ); |
|
87 | + do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data); |
|
88 | 88 | |
89 | 89 | |
90 | - if ( ! $purchase_data['price'] ) { |
|
90 | + if ( ! $purchase_data['price']) { |
|
91 | 91 | // Revert to manual |
92 | 92 | $purchase_data['gateway'] = 'manual'; |
93 | 93 | $_POST['give-gateway'] = 'manual'; |
94 | 94 | } |
95 | 95 | |
96 | 96 | // Allow the purchase data to be modified before it is sent to the gateway |
97 | - $purchase_data = apply_filters( 'give_purchase_data_before_gateway', $purchase_data, $valid_data ); |
|
97 | + $purchase_data = apply_filters('give_purchase_data_before_gateway', $purchase_data, $valid_data); |
|
98 | 98 | |
99 | 99 | // Setup the data we're storing in the purchase session |
100 | 100 | $session_data = $purchase_data; |
101 | 101 | |
102 | 102 | // Make sure credit card numbers are never stored in sessions |
103 | - unset( $session_data['card_info']['card_number'] ); |
|
103 | + unset($session_data['card_info']['card_number']); |
|
104 | 104 | |
105 | 105 | // Used for showing data to non logged-in users after purchase, and for other plugins needing purchase data. |
106 | - give_set_purchase_session( $session_data ); |
|
106 | + give_set_purchase_session($session_data); |
|
107 | 107 | |
108 | 108 | // Send info to the gateway for payment processing |
109 | - give_send_to_gateway( $purchase_data['gateway'], $purchase_data ); |
|
109 | + give_send_to_gateway($purchase_data['gateway'], $purchase_data); |
|
110 | 110 | give_die(); |
111 | 111 | |
112 | 112 | } |
113 | 113 | |
114 | -add_action( 'give_purchase', 'give_process_purchase_form' ); |
|
115 | -add_action( 'wp_ajax_give_process_checkout', 'give_process_purchase_form' ); |
|
116 | -add_action( 'wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form' ); |
|
114 | +add_action('give_purchase', 'give_process_purchase_form'); |
|
115 | +add_action('wp_ajax_give_process_checkout', 'give_process_purchase_form'); |
|
116 | +add_action('wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form'); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Process the checkout login form |
@@ -124,32 +124,32 @@ discard block |
||
124 | 124 | */ |
125 | 125 | function give_process_form_login() { |
126 | 126 | |
127 | - $is_ajax = isset( $_POST['give_ajax'] ); |
|
127 | + $is_ajax = isset($_POST['give_ajax']); |
|
128 | 128 | |
129 | 129 | $user_data = give_purchase_form_validate_user_login(); |
130 | 130 | |
131 | - if ( give_get_errors() || $user_data['user_id'] < 1 ) { |
|
132 | - if ( $is_ajax ) { |
|
133 | - do_action( 'give_ajax_checkout_errors' ); |
|
131 | + if (give_get_errors() || $user_data['user_id'] < 1) { |
|
132 | + if ($is_ajax) { |
|
133 | + do_action('give_ajax_checkout_errors'); |
|
134 | 134 | give_die(); |
135 | 135 | } else { |
136 | - wp_redirect( $_SERVER['HTTP_REFERER'] ); |
|
136 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
137 | 137 | exit; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] ); |
|
141 | + give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']); |
|
142 | 142 | |
143 | - if ( $is_ajax ) { |
|
143 | + if ($is_ajax) { |
|
144 | 144 | echo 'success'; |
145 | 145 | give_die(); |
146 | 146 | } else { |
147 | - wp_redirect( $_SERVER['HTTP_REFERER'] ); |
|
147 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | -add_action( 'wp_ajax_give_process_checkout_login', 'give_process_form_login' ); |
|
152 | -add_action( 'wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login' ); |
|
151 | +add_action('wp_ajax_give_process_checkout_login', 'give_process_form_login'); |
|
152 | +add_action('wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login'); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Purchase Form Validate Fields |
@@ -163,43 +163,43 @@ discard block |
||
163 | 163 | global $give_options; |
164 | 164 | |
165 | 165 | // Check if there is $_POST |
166 | - if ( empty( $_POST ) ) { |
|
166 | + if (empty($_POST)) { |
|
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | |
170 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
170 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
171 | 171 | |
172 | 172 | // Start an array to collect valid data |
173 | 173 | $valid_data = array( |
174 | 174 | 'gateway' => give_purchase_form_validate_gateway(), // Gateway fallback |
175 | - 'need_new_user' => false, // New user flag |
|
176 | - 'need_user_login' => false, // Login user flag |
|
177 | - 'logged_user_data' => array(), // Logged user collected data |
|
178 | - 'new_user_data' => array(), // New user collected data |
|
179 | - 'login_user_data' => array(), // Login user collected data |
|
180 | - 'guest_user_data' => array(), // Guest user collected data |
|
175 | + 'need_new_user' => false, // New user flag |
|
176 | + 'need_user_login' => false, // Login user flag |
|
177 | + 'logged_user_data' => array(), // Logged user collected data |
|
178 | + 'new_user_data' => array(), // New user collected data |
|
179 | + 'login_user_data' => array(), // Login user collected data |
|
180 | + 'guest_user_data' => array(), // Guest user collected data |
|
181 | 181 | 'cc_info' => give_purchase_form_validate_cc() // Credit card info |
182 | 182 | ); |
183 | 183 | |
184 | 184 | // Validate agree to terms |
185 | - $terms_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
186 | - if ( isset( $terms_option ) && $terms_option === 'yes' ) { |
|
185 | + $terms_option = get_post_meta($form_id, '_give_terms_option', true); |
|
186 | + if (isset($terms_option) && $terms_option === 'yes') { |
|
187 | 187 | give_purchase_form_validate_agree_to_terms(); |
188 | 188 | } |
189 | 189 | |
190 | 190 | //Validate amount is more than 0 |
191 | 191 | |
192 | 192 | |
193 | - if ( is_user_logged_in() ) { |
|
193 | + if (is_user_logged_in()) { |
|
194 | 194 | // Collect logged in user data |
195 | 195 | $valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user(); |
196 | - } else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) { |
|
196 | + } else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') { |
|
197 | 197 | // Set new user registration as required |
198 | 198 | $valid_data['need_new_user'] = true; |
199 | 199 | // Validate new user data |
200 | 200 | $valid_data['new_user_data'] = give_purchase_form_validate_new_user(); |
201 | 201 | // Check if login validation is needed |
202 | - } else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) { |
|
202 | + } else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') { |
|
203 | 203 | // Set user login as required |
204 | 204 | $valid_data['need_user_login'] = true; |
205 | 205 | // Validate users login info |
@@ -222,27 +222,27 @@ discard block |
||
222 | 222 | */ |
223 | 223 | function give_purchase_form_validate_gateway() { |
224 | 224 | |
225 | - $gateway = give_get_default_gateway( $_REQUEST['give-form-id'] ); |
|
225 | + $gateway = give_get_default_gateway($_REQUEST['give-form-id']); |
|
226 | 226 | |
227 | 227 | // Check if a gateway value is present |
228 | - if ( ! empty( $_REQUEST['give-gateway'] ) ) { |
|
228 | + if ( ! empty($_REQUEST['give-gateway'])) { |
|
229 | 229 | |
230 | - $gateway = sanitize_text_field( $_REQUEST['give-gateway'] ); |
|
230 | + $gateway = sanitize_text_field($_REQUEST['give-gateway']); |
|
231 | 231 | |
232 | 232 | //Is amount being donated in LIVE mode above 0.00? |
233 | - if ( '0.00' == $_REQUEST['give-amount'] && ! give_is_test_mode() ) { |
|
233 | + if ('0.00' == $_REQUEST['give-amount'] && ! give_is_test_mode()) { |
|
234 | 234 | |
235 | - give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) ); |
|
235 | + give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give')); |
|
236 | 236 | |
237 | 237 | } //Is this test mode zero donation? Let it through but set to manual gateway |
238 | - elseif ( '0.00' == $_REQUEST['give-amount'] && give_is_test_mode() ) { |
|
238 | + elseif ('0.00' == $_REQUEST['give-amount'] && give_is_test_mode()) { |
|
239 | 239 | |
240 | 240 | $gateway = 'manual'; |
241 | 241 | |
242 | 242 | } //Check if this gateway is active |
243 | - elseif ( ! give_is_gateway_active( $gateway ) ) { |
|
243 | + elseif ( ! give_is_gateway_active($gateway)) { |
|
244 | 244 | |
245 | - give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled', 'give' ) ); |
|
245 | + give_set_error('invalid_gateway', __('The selected payment gateway is not enabled', 'give')); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | */ |
262 | 262 | function give_purchase_form_validate_agree_to_terms() { |
263 | 263 | // Validate agree to terms |
264 | - if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) { |
|
264 | + if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) { |
|
265 | 265 | // User did not agree |
266 | - give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms of use', 'give' ) ) ); |
|
266 | + give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms of use', 'give'))); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -277,47 +277,47 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return array |
279 | 279 | */ |
280 | -function give_purchase_form_required_fields( $form_id ) { |
|
280 | +function give_purchase_form_required_fields($form_id) { |
|
281 | 281 | |
282 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
282 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
283 | 283 | |
284 | 284 | $required_fields = array( |
285 | 285 | 'give_email' => array( |
286 | 286 | 'error_id' => 'invalid_email', |
287 | - 'error_message' => __( 'Please enter a valid email address', 'give' ) |
|
287 | + 'error_message' => __('Please enter a valid email address', 'give') |
|
288 | 288 | ), |
289 | 289 | 'give_first' => array( |
290 | 290 | 'error_id' => 'invalid_first_name', |
291 | - 'error_message' => __( 'Please enter your first name', 'give' ) |
|
291 | + 'error_message' => __('Please enter your first name', 'give') |
|
292 | 292 | ) |
293 | 293 | ); |
294 | 294 | |
295 | - $require_address = give_require_billing_address( $payment_mode ); |
|
295 | + $require_address = give_require_billing_address($payment_mode); |
|
296 | 296 | |
297 | - if ( $require_address ) { |
|
298 | - $required_fields['card_address'] = array( |
|
297 | + if ($require_address) { |
|
298 | + $required_fields['card_address'] = array( |
|
299 | 299 | 'error_id' => 'invalid_card_address', |
300 | - 'error_message' => __( 'Please enter your primary billing address', 'give' ) |
|
300 | + 'error_message' => __('Please enter your primary billing address', 'give') |
|
301 | 301 | ); |
302 | - $required_fields['card_zip'] = array( |
|
302 | + $required_fields['card_zip'] = array( |
|
303 | 303 | 'error_id' => 'invalid_zip_code', |
304 | - 'error_message' => __( 'Please enter your zip / postal code', 'give' ) |
|
304 | + 'error_message' => __('Please enter your zip / postal code', 'give') |
|
305 | 305 | ); |
306 | - $required_fields['card_city'] = array( |
|
306 | + $required_fields['card_city'] = array( |
|
307 | 307 | 'error_id' => 'invalid_city', |
308 | - 'error_message' => __( 'Please enter your billing city', 'give' ) |
|
308 | + 'error_message' => __('Please enter your billing city', 'give') |
|
309 | 309 | ); |
310 | 310 | $required_fields['billing_country'] = array( |
311 | 311 | 'error_id' => 'invalid_country', |
312 | - 'error_message' => __( 'Please select your billing country', 'give' ) |
|
312 | + 'error_message' => __('Please select your billing country', 'give') |
|
313 | 313 | ); |
314 | - $required_fields['card_state'] = array( |
|
314 | + $required_fields['card_state'] = array( |
|
315 | 315 | 'error_id' => 'invalid_state', |
316 | - 'error_message' => __( 'Please enter billing state / province', 'give' ) |
|
316 | + 'error_message' => __('Please enter billing state / province', 'give') |
|
317 | 317 | ); |
318 | 318 | } |
319 | 319 | |
320 | - return apply_filters( 'give_purchase_form_required_fields', $required_fields, $form_id ); |
|
320 | + return apply_filters('give_purchase_form_required_fields', $required_fields, $form_id); |
|
321 | 321 | |
322 | 322 | } |
323 | 323 | |
@@ -330,16 +330,16 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return mixed|void |
332 | 332 | */ |
333 | -function give_require_billing_address( $payment_mode ) { |
|
333 | +function give_require_billing_address($payment_mode) { |
|
334 | 334 | |
335 | 335 | $return = false; |
336 | 336 | |
337 | - if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) { |
|
337 | + if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) { |
|
338 | 338 | $return = true; |
339 | 339 | } |
340 | 340 | |
341 | 341 | // Let payment gateways and other extensions determine if address fields should be required |
342 | - return apply_filters( 'give_require_billing_address', $return ); |
|
342 | + return apply_filters('give_require_billing_address', $return); |
|
343 | 343 | |
344 | 344 | } |
345 | 345 | |
@@ -353,43 +353,43 @@ discard block |
||
353 | 353 | function give_purchase_form_validate_logged_in_user() { |
354 | 354 | global $user_ID; |
355 | 355 | |
356 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
356 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
357 | 357 | |
358 | 358 | // Start empty array to collect valid user data |
359 | 359 | $valid_user_data = array( |
360 | 360 | // Assume there will be errors |
361 | - 'user_id' => - 1 |
|
361 | + 'user_id' => -1 |
|
362 | 362 | ); |
363 | 363 | |
364 | 364 | // Verify there is a user_ID |
365 | - if ( $user_ID > 0 ) { |
|
365 | + if ($user_ID > 0) { |
|
366 | 366 | // Get the logged in user data |
367 | - $user_data = get_userdata( $user_ID ); |
|
367 | + $user_data = get_userdata($user_ID); |
|
368 | 368 | |
369 | 369 | // Loop through required fields and show error messages |
370 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
371 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
372 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
370 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
371 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
372 | + give_set_error($value['error_id'], $value['error_message']); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
376 | 376 | // Verify data |
377 | - if ( $user_data ) { |
|
377 | + if ($user_data) { |
|
378 | 378 | // Collected logged in user data |
379 | 379 | $valid_user_data = array( |
380 | 380 | 'user_id' => $user_ID, |
381 | - 'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email, |
|
382 | - 'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name, |
|
383 | - 'user_last' => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name, |
|
381 | + 'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email, |
|
382 | + 'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name, |
|
383 | + 'user_last' => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name, |
|
384 | 384 | ); |
385 | 385 | |
386 | - if ( ! is_email( $valid_user_data['user_email'] ) ) { |
|
387 | - give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) ); |
|
386 | + if ( ! is_email($valid_user_data['user_email'])) { |
|
387 | + give_set_error('email_invalid', __('Invalid email', 'give')); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | } else { |
391 | 391 | // Set invalid user error |
392 | - give_set_error( 'invalid_user', __( 'The user information is invalid', 'give' ) ); |
|
392 | + give_set_error('invalid_user', __('The user information is invalid', 'give')); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
@@ -407,92 +407,92 @@ discard block |
||
407 | 407 | function give_purchase_form_validate_new_user() { |
408 | 408 | $registering_new_user = false; |
409 | 409 | |
410 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
410 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
411 | 411 | |
412 | 412 | // Start an empty array to collect valid user data |
413 | 413 | $valid_user_data = array( |
414 | 414 | // Assume there will be errors |
415 | - 'user_id' => - 1, |
|
415 | + 'user_id' => -1, |
|
416 | 416 | // Get first name |
417 | - 'user_first' => isset( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : '', |
|
417 | + 'user_first' => isset($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : '', |
|
418 | 418 | // Get last name |
419 | - 'user_last' => isset( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : '', |
|
419 | + 'user_last' => isset($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : '', |
|
420 | 420 | ); |
421 | 421 | |
422 | 422 | // Check the new user's credentials against existing ones |
423 | - $user_login = isset( $_POST['give_user_login'] ) ? trim( $_POST['give_user_login'] ) : false; |
|
424 | - $user_email = isset( $_POST['give_email'] ) ? trim( $_POST['give_email'] ) : false; |
|
425 | - $user_pass = isset( $_POST['give_user_pass'] ) ? trim( $_POST['give_user_pass'] ) : false; |
|
426 | - $pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false; |
|
423 | + $user_login = isset($_POST['give_user_login']) ? trim($_POST['give_user_login']) : false; |
|
424 | + $user_email = isset($_POST['give_email']) ? trim($_POST['give_email']) : false; |
|
425 | + $user_pass = isset($_POST['give_user_pass']) ? trim($_POST['give_user_pass']) : false; |
|
426 | + $pass_confirm = isset($_POST['give_user_pass_confirm']) ? trim($_POST['give_user_pass_confirm']) : false; |
|
427 | 427 | |
428 | 428 | // Loop through required fields and show error messages |
429 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
430 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
431 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
429 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
430 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
431 | + give_set_error($value['error_id'], $value['error_message']); |
|
432 | 432 | } |
433 | 433 | } |
434 | 434 | |
435 | 435 | // Check if we have an username to register |
436 | - if ( $user_login && strlen( $user_login ) > 0 ) { |
|
436 | + if ($user_login && strlen($user_login) > 0) { |
|
437 | 437 | $registering_new_user = true; |
438 | 438 | |
439 | 439 | // We have an user name, check if it already exists |
440 | - if ( username_exists( $user_login ) ) { |
|
440 | + if (username_exists($user_login)) { |
|
441 | 441 | // Username already registered |
442 | - give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) ); |
|
442 | + give_set_error('username_unavailable', __('Username already taken', 'give')); |
|
443 | 443 | // Check if it's valid |
444 | - } else if ( ! give_validate_username( $user_login ) ) { |
|
444 | + } else if ( ! give_validate_username($user_login)) { |
|
445 | 445 | // Invalid username |
446 | - if ( is_multisite() ) { |
|
447 | - give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give' ) ); |
|
446 | + if (is_multisite()) { |
|
447 | + give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give')); |
|
448 | 448 | } else { |
449 | - give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) ); |
|
449 | + give_set_error('username_invalid', __('Invalid username', 'give')); |
|
450 | 450 | } |
451 | 451 | } else { |
452 | 452 | // All the checks have run and it's good to go |
453 | 453 | $valid_user_data['user_login'] = $user_login; |
454 | 454 | } |
455 | 455 | } else { |
456 | - if ( give_no_guest_checkout( $form_id ) ) { |
|
457 | - give_set_error( 'registration_required', __( 'You must register or login to complete your donation', 'give' ) ); |
|
456 | + if (give_no_guest_checkout($form_id)) { |
|
457 | + give_set_error('registration_required', __('You must register or login to complete your donation', 'give')); |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
461 | 461 | // Check if we have an email to verify |
462 | - if ( $user_email && strlen( $user_email ) > 0 ) { |
|
462 | + if ($user_email && strlen($user_email) > 0) { |
|
463 | 463 | // Validate email |
464 | - if ( ! is_email( $user_email ) ) { |
|
465 | - give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) ); |
|
464 | + if ( ! is_email($user_email)) { |
|
465 | + give_set_error('email_invalid', __('Invalid email', 'give')); |
|
466 | 466 | // Check if email exists |
467 | - } else if ( email_exists( $user_email ) && $registering_new_user ) { |
|
468 | - give_set_error( 'email_used', __( 'Email already used', 'give' ) ); |
|
467 | + } else if (email_exists($user_email) && $registering_new_user) { |
|
468 | + give_set_error('email_used', __('Email already used', 'give')); |
|
469 | 469 | } else { |
470 | 470 | // All the checks have run and it's good to go |
471 | 471 | $valid_user_data['user_email'] = $user_email; |
472 | 472 | } |
473 | 473 | } else { |
474 | 474 | // No email |
475 | - give_set_error( 'email_empty', __( 'Enter an email', 'give' ) ); |
|
475 | + give_set_error('email_empty', __('Enter an email', 'give')); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | // Check password |
479 | - if ( $user_pass && $pass_confirm ) { |
|
479 | + if ($user_pass && $pass_confirm) { |
|
480 | 480 | // Verify confirmation matches |
481 | - if ( $user_pass != $pass_confirm ) { |
|
481 | + if ($user_pass != $pass_confirm) { |
|
482 | 482 | // Passwords do not match |
483 | - give_set_error( 'password_mismatch', __( 'Passwords don\'t match', 'give' ) ); |
|
483 | + give_set_error('password_mismatch', __('Passwords don\'t match', 'give')); |
|
484 | 484 | } else { |
485 | 485 | // All is good to go |
486 | 486 | $valid_user_data['user_pass'] = $user_pass; |
487 | 487 | } |
488 | 488 | } else { |
489 | 489 | // Password or confirmation missing |
490 | - if ( ! $user_pass && $registering_new_user ) { |
|
490 | + if ( ! $user_pass && $registering_new_user) { |
|
491 | 491 | // The password is invalid |
492 | - give_set_error( 'password_empty', __( 'Enter a password', 'give' ) ); |
|
493 | - } else if ( ! $pass_confirm && $registering_new_user ) { |
|
492 | + give_set_error('password_empty', __('Enter a password', 'give')); |
|
493 | + } else if ( ! $pass_confirm && $registering_new_user) { |
|
494 | 494 | // Confirmation password is invalid |
495 | - give_set_error( 'confirmation_empty', __( 'Enter the password confirmation', 'give' ) ); |
|
495 | + give_set_error('confirmation_empty', __('Enter the password confirmation', 'give')); |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | |
@@ -511,34 +511,34 @@ discard block |
||
511 | 511 | // Start an array to collect valid user data |
512 | 512 | $valid_user_data = array( |
513 | 513 | // Assume there will be errors |
514 | - 'user_id' => - 1 |
|
514 | + 'user_id' => -1 |
|
515 | 515 | ); |
516 | 516 | |
517 | 517 | // Username |
518 | - if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) { |
|
519 | - give_set_error( 'must_log_in', __( 'You must login or register to complete your donation', 'give' ) ); |
|
518 | + if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') { |
|
519 | + give_set_error('must_log_in', __('You must login or register to complete your donation', 'give')); |
|
520 | 520 | |
521 | 521 | return $valid_user_data; |
522 | 522 | } |
523 | 523 | |
524 | 524 | // Get the user by login |
525 | - $user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) ); |
|
525 | + $user_data = get_user_by('login', strip_tags($_POST['give_user_login'])); |
|
526 | 526 | |
527 | 527 | // Check if user exists |
528 | - if ( $user_data ) { |
|
528 | + if ($user_data) { |
|
529 | 529 | // Get password |
530 | - $user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false; |
|
530 | + $user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false; |
|
531 | 531 | |
532 | 532 | // Check user_pass |
533 | - if ( $user_pass ) { |
|
533 | + if ($user_pass) { |
|
534 | 534 | // Check if password is valid |
535 | - if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) { |
|
535 | + if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) { |
|
536 | 536 | // Incorrect password |
537 | 537 | give_set_error( |
538 | 538 | 'password_incorrect', |
539 | 539 | sprintf( |
540 | - __( 'The password you entered is incorrect. %sReset Password%s', 'give' ), |
|
541 | - '<a href="' . wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ) . '" title="' . __( 'Lost Password', 'give' ) . '">', |
|
540 | + __('The password you entered is incorrect. %sReset Password%s', 'give'), |
|
541 | + '<a href="'.wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]").'" title="'.__('Lost Password', 'give').'">', |
|
542 | 542 | '</a>' |
543 | 543 | ) |
544 | 544 | ); |
@@ -556,11 +556,11 @@ discard block |
||
556 | 556 | } |
557 | 557 | } else { |
558 | 558 | // Empty password |
559 | - give_set_error( 'password_empty', __( 'Enter a password', 'give' ) ); |
|
559 | + give_set_error('password_empty', __('Enter a password', 'give')); |
|
560 | 560 | } |
561 | 561 | } else { |
562 | 562 | // no username |
563 | - give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) ); |
|
563 | + give_set_error('username_incorrect', __('The username you entered does not exist', 'give')); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | return $valid_user_data; |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | */ |
576 | 576 | function give_purchase_form_validate_guest_user() { |
577 | 577 | |
578 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
578 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
579 | 579 | |
580 | 580 | // Start an array to collect valid user data |
581 | 581 | $valid_user_data = array( |
@@ -584,32 +584,32 @@ discard block |
||
584 | 584 | ); |
585 | 585 | |
586 | 586 | // Show error message if user must be logged in |
587 | - if ( give_logged_in_only() ) { |
|
588 | - give_set_error( 'logged_in_only', __( 'You must be logged into an account to donation', 'give' ) ); |
|
587 | + if (give_logged_in_only()) { |
|
588 | + give_set_error('logged_in_only', __('You must be logged into an account to donation', 'give')); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | // Get the guest email |
592 | - $guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
592 | + $guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
593 | 593 | |
594 | 594 | // Check email |
595 | - if ( $guest_email && strlen( $guest_email ) > 0 ) { |
|
595 | + if ($guest_email && strlen($guest_email) > 0) { |
|
596 | 596 | // Validate email |
597 | - if ( ! is_email( $guest_email ) ) { |
|
597 | + if ( ! is_email($guest_email)) { |
|
598 | 598 | // Invalid email |
599 | - give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) ); |
|
599 | + give_set_error('email_invalid', __('Invalid email', 'give')); |
|
600 | 600 | } else { |
601 | 601 | // All is good to go |
602 | 602 | $valid_user_data['user_email'] = $guest_email; |
603 | 603 | } |
604 | 604 | } else { |
605 | 605 | // No email |
606 | - give_set_error( 'email_empty', __( 'Enter an email', 'give' ) ); |
|
606 | + give_set_error('email_empty', __('Enter an email', 'give')); |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | // Loop through required fields and show error messages |
610 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
611 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
612 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
610 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
611 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
612 | + give_set_error($value['error_id'], $value['error_message']); |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
@@ -625,42 +625,42 @@ discard block |
||
625 | 625 | * @since 1.0 |
626 | 626 | * @return integer |
627 | 627 | */ |
628 | -function give_register_and_login_new_user( $user_data = array() ) { |
|
628 | +function give_register_and_login_new_user($user_data = array()) { |
|
629 | 629 | // Verify the array |
630 | - if ( empty( $user_data ) ) { |
|
631 | - return - 1; |
|
630 | + if (empty($user_data)) { |
|
631 | + return -1; |
|
632 | 632 | } |
633 | 633 | |
634 | - if ( give_get_errors() ) { |
|
635 | - return - 1; |
|
634 | + if (give_get_errors()) { |
|
635 | + return -1; |
|
636 | 636 | } |
637 | 637 | |
638 | - $user_args = apply_filters( 'give_insert_user_args', array( |
|
639 | - 'user_login' => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '', |
|
640 | - 'user_pass' => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '', |
|
641 | - 'user_email' => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '', |
|
642 | - 'first_name' => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '', |
|
643 | - 'last_name' => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '', |
|
644 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
645 | - 'role' => get_option( 'default_role' ) |
|
646 | - ), $user_data ); |
|
638 | + $user_args = apply_filters('give_insert_user_args', array( |
|
639 | + 'user_login' => isset($user_data['user_login']) ? $user_data['user_login'] : '', |
|
640 | + 'user_pass' => isset($user_data['user_pass']) ? $user_data['user_pass'] : '', |
|
641 | + 'user_email' => isset($user_data['user_email']) ? $user_data['user_email'] : '', |
|
642 | + 'first_name' => isset($user_data['user_first']) ? $user_data['user_first'] : '', |
|
643 | + 'last_name' => isset($user_data['user_last']) ? $user_data['user_last'] : '', |
|
644 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
645 | + 'role' => get_option('default_role') |
|
646 | + ), $user_data); |
|
647 | 647 | |
648 | 648 | // Insert new user |
649 | - $user_id = wp_insert_user( $user_args ); |
|
649 | + $user_id = wp_insert_user($user_args); |
|
650 | 650 | |
651 | 651 | // Validate inserted user |
652 | - if ( is_wp_error( $user_id ) ) { |
|
653 | - return - 1; |
|
652 | + if (is_wp_error($user_id)) { |
|
653 | + return -1; |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | // Allow themes and plugins to filter the user data |
657 | - $user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args ); |
|
657 | + $user_data = apply_filters('give_insert_user_data', $user_data, $user_args); |
|
658 | 658 | |
659 | 659 | // Allow themes and plugins to hook |
660 | - do_action( 'give_insert_user', $user_id, $user_data ); |
|
660 | + do_action('give_insert_user', $user_id, $user_data); |
|
661 | 661 | |
662 | 662 | // Login new user |
663 | - give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] ); |
|
663 | + give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']); |
|
664 | 664 | |
665 | 665 | // Return user id |
666 | 666 | return $user_id; |
@@ -675,27 +675,27 @@ discard block |
||
675 | 675 | * @since 1.0 |
676 | 676 | * @return array |
677 | 677 | */ |
678 | -function give_get_purchase_form_user( $valid_data = array() ) { |
|
678 | +function give_get_purchase_form_user($valid_data = array()) { |
|
679 | 679 | // Initialize user |
680 | 680 | $user = false; |
681 | - $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; |
|
681 | + $is_ajax = defined('DOING_AJAX') && DOING_AJAX; |
|
682 | 682 | |
683 | - if ( $is_ajax ) { |
|
683 | + if ($is_ajax) { |
|
684 | 684 | // Do not create or login the user during the ajax submission (check for errors only) |
685 | 685 | return true; |
686 | - } else if ( is_user_logged_in() ) { |
|
686 | + } else if (is_user_logged_in()) { |
|
687 | 687 | // Set the valid user as the logged in collected data |
688 | 688 | |
689 | 689 | $user = $valid_data['logged_in_user']; |
690 | - } else if ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) { |
|
690 | + } else if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) { |
|
691 | 691 | // New user registration |
692 | - if ( $valid_data['need_new_user'] === true ) { |
|
692 | + if ($valid_data['need_new_user'] === true) { |
|
693 | 693 | // Set user |
694 | 694 | $user = $valid_data['new_user_data']; |
695 | 695 | // Register and login new user |
696 | - $user['user_id'] = give_register_and_login_new_user( $user ); |
|
696 | + $user['user_id'] = give_register_and_login_new_user($user); |
|
697 | 697 | // User login |
698 | - } else if ( $valid_data['need_user_login'] === true && ! $is_ajax ) { |
|
698 | + } else if ($valid_data['need_user_login'] === true && ! $is_ajax) { |
|
699 | 699 | |
700 | 700 | /* |
701 | 701 | * The login form is now processed in the give_process_purchase_login() function. |
@@ -710,48 +710,48 @@ discard block |
||
710 | 710 | // Set user |
711 | 711 | $user = $valid_data['login_user_data']; |
712 | 712 | // Login user |
713 | - give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] ); |
|
713 | + give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']); |
|
714 | 714 | } |
715 | 715 | } |
716 | 716 | |
717 | 717 | // Check guest checkout |
718 | - if ( false === $user && false === give_no_guest_checkout( $_POST['give-form-id'] ) ) { |
|
718 | + if (false === $user && false === give_no_guest_checkout($_POST['give-form-id'])) { |
|
719 | 719 | // Set user |
720 | 720 | $user = $valid_data['guest_user_data']; |
721 | 721 | } |
722 | 722 | |
723 | 723 | // Verify we have an user |
724 | - if ( false === $user || empty( $user ) ) { |
|
724 | + if (false === $user || empty($user)) { |
|
725 | 725 | // Return false |
726 | 726 | return false; |
727 | 727 | } |
728 | 728 | |
729 | 729 | // Get user first name |
730 | - if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) { |
|
731 | - $user['user_first'] = isset( $_POST["give_first"] ) ? strip_tags( trim( $_POST["give_first"] ) ) : ''; |
|
730 | + if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) { |
|
731 | + $user['user_first'] = isset($_POST["give_first"]) ? strip_tags(trim($_POST["give_first"])) : ''; |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | // Get user last name |
735 | - if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) { |
|
736 | - $user['user_last'] = isset( $_POST["give_last"] ) ? strip_tags( trim( $_POST["give_last"] ) ) : ''; |
|
735 | + if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) { |
|
736 | + $user['user_last'] = isset($_POST["give_last"]) ? strip_tags(trim($_POST["give_last"])) : ''; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | // Get the user's billing address details |
740 | 740 | $user['address'] = array(); |
741 | - $user['address']['line1'] = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false; |
|
742 | - $user['address']['line2'] = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false; |
|
743 | - $user['address']['city'] = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false; |
|
744 | - $user['address']['state'] = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false; |
|
745 | - $user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false; |
|
746 | - $user['address']['zip'] = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false; |
|
747 | - |
|
748 | - if ( empty( $user['address']['country'] ) ) { |
|
741 | + $user['address']['line1'] = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false; |
|
742 | + $user['address']['line2'] = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false; |
|
743 | + $user['address']['city'] = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false; |
|
744 | + $user['address']['state'] = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false; |
|
745 | + $user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false; |
|
746 | + $user['address']['zip'] = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false; |
|
747 | + |
|
748 | + if (empty($user['address']['country'])) { |
|
749 | 749 | $user['address'] = false; |
750 | 750 | } // Country will always be set if address fields are present |
751 | 751 | |
752 | - if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) { |
|
752 | + if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) { |
|
753 | 753 | // Store the address in the user's meta so the cart can be pre-populated with it on return purchases |
754 | - update_user_meta( $user['user_id'], '_give_user_address', $user['address'] ); |
|
754 | + update_user_meta($user['user_id'], '_give_user_address', $user['address']); |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | // Return valid user |
@@ -770,16 +770,16 @@ discard block |
||
770 | 770 | $card_data = give_get_purchase_cc_info(); |
771 | 771 | |
772 | 772 | // Validate the card zip |
773 | - if ( ! empty( $card_data['card_zip'] ) ) { |
|
774 | - if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) { |
|
775 | - give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid', 'give' ) ); |
|
773 | + if ( ! empty($card_data['card_zip'])) { |
|
774 | + if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) { |
|
775 | + give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid', 'give')); |
|
776 | 776 | } |
777 | 777 | } |
778 | 778 | |
779 | 779 | //Ensure no spaces |
780 | - if ( ! empty( $card_data['card_number'] ) ) { |
|
781 | - $card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); //no "+" signs |
|
782 | - $card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces |
|
780 | + if ( ! empty($card_data['card_number'])) { |
|
781 | + $card_data['card_number'] = str_replace('+', '', $card_data['card_number']); //no "+" signs |
|
782 | + $card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces |
|
783 | 783 | } |
784 | 784 | |
785 | 785 | // This should validate card numbers at some point too |
@@ -795,17 +795,17 @@ discard block |
||
795 | 795 | */ |
796 | 796 | function give_get_purchase_cc_info() { |
797 | 797 | $cc_info = array(); |
798 | - $cc_info['card_name'] = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : ''; |
|
799 | - $cc_info['card_number'] = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : ''; |
|
800 | - $cc_info['card_cvc'] = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : ''; |
|
801 | - $cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : ''; |
|
802 | - $cc_info['card_exp_year'] = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : ''; |
|
803 | - $cc_info['card_address'] = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : ''; |
|
804 | - $cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : ''; |
|
805 | - $cc_info['card_city'] = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : ''; |
|
806 | - $cc_info['card_state'] = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : ''; |
|
807 | - $cc_info['card_country'] = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : ''; |
|
808 | - $cc_info['card_zip'] = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : ''; |
|
798 | + $cc_info['card_name'] = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : ''; |
|
799 | + $cc_info['card_number'] = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : ''; |
|
800 | + $cc_info['card_cvc'] = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : ''; |
|
801 | + $cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : ''; |
|
802 | + $cc_info['card_exp_year'] = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : ''; |
|
803 | + $cc_info['card_address'] = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : ''; |
|
804 | + $cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : ''; |
|
805 | + $cc_info['card_city'] = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : ''; |
|
806 | + $cc_info['card_state'] = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : ''; |
|
807 | + $cc_info['card_country'] = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : ''; |
|
808 | + $cc_info['card_zip'] = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : ''; |
|
809 | 809 | |
810 | 810 | // Return cc info |
811 | 811 | return $cc_info; |
@@ -821,14 +821,14 @@ discard block |
||
821 | 821 | * |
822 | 822 | * @return bool|mixed|void |
823 | 823 | */ |
824 | -function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) { |
|
824 | +function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') { |
|
825 | 825 | $ret = false; |
826 | 826 | |
827 | - if ( empty( $zip ) || empty( $country_code ) ) { |
|
827 | + if (empty($zip) || empty($country_code)) { |
|
828 | 828 | return $ret; |
829 | 829 | } |
830 | 830 | |
831 | - $country_code = strtoupper( $country_code ); |
|
831 | + $country_code = strtoupper($country_code); |
|
832 | 832 | |
833 | 833 | $zip_regex = array( |
834 | 834 | "AD" => "AD\d{3}", |
@@ -988,11 +988,11 @@ discard block |
||
988 | 988 | "ZM" => "\d{5}" |
989 | 989 | ); |
990 | 990 | |
991 | - if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) { |
|
991 | + if ( ! isset ($zip_regex[$country_code]) || preg_match("/".$zip_regex[$country_code]."/i", $zip)) { |
|
992 | 992 | $ret = true; |
993 | 993 | } |
994 | 994 | |
995 | - return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code ); |
|
995 | + return apply_filters('give_is_zip_valid', $ret, $zip, $country_code); |
|
996 | 996 | } |
997 | 997 | |
998 | 998 | |
@@ -1002,48 +1002,48 @@ discard block |
||
1002 | 1002 | * @since 1.0 |
1003 | 1003 | * @return void |
1004 | 1004 | */ |
1005 | -function give_check_purchase_email( $valid_data, $posted ) { |
|
1005 | +function give_check_purchase_email($valid_data, $posted) { |
|
1006 | 1006 | $is_banned = false; |
1007 | 1007 | $banned = give_get_banned_emails(); |
1008 | 1008 | |
1009 | - if ( empty( $banned ) ) { |
|
1009 | + if (empty($banned)) { |
|
1010 | 1010 | return; |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if ( is_user_logged_in() ) { |
|
1013 | + if (is_user_logged_in()) { |
|
1014 | 1014 | |
1015 | 1015 | // The user is logged in, check that their account email is not banned |
1016 | - $user_data = get_userdata( get_current_user_id() ); |
|
1017 | - if ( give_is_email_banned( $user_data->user_email ) ) { |
|
1016 | + $user_data = get_userdata(get_current_user_id()); |
|
1017 | + if (give_is_email_banned($user_data->user_email)) { |
|
1018 | 1018 | |
1019 | 1019 | $is_banned = true; |
1020 | 1020 | } |
1021 | 1021 | |
1022 | - if ( give_is_email_banned( $posted['give_email'] ) ) { |
|
1022 | + if (give_is_email_banned($posted['give_email'])) { |
|
1023 | 1023 | $is_banned = true; |
1024 | 1024 | } |
1025 | 1025 | |
1026 | - } elseif ( isset( $posted['give-purchase-var'] ) && $posted['give-purchase-var'] == 'needs-to-login' ) { |
|
1026 | + } elseif (isset($posted['give-purchase-var']) && $posted['give-purchase-var'] == 'needs-to-login') { |
|
1027 | 1027 | |
1028 | 1028 | // The user is logging in, check that their email is not banned |
1029 | - $user_data = get_user_by( 'login', $posted['give_user_login'] ); |
|
1030 | - if ( $user_data && give_is_email_banned( $user_data->user_email ) ) { |
|
1029 | + $user_data = get_user_by('login', $posted['give_user_login']); |
|
1030 | + if ($user_data && give_is_email_banned($user_data->user_email)) { |
|
1031 | 1031 | $is_banned = true; |
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | } else { |
1035 | 1035 | |
1036 | 1036 | // Guest purchase, check that the email is not banned |
1037 | - if ( give_is_email_banned( $posted['give_email'] ) ) { |
|
1037 | + if (give_is_email_banned($posted['give_email'])) { |
|
1038 | 1038 | $is_banned = true; |
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | } |
1042 | 1042 | |
1043 | - if ( $is_banned ) { |
|
1043 | + if ($is_banned) { |
|
1044 | 1044 | // Set an error and give the donor a general error (don't alert them that they were banned) |
1045 | - give_set_error( 'email_banned', __( 'An internal error has occurred, please try again or contact support.', 'give' ) ); |
|
1045 | + give_set_error('email_banned', __('An internal error has occurred, please try again or contact support.', 'give')); |
|
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | |
1049 | -add_action( 'give_checkout_error_checks', 'give_check_purchase_email', 10, 2 ); |
|
1049 | +add_action('give_checkout_error_checks', 'give_check_purchase_email', 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 | |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | * @return string |
25 | 25 | */ |
26 | 26 | function give_donation_history() { |
27 | - if ( is_user_logged_in() ) { |
|
27 | + if (is_user_logged_in()) { |
|
28 | 28 | ob_start(); |
29 | - give_get_template_part( 'history', 'donations' ); |
|
29 | + give_get_template_part('history', 'donations'); |
|
30 | 30 | |
31 | 31 | return ob_get_clean(); |
32 | 32 | } else { |
33 | - echo apply_filters( 'give_donation_history_nonuser_message', '<div class="give_error give_warning"><p>' . __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ) . '</p></div>' ); |
|
33 | + echo apply_filters('give_donation_history_nonuser_message', '<div class="give_error give_warning"><p>'.__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give').'</p></div>'); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
37 | +add_shortcode('donation_history', 'give_donation_history'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Donation Form Shortcode |
@@ -48,53 +48,53 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return string |
50 | 50 | */ |
51 | -function give_form_shortcode( $atts, $content = null ) { |
|
52 | - $atts = shortcode_atts( array( |
|
51 | +function give_form_shortcode($atts, $content = null) { |
|
52 | + $atts = shortcode_atts(array( |
|
53 | 53 | 'id' => '', |
54 | 54 | 'show_title' => true, |
55 | 55 | 'show_goal' => true, |
56 | 56 | 'show_content' => '', |
57 | 57 | 'float_labels' => '', |
58 | 58 | 'display_style' => '', |
59 | - ), $atts, 'give_form' ); |
|
59 | + ), $atts, 'give_form'); |
|
60 | 60 | |
61 | - foreach ( $atts as $key => $value ) { |
|
61 | + foreach ($atts as $key => $value) { |
|
62 | 62 | //convert shortcode_atts values to booleans |
63 | - if ( $key == 'show_title' ) { |
|
64 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
65 | - } elseif ( $key == 'show_goal' ) { |
|
66 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
63 | + if ($key == 'show_title') { |
|
64 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
65 | + } elseif ($key == 'show_goal') { |
|
66 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | //validate show_content value |
70 | - if ( $key == 'show_content' ) { |
|
71 | - if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) { |
|
72 | - $atts[ $key ] = ''; |
|
73 | - } else if ( $value == 'above' ) { |
|
74 | - $atts[ $key ] = 'give_pre_form'; |
|
75 | - } else if ( $value == 'below' ) { |
|
76 | - $atts[ $key ] = 'give_post_form'; |
|
70 | + if ($key == 'show_content') { |
|
71 | + if ( ! in_array($value, array('none', 'above', 'below'))) { |
|
72 | + $atts[$key] = ''; |
|
73 | + } else if ($value == 'above') { |
|
74 | + $atts[$key] = 'give_pre_form'; |
|
75 | + } else if ($value == 'below') { |
|
76 | + $atts[$key] = 'give_post_form'; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | 80 | //validate display_style and float_labels value |
81 | - if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
|
82 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
81 | + if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal'))) |
|
82 | + || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled'))) |
|
83 | 83 | ) { |
84 | 84 | |
85 | - $atts[ $key ] = ''; |
|
85 | + $atts[$key] = ''; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | 89 | //get the Give Form |
90 | 90 | ob_start(); |
91 | - give_get_donation_form( $atts ); |
|
91 | + give_get_donation_form($atts); |
|
92 | 92 | $final_output = ob_get_clean(); |
93 | 93 | |
94 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
94 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
95 | 95 | } |
96 | 96 | |
97 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
97 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Donation Form Goal Shortcode |
@@ -108,37 +108,37 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return string |
110 | 110 | */ |
111 | -function give_goal_shortcode( $atts, $content = null ) { |
|
112 | - $atts = shortcode_atts( array( |
|
111 | +function give_goal_shortcode($atts, $content = null) { |
|
112 | + $atts = shortcode_atts(array( |
|
113 | 113 | 'id' => '', |
114 | 114 | 'show_text' => true, |
115 | 115 | 'show_bar' => true, |
116 | - ), $atts, 'give_goal' ); |
|
116 | + ), $atts, 'give_goal'); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | //get the Give Form |
120 | 120 | ob_start(); |
121 | 121 | |
122 | 122 | //Sanity check 1: ensure there is an ID Provided |
123 | - if ( empty( $atts['id'] ) ) { |
|
124 | - give_output_error( __( 'Error: No Donation form ID for the shortcode provided.', 'give' ), true ); |
|
123 | + if (empty($atts['id'])) { |
|
124 | + give_output_error(__('Error: No Donation form ID for the shortcode provided.', 'give'), true); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | //Sanity check 2: Check that this form even has Goals enabled |
128 | - $goal_option = get_post_meta( $atts['id'], '_give_goal_option', true ); |
|
129 | - if ( empty( $goal_option ) || $goal_option !== 'yes' ) { |
|
130 | - give_output_error( __( 'Error: This form does not have Goals enabled.', 'give' ), true ); |
|
128 | + $goal_option = get_post_meta($atts['id'], '_give_goal_option', true); |
|
129 | + if (empty($goal_option) || $goal_option !== 'yes') { |
|
130 | + give_output_error(__('Error: This form does not have Goals enabled.', 'give'), true); |
|
131 | 131 | } else { |
132 | 132 | //Passed all sanity checks: output Goal |
133 | - give_show_goal_progress( $atts['id'], $atts ); |
|
133 | + give_show_goal_progress($atts['id'], $atts); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | $final_output = ob_get_clean(); |
137 | 137 | |
138 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
138 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
139 | 139 | } |
140 | 140 | |
141 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
141 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | * @uses give_login_form() |
156 | 156 | * @return string |
157 | 157 | */ |
158 | -function give_login_form_shortcode( $atts, $content = null ) { |
|
159 | - extract( shortcode_atts( array( |
|
158 | +function give_login_form_shortcode($atts, $content = null) { |
|
159 | + extract(shortcode_atts(array( |
|
160 | 160 | 'redirect' => '', |
161 | - ), $atts, 'give_login' ) |
|
161 | + ), $atts, 'give_login') |
|
162 | 162 | ); |
163 | 163 | |
164 | - return give_login_form( $redirect ); |
|
164 | + return give_login_form($redirect); |
|
165 | 165 | } |
166 | 166 | |
167 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
167 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Register Shortcode |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | * @uses give_register_form() |
180 | 180 | * @return string |
181 | 181 | */ |
182 | -function give_register_form_shortcode( $atts, $content = null ) { |
|
183 | - extract( shortcode_atts( array( |
|
182 | +function give_register_form_shortcode($atts, $content = null) { |
|
183 | + extract(shortcode_atts(array( |
|
184 | 184 | 'redirect' => '', |
185 | - ), $atts, 'give_register' ) |
|
185 | + ), $atts, 'give_register') |
|
186 | 186 | ); |
187 | 187 | |
188 | - return give_register_form( $redirect ); |
|
188 | + return give_register_form($redirect); |
|
189 | 189 | } |
190 | 190 | |
191 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
191 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
192 | 192 | |
193 | 193 | |
194 | 194 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return string |
205 | 205 | */ |
206 | -function give_receipt_shortcode( $atts, $content = null ) { |
|
206 | +function give_receipt_shortcode($atts, $content = null) { |
|
207 | 207 | |
208 | 208 | global $give_receipt_args, $payment; |
209 | 209 | |
@@ -211,48 +211,48 @@ discard block |
||
211 | 211 | $session = give_get_purchase_session(); |
212 | 212 | |
213 | 213 | //set payment key var |
214 | - if ( isset( $_GET['payment_key'] ) ) { |
|
215 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
216 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
214 | + if (isset($_GET['payment_key'])) { |
|
215 | + $payment_key = urldecode($_GET['payment_key']); |
|
216 | + } elseif ($give_receipt_args['payment_key']) { |
|
217 | 217 | $payment_key = $give_receipt_args['payment_key']; |
218 | - } else if ( $session ) { |
|
218 | + } else if ($session) { |
|
219 | 219 | $payment_key = $session['purchase_key']; |
220 | 220 | } |
221 | 221 | |
222 | 222 | ob_start(); |
223 | 223 | |
224 | 224 | //Check for payment key |
225 | - if ( empty( $payment_key ) ) { ?> |
|
225 | + if (empty($payment_key)) { ?> |
|
226 | 226 | |
227 | 227 | <div class="give_errors"> |
228 | - <p class="give_error"><?php echo apply_filters( 'give_receipt_no_payment_key', __( 'Sorry, there was a problem identifying this donation. Please contact the site owner for more information.', 'give' ) ); ?></p> |
|
228 | + <p class="give_error"><?php echo apply_filters('give_receipt_no_payment_key', __('Sorry, there was a problem identifying this donation. Please contact the site owner for more information.', 'give')); ?></p> |
|
229 | 229 | </div> |
230 | 230 | |
231 | 231 | <?php return ob_get_clean(); //return error |
232 | 232 | } |
233 | 233 | |
234 | 234 | //Set our important payment information variables |
235 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
236 | - $donor_id = give_get_payment_user_id( $give_receipt_args['id'] ); |
|
237 | - $payment = get_post( $give_receipt_args['id'] ); |
|
235 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
236 | + $donor_id = give_get_payment_user_id($give_receipt_args['id']); |
|
237 | + $payment = get_post($give_receipt_args['id']); |
|
238 | 238 | |
239 | 239 | |
240 | - $give_receipt_args = shortcode_atts( array( |
|
241 | - 'error' => __( 'Sorry, it appears the viewing window for this donation receipt has expired or you do not have the permission to view this donation receipt.', 'give' ), |
|
240 | + $give_receipt_args = shortcode_atts(array( |
|
241 | + 'error' => __('Sorry, it appears the viewing window for this donation receipt has expired or you do not have the permission to view this donation receipt.', 'give'), |
|
242 | 242 | 'price' => true, |
243 | 243 | 'date' => true, |
244 | 244 | 'payment_key' => false, |
245 | 245 | 'payment_method' => true, |
246 | 246 | 'payment_id' => true |
247 | - ), $atts, 'give_receipt' ); |
|
247 | + ), $atts, 'give_receipt'); |
|
248 | 248 | |
249 | 249 | //Is registration open? If so, add better error messaging to tell user their session expired |
250 | - if ( get_option( 'users_can_register' ) ) { |
|
250 | + if (get_option('users_can_register')) { |
|
251 | 251 | |
252 | - $email = get_post_meta( $payment->ID, '_give_payment_user_email', true ); |
|
253 | - $donation_history = get_permalink( give_get_option( 'history_page' ) ); |
|
252 | + $email = get_post_meta($payment->ID, '_give_payment_user_email', true); |
|
253 | + $donation_history = get_permalink(give_get_option('history_page')); |
|
254 | 254 | |
255 | - $give_receipt_args['error'] .= sprintf( __( ' To view your receipt, please <a href="%s">create an account</a> using the following email %s (the email attached to this donation) and visit the <a href="%s">donation history page</a>', 'give' ), wp_registration_url(), '<strong>' . $email . '</strong>', $donation_history ); |
|
255 | + $give_receipt_args['error'] .= sprintf(__(' To view your receipt, please <a href="%s">create an account</a> using the following email %s (the email attached to this donation) and visit the <a href="%s">donation history page</a>', 'give'), wp_registration_url(), '<strong>'.$email.'</strong>', $donation_history); |
|
256 | 256 | |
257 | 257 | } |
258 | 258 | |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | * |
267 | 267 | * Or if user is logged in and the user can view sensitive donor data |
268 | 268 | */ |
269 | - $user_can_view = ( is_user_logged_in() && $donor_id == get_current_user_id() ) || ( ( $donor_id == 0 || $donor_id == '-1' ) && ! is_user_logged_in() && give_get_purchase_session() ) || current_user_can( 'view_give_sensitive_data' ); |
|
269 | + $user_can_view = (is_user_logged_in() && $donor_id == get_current_user_id()) || (($donor_id == 0 || $donor_id == '-1') && ! is_user_logged_in() && give_get_purchase_session()) || current_user_can('view_give_sensitive_data'); |
|
270 | 270 | |
271 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { ?> |
|
271 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { ?> |
|
272 | 272 | |
273 | 273 | <div class="give_errors"> |
274 | 274 | <p class="give_error"><?php echo $give_receipt_args['error']; ?></p> |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | <?php } |
280 | 280 | |
281 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
281 | + give_get_template_part('shortcode', 'receipt'); |
|
282 | 282 | |
283 | 283 | $display = ob_get_clean(); |
284 | 284 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | } |
288 | 288 | |
289 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
289 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Profile Editor Shortcode |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @return string Output generated from the profile editor |
308 | 308 | */ |
309 | -function give_profile_editor_shortcode( $atts, $content = null ) { |
|
309 | +function give_profile_editor_shortcode($atts, $content = null) { |
|
310 | 310 | |
311 | 311 | ob_start(); |
312 | 312 | |
313 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
313 | + give_get_template_part('shortcode', 'profile-editor'); |
|
314 | 314 | |
315 | 315 | $display = ob_get_clean(); |
316 | 316 | |
317 | 317 | return $display; |
318 | 318 | } |
319 | 319 | |
320 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
320 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
321 | 321 | |
322 | 322 | /** |
323 | 323 | * Process Profile Updater Form |
@@ -330,30 +330,30 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return false |
332 | 332 | */ |
333 | -function give_process_profile_editor_updates( $data ) { |
|
333 | +function give_process_profile_editor_updates($data) { |
|
334 | 334 | // Profile field change request |
335 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
335 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
336 | 336 | return false; |
337 | 337 | } |
338 | 338 | |
339 | 339 | // Nonce security |
340 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
340 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | |
344 | 344 | $user_id = get_current_user_id(); |
345 | - $old_user_data = get_userdata( $user_id ); |
|
346 | - |
|
347 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
348 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
349 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
350 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
351 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
352 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
353 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
354 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
355 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
356 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
345 | + $old_user_data = get_userdata($user_id); |
|
346 | + |
|
347 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
348 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
349 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
350 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
351 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
352 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
353 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
354 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
355 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
356 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
357 | 357 | |
358 | 358 | $userdata = array( |
359 | 359 | 'ID' => $user_id, |
@@ -373,45 +373,45 @@ discard block |
||
373 | 373 | 'country' => $country |
374 | 374 | ); |
375 | 375 | |
376 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
376 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
377 | 377 | |
378 | 378 | // New password |
379 | - if ( ! empty( $data['give_new_user_pass1'] ) ) { |
|
380 | - if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) { |
|
381 | - give_set_error( 'password_mismatch', __( 'The passwords you entered do not match. Please try again.', 'give' ) ); |
|
379 | + if ( ! empty($data['give_new_user_pass1'])) { |
|
380 | + if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) { |
|
381 | + give_set_error('password_mismatch', __('The passwords you entered do not match. Please try again.', 'give')); |
|
382 | 382 | } else { |
383 | 383 | $userdata['user_pass'] = $data['give_new_user_pass1']; |
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | 387 | // Make sure the new email doesn't belong to another user |
388 | - if ( $email != $old_user_data->user_email ) { |
|
389 | - if ( email_exists( $email ) ) { |
|
390 | - give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
388 | + if ($email != $old_user_data->user_email) { |
|
389 | + if (email_exists($email)) { |
|
390 | + give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | 394 | // Check for errors |
395 | 395 | $errors = give_get_errors(); |
396 | 396 | |
397 | - if ( $errors ) { |
|
397 | + if ($errors) { |
|
398 | 398 | // Send back to the profile editor if there are errors |
399 | - wp_redirect( $data['give_redirect'] ); |
|
399 | + wp_redirect($data['give_redirect']); |
|
400 | 400 | give_die(); |
401 | 401 | } |
402 | 402 | |
403 | 403 | // Update the user |
404 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
405 | - $updated = wp_update_user( $userdata ); |
|
404 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
405 | + $updated = wp_update_user($userdata); |
|
406 | 406 | |
407 | - if ( $updated ) { |
|
408 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
409 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
407 | + if ($updated) { |
|
408 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
409 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
410 | 410 | give_die(); |
411 | 411 | } |
412 | 412 | |
413 | 413 | return false; |
414 | 414 | } |
415 | 415 | |
416 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
416 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
|
417 | 417 |