@@ -209,14 +209,14 @@ |
||
209 | 209 | remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
210 | 210 | |
211 | 211 | if ( $payments ) { |
212 | - /** |
|
213 | - * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon. |
|
214 | - * |
|
215 | - * @since 1.6 |
|
216 | - * |
|
217 | - * @param array $skip_payment_gateways Array of payment gateways |
|
218 | - */ |
|
219 | - $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) ); |
|
212 | + /** |
|
213 | + * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon. |
|
214 | + * |
|
215 | + * @since 1.6 |
|
216 | + * |
|
217 | + * @param array $skip_payment_gateways Array of payment gateways |
|
218 | + */ |
|
219 | + $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) ); |
|
220 | 220 | |
221 | 221 | foreach ( $payments as $payment ) { |
222 | 222 | $gateway = give_get_payment_gateway( $payment ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | 32 | |
33 | 33 | // Make sure that payments are only completed once |
34 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
34 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Make sure the payment completion is only processed when new status is complete |
39 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
39 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $payment = new Give_Payment( $payment_id ); |
|
43 | + $payment = new Give_Payment($payment_id); |
|
44 | 44 | |
45 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
45 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
46 | 46 | $payment_meta = $payment->payment_meta; |
47 | 47 | $completed_date = $payment->completed_date; |
48 | 48 | $user_info = $payment->user_info; |
@@ -51,38 +51,38 @@ discard block |
||
51 | 51 | $price_id = $payment->price_id; |
52 | 52 | $form_id = $payment->form_id; |
53 | 53 | |
54 | - do_action( 'give_pre_complete_purchase', $payment_id ); |
|
54 | + do_action('give_pre_complete_purchase', $payment_id); |
|
55 | 55 | |
56 | 56 | // Ensure these actions only run once, ever |
57 | - if ( empty( $completed_date ) ) { |
|
57 | + if (empty($completed_date)) { |
|
58 | 58 | |
59 | - give_record_sale_in_log( $form_id, $payment_id, $price_id, $creation_date ); |
|
60 | - do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta ); |
|
59 | + give_record_sale_in_log($form_id, $payment_id, $price_id, $creation_date); |
|
60 | + do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta); |
|
61 | 61 | |
62 | 62 | } |
63 | 63 | |
64 | 64 | // Increase the earnings for this form ID |
65 | - give_increase_earnings( $form_id, $amount ); |
|
66 | - give_increase_purchase_count( $form_id ); |
|
65 | + give_increase_earnings($form_id, $amount); |
|
66 | + give_increase_purchase_count($form_id); |
|
67 | 67 | |
68 | 68 | // Clear the total earnings cache |
69 | - delete_transient( 'give_earnings_total' ); |
|
69 | + delete_transient('give_earnings_total'); |
|
70 | 70 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
71 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
72 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
71 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
72 | + delete_transient(md5('give_earnings_todaytoday')); |
|
73 | 73 | |
74 | 74 | // Increase the donor's purchase stats |
75 | - $customer = new Give_Customer( $customer_id ); |
|
75 | + $customer = new Give_Customer($customer_id); |
|
76 | 76 | $customer->increase_purchase_count(); |
77 | - $customer->increase_value( $amount ); |
|
77 | + $customer->increase_value($amount); |
|
78 | 78 | |
79 | - give_increase_total_earnings( $amount ); |
|
79 | + give_increase_total_earnings($amount); |
|
80 | 80 | |
81 | 81 | // Ensure this action only runs once ever |
82 | - if ( empty( $completed_date ) ) { |
|
82 | + if (empty($completed_date)) { |
|
83 | 83 | |
84 | 84 | // Save the completed date |
85 | - $payment->completed_date = current_time( 'mysql' ); |
|
85 | + $payment->completed_date = current_time('mysql'); |
|
86 | 86 | $payment->save(); |
87 | 87 | |
88 | 88 | /** |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @param int $payment_id The ID of the payment. |
94 | 94 | */ |
95 | - do_action( 'give_complete_purchase', $payment_id ); |
|
95 | + do_action('give_complete_purchase', $payment_id); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
100 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | /** |
@@ -111,24 +111,24 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return void |
113 | 113 | */ |
114 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
114 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
115 | 115 | |
116 | 116 | // Get the list of statuses so that status in the payment note can be translated |
117 | 117 | $stati = give_get_payment_statuses(); |
118 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
119 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
118 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
119 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
120 | 120 | |
121 | 121 | $status_change = sprintf( |
122 | 122 | /* translators: 1: old status 2: new status */ |
123 | - esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), |
|
123 | + esc_html__('Status changed from %1$s to %2$s.', 'give'), |
|
124 | 124 | $old_status, |
125 | 125 | $new_status |
126 | 126 | ); |
127 | 127 | |
128 | - give_insert_payment_note( $payment_id, $status_change ); |
|
128 | + give_insert_payment_note($payment_id, $status_change); |
|
129 | 129 | } |
130 | 130 | |
131 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
131 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
132 | 132 | |
133 | 133 | |
134 | 134 | /** |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @return void |
147 | 147 | */ |
148 | -function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) { |
|
148 | +function give_clear_user_history_cache($payment_id, $new_status, $old_status) { |
|
149 | 149 | |
150 | - $payment = new Give_Payment( $payment_id ); |
|
150 | + $payment = new Give_Payment($payment_id); |
|
151 | 151 | |
152 | - if ( ! empty( $payment->user_id ) ) { |
|
153 | - delete_transient( 'give_user_' . $payment->user_id . '_purchases' ); |
|
152 | + if ( ! empty($payment->user_id)) { |
|
153 | + delete_transient('give_user_'.$payment->user_id.'_purchases'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | -add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 ); |
|
158 | +add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3); |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Update Old Payments Totals |
@@ -170,25 +170,25 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | -function give_update_old_payments_with_totals( $data ) { |
|
174 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
173 | +function give_update_old_payments_with_totals($data) { |
|
174 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
175 | 175 | return; |
176 | 176 | } |
177 | 177 | |
178 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
178 | + if (get_option('give_payment_totals_upgraded')) { |
|
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | - $payments = give_get_payments( array( |
|
182 | + $payments = give_get_payments(array( |
|
183 | 183 | 'offset' => 0, |
184 | - 'number' => - 1, |
|
184 | + 'number' => -1, |
|
185 | 185 | 'mode' => 'all' |
186 | - ) ); |
|
186 | + )); |
|
187 | 187 | |
188 | - if ( $payments ) { |
|
189 | - foreach ( $payments as $payment ) { |
|
188 | + if ($payments) { |
|
189 | + foreach ($payments as $payment) { |
|
190 | 190 | |
191 | - $payment = new Give_Payment( $payment->ID ); |
|
191 | + $payment = new Give_Payment($payment->ID); |
|
192 | 192 | $meta = $payment->get_meta(); |
193 | 193 | |
194 | 194 | $payment->total = $meta['amount']; |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
200 | + add_option('give_payment_totals_upgraded', 1); |
|
201 | 201 | } |
202 | 202 | |
203 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
203 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Mark Abandoned Donations |
@@ -214,17 +214,17 @@ discard block |
||
214 | 214 | function give_mark_abandoned_donations() { |
215 | 215 | $args = array( |
216 | 216 | 'status' => 'pending', |
217 | - 'number' => - 1, |
|
217 | + 'number' => -1, |
|
218 | 218 | 'output' => 'give_payments', |
219 | 219 | ); |
220 | 220 | |
221 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
221 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
222 | 222 | |
223 | - $payments = give_get_payments( $args ); |
|
223 | + $payments = give_get_payments($args); |
|
224 | 224 | |
225 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
225 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
226 | 226 | |
227 | - if ( $payments ) { |
|
227 | + if ($payments) { |
|
228 | 228 | /** |
229 | 229 | * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon. |
230 | 230 | * |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @param array $skip_payment_gateways Array of payment gateways |
234 | 234 | */ |
235 | - $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) ); |
|
235 | + $skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline')); |
|
236 | 236 | |
237 | - foreach ( $payments as $payment ) { |
|
238 | - $gateway = give_get_payment_gateway( $payment ); |
|
237 | + foreach ($payments as $payment) { |
|
238 | + $gateway = give_get_payment_gateway($payment); |
|
239 | 239 | |
240 | 240 | // Skip payment gateways. |
241 | - if ( in_array( $gateway, $skip_payment_gateways ) ) { |
|
241 | + if (in_array($gateway, $skip_payment_gateways)) { |
|
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
@@ -248,4 +248,4 @@ discard block |
||
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
251 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
@@ -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,15 +24,15 @@ discard block |
||
24 | 24 | * @global $wp_version |
25 | 25 | * @return void |
26 | 26 | */ |
27 | -function give_install( $network_wide = false ) { |
|
27 | +function give_install($network_wide = false) { |
|
28 | 28 | |
29 | 29 | global $wpdb; |
30 | 30 | |
31 | - if ( is_multisite() && $network_wide ) { |
|
31 | + if (is_multisite() && $network_wide) { |
|
32 | 32 | |
33 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
33 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
34 | 34 | |
35 | - switch_to_blog( $blog_id ); |
|
35 | + switch_to_blog($blog_id); |
|
36 | 36 | give_run_install(); |
37 | 37 | restore_current_blog(); |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
49 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Run the Give Install process |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | give_setup_post_types(); |
63 | 63 | |
64 | 64 | // Clear the permalinks |
65 | - flush_rewrite_rules( false ); |
|
65 | + flush_rewrite_rules(false); |
|
66 | 66 | |
67 | 67 | // Add Upgraded From Option |
68 | - $current_version = get_option( 'give_version' ); |
|
69 | - if ( $current_version ) { |
|
70 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
68 | + $current_version = get_option('give_version'); |
|
69 | + if ($current_version) { |
|
70 | + update_option('give_version_upgraded_from', $current_version); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Setup some default options |
74 | 74 | $options = array(); |
75 | 75 | |
76 | 76 | // Checks if the Success Page option exists AND that the page exists |
77 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
77 | + if ( ! get_post(give_get_option('success_page'))) { |
|
78 | 78 | |
79 | 79 | // Purchase Confirmation (Success) Page |
80 | 80 | $success = wp_insert_post( |
81 | 81 | array( |
82 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
82 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
83 | 83 | 'post_content' => '[give_receipt]', |
84 | 84 | 'post_status' => 'publish', |
85 | 85 | 'post_author' => 1, |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // Checks if the Failure Page option exists AND that the page exists |
96 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
96 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
97 | 97 | |
98 | 98 | // Failed Purchase Page |
99 | 99 | $failed = wp_insert_post( |
100 | 100 | array( |
101 | - 'post_title' => esc_html__( 'Transaction Failed', 'give' ), |
|
102 | - 'post_content' => esc_html__( 'We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give' ), |
|
101 | + 'post_title' => esc_html__('Transaction Failed', 'give'), |
|
102 | + 'post_content' => esc_html__('We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give'), |
|
103 | 103 | 'post_status' => 'publish', |
104 | 104 | 'post_author' => 1, |
105 | 105 | 'post_type' => 'page', |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | // Checks if the History Page option exists AND that the page exists |
114 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
114 | + if ( ! get_post(give_get_option('history_page'))) { |
|
115 | 115 | // Purchase History (History) Page |
116 | 116 | $history = wp_insert_post( |
117 | 117 | array( |
118 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
118 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
119 | 119 | 'post_content' => '[donation_history]', |
120 | 120 | 'post_status' => 'publish', |
121 | 121 | 'post_author' => 1, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency |
131 | - if ( empty( $current_version ) ) { |
|
131 | + if (empty($current_version)) { |
|
132 | 132 | $options['base_country'] = 'US'; |
133 | 133 | $options['test_mode'] = 1; |
134 | 134 | $options['currency'] = 'USD'; |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // Populate some default values |
151 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
152 | - update_option( 'give_version', GIVE_VERSION ); |
|
151 | + update_option('give_settings', array_merge($give_options, $options)); |
|
152 | + update_option('give_version', GIVE_VERSION); |
|
153 | 153 | |
154 | 154 | //Update Version Number |
155 | - if ( $current_version ) { |
|
156 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
155 | + if ($current_version) { |
|
156 | + update_option('give_version_upgraded_from', $current_version); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // Create Give roles |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $roles->add_caps(); |
163 | 163 | |
164 | 164 | $api = new Give_API(); |
165 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
165 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
166 | 166 | |
167 | 167 | // Create the customers databases |
168 | 168 | @Give()->customers->create_table(); |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | Give()->session->use_php_sessions(); |
173 | 173 | |
174 | 174 | // Add a temporary option to note that Give pages have been created |
175 | - set_transient( '_give_installed', $options, 30 ); |
|
175 | + set_transient('_give_installed', $options, 30); |
|
176 | 176 | |
177 | - if ( ! $current_version ) { |
|
177 | + if ( ! $current_version) { |
|
178 | 178 | |
179 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
179 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
180 | 180 | |
181 | 181 | // When new upgrade routines are added, mark them as complete on fresh install |
182 | 182 | $upgrade_routines = array( |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | 'upgrade_give_offline_status' |
186 | 186 | ); |
187 | 187 | |
188 | - foreach ( $upgrade_routines as $upgrade ) { |
|
189 | - give_set_upgrade_complete( $upgrade ); |
|
188 | + foreach ($upgrade_routines as $upgrade) { |
|
189 | + give_set_upgrade_complete($upgrade); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | 193 | // Bail if activating from network, or bulk |
194 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
194 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | 198 | // Add the transient to redirect |
199 | - set_transient( '_give_activation_redirect', true, 30 ); |
|
199 | + set_transient('_give_activation_redirect', true, 30); |
|
200 | 200 | |
201 | 201 | } |
202 | 202 | |
203 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
203 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Network Activated New Site Setup. |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | * @param int $site_id The Site ID. |
217 | 217 | * @param array $meta Blog Meta. |
218 | 218 | */ |
219 | -function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
219 | +function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
220 | 220 | |
221 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
221 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
222 | 222 | |
223 | - switch_to_blog( $blog_id ); |
|
223 | + switch_to_blog($blog_id); |
|
224 | 224 | give_install(); |
225 | 225 | restore_current_blog(); |
226 | 226 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | } |
230 | 230 | |
231 | -add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 ); |
|
231 | +add_action('wpmu_new_blog', 'on_create_blog', 10, 6); |
|
232 | 232 | |
233 | 233 | |
234 | 234 | /** |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return array The tables to drop. |
243 | 243 | */ |
244 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
244 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
245 | 245 | |
246 | - switch_to_blog( $blog_id ); |
|
246 | + switch_to_blog($blog_id); |
|
247 | 247 | $customers_db = new Give_DB_Customers(); |
248 | 248 | $customer_meta_db = new Give_DB_Customer_Meta(); |
249 | 249 | |
250 | - if ( $customers_db->installed() ) { |
|
250 | + if ($customers_db->installed()) { |
|
251 | 251 | $tables[] = $customers_db->table_name; |
252 | 252 | $tables[] = $customer_meta_db->table_name; |
253 | 253 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | } |
259 | 259 | |
260 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
260 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
261 | 261 | |
262 | 262 | /** |
263 | 263 | * Post-installation |
@@ -269,16 +269,16 @@ discard block |
||
269 | 269 | */ |
270 | 270 | function give_after_install() { |
271 | 271 | |
272 | - if ( ! is_admin() ) { |
|
272 | + if ( ! is_admin()) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | - $give_options = get_transient( '_give_installed' ); |
|
277 | - $give_table_check = get_option( '_give_table_check', false ); |
|
276 | + $give_options = get_transient('_give_installed'); |
|
277 | + $give_table_check = get_option('_give_table_check', false); |
|
278 | 278 | |
279 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
279 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
280 | 280 | |
281 | - if ( ! @Give()->customer_meta->installed() ) { |
|
281 | + if ( ! @Give()->customer_meta->installed()) { |
|
282 | 282 | |
283 | 283 | // Create the customer meta database |
284 | 284 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -286,27 +286,27 @@ discard block |
||
286 | 286 | |
287 | 287 | } |
288 | 288 | |
289 | - if ( ! @Give()->customers->installed() ) { |
|
289 | + if ( ! @Give()->customers->installed()) { |
|
290 | 290 | // Create the customers database |
291 | 291 | // (this ensures it creates it on multisite instances where it is network activated). |
292 | 292 | @Give()->customers->create_table(); |
293 | 293 | |
294 | - do_action( 'give_after_install', $give_options ); |
|
294 | + do_action('give_after_install', $give_options); |
|
295 | 295 | } |
296 | 296 | |
297 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
297 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
298 | 298 | |
299 | 299 | } |
300 | 300 | |
301 | 301 | // Delete the transient |
302 | - if ( false !== $give_options ) { |
|
303 | - delete_transient( '_give_installed' ); |
|
302 | + if (false !== $give_options) { |
|
303 | + delete_transient('_give_installed'); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
307 | 307 | } |
308 | 308 | |
309 | -add_action( 'admin_init', 'give_after_install' ); |
|
309 | +add_action('admin_init', 'give_after_install'); |
|
310 | 310 | |
311 | 311 | |
312 | 312 | /** |
@@ -321,11 +321,11 @@ discard block |
||
321 | 321 | |
322 | 322 | global $wp_roles; |
323 | 323 | |
324 | - if ( ! is_object( $wp_roles ) ) { |
|
324 | + if ( ! is_object($wp_roles)) { |
|
325 | 325 | return; |
326 | 326 | } |
327 | 327 | |
328 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
328 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
329 | 329 | |
330 | 330 | // Create Give plugin roles |
331 | 331 | $roles = new Give_Roles(); |
@@ -336,4 +336,4 @@ discard block |
||
336 | 336 | |
337 | 337 | } |
338 | 338 | |
339 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
340 | 339 | \ No newline at end of file |
340 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
341 | 341 | \ No newline at end of file |
@@ -46,27 +46,27 @@ |
||
46 | 46 | * @param string $default_path (default: '') |
47 | 47 | */ |
48 | 48 | function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
49 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
50 | - extract( $args ); |
|
51 | - } |
|
49 | + if ( ! empty( $args ) && is_array( $args ) ) { |
|
50 | + extract( $args ); |
|
51 | + } |
|
52 | 52 | |
53 | - $template_names = array( $template_name . '.php' ); |
|
53 | + $template_names = array( $template_name . '.php' ); |
|
54 | 54 | |
55 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
55 | + $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
56 | 56 | |
57 | - if ( ! file_exists( $located ) ) { |
|
58 | - give_output_error( sprintf( __( 'Error: %s template does not find.', 'give' ), $located ), true ); |
|
59 | - return; |
|
60 | - } |
|
57 | + if ( ! file_exists( $located ) ) { |
|
58 | + give_output_error( sprintf( __( 'Error: %s template does not find.', 'give' ), $located ), true ); |
|
59 | + return; |
|
60 | + } |
|
61 | 61 | |
62 | - // Allow 3rd party plugin filter template file from their plugin. |
|
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
62 | + // Allow 3rd party plugin filter template file from their plugin. |
|
63 | + $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
64 | 64 | |
65 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
65 | + do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
66 | 66 | |
67 | - include( $located ); |
|
67 | + include( $located ); |
|
68 | 68 | |
69 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
69 | + do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function give_get_templates_dir() { |
24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function give_get_templates_url() { |
34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
34 | + return GIVE_PLUGIN_URL.'templates'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -45,28 +45,28 @@ discard block |
||
45 | 45 | * @param string $template_path (default: '') |
46 | 46 | * @param string $default_path (default: '') |
47 | 47 | */ |
48 | -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
49 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
50 | - extract( $args ); |
|
48 | +function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
49 | + if ( ! empty($args) && is_array($args)) { |
|
50 | + extract($args); |
|
51 | 51 | } |
52 | 52 | |
53 | - $template_names = array( $template_name . '.php' ); |
|
53 | + $template_names = array($template_name.'.php'); |
|
54 | 54 | |
55 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
55 | + $located = give_locate_template($template_names, $template_path, $default_path); |
|
56 | 56 | |
57 | - if ( ! file_exists( $located ) ) { |
|
58 | - give_output_error( sprintf( __( 'Error: %s template does not find.', 'give' ), $located ), true ); |
|
57 | + if ( ! file_exists($located)) { |
|
58 | + give_output_error(sprintf(__('Error: %s template does not find.', 'give'), $located), true); |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // Allow 3rd party plugin filter template file from their plugin. |
63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
63 | + $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path); |
|
64 | 64 | |
65 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
65 | + do_action('give_before_template_part', $template_name, $template_path, $located, $args); |
|
66 | 66 | |
67 | - include( $located ); |
|
67 | + include($located); |
|
68 | 68 | |
69 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
69 | + do_action('give_after_template_part', $template_name, $template_path, $located, $args); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -86,23 +86,23 @@ discard block |
||
86 | 86 | * @uses load_template() |
87 | 87 | * @uses get_template_part() |
88 | 88 | */ |
89 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
89 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
90 | 90 | |
91 | 91 | // Execute code for this part |
92 | - do_action( 'get_template_part_' . $slug, $slug, $name ); |
|
92 | + do_action('get_template_part_'.$slug, $slug, $name); |
|
93 | 93 | |
94 | 94 | // Setup possible parts |
95 | 95 | $templates = array(); |
96 | - if ( isset( $name ) ) { |
|
97 | - $templates[] = $slug . '-' . $name . '.php'; |
|
96 | + if (isset($name)) { |
|
97 | + $templates[] = $slug.'-'.$name.'.php'; |
|
98 | 98 | } |
99 | - $templates[] = $slug . '.php'; |
|
99 | + $templates[] = $slug.'.php'; |
|
100 | 100 | |
101 | 101 | // Allow template parts to be filtered |
102 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
102 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
103 | 103 | |
104 | 104 | // Return the part that is found |
105 | - return give_locate_template( $templates, $load, false ); |
|
105 | + return give_locate_template($templates, $load, false); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -123,37 +123,37 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string The template filename if one is located. |
125 | 125 | */ |
126 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
126 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
127 | 127 | // No file found yet |
128 | 128 | $located = false; |
129 | 129 | |
130 | 130 | // Try to find a template file |
131 | - foreach ( (array) $template_names as $template_name ) { |
|
131 | + foreach ((array) $template_names as $template_name) { |
|
132 | 132 | |
133 | 133 | // Continue if template is empty |
134 | - if ( empty( $template_name ) ) { |
|
134 | + if (empty($template_name)) { |
|
135 | 135 | continue; |
136 | 136 | } |
137 | 137 | |
138 | 138 | // Trim off any slashes from the template name |
139 | - $template_name = ltrim( $template_name, '/' ); |
|
139 | + $template_name = ltrim($template_name, '/'); |
|
140 | 140 | |
141 | 141 | // try locating this template file by looping through the template paths |
142 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
142 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
143 | 143 | |
144 | - if ( file_exists( $template_path . $template_name ) ) { |
|
145 | - $located = $template_path . $template_name; |
|
144 | + if (file_exists($template_path.$template_name)) { |
|
145 | + $located = $template_path.$template_name; |
|
146 | 146 | break; |
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - if ( $located ) { |
|
150 | + if ($located) { |
|
151 | 151 | break; |
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
156 | - load_template( $located, $require_once ); |
|
155 | + if ((true == $load) && ! empty($located)) { |
|
156 | + load_template($located, $require_once); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | return $located; |
@@ -170,17 +170,17 @@ discard block |
||
170 | 170 | $template_dir = give_get_theme_template_dir_name(); |
171 | 171 | |
172 | 172 | $file_paths = array( |
173 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
174 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
173 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
174 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
175 | 175 | 100 => give_get_templates_dir() |
176 | 176 | ); |
177 | 177 | |
178 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
178 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
179 | 179 | |
180 | 180 | // sort the file paths based on priority |
181 | - ksort( $file_paths, SORT_NUMERIC ); |
|
181 | + ksort($file_paths, SORT_NUMERIC); |
|
182 | 182 | |
183 | - return array_map( 'trailingslashit', $file_paths ); |
|
183 | + return array_map('trailingslashit', $file_paths); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return string |
193 | 193 | */ |
194 | 194 | function give_get_theme_template_dir_name() { |
195 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
195 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * @return void |
203 | 203 | */ |
204 | 204 | function give_version_in_header() { |
205 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
205 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
206 | 206 | } |
207 | 207 | |
208 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
208 | +add_action('wp_head', 'give_version_in_header'); |
|
209 | 209 | |
210 | 210 | /** |
211 | 211 | * Determines if we're currently on the Donations History page. |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | */ |
216 | 216 | function give_is_donation_history_page() { |
217 | 217 | |
218 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
218 | + $ret = is_page(give_get_option('history_page')); |
|
219 | 219 | |
220 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
220 | + return apply_filters('give_is_donation_history_page', $ret); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -229,25 +229,25 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return array Modified array of classes |
231 | 231 | */ |
232 | -function give_add_body_classes( $class ) { |
|
232 | +function give_add_body_classes($class) { |
|
233 | 233 | $classes = (array) $class; |
234 | 234 | |
235 | - if ( give_is_success_page() ) { |
|
235 | + if (give_is_success_page()) { |
|
236 | 236 | $classes[] = 'give-success'; |
237 | 237 | $classes[] = 'give-page'; |
238 | 238 | } |
239 | 239 | |
240 | - if ( give_is_failed_transaction_page() ) { |
|
240 | + if (give_is_failed_transaction_page()) { |
|
241 | 241 | $classes[] = 'give-failed-transaction'; |
242 | 242 | $classes[] = 'give-page'; |
243 | 243 | } |
244 | 244 | |
245 | - if ( give_is_donation_history_page() ) { |
|
245 | + if (give_is_donation_history_page()) { |
|
246 | 246 | $classes[] = 'give-donation-history'; |
247 | 247 | $classes[] = 'give-page'; |
248 | 248 | } |
249 | 249 | |
250 | - if ( give_is_test_mode() ) { |
|
250 | + if (give_is_test_mode()) { |
|
251 | 251 | $classes[] = 'give-test-mode'; |
252 | 252 | $classes[] = 'give-page'; |
253 | 253 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | //Theme-specific Classes used to prevent conflicts via CSS |
256 | 256 | $current_theme = wp_get_theme(); |
257 | 257 | |
258 | - switch ( $current_theme->template ) { |
|
258 | + switch ($current_theme->template) { |
|
259 | 259 | |
260 | 260 | case 'Divi': |
261 | 261 | $classes[] = 'give-divi'; |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | |
270 | 270 | } |
271 | 271 | |
272 | - return array_unique( $classes ); |
|
272 | + return array_unique($classes); |
|
273 | 273 | } |
274 | 274 | |
275 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
275 | +add_filter('body_class', 'give_add_body_classes'); |
|
276 | 276 | |
277 | 277 | |
278 | 278 | /** |
@@ -288,22 +288,22 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return array |
290 | 290 | */ |
291 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
292 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
291 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
292 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
293 | 293 | return $classes; |
294 | 294 | } |
295 | 295 | |
296 | 296 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
297 | 297 | |
298 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
299 | - unset( $classes[ $key ] ); |
|
298 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
299 | + unset($classes[$key]); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | return $classes; |
303 | 303 | } |
304 | 304 | |
305 | 305 | |
306 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
306 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
307 | 307 | |
308 | 308 | /** |
309 | 309 | * Get the placeholder image URL for forms etc |
@@ -313,85 +313,85 @@ discard block |
||
313 | 313 | */ |
314 | 314 | function give_get_placeholder_img_src() { |
315 | 315 | |
316 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
316 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
317 | 317 | |
318 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
318 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | |
322 | 322 | /** |
323 | 323 | * Global |
324 | 324 | */ |
325 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
325 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Output the start of the page wrapper. |
329 | 329 | */ |
330 | 330 | function give_output_content_wrapper() { |
331 | - give_get_template_part( 'global/wrapper-start' ); |
|
331 | + give_get_template_part('global/wrapper-start'); |
|
332 | 332 | } |
333 | 333 | } |
334 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
334 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
335 | 335 | |
336 | 336 | /** |
337 | 337 | * Output the end of the page wrapper. |
338 | 338 | */ |
339 | 339 | function give_output_content_wrapper_end() { |
340 | - give_get_template_part( 'global/wrapper-end' ); |
|
340 | + give_get_template_part('global/wrapper-end'); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Single Give Form |
346 | 346 | */ |
347 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
347 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
348 | 348 | function give_left_sidebar_pre_wrap() { |
349 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
349 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
353 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
353 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
354 | 354 | function give_left_sidebar_post_wrap() { |
355 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
355 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
359 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
359 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
360 | 360 | function give_get_forms_sidebar() { |
361 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
361 | + give_get_template_part('single-give-form/sidebar'); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
365 | +if ( ! function_exists('give_show_form_images')) { |
|
366 | 366 | |
367 | 367 | /** |
368 | 368 | * Output the product image before the single product summary. |
369 | 369 | */ |
370 | 370 | function give_show_form_images() { |
371 | - $featured_image_option = give_get_option( 'disable_form_featured_img' ); |
|
372 | - if ( $featured_image_option !== 'on' ) { |
|
373 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
371 | + $featured_image_option = give_get_option('disable_form_featured_img'); |
|
372 | + if ($featured_image_option !== 'on') { |
|
373 | + give_get_template_part('single-give-form/featured-image'); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
378 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
378 | +if ( ! function_exists('give_template_single_title')) { |
|
379 | 379 | |
380 | 380 | /** |
381 | 381 | * Output the product title. |
382 | 382 | */ |
383 | 383 | function give_template_single_title() { |
384 | - give_get_template_part( 'single-give-form/title' ); |
|
384 | + give_get_template_part('single-give-form/title'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
388 | +if ( ! function_exists('give_show_avatars')) { |
|
389 | 389 | |
390 | 390 | /** |
391 | 391 | * Output the product title. |
392 | 392 | */ |
393 | 393 | function give_show_avatars() { |
394 | - echo do_shortcode( '[give_donators_gravatars]' ); |
|
394 | + echo do_shortcode('[give_donators_gravatars]'); |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * Conditional Functions |
400 | 400 | */ |
401 | 401 | |
402 | -if ( ! function_exists( 'is_give_form' ) ) { |
|
402 | +if ( ! function_exists('is_give_form')) { |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * is_give_form |
@@ -411,11 +411,11 @@ discard block |
||
411 | 411 | * @return bool |
412 | 412 | */ |
413 | 413 | function is_give_form() { |
414 | - return is_singular( array( 'give_form' ) ); |
|
414 | + return is_singular(array('give_form')); |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
418 | -if ( ! function_exists( 'is_give_category' ) ) { |
|
418 | +if ( ! function_exists('is_give_category')) { |
|
419 | 419 | |
420 | 420 | /** |
421 | 421 | * is_give_category |
@@ -430,12 +430,12 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @return bool |
432 | 432 | */ |
433 | - function is_give_category( $term = '' ) { |
|
434 | - return is_tax( 'give_forms_category', $term ); |
|
433 | + function is_give_category($term = '') { |
|
434 | + return is_tax('give_forms_category', $term); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | |
438 | -if ( ! function_exists( 'is_give_tag' ) ) { |
|
438 | +if ( ! function_exists('is_give_tag')) { |
|
439 | 439 | |
440 | 440 | /** |
441 | 441 | * is_give_tag |
@@ -450,12 +450,12 @@ discard block |
||
450 | 450 | * |
451 | 451 | * @return bool |
452 | 452 | */ |
453 | - function is_give_tag( $term = '' ) { |
|
454 | - return is_tax( 'give_forms_tag', $term ); |
|
453 | + function is_give_tag($term = '') { |
|
454 | + return is_tax('give_forms_tag', $term); |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | |
458 | -if ( ! function_exists( 'is_give_taxonomy' ) ) { |
|
458 | +if ( ! function_exists('is_give_taxonomy')) { |
|
459 | 459 | |
460 | 460 | /** |
461 | 461 | * is_give_taxonomy |
@@ -467,6 +467,6 @@ discard block |
||
467 | 467 | * @return bool |
468 | 468 | */ |
469 | 469 | function is_give_taxonomy() { |
470 | - return is_tax( get_object_taxonomies( 'give_form' ) ); |
|
470 | + return is_tax(get_object_taxonomies('give_form')); |
|
471 | 471 | } |
472 | 472 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string $output Give transactions dropdown |
35 | 35 | */ |
36 | - public function transactions_dropdown( $args = array() ) { |
|
36 | + public function transactions_dropdown($args = array()) { |
|
37 | 37 | |
38 | 38 | $defaults = array( |
39 | 39 | 'name' => 'transactions', |
@@ -44,36 +44,36 @@ discard block |
||
44 | 44 | 'chosen' => false, |
45 | 45 | 'number' => 30, |
46 | 46 | /* translators: %s: transaction singular label */ |
47 | - 'placeholder' => esc_html__( 'Select a transaction', 'give' ) |
|
47 | + 'placeholder' => esc_html__('Select a transaction', 'give') |
|
48 | 48 | ); |
49 | 49 | |
50 | - $args = wp_parse_args( $args, $defaults ); |
|
50 | + $args = wp_parse_args($args, $defaults); |
|
51 | 51 | |
52 | 52 | |
53 | - $payments = new Give_Payments_Query( array( |
|
53 | + $payments = new Give_Payments_Query(array( |
|
54 | 54 | 'number' => $args['number'] |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | $payments = $payments->get_payments(); |
58 | 58 | |
59 | 59 | $options = array(); |
60 | 60 | |
61 | 61 | //Provide nice human readable options. |
62 | - if ( $payments ) { |
|
62 | + if ($payments) { |
|
63 | 63 | $options[0] = |
64 | 64 | /* translators: %s: transaction singular label */ |
65 | - esc_html__( 'Select a transaction', 'give' ); |
|
66 | - foreach ( $payments as $payment ) { |
|
65 | + esc_html__('Select a transaction', 'give'); |
|
66 | + foreach ($payments as $payment) { |
|
67 | 67 | |
68 | - $options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title); |
|
68 | + $options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | } else { |
72 | - $options[0] = esc_html__( 'No Transactions Found', 'give' ); |
|
72 | + $options[0] = esc_html__('No Transactions Found', 'give'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | - $output = $this->select( array( |
|
76 | + $output = $this->select(array( |
|
77 | 77 | 'name' => $args['name'], |
78 | 78 | 'selected' => $args['selected'], |
79 | 79 | 'id' => $args['id'], |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | 'select_atts' => $args['select_atts'], |
86 | 86 | 'show_option_all' => false, |
87 | 87 | 'show_option_none' => false |
88 | - ) ); |
|
88 | + )); |
|
89 | 89 | |
90 | 90 | return $output; |
91 | 91 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return string $output Give forms dropdown |
102 | 102 | */ |
103 | - public function forms_dropdown( $args = array() ) { |
|
103 | + public function forms_dropdown($args = array()) { |
|
104 | 104 | |
105 | 105 | $defaults = array( |
106 | 106 | 'name' => 'forms', |
@@ -111,47 +111,47 @@ discard block |
||
111 | 111 | 'chosen' => false, |
112 | 112 | 'number' => 30, |
113 | 113 | /* translators: %s: form singular label */ |
114 | - 'placeholder' => sprintf( esc_html__( 'Select a %s', 'give' ), give_get_forms_label_singular() ) |
|
114 | + 'placeholder' => sprintf(esc_html__('Select a %s', 'give'), give_get_forms_label_singular()) |
|
115 | 115 | ); |
116 | 116 | |
117 | - $args = wp_parse_args( $args, $defaults ); |
|
117 | + $args = wp_parse_args($args, $defaults); |
|
118 | 118 | |
119 | - $forms = get_posts( array( |
|
119 | + $forms = get_posts(array( |
|
120 | 120 | 'post_type' => 'give_forms', |
121 | 121 | 'orderby' => 'title', |
122 | 122 | 'order' => 'ASC', |
123 | 123 | 'posts_per_page' => $args['number'] |
124 | - ) ); |
|
124 | + )); |
|
125 | 125 | |
126 | 126 | $options = array(); |
127 | 127 | |
128 | - if ( $forms ) { |
|
128 | + if ($forms) { |
|
129 | 129 | $options[0] = sprintf( |
130 | 130 | /* translators: %s: form singular label */ |
131 | - esc_html__( 'Select a %s', 'give' ), |
|
131 | + esc_html__('Select a %s', 'give'), |
|
132 | 132 | give_get_forms_label_singular() |
133 | 133 | ); |
134 | - foreach ( $forms as $form ) { |
|
135 | - $options[ absint( $form->ID ) ] = esc_html( $form->post_title ); |
|
134 | + foreach ($forms as $form) { |
|
135 | + $options[absint($form->ID)] = esc_html($form->post_title); |
|
136 | 136 | } |
137 | 137 | } else { |
138 | - $options[0] = esc_html__( 'No Give Donation Forms Found', 'give' ); |
|
138 | + $options[0] = esc_html__('No Give Donation Forms Found', 'give'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | // This ensures that any selected forms are included in the drop down |
142 | - if ( is_array( $args['selected'] ) ) { |
|
143 | - foreach ( $args['selected'] as $item ) { |
|
144 | - if ( ! in_array( $item, $options ) ) { |
|
145 | - $options[ $item ] = get_the_title( $item ); |
|
142 | + if (is_array($args['selected'])) { |
|
143 | + foreach ($args['selected'] as $item) { |
|
144 | + if ( ! in_array($item, $options)) { |
|
145 | + $options[$item] = get_the_title($item); |
|
146 | 146 | } |
147 | 147 | } |
148 | - } elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) { |
|
149 | - if ( ! in_array( $args['selected'], $options ) ) { |
|
150 | - $options[ $args['selected'] ] = get_the_title( $args['selected'] ); |
|
148 | + } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) { |
|
149 | + if ( ! in_array($args['selected'], $options)) { |
|
150 | + $options[$args['selected']] = get_the_title($args['selected']); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - $output = $this->select( array( |
|
154 | + $output = $this->select(array( |
|
155 | 155 | 'name' => $args['name'], |
156 | 156 | 'selected' => $args['selected'], |
157 | 157 | 'id' => $args['id'], |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'placeholder' => $args['placeholder'], |
163 | 163 | 'show_option_all' => false, |
164 | 164 | 'show_option_none' => false |
165 | - ) ); |
|
165 | + )); |
|
166 | 166 | |
167 | 167 | return $output; |
168 | 168 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return string $output Donor dropdown |
179 | 179 | */ |
180 | - public function donor_dropdown( $args = array() ) { |
|
180 | + public function donor_dropdown($args = array()) { |
|
181 | 181 | |
182 | 182 | $defaults = array( |
183 | 183 | 'name' => 'customers', |
@@ -186,38 +186,38 @@ discard block |
||
186 | 186 | 'multiple' => false, |
187 | 187 | 'selected' => 0, |
188 | 188 | 'chosen' => true, |
189 | - 'placeholder' => esc_attr__( 'Select a Donor', 'give' ), |
|
189 | + 'placeholder' => esc_attr__('Select a Donor', 'give'), |
|
190 | 190 | 'number' => 30 |
191 | 191 | ); |
192 | 192 | |
193 | - $args = wp_parse_args( $args, $defaults ); |
|
193 | + $args = wp_parse_args($args, $defaults); |
|
194 | 194 | |
195 | - $customers = Give()->customers->get_customers( array( |
|
195 | + $customers = Give()->customers->get_customers(array( |
|
196 | 196 | 'number' => $args['number'] |
197 | - ) ); |
|
197 | + )); |
|
198 | 198 | |
199 | 199 | $options = array(); |
200 | 200 | |
201 | - if ( $customers ) { |
|
202 | - $options[0] = esc_html__( 'No donor attached', 'give' ); |
|
203 | - foreach ( $customers as $customer ) { |
|
204 | - $options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
201 | + if ($customers) { |
|
202 | + $options[0] = esc_html__('No donor attached', 'give'); |
|
203 | + foreach ($customers as $customer) { |
|
204 | + $options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')'); |
|
205 | 205 | } |
206 | 206 | } else { |
207 | - $options[0] = esc_html__( 'No donors found', 'give' ); |
|
207 | + $options[0] = esc_html__('No donors found', 'give'); |
|
208 | 208 | } |
209 | 209 | |
210 | - if ( ! empty( $args['selected'] ) ) { |
|
210 | + if ( ! empty($args['selected'])) { |
|
211 | 211 | |
212 | 212 | // If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed. |
213 | 213 | |
214 | - if ( ! array_key_exists( $args['selected'], $options ) ) { |
|
214 | + if ( ! array_key_exists($args['selected'], $options)) { |
|
215 | 215 | |
216 | - $customer = new Give_Customer( $args['selected'] ); |
|
216 | + $customer = new Give_Customer($args['selected']); |
|
217 | 217 | |
218 | - if ( $customer ) { |
|
218 | + if ($customer) { |
|
219 | 219 | |
220 | - $options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
220 | + $options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')'); |
|
221 | 221 | |
222 | 222 | } |
223 | 223 | |
@@ -225,17 +225,17 @@ discard block |
||
225 | 225 | |
226 | 226 | } |
227 | 227 | |
228 | - $output = $this->select( array( |
|
228 | + $output = $this->select(array( |
|
229 | 229 | 'name' => $args['name'], |
230 | 230 | 'selected' => $args['selected'], |
231 | 231 | 'id' => $args['id'], |
232 | - 'class' => $args['class'] . ' give-customer-select', |
|
232 | + 'class' => $args['class'].' give-customer-select', |
|
233 | 233 | 'options' => $options, |
234 | 234 | 'multiple' => $args['multiple'], |
235 | 235 | 'chosen' => $args['chosen'], |
236 | 236 | 'show_option_all' => false, |
237 | 237 | 'show_option_none' => false |
238 | - ) ); |
|
238 | + )); |
|
239 | 239 | |
240 | 240 | return $output; |
241 | 241 | } |
@@ -252,21 +252,21 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return string $output Category dropdown. |
254 | 254 | */ |
255 | - public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) { |
|
256 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
255 | + public function category_dropdown($name = 'give_forms_categories', $selected = 0) { |
|
256 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
257 | 257 | $options = array(); |
258 | 258 | |
259 | - foreach ( $categories as $category ) { |
|
260 | - $options[ absint( $category->term_id ) ] = esc_html( $category->name ); |
|
259 | + foreach ($categories as $category) { |
|
260 | + $options[absint($category->term_id)] = esc_html($category->name); |
|
261 | 261 | } |
262 | 262 | |
263 | - $output = $this->select( array( |
|
263 | + $output = $this->select(array( |
|
264 | 264 | 'name' => $name, |
265 | 265 | 'selected' => $selected, |
266 | 266 | 'options' => $options, |
267 | - 'show_option_all' => esc_html__( 'All Categories', 'give' ), |
|
267 | + 'show_option_all' => esc_html__('All Categories', 'give'), |
|
268 | 268 | 'show_option_none' => false |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | |
271 | 271 | return $output; |
272 | 272 | } |
@@ -284,25 +284,25 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return string $output Year dropdown. |
286 | 286 | */ |
287 | - public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) { |
|
288 | - $current = date( 'Y' ); |
|
289 | - $start_year = $current - absint( $years_before ); |
|
290 | - $end_year = $current + absint( $years_after ); |
|
291 | - $selected = empty( $selected ) ? date( 'Y' ) : $selected; |
|
287 | + public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) { |
|
288 | + $current = date('Y'); |
|
289 | + $start_year = $current - absint($years_before); |
|
290 | + $end_year = $current + absint($years_after); |
|
291 | + $selected = empty($selected) ? date('Y') : $selected; |
|
292 | 292 | $options = array(); |
293 | 293 | |
294 | - while ( $start_year <= $end_year ) { |
|
295 | - $options[ absint( $start_year ) ] = $start_year; |
|
296 | - $start_year ++; |
|
294 | + while ($start_year <= $end_year) { |
|
295 | + $options[absint($start_year)] = $start_year; |
|
296 | + $start_year++; |
|
297 | 297 | } |
298 | 298 | |
299 | - $output = $this->select( array( |
|
299 | + $output = $this->select(array( |
|
300 | 300 | 'name' => $name, |
301 | 301 | 'selected' => $selected, |
302 | 302 | 'options' => $options, |
303 | 303 | 'show_option_all' => false, |
304 | 304 | 'show_option_none' => false |
305 | - ) ); |
|
305 | + )); |
|
306 | 306 | |
307 | 307 | return $output; |
308 | 308 | } |
@@ -319,23 +319,23 @@ discard block |
||
319 | 319 | * |
320 | 320 | * @return string $output Month dropdown. |
321 | 321 | */ |
322 | - public function month_dropdown( $name = 'month', $selected = 0 ) { |
|
322 | + public function month_dropdown($name = 'month', $selected = 0) { |
|
323 | 323 | $month = 1; |
324 | 324 | $options = array(); |
325 | - $selected = empty( $selected ) ? date( 'n' ) : $selected; |
|
325 | + $selected = empty($selected) ? date('n') : $selected; |
|
326 | 326 | |
327 | - while ( $month <= 12 ) { |
|
328 | - $options[ absint( $month ) ] = give_month_num_to_name( $month ); |
|
329 | - $month ++; |
|
327 | + while ($month <= 12) { |
|
328 | + $options[absint($month)] = give_month_num_to_name($month); |
|
329 | + $month++; |
|
330 | 330 | } |
331 | 331 | |
332 | - $output = $this->select( array( |
|
332 | + $output = $this->select(array( |
|
333 | 333 | 'name' => $name, |
334 | 334 | 'selected' => $selected, |
335 | 335 | 'options' => $options, |
336 | 336 | 'show_option_all' => false, |
337 | 337 | 'show_option_none' => false |
338 | - ) ); |
|
338 | + )); |
|
339 | 339 | |
340 | 340 | return $output; |
341 | 341 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @return string |
352 | 352 | */ |
353 | - public function select( $args = array() ) { |
|
353 | + public function select($args = array()) { |
|
354 | 354 | $defaults = array( |
355 | 355 | 'options' => array(), |
356 | 356 | 'name' => null, |
@@ -361,61 +361,61 @@ discard block |
||
361 | 361 | 'placeholder' => null, |
362 | 362 | 'multiple' => false, |
363 | 363 | 'select_atts' => false, |
364 | - 'show_option_all' => esc_html__( 'All', 'give' ), |
|
365 | - 'show_option_none' => esc_html__( 'None', 'give' ) |
|
364 | + 'show_option_all' => esc_html__('All', 'give'), |
|
365 | + 'show_option_none' => esc_html__('None', 'give') |
|
366 | 366 | ); |
367 | 367 | |
368 | - $args = wp_parse_args( $args, $defaults ); |
|
368 | + $args = wp_parse_args($args, $defaults); |
|
369 | 369 | |
370 | 370 | |
371 | - if ( $args['multiple'] ) { |
|
371 | + if ($args['multiple']) { |
|
372 | 372 | $multiple = ' MULTIPLE'; |
373 | 373 | } else { |
374 | 374 | $multiple = ''; |
375 | 375 | } |
376 | 376 | |
377 | - if ( $args['chosen'] ) { |
|
377 | + if ($args['chosen']) { |
|
378 | 378 | $args['class'] .= ' give-select-chosen'; |
379 | 379 | } |
380 | 380 | |
381 | - if ( $args['placeholder'] ) { |
|
381 | + if ($args['placeholder']) { |
|
382 | 382 | $placeholder = $args['placeholder']; |
383 | 383 | } else { |
384 | 384 | $placeholder = ''; |
385 | 385 | } |
386 | 386 | |
387 | 387 | |
388 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '">'; |
|
388 | + $output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'">'; |
|
389 | 389 | |
390 | - if ( $args['show_option_all'] ) { |
|
391 | - if ( $args['multiple'] ) { |
|
392 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
390 | + if ($args['show_option_all']) { |
|
391 | + if ($args['multiple']) { |
|
392 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
393 | 393 | } else { |
394 | - $selected = selected( $args['selected'], 0, false ); |
|
394 | + $selected = selected($args['selected'], 0, false); |
|
395 | 395 | } |
396 | - $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>'; |
|
396 | + $output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>'; |
|
397 | 397 | } |
398 | 398 | |
399 | - if ( ! empty( $args['options'] ) ) { |
|
399 | + if ( ! empty($args['options'])) { |
|
400 | 400 | |
401 | - if ( $args['show_option_none'] ) { |
|
402 | - if ( $args['multiple'] ) { |
|
403 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
401 | + if ($args['show_option_none']) { |
|
402 | + if ($args['multiple']) { |
|
403 | + $selected = selected(true, in_array( -1, $args['selected'] ), false); |
|
404 | 404 | } else { |
405 | - $selected = selected( $args['selected'], - 1, false ); |
|
405 | + $selected = selected($args['selected'], - 1, false); |
|
406 | 406 | } |
407 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
407 | + $output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>'; |
|
408 | 408 | } |
409 | 409 | |
410 | - foreach ( $args['options'] as $key => $option ) { |
|
410 | + foreach ($args['options'] as $key => $option) { |
|
411 | 411 | |
412 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
413 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
412 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
413 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
414 | 414 | } else { |
415 | - $selected = selected( $args['selected'], $key, false ); |
|
415 | + $selected = selected($args['selected'], $key, false); |
|
416 | 416 | } |
417 | 417 | |
418 | - $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
|
418 | + $output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>'; |
|
419 | 419 | } |
420 | 420 | } |
421 | 421 | |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * |
435 | 435 | * @return string |
436 | 436 | */ |
437 | - public function checkbox( $args = array() ) { |
|
437 | + public function checkbox($args = array()) { |
|
438 | 438 | $defaults = array( |
439 | 439 | 'name' => null, |
440 | 440 | 'current' => null, |
@@ -445,16 +445,16 @@ discard block |
||
445 | 445 | ) |
446 | 446 | ); |
447 | 447 | |
448 | - $args = wp_parse_args( $args, $defaults ); |
|
448 | + $args = wp_parse_args($args, $defaults); |
|
449 | 449 | |
450 | 450 | $options = ''; |
451 | - if ( ! empty( $args['options']['disabled'] ) ) { |
|
451 | + if ( ! empty($args['options']['disabled'])) { |
|
452 | 452 | $options .= ' disabled="disabled"'; |
453 | - } elseif ( ! empty( $args['options']['readonly'] ) ) { |
|
453 | + } elseif ( ! empty($args['options']['readonly'])) { |
|
454 | 454 | $options .= ' readonly'; |
455 | 455 | } |
456 | 456 | |
457 | - $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />'; |
|
457 | + $output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />'; |
|
458 | 458 | |
459 | 459 | return $output; |
460 | 460 | } |
@@ -469,22 +469,22 @@ discard block |
||
469 | 469 | * |
470 | 470 | * @return string Text field. |
471 | 471 | */ |
472 | - public function text( $args = array() ) { |
|
472 | + public function text($args = array()) { |
|
473 | 473 | // Backwards compatibility |
474 | - if ( func_num_args() > 1 ) { |
|
474 | + if (func_num_args() > 1) { |
|
475 | 475 | $args = func_get_args(); |
476 | 476 | |
477 | 477 | $name = $args[0]; |
478 | - $value = isset( $args[1] ) ? $args[1] : ''; |
|
479 | - $label = isset( $args[2] ) ? $args[2] : ''; |
|
480 | - $desc = isset( $args[3] ) ? $args[3] : ''; |
|
478 | + $value = isset($args[1]) ? $args[1] : ''; |
|
479 | + $label = isset($args[2]) ? $args[2] : ''; |
|
480 | + $desc = isset($args[3]) ? $args[3] : ''; |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | $defaults = array( |
484 | - 'name' => isset( $name ) ? $name : 'text', |
|
485 | - 'value' => isset( $value ) ? $value : null, |
|
486 | - 'label' => isset( $label ) ? $label : null, |
|
487 | - 'desc' => isset( $desc ) ? $desc : null, |
|
484 | + 'name' => isset($name) ? $name : 'text', |
|
485 | + 'value' => isset($value) ? $value : null, |
|
486 | + 'label' => isset($label) ? $label : null, |
|
487 | + 'desc' => isset($desc) ? $desc : null, |
|
488 | 488 | 'placeholder' => '', |
489 | 489 | 'class' => 'regular-text', |
490 | 490 | 'disabled' => false, |
@@ -492,29 +492,29 @@ discard block |
||
492 | 492 | 'data' => false |
493 | 493 | ); |
494 | 494 | |
495 | - $args = wp_parse_args( $args, $defaults ); |
|
495 | + $args = wp_parse_args($args, $defaults); |
|
496 | 496 | |
497 | 497 | $disabled = ''; |
498 | - if ( $args['disabled'] ) { |
|
498 | + if ($args['disabled']) { |
|
499 | 499 | $disabled = ' disabled="disabled"'; |
500 | 500 | } |
501 | 501 | |
502 | 502 | $data = ''; |
503 | - if ( ! empty( $args['data'] ) ) { |
|
504 | - foreach ( $args['data'] as $key => $value ) { |
|
505 | - $data .= 'data-' . $key . '="' . $value . '" '; |
|
503 | + if ( ! empty($args['data'])) { |
|
504 | + foreach ($args['data'] as $key => $value) { |
|
505 | + $data .= 'data-'.$key.'="'.$value.'" '; |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
509 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
509 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
510 | 510 | |
511 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
511 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
512 | 512 | |
513 | - if ( ! empty( $args['desc'] ) ) { |
|
514 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
513 | + if ( ! empty($args['desc'])) { |
|
514 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
515 | 515 | } |
516 | 516 | |
517 | - $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>'; |
|
517 | + $output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>'; |
|
518 | 518 | |
519 | 519 | $output .= '</span>'; |
520 | 520 | |
@@ -531,15 +531,15 @@ discard block |
||
531 | 531 | * |
532 | 532 | * @return string Datepicker field. |
533 | 533 | */ |
534 | - public function date_field( $args = array() ) { |
|
534 | + public function date_field($args = array()) { |
|
535 | 535 | |
536 | - if ( empty( $args['class'] ) ) { |
|
536 | + if (empty($args['class'])) { |
|
537 | 537 | $args['class'] = 'give_datepicker'; |
538 | - } elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) { |
|
538 | + } elseif ( ! strpos($args['class'], 'give_datepicker')) { |
|
539 | 539 | $args['class'] .= ' give_datepicker'; |
540 | 540 | } |
541 | 541 | |
542 | - return $this->text( $args ); |
|
542 | + return $this->text($args); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * |
554 | 554 | * @return string textarea |
555 | 555 | */ |
556 | - public function textarea( $args = array() ) { |
|
556 | + public function textarea($args = array()) { |
|
557 | 557 | $defaults = array( |
558 | 558 | 'name' => 'textarea', |
559 | 559 | 'value' => null, |
@@ -563,21 +563,21 @@ discard block |
||
563 | 563 | 'disabled' => false |
564 | 564 | ); |
565 | 565 | |
566 | - $args = wp_parse_args( $args, $defaults ); |
|
566 | + $args = wp_parse_args($args, $defaults); |
|
567 | 567 | |
568 | 568 | $disabled = ''; |
569 | - if ( $args['disabled'] ) { |
|
569 | + if ($args['disabled']) { |
|
570 | 570 | $disabled = ' disabled="disabled"'; |
571 | 571 | } |
572 | 572 | |
573 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
573 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
574 | 574 | |
575 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
575 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
576 | 576 | |
577 | - $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>'; |
|
577 | + $output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>'; |
|
578 | 578 | |
579 | - if ( ! empty( $args['desc'] ) ) { |
|
580 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
579 | + if ( ! empty($args['desc'])) { |
|
580 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | $output .= '</span>'; |
@@ -595,12 +595,12 @@ discard block |
||
595 | 595 | * |
596 | 596 | * @return string text field with ajax search. |
597 | 597 | */ |
598 | - public function ajax_user_search( $args = array() ) { |
|
598 | + public function ajax_user_search($args = array()) { |
|
599 | 599 | |
600 | 600 | $defaults = array( |
601 | 601 | 'name' => 'user_id', |
602 | 602 | 'value' => null, |
603 | - 'placeholder' => esc_attr__( 'Enter username', 'give' ), |
|
603 | + 'placeholder' => esc_attr__('Enter username', 'give'), |
|
604 | 604 | 'label' => null, |
605 | 605 | 'desc' => null, |
606 | 606 | 'class' => '', |
@@ -609,13 +609,13 @@ discard block |
||
609 | 609 | 'data' => false |
610 | 610 | ); |
611 | 611 | |
612 | - $args = wp_parse_args( $args, $defaults ); |
|
612 | + $args = wp_parse_args($args, $defaults); |
|
613 | 613 | |
614 | - $args['class'] = 'give-ajax-user-search ' . $args['class']; |
|
614 | + $args['class'] = 'give-ajax-user-search '.$args['class']; |
|
615 | 615 | |
616 | 616 | $output = '<span class="give_user_search_wrap">'; |
617 | - $output .= $this->text( $args ); |
|
618 | - $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="' . esc_attr__( 'Cancel', 'give' ) . '" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>'; |
|
617 | + $output .= $this->text($args); |
|
618 | + $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="'.esc_attr__('Cancel', 'give').'" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>'; |
|
619 | 619 | $output .= '</span>'; |
620 | 620 | |
621 | 621 | return $output; |
@@ -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 | - esc_html__( 'Welcome to Give', 'give' ), |
|
55 | - esc_html__( 'Welcome to Give', 'give' ), |
|
54 | + esc_html__('Welcome to Give', 'give'), |
|
55 | + esc_html__('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 | - esc_html__( 'Give Changelog', 'give' ), |
|
64 | - esc_html__( 'Give Changelog', 'give' ), |
|
63 | + esc_html__('Give Changelog', 'give'), |
|
64 | + esc_html__('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 | - esc_html__( 'Getting started with Give', 'give' ), |
|
73 | - esc_html__( 'Getting started with Give', 'give' ), |
|
72 | + esc_html__('Getting started with Give', 'give'), |
|
73 | + esc_html__('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 | - esc_html__( 'The people that build Give', 'give' ), |
|
82 | - esc_html__( 'The people that build Give', 'give' ), |
|
81 | + esc_html__('The people that build Give', 'give'), |
|
82 | + esc_html__('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 | <h2 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 esc_html_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 esc_html_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 esc_html_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 esc_html_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 esc_html_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 esc_html_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 esc_html_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 esc_html_e('Add-ons', 'give'); ?> |
|
232 | 232 | </a> |
233 | 233 | </h2> |
234 | 234 | <?php |
@@ -242,13 +242,13 @@ 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 | 248 | <h1 class="welcome-h1"><?php |
249 | 249 | printf( |
250 | 250 | /* translators: %s: Give version */ |
251 | - esc_html__( 'Welcome to Give %s', 'give' ), |
|
251 | + esc_html__('Welcome to Give %s', 'give'), |
|
252 | 252 | $display_version |
253 | 253 | ); |
254 | 254 | ?></h1> |
@@ -258,20 +258,20 @@ discard block |
||
258 | 258 | <p class="about-text"><?php |
259 | 259 | printf( |
260 | 260 | /* translators: 1: https://givewp.com/documenation/ 2: title attribute text */ |
261 | - __( '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="%1$s" title="%2$s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
262 | - esc_url( 'https://givewp.com/documenation/' ), |
|
263 | - esc_attr__( 'View the Give plugin documentation online', 'give' ) |
|
261 | + __('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="%1$s" title="%2$s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
262 | + esc_url('https://givewp.com/documenation/'), |
|
263 | + esc_attr__('View the Give plugin documentation online', 'give') |
|
264 | 264 | ); |
265 | 265 | ?></p> |
266 | 266 | |
267 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
267 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
268 | 268 | |
269 | 269 | <?php give_get_newsletter() ?> |
270 | 270 | |
271 | 271 | <div class="give-badge"><?php |
272 | 272 | printf( |
273 | 273 | /* translators: %s: Give version */ |
274 | - esc_html__( 'Version %s', 'give' ), |
|
274 | + esc_html__('Version %s', 'give'), |
|
275 | 275 | $display_version |
276 | 276 | ); |
277 | 277 | ?></div> |
@@ -281,15 +281,15 @@ discard block |
||
281 | 281 | <div class="feature-section clearfix introduction"> |
282 | 282 | |
283 | 283 | <div class="video feature-section-item"> |
284 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form"> |
|
284 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form"> |
|
285 | 285 | |
286 | 286 | </div> |
287 | 287 | |
288 | 288 | <div class="content feature-section-item last-feature"> |
289 | 289 | |
290 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
290 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
291 | 291 | |
292 | - <p><?php esc_html_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> |
|
292 | + <p><?php esc_html_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> |
|
293 | 293 | <a href="https://givewp.com" target="_blank" class="button-secondary" title="Visit the Give Website">Learn More |
294 | 294 | <span class="dashicons dashicons-external"></span></a> |
295 | 295 | |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | |
303 | 303 | <div class="content feature-section-item"> |
304 | 304 | |
305 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
305 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
306 | 306 | |
307 | - <p><?php esc_html_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> |
|
307 | + <p><?php esc_html_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> |
|
308 | 308 | <a href="https://givewp.com/documentation" target="_blank" class="button-secondary" title="Visit the Give Website">View Documentation |
309 | 309 | <span class="dashicons dashicons-external"></span></a> |
310 | 310 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | <div class="content feature-section-item last-feature"> |
314 | 314 | |
315 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give"> |
|
315 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give"> |
|
316 | 316 | |
317 | 317 | </div> |
318 | 318 | |
@@ -332,22 +332,22 @@ discard block |
||
332 | 332 | * @return void |
333 | 333 | */ |
334 | 334 | public function changelog_screen() { |
335 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
335 | + list($display_version) = explode('-', GIVE_VERSION); |
|
336 | 336 | ?> |
337 | 337 | <div class="wrap about-wrap"> |
338 | - <h1><?php esc_html_e( 'Give Changelog', 'give' ); ?></h1> |
|
338 | + <h1><?php esc_html_e('Give Changelog', 'give'); ?></h1> |
|
339 | 339 | |
340 | 340 | <p class="about-text"><?php |
341 | 341 | printf( |
342 | 342 | /* translators: %s: Give version */ |
343 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
343 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
344 | 344 | $display_version |
345 | 345 | ); |
346 | 346 | ?></p> |
347 | 347 | <div class="give-badge"><?php |
348 | 348 | printf( |
349 | 349 | /* translators: %s: Give version */ |
350 | - esc_html__( 'Version %s', 'give' ), |
|
350 | + esc_html__('Version %s', 'give'), |
|
351 | 351 | $display_version |
352 | 352 | ); |
353 | 353 | ?></div> |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | <?php $this->tabs(); ?> |
356 | 356 | |
357 | 357 | <div class="changelog"> |
358 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
358 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
359 | 359 | |
360 | 360 | <div class="feature-section"> |
361 | 361 | <?php echo $this->parse_readme(); ?> |
@@ -363,10 +363,10 @@ discard block |
||
363 | 363 | </div> |
364 | 364 | |
365 | 365 | <div class="return-to-dashboard"> |
366 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
366 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
367 | 367 | 'post_type' => 'give_forms', |
368 | 368 | 'page' => 'give-settings' |
369 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Go to Give Settings', 'give' ); ?></a> |
|
369 | + ), 'edit.php'))); ?>"><?php esc_html_e('Go to Give Settings', 'give'); ?></a> |
|
370 | 370 | </div> |
371 | 371 | </div> |
372 | 372 | <?php |
@@ -380,45 +380,45 @@ discard block |
||
380 | 380 | * @return void |
381 | 381 | */ |
382 | 382 | public function getting_started_screen() { |
383 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
383 | + list($display_version) = explode('-', GIVE_VERSION); |
|
384 | 384 | ?> |
385 | 385 | <div class="wrap about-wrap get-started"> |
386 | 386 | <h1 class="welcome-h1"><?php |
387 | 387 | printf( |
388 | 388 | /* translators: %s: Give version */ |
389 | - esc_html__( 'Give %s - Getting Started Guide', 'give' ), |
|
389 | + esc_html__('Give %s - Getting Started Guide', 'give'), |
|
390 | 390 | $display_version |
391 | 391 | ); |
392 | 392 | ?></h1> |
393 | 393 | |
394 | 394 | <?php give_social_media_elements() ?> |
395 | 395 | |
396 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
396 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
397 | 397 | |
398 | - <p class="newsletter-intro"><?php esc_html_e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?>.</p> |
|
398 | + <p class="newsletter-intro"><?php esc_html_e('Don\'t forget to sign up for the newsletter!', 'give'); ?>.</p> |
|
399 | 399 | |
400 | 400 | <?php give_get_newsletter() ?> |
401 | 401 | |
402 | 402 | <div class="give-badge"><?php |
403 | 403 | printf( |
404 | 404 | /* translators: %s: Give version */ |
405 | - esc_html__( 'Version %s', 'give' ), |
|
405 | + esc_html__('Version %s', 'give'), |
|
406 | 406 | $display_version |
407 | 407 | ); |
408 | 408 | ?></div> |
409 | 409 | |
410 | 410 | <?php $this->tabs(); ?> |
411 | 411 | |
412 | - <p class="about-text"><?php printf( esc_html__( '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 ); ?></p> |
|
412 | + <p class="about-text"><?php printf(esc_html__('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); ?></p> |
|
413 | 413 | |
414 | 414 | <div class="feature-section clearfix"> |
415 | 415 | |
416 | 416 | <div class="content feature-section-item"> |
417 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
417 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
418 | 418 | |
419 | - <p><?php esc_html_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> |
|
419 | + <p><?php esc_html_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> |
|
420 | 420 | |
421 | - <p><?php esc_html_e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p> |
|
421 | + <p><?php esc_html_e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p> |
|
422 | 422 | </div> |
423 | 423 | |
424 | 424 | <div class="content feature-section-item last-feature"> |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | </div> |
436 | 436 | |
437 | 437 | <div class="content feature-section-item last-feature"> |
438 | - <h3><?php esc_html_e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3> |
|
438 | + <h3><?php esc_html_e('STEP 2: Choose Your Levels', 'give'); ?></h3> |
|
439 | 439 | |
440 | - <p><?php esc_html_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> |
|
440 | + <p><?php esc_html_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> |
|
441 | 441 | </div> |
442 | 442 | |
443 | 443 | </div> |
@@ -446,11 +446,11 @@ discard block |
||
446 | 446 | <div class="feature-section clearfix"> |
447 | 447 | |
448 | 448 | <div class="content feature-section-item add-content"> |
449 | - <h3><?php esc_html_e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3> |
|
449 | + <h3><?php esc_html_e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3> |
|
450 | 450 | |
451 | - <p><?php esc_html_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> |
|
451 | + <p><?php esc_html_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> |
|
452 | 452 | |
453 | - <p><?php esc_html_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> |
|
453 | + <p><?php esc_html_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> |
|
454 | 454 | </div> |
455 | 455 | |
456 | 456 | <div class="content feature-section-item last-feature"> |
@@ -467,9 +467,9 @@ discard block |
||
467 | 467 | </div> |
468 | 468 | |
469 | 469 | <div class="content feature-section-item last-feature"> |
470 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
470 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
471 | 471 | |
472 | - <p><?php esc_html_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> |
|
472 | + <p><?php esc_html_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> |
|
473 | 473 | </div> |
474 | 474 | |
475 | 475 | |
@@ -489,38 +489,38 @@ discard block |
||
489 | 489 | * @return void |
490 | 490 | */ |
491 | 491 | public function credits_screen() { |
492 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
492 | + list($display_version) = explode('-', GIVE_VERSION); |
|
493 | 493 | ?> |
494 | 494 | <div class="wrap about-wrap"> |
495 | 495 | <h1 class="welcome-h1"><?php |
496 | 496 | printf( |
497 | 497 | /* translators: %s: Give version */ |
498 | - esc_html__( 'Give %s - Credits', 'give' ), |
|
498 | + esc_html__('Give %s - Credits', 'give'), |
|
499 | 499 | $display_version |
500 | 500 | ); |
501 | 501 | ?></h1> |
502 | 502 | |
503 | 503 | <?php give_social_media_elements() ?> |
504 | 504 | |
505 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly. ', 'give' ); ?></p> |
|
505 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly. ', 'give'); ?></p> |
|
506 | 506 | |
507 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
507 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
508 | 508 | |
509 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
509 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
510 | 510 | |
511 | 511 | <?php give_get_newsletter() ?> |
512 | 512 | |
513 | 513 | <div class="give-badge"><?php |
514 | 514 | printf( |
515 | 515 | /* translators: %s: Give version */ |
516 | - esc_html__( 'Version %s', 'give' ), |
|
516 | + esc_html__('Version %s', 'give'), |
|
517 | 517 | $display_version |
518 | 518 | ); |
519 | 519 | ?></div> |
520 | 520 | |
521 | 521 | <?php $this->tabs(); ?> |
522 | 522 | |
523 | - <p class="about-description"><?php printf( __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), esc_url( 'https://github.com/WordImpress/give' ) ); ?></p> |
|
523 | + <p class="about-description"><?php printf(__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), esc_url('https://github.com/WordImpress/give')); ?></p> |
|
524 | 524 | |
525 | 525 | <?php echo $this->contributors(); ?> |
526 | 526 | </div> |
@@ -535,21 +535,21 @@ discard block |
||
535 | 535 | * @return string $readme HTML formatted readme file |
536 | 536 | */ |
537 | 537 | public function parse_readme() { |
538 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
538 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null; |
|
539 | 539 | |
540 | - if ( ! $file ) { |
|
541 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
540 | + if ( ! $file) { |
|
541 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
542 | 542 | } else { |
543 | - $readme = file_get_contents( $file ); |
|
544 | - $readme = nl2br( esc_html( $readme ) ); |
|
545 | - $readme = explode( '== Changelog ==', $readme ); |
|
546 | - $readme = end( $readme ); |
|
547 | - |
|
548 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
549 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
550 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
551 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
552 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
543 | + $readme = file_get_contents($file); |
|
544 | + $readme = nl2br(esc_html($readme)); |
|
545 | + $readme = explode('== Changelog ==', $readme); |
|
546 | + $readme = end($readme); |
|
547 | + |
|
548 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
549 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
550 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
551 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
552 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | return $readme; |
@@ -566,27 +566,27 @@ discard block |
||
566 | 566 | public function contributors() { |
567 | 567 | $contributors = $this->get_contributors(); |
568 | 568 | |
569 | - if ( empty( $contributors ) ) { |
|
569 | + if (empty($contributors)) { |
|
570 | 570 | return ''; |
571 | 571 | } |
572 | 572 | |
573 | 573 | $contributor_list = '<ul class="wp-people-group">'; |
574 | 574 | |
575 | - foreach ( $contributors as $contributor ) { |
|
575 | + foreach ($contributors as $contributor) { |
|
576 | 576 | $contributor_list .= '<li class="wp-person">'; |
577 | - $contributor_list .= sprintf( '<a href="%s" title="%s">', |
|
578 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
577 | + $contributor_list .= sprintf('<a href="%s" title="%s">', |
|
578 | + esc_url('https://github.com/'.$contributor->login), |
|
579 | 579 | esc_html( |
580 | 580 | sprintf( |
581 | 581 | /* translators: %s: github contributor */ |
582 | - esc_html__( 'View %s', 'give' ), |
|
582 | + esc_html__('View %s', 'give'), |
|
583 | 583 | $contributor->login |
584 | 584 | ) |
585 | 585 | ) |
586 | 586 | ); |
587 | - $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) ); |
|
587 | + $contributor_list .= sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login)); |
|
588 | 588 | $contributor_list .= '</a>'; |
589 | - $contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) ); |
|
589 | + $contributor_list .= sprintf('<a class="web" href="%s">%s</a>', esc_url('https://github.com/'.$contributor->login), esc_html($contributor->login)); |
|
590 | 590 | $contributor_list .= '</a>'; |
591 | 591 | $contributor_list .= '</li>'; |
592 | 592 | } |
@@ -604,25 +604,25 @@ discard block |
||
604 | 604 | * @return array $contributors List of contributors |
605 | 605 | */ |
606 | 606 | public function get_contributors() { |
607 | - $contributors = get_transient( 'give_contributors' ); |
|
607 | + $contributors = get_transient('give_contributors'); |
|
608 | 608 | |
609 | - if ( false !== $contributors ) { |
|
609 | + if (false !== $contributors) { |
|
610 | 610 | return $contributors; |
611 | 611 | } |
612 | 612 | |
613 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
613 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
614 | 614 | |
615 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
615 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
616 | 616 | return array(); |
617 | 617 | } |
618 | 618 | |
619 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
619 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
620 | 620 | |
621 | - if ( ! is_array( $contributors ) ) { |
|
621 | + if ( ! is_array($contributors)) { |
|
622 | 622 | return array(); |
623 | 623 | } |
624 | 624 | |
625 | - set_transient( 'give_contributors', $contributors, 3600 ); |
|
625 | + set_transient('give_contributors', $contributors, 3600); |
|
626 | 626 | |
627 | 627 | return $contributors; |
628 | 628 | } |
@@ -641,24 +641,24 @@ discard block |
||
641 | 641 | |
642 | 642 | |
643 | 643 | // Bail if no activation redirect |
644 | - if ( ! get_transient( '_give_activation_redirect' ) ) { |
|
644 | + if ( ! get_transient('_give_activation_redirect')) { |
|
645 | 645 | return; |
646 | 646 | } |
647 | 647 | |
648 | 648 | // Delete the redirect transient |
649 | - delete_transient( '_give_activation_redirect' ); |
|
649 | + delete_transient('_give_activation_redirect'); |
|
650 | 650 | |
651 | 651 | // Bail if activating from network, or bulk |
652 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
652 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
653 | 653 | return; |
654 | 654 | } |
655 | 655 | |
656 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
656 | + $upgrade = get_option('give_version_upgraded_from'); |
|
657 | 657 | |
658 | - if ( ! $upgrade ) { // First time install |
|
659 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
658 | + if ( ! $upgrade) { // First time install |
|
659 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
660 | 660 | exit; |
661 | - } elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings |
|
661 | + } elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings |
|
662 | 662 | |
663 | 663 | } else { // Welcome is NOT disabled in settings |
664 | 664 | 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 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( $typenow == 'give_forms' ) { |
|
30 | + if ($typenow == 'give_forms') { |
|
31 | 31 | $rate_text = sprintf( |
32 | 32 | /* translators: %s: Link to 5 star rating */ |
33 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
34 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
33 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
34 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.esc_attr__('Thanks :)', 'give').'">★★★★★</a>' |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | return $rate_text; |
@@ -40,4 +40,4 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
43 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,39 +29,39 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
34 | 34 | ?> |
35 | 35 | <div class="wrap"> |
36 | 36 | |
37 | - <h1 class="screen-reader-text"><?php esc_html_e( 'Give Reports', 'give' ); ?></h1> |
|
37 | + <h1 class="screen-reader-text"><?php esc_html_e('Give Reports', 'give'); ?></h1> |
|
38 | 38 | |
39 | 39 | <h2 class="nav-tab-wrapper"> |
40 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
40 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
41 | 41 | 'tab' => 'reports', |
42 | 42 | 'settings-updated' => false |
43 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Reports', 'give' ); ?></a> |
|
44 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
45 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
43 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Reports', 'give'); ?></a> |
|
44 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
45 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
46 | 46 | 'tab' => 'export', |
47 | 47 | 'settings-updated' => false |
48 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
48 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
49 | 49 | <?php } ?> |
50 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
50 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
51 | 51 | 'tab' => 'logs', |
52 | 52 | 'settings-updated' => false |
53 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Logs', 'give' ); ?></a> |
|
54 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
53 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Logs', 'give'); ?></a> |
|
54 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
55 | 55 | 'tab' => 'tools', |
56 | 56 | 'settings-updated' => false |
57 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Tools', 'give' ); ?></a> |
|
58 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
57 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Tools', 'give'); ?></a> |
|
58 | + <?php do_action('give_reports_tabs'); ?> |
|
59 | 59 | </h2> |
60 | 60 | |
61 | 61 | <?php |
62 | - do_action( 'give_reports_page_top' ); |
|
63 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
64 | - do_action( 'give_reports_page_bottom' ); |
|
62 | + do_action('give_reports_page_top'); |
|
63 | + do_action('give_reports_tab_'.$active_tab); |
|
64 | + do_action('give_reports_page_bottom'); |
|
65 | 65 | ?> |
66 | 66 | </div><!-- .wrap --> |
67 | 67 | <?php |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function give_reports_default_views() { |
77 | 77 | $views = array( |
78 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
78 | + 'earnings' => esc_html__('Income', 'give'), |
|
79 | 79 | 'forms' => give_get_forms_label_plural(), |
80 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
81 | - 'gateways' => esc_html__( 'Payment Methods', 'give' ) |
|
80 | + 'donors' => esc_html__('Donors', 'give'), |
|
81 | + 'gateways' => esc_html__('Payment Methods', 'give') |
|
82 | 82 | ); |
83 | 83 | |
84 | - $views = apply_filters( 'give_report_views', $views ); |
|
84 | + $views = apply_filters('give_report_views', $views); |
|
85 | 85 | |
86 | 86 | return $views; |
87 | 87 | } |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | * @return string $view Report View |
98 | 98 | * |
99 | 99 | */ |
100 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
100 | +function give_get_reporting_view($default = 'earnings') { |
|
101 | 101 | |
102 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
102 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
103 | 103 | $view = $default; |
104 | 104 | } else { |
105 | 105 | $view = $_GET['view']; |
106 | 106 | } |
107 | 107 | |
108 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
108 | + return apply_filters('give_get_reporting_view', $view); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | $current_view = 'earnings'; |
119 | 119 | $views = give_reports_default_views(); |
120 | 120 | |
121 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
121 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
122 | 122 | $current_view = $_GET['view']; |
123 | 123 | } |
124 | 124 | |
125 | - do_action( 'give_reports_view_' . $current_view ); |
|
125 | + do_action('give_reports_view_'.$current_view); |
|
126 | 126 | } |
127 | 127 | |
128 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
128 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Renders the Reports Page Views Drop Downs |
@@ -135,25 +135,25 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function give_report_views() { |
137 | 137 | $views = give_reports_default_views(); |
138 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
139 | - do_action( 'give_report_view_actions_before' ); |
|
138 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
139 | + do_action('give_report_view_actions_before'); |
|
140 | 140 | ?> |
141 | 141 | <form id="give-reports-filter" method="get"> |
142 | 142 | <select id="give-reports-view" name="view"> |
143 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
144 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
145 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
143 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
144 | + <?php foreach ($views as $view_id => $label) : ?> |
|
145 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
146 | 146 | <?php endforeach; ?> |
147 | 147 | </select> |
148 | 148 | |
149 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
149 | + <?php do_action('give_report_view_actions'); ?> |
|
150 | 150 | |
151 | 151 | <input type="hidden" name="post_type" value="give_forms"/> |
152 | 152 | <input type="hidden" name="page" value="give-reports"/> |
153 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
153 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
154 | 154 | </form> |
155 | 155 | <?php |
156 | - do_action( 'give_report_view_actions_after' ); |
|
156 | + do_action('give_report_view_actions_after'); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function give_reports_forms_table() { |
168 | 168 | |
169 | - if ( isset( $_GET['form-id'] ) ) { |
|
169 | + if (isset($_GET['form-id'])) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
173 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
174 | 174 | |
175 | 175 | $give_table = new Give_Form_Reports_Table(); |
176 | 176 | $give_table->prepare_items(); |
177 | 177 | $give_table->display(); |
178 | 178 | } |
179 | 179 | |
180 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
180 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
181 | 181 | |
182 | 182 | /** |
183 | 183 | * Renders the detailed report for a specific give form |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @return void |
187 | 187 | */ |
188 | 188 | function give_reports_form_details() { |
189 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
189 | + if ( ! isset($_GET['form-id'])) { |
|
190 | 190 | return; |
191 | 191 | } |
192 | 192 | ?> |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | <div class="actions bulkactions"> |
195 | 195 | <?php give_report_views(); ?> |
196 | 196 | |
197 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
197 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
198 | 198 | </div> |
199 | 199 | </div> |
200 | 200 | <?php |
201 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
201 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
202 | 202 | } |
203 | 203 | |
204 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
204 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Renders the Reports Donors Table |
@@ -212,28 +212,28 @@ discard block |
||
212 | 212 | * @return void |
213 | 213 | */ |
214 | 214 | function give_reports_donors_table() { |
215 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
215 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
216 | 216 | |
217 | 217 | $give_table = new Give_Donor_Reports_Table(); |
218 | 218 | $give_table->prepare_items(); |
219 | 219 | ?> |
220 | 220 | <div class="wrap give-reports-donors-wrap"> |
221 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
222 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
221 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
222 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
223 | 223 | <?php |
224 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
224 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
225 | 225 | $give_table->display(); |
226 | 226 | ?> |
227 | 227 | <input type="hidden" name="post_type" value="give_forms"/> |
228 | 228 | <input type="hidden" name="page" value="give-reports"/> |
229 | 229 | <input type="hidden" name="view" value="donors"/> |
230 | 230 | </form> |
231 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
231 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
232 | 232 | </div> |
233 | 233 | <?php |
234 | 234 | } |
235 | 235 | |
236 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
236 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
237 | 237 | |
238 | 238 | |
239 | 239 | /** |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | * @return void |
246 | 246 | */ |
247 | 247 | function give_reports_gateways_table() { |
248 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
248 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
249 | 249 | |
250 | 250 | $give_table = new Give_Gateawy_Reports_Table(); |
251 | 251 | $give_table->prepare_items(); |
252 | 252 | $give_table->display(); |
253 | 253 | } |
254 | 254 | |
255 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
255 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
256 | 256 | |
257 | 257 | |
258 | 258 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | function give_reports_earnings() { |
265 | 265 | ?> |
266 | 266 | <div class="tablenav top reports-table-nav"> |
267 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Over Time', 'give' ); ?></span></h3> |
|
267 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Over Time', 'give'); ?></span></h3> |
|
268 | 268 | |
269 | 269 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
270 | 270 | </div> |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | give_reports_graph(); |
273 | 273 | } |
274 | 274 | |
275 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
275 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
276 | 276 | |
277 | 277 | |
278 | 278 | /** |
@@ -287,53 +287,53 @@ discard block |
||
287 | 287 | <div id="post-body"> |
288 | 288 | <div id="post-body-content"> |
289 | 289 | |
290 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
290 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
291 | 291 | |
292 | 292 | <table class="widefat export-options-table give-table"> |
293 | 293 | <thead> |
294 | 294 | <tr> |
295 | - <th class="row-title"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
296 | - <th><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
295 | + <th class="row-title"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
296 | + <th><?php esc_html_e('Export Options', 'give'); ?></th> |
|
297 | 297 | </tr> |
298 | 298 | </thead> |
299 | 299 | <tbody> |
300 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
300 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
301 | 301 | <tr class="give-export-pdf-sales-earnings"> |
302 | 302 | <td class="row-title"> |
303 | - <h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
303 | + <h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
304 | 304 | |
305 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
305 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
306 | 306 | </td> |
307 | 307 | <td> |
308 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a> |
|
308 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a> |
|
309 | 309 | </td> |
310 | 310 | </tr> |
311 | 311 | <tr class="alternate give-export-sales-earnings"> |
312 | 312 | <td class="row-title"> |
313 | - <h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
313 | + <h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
314 | 314 | |
315 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
315 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
316 | 316 | </td> |
317 | 317 | <td> |
318 | 318 | <form method="post"> |
319 | 319 | <?php |
320 | 320 | printf( |
321 | 321 | /* translators: 1: start date dropdown 2: end date dropdown */ |
322 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
323 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
324 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
322 | + esc_html__('%1$s to %2$s', 'give'), |
|
323 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
324 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
325 | 325 | ); |
326 | 326 | ?> |
327 | 327 | <input type="hidden" name="give-action" value="earnings_export"/> |
328 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
328 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
329 | 329 | </form> |
330 | 330 | </td> |
331 | 331 | </tr> |
332 | 332 | <tr class="give-export-payment-history"> |
333 | 333 | <td class="row-title"> |
334 | - <h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3> |
|
334 | + <h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3> |
|
335 | 335 | |
336 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
336 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
337 | 337 | </td> |
338 | 338 | <td> |
339 | 339 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -341,29 +341,29 @@ discard block |
||
341 | 341 | $args = array( |
342 | 342 | 'id' => 'give-payment-export-start', |
343 | 343 | 'name' => 'start', |
344 | - 'placeholder' => esc_attr__( 'Start date', 'give' ) |
|
344 | + 'placeholder' => esc_attr__('Start date', 'give') |
|
345 | 345 | ); |
346 | - echo Give()->html->date_field( $args ); ?> |
|
346 | + echo Give()->html->date_field($args); ?> |
|
347 | 347 | <?php |
348 | 348 | $args = array( |
349 | 349 | 'id' => 'give-payment-export-end', |
350 | 350 | 'name' => 'end', |
351 | - 'placeholder' => esc_attr__( 'End date', 'give' ) |
|
351 | + 'placeholder' => esc_attr__('End date', 'give') |
|
352 | 352 | ); |
353 | - echo Give()->html->date_field( $args ); ?> |
|
353 | + echo Give()->html->date_field($args); ?> |
|
354 | 354 | <select name="status"> |
355 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
355 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
356 | 356 | <?php |
357 | 357 | $statuses = give_get_payment_statuses(); |
358 | - foreach ( $statuses as $status => $label ) { |
|
359 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
358 | + foreach ($statuses as $status => $label) { |
|
359 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
360 | 360 | } |
361 | 361 | ?> |
362 | 362 | </select> |
363 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
363 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
364 | 364 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
365 | 365 | <span> |
366 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
366 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
367 | 367 | <span class="spinner"></span> |
368 | 368 | </span> |
369 | 369 | </form> |
@@ -372,9 +372,9 @@ discard block |
||
372 | 372 | </tr> |
373 | 373 | <tr class="alternate give-export-donors"> |
374 | 374 | <td class="row-title"> |
375 | - <h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
375 | + <h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3> |
|
376 | 376 | |
377 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
377 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
378 | 378 | </td> |
379 | 379 | <td> |
380 | 380 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -385,54 +385,54 @@ discard block |
||
385 | 385 | 'id' => 'give_customer_export_form', |
386 | 386 | 'chosen' => true |
387 | 387 | ); |
388 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
388 | + echo Give()->html->forms_dropdown($args); ?> |
|
389 | 389 | |
390 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
390 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
391 | 391 | |
392 | 392 | <div id="export-donor-options-wrap" class="give-clearfix"> |
393 | - <p><?php esc_html_e( 'Export Columns', 'give' ); ?>:</p> |
|
393 | + <p><?php esc_html_e('Export Columns', 'give'); ?>:</p> |
|
394 | 394 | <ul id="give-export-option-ul"> |
395 | 395 | <li> |
396 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
396 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
397 | 397 | </label> |
398 | 398 | </li> |
399 | 399 | <li> |
400 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
400 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
401 | 401 | </label> |
402 | 402 | </li> |
403 | 403 | <li> |
404 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
404 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
405 | 405 | </label> |
406 | 406 | </li> |
407 | 407 | <li> |
408 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
408 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
409 | 409 | </label> |
410 | 410 | </li> |
411 | 411 | <li> |
412 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
412 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
413 | 413 | </label> |
414 | 414 | </li> |
415 | 415 | <li> |
416 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
416 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
417 | 417 | </label> |
418 | 418 | </li> |
419 | 419 | <li> |
420 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
420 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
421 | 421 | </label> |
422 | 422 | </li> |
423 | 423 | </ul> |
424 | 424 | </div> |
425 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
425 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
426 | 426 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
427 | 427 | <input type="hidden" name="give-action" value="email_export"/> |
428 | 428 | </form> |
429 | 429 | </td> |
430 | 430 | </tr> |
431 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
431 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
432 | 432 | </tbody> |
433 | 433 | </table> |
434 | 434 | |
435 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
435 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
436 | 436 | |
437 | 437 | </div> |
438 | 438 | <!-- .post-body-content --> |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | <?php |
443 | 443 | } |
444 | 444 | |
445 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
445 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Renders the Reports page |
@@ -452,19 +452,19 @@ discard block |
||
452 | 452 | */ |
453 | 453 | function give_reports_tab_logs() { |
454 | 454 | |
455 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
455 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
456 | 456 | |
457 | 457 | $current_view = 'sales'; |
458 | 458 | $log_views = give_log_default_views(); |
459 | 459 | |
460 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
460 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
461 | 461 | $current_view = $_GET['view']; |
462 | 462 | } |
463 | 463 | |
464 | - do_action( 'give_logs_view_' . $current_view ); |
|
464 | + do_action('give_logs_view_'.$current_view); |
|
465 | 465 | } |
466 | 466 | |
467 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
467 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
468 | 468 | |
469 | 469 | /** |
470 | 470 | * Retrieves estimated monthly earnings and sales |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | */ |
475 | 475 | function give_estimated_monthly_stats() { |
476 | 476 | |
477 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
477 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
478 | 478 | |
479 | - if ( false === $estimated ) { |
|
479 | + if (false === $estimated) { |
|
480 | 480 | |
481 | 481 | $estimated = array( |
482 | 482 | 'earnings' => 0, |
@@ -485,20 +485,20 @@ discard block |
||
485 | 485 | |
486 | 486 | $stats = new Give_Payment_Stats; |
487 | 487 | |
488 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
489 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
488 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
489 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
490 | 490 | |
491 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
492 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
493 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
494 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
491 | + $current_day = date('d', current_time('timestamp')); |
|
492 | + $current_month = date('n', current_time('timestamp')); |
|
493 | + $current_year = date('Y', current_time('timestamp')); |
|
494 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
495 | 495 | |
496 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
497 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
496 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
497 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
498 | 498 | |
499 | 499 | // Cache for one day |
500 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
500 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
501 | 501 | } |
502 | 502 | |
503 | - return maybe_unserialize( $estimated ); |
|
503 | + return maybe_unserialize($estimated); |
|
504 | 504 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function csv_cols() { |
41 | 41 | $cols = array( |
42 | - 'id' => esc_html__( 'ID', 'give' ), // unaltered payment ID (use for querying). |
|
43 | - 'seq_id' => esc_html__( 'Payment Number', 'give' ), // sequential payment ID. |
|
44 | - 'email' => esc_html__( 'Email', 'give' ), |
|
45 | - 'first' => esc_html__( 'First Name', 'give' ), |
|
46 | - 'last' => esc_html__( 'Last Name', 'give' ), |
|
47 | - 'address1' => esc_html__( 'Address', 'give' ), |
|
48 | - 'address2' => esc_html__( 'Address (Line 2)', 'give' ), |
|
49 | - 'city' => esc_html__( 'City', 'give' ), |
|
50 | - 'state' => esc_html__( 'State', 'give' ), |
|
51 | - 'country' => esc_html__( 'Country', 'give' ), |
|
52 | - 'zip' => esc_html__( 'Zip / Postal Code', 'give' ), |
|
53 | - 'form_id' => esc_html__( 'Form ID', 'give' ), |
|
54 | - 'form_name' => esc_html__( 'Form Name', 'give' ), |
|
55 | - 'amount' => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
56 | - 'gateway' => esc_html__( 'Payment Method', 'give' ), |
|
57 | - 'trans_id' => esc_html__( 'Transaction ID', 'give' ), |
|
58 | - 'key' => esc_html__( 'Purchase Key', 'give' ), |
|
59 | - 'date' => esc_html__( 'Date', 'give' ), |
|
60 | - 'user' => esc_html__( 'User', 'give' ), |
|
61 | - 'status' => esc_html__( 'Status', 'give' ) |
|
42 | + 'id' => esc_html__('ID', 'give'), // unaltered payment ID (use for querying). |
|
43 | + 'seq_id' => esc_html__('Payment Number', 'give'), // sequential payment ID. |
|
44 | + 'email' => esc_html__('Email', 'give'), |
|
45 | + 'first' => esc_html__('First Name', 'give'), |
|
46 | + 'last' => esc_html__('Last Name', 'give'), |
|
47 | + 'address1' => esc_html__('Address', 'give'), |
|
48 | + 'address2' => esc_html__('Address (Line 2)', 'give'), |
|
49 | + 'city' => esc_html__('City', 'give'), |
|
50 | + 'state' => esc_html__('State', 'give'), |
|
51 | + 'country' => esc_html__('Country', 'give'), |
|
52 | + 'zip' => esc_html__('Zip / Postal Code', 'give'), |
|
53 | + 'form_id' => esc_html__('Form ID', 'give'), |
|
54 | + 'form_name' => esc_html__('Form Name', 'give'), |
|
55 | + 'amount' => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
56 | + 'gateway' => esc_html__('Payment Method', 'give'), |
|
57 | + 'trans_id' => esc_html__('Transaction ID', 'give'), |
|
58 | + 'key' => esc_html__('Purchase Key', 'give'), |
|
59 | + 'date' => esc_html__('Date', 'give'), |
|
60 | + 'user' => esc_html__('User', 'give'), |
|
61 | + 'status' => esc_html__('Status', 'give') |
|
62 | 62 | ); |
63 | 63 | |
64 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
65 | - unset( $cols['seq_id'] ); |
|
64 | + if ( ! give_get_option('enable_sequential')) { |
|
65 | + unset($cols['seq_id']); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return $cols; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | 'status' => $this->status |
88 | 88 | ); |
89 | 89 | |
90 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
90 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
91 | 91 | |
92 | 92 | $args['date_query'] = array( |
93 | 93 | array( |
94 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
95 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
94 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
95 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
96 | 96 | 'inclusive' => true |
97 | 97 | ) |
98 | 98 | ); |
@@ -101,52 +101,52 @@ discard block |
||
101 | 101 | |
102 | 102 | //echo json_encode($args ); exit; |
103 | 103 | |
104 | - $payments = give_get_payments( $args ); |
|
104 | + $payments = give_get_payments($args); |
|
105 | 105 | |
106 | - if ( $payments ) { |
|
106 | + if ($payments) { |
|
107 | 107 | |
108 | - foreach ( $payments as $payment ) { |
|
109 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
110 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
111 | - $total = give_get_payment_amount( $payment->ID ); |
|
112 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
108 | + foreach ($payments as $payment) { |
|
109 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
110 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
111 | + $total = give_get_payment_amount($payment->ID); |
|
112 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
113 | 113 | $products = ''; |
114 | 114 | $skus = ''; |
115 | 115 | |
116 | - if ( is_numeric( $user_id ) ) { |
|
117 | - $user = get_userdata( $user_id ); |
|
116 | + if (is_numeric($user_id)) { |
|
117 | + $user = get_userdata($user_id); |
|
118 | 118 | } else { |
119 | 119 | $user = false; |
120 | 120 | } |
121 | 121 | |
122 | 122 | $data[] = array( |
123 | 123 | 'id' => $payment->ID, |
124 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
124 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
125 | 125 | 'email' => $payment_meta['email'], |
126 | 126 | 'first' => $user_info['first_name'], |
127 | 127 | 'last' => $user_info['last_name'], |
128 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
129 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
130 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
131 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
132 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
133 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
134 | - 'form_id' => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '', |
|
135 | - 'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '', |
|
128 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
129 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
130 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
131 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
132 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
133 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
134 | + 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', |
|
135 | + 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', |
|
136 | 136 | 'skus' => $skus, |
137 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
138 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
139 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
137 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
138 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
139 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
140 | 140 | 'key' => $payment_meta['key'], |
141 | 141 | 'date' => $payment->post_date, |
142 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
143 | - 'status' => give_get_payment_status( $payment, true ) |
|
142 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
143 | + 'status' => give_get_payment_status($payment, true) |
|
144 | 144 | ); |
145 | 145 | |
146 | 146 | } |
147 | 147 | |
148 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
149 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
148 | + $data = apply_filters('give_export_get_data', $data); |
|
149 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
150 | 150 | |
151 | 151 | return $data; |
152 | 152 | |
@@ -166,27 +166,27 @@ discard block |
||
166 | 166 | |
167 | 167 | $status = $this->status; |
168 | 168 | $args = array( |
169 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
170 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
169 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
170 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
171 | 171 | ); |
172 | 172 | |
173 | - if ( 'any' == $status ) { |
|
173 | + if ('any' == $status) { |
|
174 | 174 | |
175 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
175 | + $total = array_sum((array) give_count_payments($args)); |
|
176 | 176 | |
177 | 177 | } else { |
178 | 178 | |
179 | - $total = give_count_payments( $args )->$status; |
|
179 | + $total = give_count_payments($args)->$status; |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
183 | 183 | $percentage = 100; |
184 | 184 | |
185 | - if ( $total > 0 ) { |
|
186 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
185 | + if ($total > 0) { |
|
186 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
187 | 187 | } |
188 | 188 | |
189 | - if ( $percentage > 100 ) { |
|
189 | + if ($percentage > 100) { |
|
190 | 190 | $percentage = 100; |
191 | 191 | } |
192 | 192 | |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @param array $request The Form Data passed into the batch processing. |
202 | 202 | */ |
203 | - public function set_properties( $request ) { |
|
204 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
205 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
206 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
203 | + public function set_properties($request) { |
|
204 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
205 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
206 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
207 | 207 | } |
208 | 208 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
68 | - switch ( $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | + switch ($column_name) { |
|
69 | 69 | default: |
70 | - return $item[ $column_name ]; |
|
70 | + return $item[$column_name]; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function get_columns() { |
82 | 82 | $columns = array( |
83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
84 | - 'complete_sales' => esc_attr__( 'Complete Transactions', 'give' ), |
|
85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Transactions', 'give' ), |
|
86 | - 'total_sales' => esc_attr__( 'Total Transactions', 'give' ), |
|
87 | - 'total_donations' => esc_attr__( 'Total Donations', 'give' ) |
|
83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
84 | + 'complete_sales' => esc_attr__('Complete Transactions', 'give'), |
|
85 | + 'pending_sales' => esc_attr__('Pending / Failed Transactions', 'give'), |
|
86 | + 'total_sales' => esc_attr__('Total Transactions', 'give'), |
|
87 | + 'total_donations' => esc_attr__('Total Donations', 'give') |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return int Current page number |
100 | 100 | */ |
101 | 101 | public function get_paged() { |
102 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
102 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @since 1.0 |
111 | 111 | * @return void |
112 | 112 | */ |
113 | - public function bulk_actions( $which = '' ) { |
|
113 | + public function bulk_actions($which = '') { |
|
114 | 114 | // These aren't really bulk actions but this outputs the markup in the right place |
115 | 115 | give_report_views(); |
116 | 116 | } |
@@ -123,23 +123,23 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param string $which |
125 | 125 | */ |
126 | - protected function display_tablenav( $which ) { |
|
126 | + protected function display_tablenav($which) { |
|
127 | 127 | |
128 | - if ( 'top' == $which ) { |
|
129 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
128 | + if ('top' == $which) { |
|
129 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
130 | 130 | } |
131 | 131 | ?> |
132 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
132 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
133 | 133 | |
134 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Payment Methods Report', 'give' ); ?></span></h3> |
|
134 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Payment Methods Report', 'give'); ?></span></h3> |
|
135 | 135 | |
136 | 136 | <div class="alignright tablenav-right"> |
137 | 137 | <div class="actions bulkactions"> |
138 | - <?php $this->bulk_actions( $which ); ?> |
|
138 | + <?php $this->bulk_actions($which); ?> |
|
139 | 139 | </div> |
140 | 140 | <?php |
141 | - $this->extra_tablenav( $which ); |
|
142 | - $this->pagination( $which ); |
|
141 | + $this->extra_tablenav($which); |
|
142 | + $this->pagination($which); |
|
143 | 143 | ?> |
144 | 144 | </div> |
145 | 145 | |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | $gateways = give_get_payment_gateways(); |
165 | 165 | $stats = new Give_Payment_Stats(); |
166 | 166 | |
167 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
167 | + foreach ($gateways as $gateway_id => $gateway) { |
|
168 | 168 | |
169 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
170 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
169 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
170 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
171 | 171 | |
172 | 172 | $reports_data[] = array( |
173 | 173 | 'ID' => $gateway_id, |
174 | 174 | 'label' => $gateway['admin_label'], |
175 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
176 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
177 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
178 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ) |
|
175 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
176 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
177 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
178 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))) |
|
179 | 179 | ); |
180 | 180 | } |
181 | 181 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $columns = $this->get_columns(); |
198 | 198 | $hidden = array(); // No hidden columns |
199 | 199 | $sortable = $this->get_sortable_columns(); |
200 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
200 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
201 | 201 | $this->items = $this->reports_data(); |
202 | 202 | |
203 | 203 | } |