@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Register extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
22 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
21 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
22 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_register' ); |
|
24 | + parent::__construct('give_register'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'textbox', |
41 | 41 | 'name' => 'redirect', |
42 | 42 | 'minWidth' => 320, |
43 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
43 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_show_upgrade_notices() { |
27 | 27 | |
28 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
28 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
29 | 29 | return; |
30 | 30 | } // Don't show notices on the upgrades page |
31 | 31 | |
32 | - $give_version = get_option( 'give_version' ); |
|
32 | + $give_version = get_option('give_version'); |
|
33 | 33 | |
34 | - if ( ! $give_version ) { |
|
34 | + if ( ! $give_version) { |
|
35 | 35 | // 1.0 is the first version to use this option so we must add it |
36 | 36 | $give_version = '1.0'; |
37 | 37 | } |
38 | 38 | |
39 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
39 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
40 | 40 | |
41 | 41 | /* |
42 | 42 | * NOTICE: |
@@ -47,20 +47,20 @@ discard block |
||
47 | 47 | */ |
48 | 48 | |
49 | 49 | //v1.3.2 Upgrades |
50 | - if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) { |
|
50 | + if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) { |
|
51 | 51 | printf( |
52 | 52 | /* translators: %s: upgrade URL */ |
53 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
54 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
53 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
54 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
55 | 55 | ); |
56 | 56 | } |
57 | 57 | |
58 | 58 | //v1.3.4 Upgrades //ensure the user has gone through 1.3.4 |
59 | - if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) { |
|
59 | + if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) { |
|
60 | 60 | printf( |
61 | 61 | /* translators: %s: upgrade URL */ |
62 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
63 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
62 | + '<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
63 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
64 | 64 | ); |
65 | 65 | } |
66 | 66 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | } |
72 | 72 | |
73 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
73 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Triggers all upgrade functions |
@@ -82,26 +82,26 @@ discard block |
||
82 | 82 | */ |
83 | 83 | function give_trigger_upgrades() { |
84 | 84 | |
85 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
86 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
85 | + if ( ! current_user_can('manage_give_settings')) { |
|
86 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
87 | 87 | } |
88 | 88 | |
89 | - $give_version = get_option( 'give_version' ); |
|
89 | + $give_version = get_option('give_version'); |
|
90 | 90 | |
91 | - if ( ! $give_version ) { |
|
91 | + if ( ! $give_version) { |
|
92 | 92 | // 1.0 is the first version to use this option so we must add it |
93 | 93 | $give_version = '1.0'; |
94 | - add_option( 'give_version', $give_version ); |
|
94 | + add_option('give_version', $give_version); |
|
95 | 95 | } |
96 | 96 | |
97 | - update_option( 'give_version', GIVE_VERSION ); |
|
97 | + update_option('give_version', GIVE_VERSION); |
|
98 | 98 | |
99 | - if ( DOING_AJAX ) { |
|
100 | - die( 'complete' ); |
|
99 | + if (DOING_AJAX) { |
|
100 | + die('complete'); |
|
101 | 101 | } // Let AJAX know that the upgrade is complete |
102 | 102 | } |
103 | 103 | |
104 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
104 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Check if the upgrade routine has been run for a specific action |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return bool If the action has been added to the completed actions array |
114 | 114 | */ |
115 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
115 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
116 | 116 | |
117 | - if ( empty( $upgrade_action ) ) { |
|
117 | + if (empty($upgrade_action)) { |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | 121 | $completed_upgrades = give_get_completed_upgrades(); |
122 | 122 | |
123 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
123 | + return in_array($upgrade_action, $completed_upgrades); |
|
124 | 124 | |
125 | 125 | } |
126 | 126 | |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return bool If the function was successfully added |
135 | 135 | */ |
136 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
136 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
137 | 137 | |
138 | - if ( empty( $upgrade_action ) ) { |
|
138 | + if (empty($upgrade_action)) { |
|
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | $completed_upgrades[] = $upgrade_action; |
144 | 144 | |
145 | 145 | // Remove any blanks, and only show uniques |
146 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
146 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
147 | 147 | |
148 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
148 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function give_get_completed_upgrades() { |
158 | 158 | |
159 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
159 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
160 | 160 | |
161 | - if ( false === $completed_upgrades ) { |
|
161 | + if (false === $completed_upgrades) { |
|
162 | 162 | $completed_upgrades = array(); |
163 | 163 | } |
164 | 164 | |
@@ -177,30 +177,30 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function give_v132_upgrade_give_payment_customer_id() { |
179 | 179 | global $wpdb; |
180 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
181 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
180 | + if ( ! current_user_can('manage_give_settings')) { |
|
181 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
182 | 182 | } |
183 | 183 | |
184 | - ignore_user_abort( true ); |
|
184 | + ignore_user_abort(true); |
|
185 | 185 | |
186 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
187 | - @set_time_limit( 0 ); |
|
186 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
187 | + @set_time_limit(0); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | //UPDATE DB METAKEYS |
191 | 191 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
192 | - $query = $wpdb->query( $sql ); |
|
192 | + $query = $wpdb->query($sql); |
|
193 | 193 | |
194 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
195 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
196 | - delete_option( 'give_doing_upgrade' ); |
|
197 | - wp_redirect( admin_url() ); |
|
194 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
195 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
196 | + delete_option('give_doing_upgrade'); |
|
197 | + wp_redirect(admin_url()); |
|
198 | 198 | exit; |
199 | 199 | |
200 | 200 | |
201 | 201 | } |
202 | 202 | |
203 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
203 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Upgrades the Offline Status |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | |
215 | 215 | global $wpdb; |
216 | 216 | |
217 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
218 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
217 | + if ( ! current_user_can('manage_give_settings')) { |
|
218 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
219 | 219 | } |
220 | 220 | |
221 | - ignore_user_abort( true ); |
|
221 | + ignore_user_abort(true); |
|
222 | 222 | |
223 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
224 | - @set_time_limit( 0 ); |
|
223 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
224 | + @set_time_limit(0); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Get abandoned offline payments |
@@ -231,35 +231,35 @@ discard block |
||
231 | 231 | $where .= "AND ( p.post_status = 'abandoned' )"; |
232 | 232 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
233 | 233 | |
234 | - $sql = $select . $join . $where; |
|
235 | - $found_payments = $wpdb->get_col( $sql ); |
|
234 | + $sql = $select.$join.$where; |
|
235 | + $found_payments = $wpdb->get_col($sql); |
|
236 | 236 | |
237 | 237 | |
238 | - foreach ( $found_payments as $payment ) { |
|
238 | + foreach ($found_payments as $payment) { |
|
239 | 239 | |
240 | 240 | //Only change ones marked abandoned since our release last week |
241 | 241 | //because the admin may have marked some abandoned themselves |
242 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
242 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
243 | 243 | |
244 | 244 | //1450124863 = 12/10/2015 20:42:25 |
245 | - if ( $modified_time >= 1450124863 ) { |
|
245 | + if ($modified_time >= 1450124863) { |
|
246 | 246 | |
247 | - give_update_payment_status( $payment, 'pending' ); |
|
247 | + give_update_payment_status($payment, 'pending'); |
|
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | 251 | } |
252 | 252 | |
253 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
254 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
255 | - delete_option( 'give_doing_upgrade' ); |
|
256 | - wp_redirect( admin_url() ); |
|
253 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
254 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
255 | + delete_option('give_doing_upgrade'); |
|
256 | + wp_redirect(admin_url()); |
|
257 | 257 | exit; |
258 | 258 | |
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
262 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
|
263 | 263 | |
264 | 264 | |
265 | 265 | /** |
@@ -271,17 +271,17 @@ discard block |
||
271 | 271 | */ |
272 | 272 | function give_v152_cleanup_users() { |
273 | 273 | |
274 | - $give_version = get_option( 'give_version' ); |
|
274 | + $give_version = get_option('give_version'); |
|
275 | 275 | |
276 | - if ( ! $give_version ) { |
|
276 | + if ( ! $give_version) { |
|
277 | 277 | // 1.0 is the first version to use this option so we must add it |
278 | 278 | $give_version = '1.0'; |
279 | 279 | } |
280 | 280 | |
281 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
281 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
282 | 282 | |
283 | 283 | //v1.5.2 Upgrades |
284 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
284 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
285 | 285 | |
286 | 286 | //Delete all caps with "ss" |
287 | 287 | //Also delete all unused "campaign" roles |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | ); |
329 | 329 | |
330 | 330 | global $wp_roles; |
331 | - foreach ( $delete_caps as $cap ) { |
|
332 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
333 | - $wp_roles->remove_cap( $role, $cap ); |
|
331 | + foreach ($delete_caps as $cap) { |
|
332 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
333 | + $wp_roles->remove_cap($role, $cap); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
@@ -340,12 +340,12 @@ discard block |
||
340 | 340 | $roles->add_caps(); |
341 | 341 | |
342 | 342 | //The Update Ran |
343 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
344 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
345 | - delete_option( 'give_doing_upgrade' ); |
|
343 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
344 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
345 | + delete_option('give_doing_upgrade'); |
|
346 | 346 | |
347 | 347 | } |
348 | 348 | |
349 | 349 | } |
350 | 350 | |
351 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
352 | 351 | \ No newline at end of file |
352 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
353 | 353 | \ No newline at end of file |
@@ -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,29 +39,29 @@ 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 | - 'products' => esc_html__( 'Products', 'give' ), |
|
54 | - 'amount' => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
55 | - 'gateway' => esc_html__( 'Payment Method', 'give' ), |
|
56 | - 'trans_id' => esc_html__( 'Transaction ID', 'give' ), |
|
57 | - 'key' => esc_html__( 'Purchase Key', 'give' ), |
|
58 | - 'date' => esc_html__( 'Date', 'give' ), |
|
59 | - 'user' => esc_html__( 'User', 'give' ), |
|
60 | - '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 | + 'products' => esc_html__('Products', 'give'), |
|
54 | + 'amount' => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
55 | + 'gateway' => esc_html__('Payment Method', 'give'), |
|
56 | + 'trans_id' => esc_html__('Transaction ID', 'give'), |
|
57 | + 'key' => esc_html__('Purchase Key', 'give'), |
|
58 | + 'date' => esc_html__('Date', 'give'), |
|
59 | + 'user' => esc_html__('User', 'give'), |
|
60 | + 'status' => esc_html__('Status', 'give') |
|
61 | 61 | ); |
62 | 62 | |
63 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
64 | - unset( $cols['seq_id'] ); |
|
63 | + if ( ! give_get_option('enable_sequential')) { |
|
64 | + unset($cols['seq_id']); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | 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,104 +101,104 @@ 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 ( $downloads ) { |
|
117 | - foreach ( $downloads as $key => $download ) { |
|
116 | + if ($downloads) { |
|
117 | + foreach ($downloads as $key => $download) { |
|
118 | 118 | |
119 | 119 | // Form ID |
120 | - $id = isset( $payment_meta['cart_details'] ) ? $download['id'] : $download; |
|
121 | - $qty = isset( $download['quantity'] ) ? $download['quantity'] : 1; |
|
120 | + $id = isset($payment_meta['cart_details']) ? $download['id'] : $download; |
|
121 | + $qty = isset($download['quantity']) ? $download['quantity'] : 1; |
|
122 | 122 | |
123 | - if ( isset( $download['price'] ) ) { |
|
123 | + if (isset($download['price'])) { |
|
124 | 124 | $price = $download['price']; |
125 | 125 | } else { |
126 | 126 | // If the download has variable prices, override the default price |
127 | - $price_override = isset( $payment_meta['cart_details'] ) ? $download['price'] : null; |
|
128 | - $price = give_get_download_final_price( $id, $user_info, $price_override ); |
|
127 | + $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null; |
|
128 | + $price = give_get_download_final_price($id, $user_info, $price_override); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | // Display the Downoad Name |
133 | - $products .= html_entity_decode( get_the_title( $id ) ); |
|
133 | + $products .= html_entity_decode(get_the_title($id)); |
|
134 | 134 | |
135 | - if ( $qty > 1 ) { |
|
136 | - $products .= html_entity_decode( ' (' . $qty . ')' ); |
|
135 | + if ($qty > 1) { |
|
136 | + $products .= html_entity_decode(' ('.$qty.')'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $products .= ' - '; |
140 | 140 | |
141 | - if ( give_use_skus() ) { |
|
142 | - $sku = give_get_download_sku( $id ); |
|
141 | + if (give_use_skus()) { |
|
142 | + $sku = give_get_download_sku($id); |
|
143 | 143 | |
144 | - if ( ! empty( $sku ) ) { |
|
144 | + if ( ! empty($sku)) { |
|
145 | 145 | $skus .= $sku; |
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - if ( isset( $downloads[ $key ]['item_number'] ) && isset( $downloads[ $key ]['item_number']['options'] ) ) { |
|
150 | - $price_options = $downloads[ $key ]['item_number']['options']; |
|
149 | + if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) { |
|
150 | + $price_options = $downloads[$key]['item_number']['options']; |
|
151 | 151 | |
152 | - if ( isset( $price_options['price_id'] ) ) { |
|
153 | - $products .= html_entity_decode( give_get_price_option_name( $id, $price_options['price_id'], $payment->ID ) ) . ' - '; |
|
152 | + if (isset($price_options['price_id'])) { |
|
153 | + $products .= html_entity_decode(give_get_price_option_name($id, $price_options['price_id'], $payment->ID)).' - '; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - $products .= html_entity_decode( give_currency_filter( give_format_amount( $price ) ) ); |
|
157 | + $products .= html_entity_decode(give_currency_filter(give_format_amount($price))); |
|
158 | 158 | |
159 | - if ( $key != ( count( $downloads ) - 1 ) ) { |
|
159 | + if ($key != (count($downloads) - 1)) { |
|
160 | 160 | $products .= ' / '; |
161 | 161 | |
162 | - if ( give_use_skus() ) { |
|
162 | + if (give_use_skus()) { |
|
163 | 163 | $skus .= ' / '; |
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( is_numeric( $user_id ) ) { |
|
170 | - $user = get_userdata( $user_id ); |
|
169 | + if (is_numeric($user_id)) { |
|
170 | + $user = get_userdata($user_id); |
|
171 | 171 | } else { |
172 | 172 | $user = false; |
173 | 173 | } |
174 | 174 | |
175 | 175 | $data[] = array( |
176 | 176 | 'id' => $payment->ID, |
177 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
177 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
178 | 178 | 'email' => $payment_meta['email'], |
179 | 179 | 'first' => $user_info['first_name'], |
180 | 180 | 'last' => $user_info['last_name'], |
181 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
182 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
183 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
184 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
185 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
186 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
181 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
182 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
183 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
184 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
185 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
186 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
187 | 187 | 'products' => $products, |
188 | 188 | 'skus' => $skus, |
189 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
190 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
191 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
189 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
190 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
191 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
192 | 192 | 'key' => $payment_meta['key'], |
193 | 193 | 'date' => $payment->post_date, |
194 | - 'user' => $user ? $user->display_name : esc_html__( 'guest', 'give' ), |
|
195 | - 'status' => give_get_payment_status( $payment, true ) |
|
194 | + 'user' => $user ? $user->display_name : esc_html__('guest', 'give'), |
|
195 | + 'status' => give_get_payment_status($payment, true) |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | } |
199 | 199 | |
200 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
201 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
200 | + $data = apply_filters('give_export_get_data', $data); |
|
201 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
202 | 202 | |
203 | 203 | return $data; |
204 | 204 | |
@@ -218,27 +218,27 @@ discard block |
||
218 | 218 | |
219 | 219 | $status = $this->status; |
220 | 220 | $args = array( |
221 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
222 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
221 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
222 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
223 | 223 | ); |
224 | 224 | |
225 | - if ( 'any' == $status ) { |
|
225 | + if ('any' == $status) { |
|
226 | 226 | |
227 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
227 | + $total = array_sum((array) give_count_payments($args)); |
|
228 | 228 | |
229 | 229 | } else { |
230 | 230 | |
231 | - $total = give_count_payments( $args )->$status; |
|
231 | + $total = give_count_payments($args)->$status; |
|
232 | 232 | |
233 | 233 | } |
234 | 234 | |
235 | 235 | $percentage = 100; |
236 | 236 | |
237 | - if ( $total > 0 ) { |
|
238 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
237 | + if ($total > 0) { |
|
238 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( $percentage > 100 ) { |
|
241 | + if ($percentage > 100) { |
|
242 | 242 | $percentage = 100; |
243 | 243 | } |
244 | 244 | |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param array $request The Form Data passed into the batch processing |
254 | 254 | */ |
255 | - public function set_properties( $request ) { |
|
256 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
257 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
258 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
255 | + public function set_properties($request) { |
|
256 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
257 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
258 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
259 | 259 | } |
260 | 260 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
27 | 27 | } |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
31 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
32 | 32 | |
33 | 33 | $export = new $_REQUEST['class']; |
34 | 34 | $export->export(); |
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
38 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Exports earnings for a specified time period |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | function give_export_earnings() { |
49 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php'; |
|
49 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php'; |
|
50 | 50 | |
51 | 51 | $earnings_export = new Give_Earnings_Export(); |
52 | 52 | |
53 | 53 | $earnings_export->export(); |
54 | 54 | } |
55 | 55 | |
56 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
56 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function give_export_all_customers() { |
69 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php'; |
|
69 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php'; |
|
70 | 70 | |
71 | 71 | $customer_export = new Give_Donors_Export(); |
72 | 72 | |
73 | 73 | $customer_export->export(); |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'give_email_export', 'give_export_all_customers' ); |
|
76 | +add_action('give_email_export', 'give_export_all_customers'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Add a hook allowing extensions to register a hook on the batch export process |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | function give_register_batch_exporters() { |
85 | - if ( is_admin() ) { |
|
86 | - do_action( 'give_register_batch_exporter' ); |
|
85 | + if (is_admin()) { |
|
86 | + do_action('give_register_batch_exporter'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
90 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Register the payments batch exporter |
94 | 94 | * @since 1.5 |
95 | 95 | */ |
96 | 96 | function give_register_payments_batch_export() { |
97 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
97 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
98 | 98 | } |
99 | 99 | |
100 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
100 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Loads the payments batch process if needed |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return void |
110 | 110 | */ |
111 | -function give_include_payments_batch_processor( $class ) { |
|
111 | +function give_include_payments_batch_processor($class) { |
|
112 | 112 | |
113 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
114 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
113 | + if ('Give_Batch_Payments_Export' === $class) { |
|
114 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * @since 1.5.2 |
122 | 122 | */ |
123 | 123 | function give_register_customers_batch_export() { |
124 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 ); |
|
124 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1); |
|
125 | 125 | } |
126 | 126 | |
127 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
127 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Loads the customers batch process if needed |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_include_customers_batch_processor( $class ) { |
|
138 | +function give_include_customers_batch_processor($class) { |
|
139 | 139 | |
140 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
141 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
140 | + if ('Give_Batch_Customers_Export' === $class) { |
|
141 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | } |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | * @since 1.5 |
150 | 150 | */ |
151 | 151 | function give_register_forms_batch_export() { |
152 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
152 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
153 | 153 | } |
154 | 154 | |
155 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
155 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
156 | 156 | |
157 | 157 | /** |
158 | 158 | * Loads the file downloads batch process if needed |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return void |
165 | 165 | */ |
166 | -function give_include_forms_batch_processor( $class ) { |
|
166 | +function give_include_forms_batch_processor($class) { |
|
167 | 167 | |
168 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
169 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
168 | + if ('Give_Batch_Forms_Export' === $class) { |
|
169 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | } |
173 | 173 | \ No newline at end of file |
@@ -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 | |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | public function csv_cols() { |
42 | 42 | |
43 | 43 | $cols = array( |
44 | - 'ID' => esc_html__( 'ID', 'give' ), |
|
45 | - 'post_name' => esc_html__( 'Slug', 'give' ), |
|
46 | - 'post_title' => esc_html__( 'Name', 'give' ), |
|
47 | - 'post_date' => esc_html__( 'Date Created', 'give' ), |
|
48 | - 'post_author' => esc_html__( 'Author', 'give' ), |
|
49 | - 'post_content' => esc_html__( 'Description', 'give' ), |
|
50 | - 'post_excerpt' => esc_html__( 'Excerpt', 'give' ), |
|
51 | - 'post_status' => esc_html__( 'Status', 'give' ), |
|
52 | - 'categories' => esc_html__( 'Categories', 'give' ), |
|
53 | - 'tags' => esc_html__( 'Tags', 'give' ), |
|
54 | - 'give_price' => esc_html__( 'Price', 'give' ), |
|
55 | - '_thumbnail_id' => esc_html__( 'Featured Image', 'give' ), |
|
56 | - '_give_form_sales' => esc_html__( 'Donations', 'give' ), |
|
57 | - '_give_download_earnings' => esc_html__( 'Income', 'give' ), |
|
44 | + 'ID' => esc_html__('ID', 'give'), |
|
45 | + 'post_name' => esc_html__('Slug', 'give'), |
|
46 | + 'post_title' => esc_html__('Name', 'give'), |
|
47 | + 'post_date' => esc_html__('Date Created', 'give'), |
|
48 | + 'post_author' => esc_html__('Author', 'give'), |
|
49 | + 'post_content' => esc_html__('Description', 'give'), |
|
50 | + 'post_excerpt' => esc_html__('Excerpt', 'give'), |
|
51 | + 'post_status' => esc_html__('Status', 'give'), |
|
52 | + 'categories' => esc_html__('Categories', 'give'), |
|
53 | + 'tags' => esc_html__('Tags', 'give'), |
|
54 | + 'give_price' => esc_html__('Price', 'give'), |
|
55 | + '_thumbnail_id' => esc_html__('Featured Image', 'give'), |
|
56 | + '_give_form_sales' => esc_html__('Donations', 'give'), |
|
57 | + '_give_download_earnings' => esc_html__('Income', 'give'), |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | return $cols; |
@@ -86,43 +86,43 @@ discard block |
||
86 | 86 | 'paged' => $this->step |
87 | 87 | ); |
88 | 88 | |
89 | - $downloads = new WP_Query( $args ); |
|
89 | + $downloads = new WP_Query($args); |
|
90 | 90 | |
91 | - if ( $downloads->posts ) { |
|
92 | - foreach ( $downloads->posts as $download ) { |
|
91 | + if ($downloads->posts) { |
|
92 | + foreach ($downloads->posts as $download) { |
|
93 | 93 | |
94 | 94 | $row = array(); |
95 | 95 | |
96 | - foreach ( $this->csv_cols() as $key => $value ) { |
|
96 | + foreach ($this->csv_cols() as $key => $value) { |
|
97 | 97 | |
98 | 98 | // Setup default value |
99 | - $row[ $key ] = ''; |
|
99 | + $row[$key] = ''; |
|
100 | 100 | |
101 | - if ( in_array( $key, $meta ) ) { |
|
101 | + if (in_array($key, $meta)) { |
|
102 | 102 | |
103 | - switch ( $key ) { |
|
103 | + switch ($key) { |
|
104 | 104 | |
105 | 105 | case '_thumbnail_id' : |
106 | 106 | |
107 | - $image_id = get_post_thumbnail_id( $download->ID ); |
|
108 | - $row[ $key ] = wp_get_attachment_url( $image_id ); |
|
107 | + $image_id = get_post_thumbnail_id($download->ID); |
|
108 | + $row[$key] = wp_get_attachment_url($image_id); |
|
109 | 109 | |
110 | 110 | break; |
111 | 111 | |
112 | 112 | case 'give_price' : |
113 | 113 | |
114 | - if ( give_has_variable_prices( $download->ID ) ) { |
|
114 | + if (give_has_variable_prices($download->ID)) { |
|
115 | 115 | |
116 | 116 | $prices = array(); |
117 | - foreach ( give_get_variable_prices( $download->ID ) as $price ) { |
|
118 | - $prices[] = $price['name'] . ': ' . $price['amount']; |
|
117 | + foreach (give_get_variable_prices($download->ID) as $price) { |
|
118 | + $prices[] = $price['name'].': '.$price['amount']; |
|
119 | 119 | } |
120 | 120 | |
121 | - $row[ $key ] = implode( ' | ', $prices ); |
|
121 | + $row[$key] = implode(' | ', $prices); |
|
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $row[ $key ] = give_get_download_price( $download->ID ); |
|
125 | + $row[$key] = give_get_download_price($download->ID); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
@@ -132,54 +132,54 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | $files = array(); |
135 | - foreach ( give_get_download_files( $download->ID ) as $file ) { |
|
135 | + foreach (give_get_download_files($download->ID) as $file) { |
|
136 | 136 | $files[] = $file['file']; |
137 | 137 | } |
138 | 138 | |
139 | - $row[ $key ] = implode( ' | ', $files ); |
|
139 | + $row[$key] = implode(' | ', $files); |
|
140 | 140 | |
141 | 141 | break; |
142 | 142 | |
143 | 143 | default : |
144 | 144 | |
145 | - $row[ $key ] = get_post_meta( $download->ID, $key, true ); |
|
145 | + $row[$key] = get_post_meta($download->ID, $key, true); |
|
146 | 146 | |
147 | 147 | break; |
148 | 148 | |
149 | 149 | } |
150 | 150 | |
151 | - } elseif ( isset( $download->$key ) ) { |
|
151 | + } elseif (isset($download->$key)) { |
|
152 | 152 | |
153 | - switch ( $key ) { |
|
153 | + switch ($key) { |
|
154 | 154 | |
155 | 155 | case 'post_author' : |
156 | 156 | |
157 | - $row[ $key ] = get_the_author_meta( 'user_login', $download->post_author ); |
|
157 | + $row[$key] = get_the_author_meta('user_login', $download->post_author); |
|
158 | 158 | |
159 | 159 | break; |
160 | 160 | |
161 | 161 | default : |
162 | 162 | |
163 | - $row[ $key ] = $download->$key; |
|
163 | + $row[$key] = $download->$key; |
|
164 | 164 | |
165 | 165 | break; |
166 | 166 | } |
167 | 167 | |
168 | - } elseif ( 'tags' == $key ) { |
|
168 | + } elseif ('tags' == $key) { |
|
169 | 169 | |
170 | - $terms = get_the_terms( $download->ID, 'download_tag' ); |
|
171 | - if ( $terms ) { |
|
172 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
173 | - $row[ $key ] = implode( ' | ', $terms ); |
|
170 | + $terms = get_the_terms($download->ID, 'download_tag'); |
|
171 | + if ($terms) { |
|
172 | + $terms = wp_list_pluck($terms, 'name'); |
|
173 | + $row[$key] = implode(' | ', $terms); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
177 | - } elseif ( 'categories' == $key ) { |
|
177 | + } elseif ('categories' == $key) { |
|
178 | 178 | |
179 | - $terms = get_the_terms( $download->ID, 'download_category' ); |
|
180 | - if ( $terms ) { |
|
181 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
182 | - $row[ $key ] = implode( ' | ', $terms ); |
|
179 | + $terms = get_the_terms($download->ID, 'download_category'); |
|
180 | + if ($terms) { |
|
181 | + $terms = wp_list_pluck($terms, 'name'); |
|
182 | + $row[$key] = implode(' | ', $terms); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | } |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | |
191 | 191 | } |
192 | 192 | |
193 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
194 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
193 | + $data = apply_filters('give_export_get_data', $data); |
|
194 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
195 | 195 | |
196 | 196 | return $data; |
197 | 197 | } |
@@ -210,20 +210,20 @@ discard block |
||
210 | 210 | |
211 | 211 | $args = array( |
212 | 212 | 'post_type' => 'give_forms', |
213 | - 'posts_per_page' => - 1, |
|
213 | + 'posts_per_page' => -1, |
|
214 | 214 | 'post_status' => 'any', |
215 | 215 | 'fields' => 'ids', |
216 | 216 | ); |
217 | 217 | |
218 | - $downloads = new WP_Query( $args ); |
|
218 | + $downloads = new WP_Query($args); |
|
219 | 219 | $total = (int) $downloads->post_count; |
220 | 220 | $percentage = 100; |
221 | 221 | |
222 | - if ( $total > 0 ) { |
|
223 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
222 | + if ($total > 0) { |
|
223 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
224 | 224 | } |
225 | 225 | |
226 | - if ( $percentage > 100 ) { |
|
226 | + if ($percentage > 100) { |
|
227 | 227 | $percentage = 100; |
228 | 228 | } |
229 | 229 |
@@ -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 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return bool Whether we can export or not |
38 | 38 | */ |
39 | 39 | public function can_export() { |
40 | - return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) ); |
|
40 | + return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | public function headers() { |
51 | - ignore_user_abort( true ); |
|
51 | + ignore_user_abort(true); |
|
52 | 52 | |
53 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
54 | - set_time_limit( 0 ); |
|
53 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
54 | + set_time_limit(0); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | nocache_headers(); |
58 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
59 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
60 | - header( "Expires: 0" ); |
|
58 | + header('Content-Type: text/csv; charset=utf-8'); |
|
59 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
60 | + header("Expires: 0"); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function csv_cols() { |
71 | 71 | $cols = array( |
72 | - 'id' => esc_html__( 'ID', 'give' ), |
|
73 | - 'date' => esc_html__( 'Date', 'give' ) |
|
72 | + 'id' => esc_html__('ID', 'give'), |
|
73 | + 'date' => esc_html__('Date', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | return $cols; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function get_csv_cols() { |
87 | 87 | $cols = $this->csv_cols(); |
88 | 88 | |
89 | - return apply_filters( 'give_export_csv_cols_' . $this->export_type, $cols ); |
|
89 | + return apply_filters('give_export_csv_cols_'.$this->export_type, $cols); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | public function csv_cols_out() { |
101 | 101 | $cols = $this->get_csv_cols(); |
102 | 102 | $i = 1; |
103 | - foreach ( $cols as $col_id => $column ) { |
|
104 | - echo '"' . addslashes( $column ) . '"'; |
|
105 | - echo $i == count( $cols ) ? '' : ','; |
|
106 | - $i ++; |
|
103 | + foreach ($cols as $col_id => $column) { |
|
104 | + echo '"'.addslashes($column).'"'; |
|
105 | + echo $i == count($cols) ? '' : ','; |
|
106 | + $i++; |
|
107 | 107 | } |
108 | 108 | echo "\r\n"; |
109 | 109 | } |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | $data = array( |
121 | 121 | 0 => array( |
122 | 122 | 'id' => '', |
123 | - 'data' => date( 'F j, Y' ) |
|
123 | + 'data' => date('F j, Y') |
|
124 | 124 | ), |
125 | 125 | 1 => array( |
126 | 126 | 'id' => '', |
127 | - 'data' => date( 'F j, Y' ) |
|
127 | + 'data' => date('F j, Y') |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | |
131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
132 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
131 | + $data = apply_filters('give_export_get_data', $data); |
|
132 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
133 | 133 | |
134 | 134 | return $data; |
135 | 135 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | $cols = $this->get_csv_cols(); |
148 | 148 | |
149 | 149 | // Output each row |
150 | - foreach ( $data as $row ) { |
|
150 | + foreach ($data as $row) { |
|
151 | 151 | $i = 1; |
152 | - foreach ( $row as $col_id => $column ) { |
|
152 | + foreach ($row as $col_id => $column) { |
|
153 | 153 | // Make sure the column is valid |
154 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
155 | - echo '"' . addslashes( $column ) . '"'; |
|
156 | - echo $i == count( $cols ) ? '' : ','; |
|
157 | - $i ++; |
|
154 | + if (array_key_exists($col_id, $cols)) { |
|
155 | + echo '"'.addslashes($column).'"'; |
|
156 | + echo $i == count($cols) ? '' : ','; |
|
157 | + $i++; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | echo "\r\n"; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function export() { |
176 | - if ( ! $this->can_export() ) { |
|
177 | - wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
176 | + if ( ! $this->can_export()) { |
|
177 | + wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // Set headers |
@@ -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 | |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | public function headers() { |
41 | - ignore_user_abort( true ); |
|
41 | + ignore_user_abort(true); |
|
42 | 42 | |
43 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
44 | - set_time_limit( 0 ); |
|
43 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
44 | + set_time_limit(0); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | nocache_headers(); |
48 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
49 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
50 | - header( "Expires: 0" ); |
|
48 | + header('Content-Type: text/csv; charset=utf-8'); |
|
49 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
50 | + header("Expires: 0"); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | public function csv_cols() { |
62 | 62 | |
63 | 63 | $cols = array( |
64 | - 'date' => esc_html__( 'Date', 'give' ), |
|
65 | - 'donations' => esc_html__( 'Donations', 'give' ), |
|
64 | + 'date' => esc_html__('Date', 'give'), |
|
65 | + 'donations' => esc_html__('Donations', 'give'), |
|
66 | 66 | /* translators: %s: currency */ |
67 | - 'earnings' => sprintf( esc_html__( 'Income (%s)', 'give' ), html_entity_decode( give_currency_filter( '' ) ) ) |
|
67 | + 'earnings' => sprintf(esc_html__('Income (%s)', 'give'), html_entity_decode(give_currency_filter(''))) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | return $cols; |
@@ -79,28 +79,28 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function get_data() { |
81 | 81 | |
82 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
83 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
84 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
85 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
82 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
83 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
84 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
85 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
86 | 86 | |
87 | 87 | $data = array(); |
88 | 88 | $year = $start_year; |
89 | 89 | $stats = new Give_Payment_Stats; |
90 | 90 | |
91 | - while ( $year <= $end_year ) { |
|
91 | + while ($year <= $end_year) { |
|
92 | 92 | |
93 | - if ( $year == $start_year && $year == $end_year ) { |
|
93 | + if ($year == $start_year && $year == $end_year) { |
|
94 | 94 | |
95 | 95 | $m1 = $start_month; |
96 | 96 | $m2 = $end_month; |
97 | 97 | |
98 | - } elseif ( $year == $start_year ) { |
|
98 | + } elseif ($year == $start_year) { |
|
99 | 99 | |
100 | 100 | $m1 = $start_month; |
101 | 101 | $m2 = 12; |
102 | 102 | |
103 | - } elseif ( $year == $end_year ) { |
|
103 | + } elseif ($year == $end_year) { |
|
104 | 104 | |
105 | 105 | $m1 = 1; |
106 | 106 | $m2 = $end_month; |
@@ -112,28 +112,28 @@ discard block |
||
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - while ( $m1 <= $m2 ) { |
|
115 | + while ($m1 <= $m2) { |
|
116 | 116 | |
117 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
118 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
117 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
118 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
119 | 119 | |
120 | 120 | $data[] = array( |
121 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
122 | - 'donations' => $stats->get_sales( 0, $date1, $date2, array( 'publish', 'revoked' ) ), |
|
123 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ), |
|
121 | + 'date' => date_i18n('F Y', $date1), |
|
122 | + 'donations' => $stats->get_sales(0, $date1, $date2, array('publish', 'revoked')), |
|
123 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2)), |
|
124 | 124 | ); |
125 | 125 | |
126 | - $m1 ++; |
|
126 | + $m1++; |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | - $year ++; |
|
131 | + $year++; |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
136 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
135 | + $data = apply_filters('give_export_get_data', $data); |
|
136 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
137 | 137 | |
138 | 138 | return $data; |
139 | 139 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,80 +22,80 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
29 | - do_action( 'give_tools_recount_stats_before' ); |
|
29 | + do_action('give_tools_recount_stats_before'); |
|
30 | 30 | ?> |
31 | 31 | <div id="poststuff"> |
32 | 32 | <div class="postbox"> |
33 | 33 | |
34 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
34 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
35 | 35 | |
36 | 36 | <div class="inside recount-stats-controls"> |
37 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
37 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
38 | 38 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
39 | 39 | |
40 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
40 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
41 | 41 | |
42 | 42 | <select name="give-export-class" id="recount-stats-type"> |
43 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
44 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
45 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
46 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
47 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
48 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
49 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
50 | - <?php do_action( 'give_recount_tool_options' ); ?> |
|
43 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
44 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
45 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
46 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
47 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
48 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
49 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
50 | + <?php do_action('give_recount_tool_options'); ?> |
|
51 | 51 | </select> |
52 | 52 | |
53 | 53 | <span id="tools-form-dropdown" style="display: none"> |
54 | 54 | <?php |
55 | 55 | $args = array( |
56 | 56 | 'name' => 'form_id', |
57 | - 'number' => - 1, |
|
57 | + 'number' => -1, |
|
58 | 58 | 'chosen' => true, |
59 | 59 | ); |
60 | - echo Give()->html->forms_dropdown( $args ); |
|
60 | + echo Give()->html->forms_dropdown($args); |
|
61 | 61 | ?> |
62 | 62 | </span> |
63 | 63 | |
64 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
64 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
65 | 65 | |
66 | 66 | <br/> |
67 | 67 | |
68 | 68 | <span class="give-recount-stats-descriptions"> |
69 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
69 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
70 | 70 | <span id="recount-form"><?php |
71 | 71 | printf( |
72 | 72 | /* translators: %s: form singular label */ |
73 | - esc_html__( 'Recalculates the donation and income stats for a specific %s.', 'give' ), |
|
74 | - give_get_forms_label_singular( true ) |
|
73 | + esc_html__('Recalculates the donation and income stats for a specific %s.', 'give'), |
|
74 | + give_get_forms_label_singular(true) |
|
75 | 75 | ); |
76 | 76 | ?></span> |
77 | 77 | <span id="recount-all"><?php |
78 | 78 | printf( |
79 | 79 | /* translators: %s: form plural label */ |
80 | - esc_html__( 'Recalculates the earnings and sales stats for all %s.', 'give' ), |
|
81 | - give_get_forms_label_plural( true ) |
|
80 | + esc_html__('Recalculates the earnings and sales stats for all %s.', 'give'), |
|
81 | + give_get_forms_label_plural(true) |
|
82 | 82 | ); |
83 | 83 | ?></span> |
84 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
85 | - <?php do_action( 'give_recount_tool_descriptions' ); ?> |
|
86 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give' ); ?></span> |
|
87 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
84 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
85 | + <?php do_action('give_recount_tool_descriptions'); ?> |
|
86 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give'); ?></span> |
|
87 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
88 | 88 | </span> |
89 | 89 | |
90 | 90 | <span class="spinner"></span> |
91 | 91 | |
92 | 92 | </form> |
93 | - <?php do_action( 'give_tools_recount_forms' ); ?> |
|
93 | + <?php do_action('give_tools_recount_forms'); ?> |
|
94 | 94 | </div><!-- .inside --> |
95 | 95 | </div><!-- .postbox --> |
96 | 96 | </div><!-- #poststuff --> |
97 | 97 | <?php |
98 | - do_action( 'give_tools_recount_stats_after' ); |
|
98 | + do_action('give_tools_recount_stats_after'); |
|
99 | 99 | } |
100 | 100 | |
101 | -add_action( 'give_reports_tab_tools', 'give_tools_recount_stats_display' ); |
|
101 | +add_action('give_reports_tab_tools', 'give_tools_recount_stats_display'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | function give_add_ons_page() { |
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | - <h2><?php esc_html_e( 'Give Add-ons', 'give' ); ?> |
|
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e( 'Browse All Add-ons', 'give' ); ?>" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
28 | + <h2><?php esc_html_e('Give Add-ons', 'give'); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e('Browse All Add-ons', 'give'); ?>" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h2> |
32 | 32 | |
33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
51 | + $cache = get_transient('give_add_ons_feed'); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | - $cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
62 | + $cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |