@@ -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 | /** |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | public function __construct() { |
62 | 62 | |
63 | 63 | // Set parent defaults |
64 | - parent::__construct( array( |
|
65 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
66 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
64 | + parent::__construct(array( |
|
65 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
66 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
67 | 67 | 'ajax' => false // Does this table support ajax? |
68 | - ) ); |
|
68 | + )); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -80,20 +80,20 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return void |
82 | 82 | */ |
83 | - public function search_box( $text, $input_id ) { |
|
84 | - $input_id = $input_id . '-search-input'; |
|
83 | + public function search_box($text, $input_id) { |
|
84 | + $input_id = $input_id.'-search-input'; |
|
85 | 85 | |
86 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
87 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
87 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
88 | 88 | } |
89 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
90 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
89 | + if ( ! empty($_REQUEST['order'])) { |
|
90 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
91 | 91 | } |
92 | 92 | ?> |
93 | 93 | <p class="search-box" role="search"> |
94 | 94 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
95 | 95 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
96 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
96 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
97 | 97 | </p> |
98 | 98 | <?php |
99 | 99 | } |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string Column Name. |
111 | 111 | */ |
112 | - public function column_default( $item, $column_name ) { |
|
113 | - switch ( $column_name ) { |
|
112 | + public function column_default($item, $column_name) { |
|
113 | + switch ($column_name) { |
|
114 | 114 | |
115 | 115 | case 'num_purchases' : |
116 | - $value = '<a href="' . |
|
117 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
118 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
116 | + $value = '<a href="'. |
|
117 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
118 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
119 | 119 | break; |
120 | 120 | |
121 | 121 | case 'amount_spent' : |
122 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
122 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
123 | 123 | break; |
124 | 124 | |
125 | 125 | case 'date_created' : |
126 | - $value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) ); |
|
126 | + $value = date_i18n(give_date_format(), strtotime($item['date_created'])); |
|
127 | 127 | break; |
128 | 128 | |
129 | 129 | default: |
130 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
130 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
131 | 131 | break; |
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
134 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return string |
144 | 144 | */ |
145 | - public function column_name( $item ) { |
|
146 | - $name = '#' . $item['id'] . ' '; |
|
147 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
148 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
149 | - $actions = $this->get_row_actions( $item ); |
|
145 | + public function column_name($item) { |
|
146 | + $name = '#'.$item['id'].' '; |
|
147 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
148 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
149 | + $actions = $this->get_row_actions($item); |
|
150 | 150 | |
151 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
151 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function get_columns() { |
162 | 162 | $columns = array( |
163 | - 'name' => esc_html__( 'Name', 'give' ), |
|
164 | - 'email' => esc_html__( 'Email', 'give' ), |
|
165 | - 'num_purchases' => esc_html__( 'Donations', 'give' ), |
|
166 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ), |
|
167 | - 'date_created' => esc_html__( 'Date Created', 'give' ) |
|
163 | + 'name' => esc_html__('Name', 'give'), |
|
164 | + 'email' => esc_html__('Email', 'give'), |
|
165 | + 'num_purchases' => esc_html__('Donations', 'give'), |
|
166 | + 'amount_spent' => esc_html__('Total Donated', 'give'), |
|
167 | + 'date_created' => esc_html__('Date Created', 'give') |
|
168 | 168 | ); |
169 | 169 | |
170 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
170 | + return apply_filters('give_report_customer_columns', $columns); |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function get_sortable_columns() { |
182 | 182 | return array( |
183 | - 'date_created' => array( 'date_created', true ), |
|
184 | - 'name' => array( 'name', true ), |
|
185 | - 'num_purchases' => array( 'purchase_count', false ), |
|
186 | - 'amount_spent' => array( 'purchase_value', false ), |
|
183 | + 'date_created' => array('date_created', true), |
|
184 | + 'name' => array('name', true), |
|
185 | + 'num_purchases' => array('purchase_count', false), |
|
186 | + 'amount_spent' => array('purchase_value', false), |
|
187 | 187 | ); |
188 | 188 | } |
189 | 189 | |
@@ -195,34 +195,34 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @return array An array of action links. |
197 | 197 | */ |
198 | - public function get_row_actions( $item ) { |
|
198 | + public function get_row_actions($item) { |
|
199 | 199 | |
200 | 200 | $actions = array( |
201 | 201 | |
202 | 202 | 'view' => sprintf( |
203 | 203 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
204 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ), |
|
205 | - sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ), |
|
206 | - esc_html__( 'View Donor', 'give' ) |
|
204 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']), |
|
205 | + sprintf(esc_attr__('View "%s"', 'give'), $item['name']), |
|
206 | + esc_html__('View Donor', 'give') |
|
207 | 207 | ), |
208 | 208 | |
209 | 209 | 'notes' => sprintf( |
210 | 210 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
211 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ), |
|
212 | - sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ), |
|
213 | - esc_html__( 'Notes', 'give' ) |
|
211 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']), |
|
212 | + sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']), |
|
213 | + esc_html__('Notes', 'give') |
|
214 | 214 | ), |
215 | 215 | |
216 | 216 | 'delete' => sprintf( |
217 | 217 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
218 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ), |
|
219 | - sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ), |
|
220 | - esc_html__( 'Delete', 'give' ) |
|
218 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']), |
|
219 | + sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']), |
|
220 | + esc_html__('Delete', 'give') |
|
221 | 221 | ) |
222 | 222 | |
223 | 223 | ); |
224 | 224 | |
225 | - return apply_filters( 'give_donor_row_actions', $actions, $item ); |
|
225 | + return apply_filters('give_donor_row_actions', $actions, $item); |
|
226 | 226 | |
227 | 227 | } |
228 | 228 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @since 1.0 |
234 | 234 | * @return void |
235 | 235 | */ |
236 | - public function bulk_actions( $which = '' ) { |
|
236 | + public function bulk_actions($which = '') { |
|
237 | 237 | // These aren't really bulk actions but this outputs the markup in the right place. |
238 | 238 | } |
239 | 239 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return int Current page number. |
246 | 246 | */ |
247 | 247 | public function get_paged() { |
248 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
248 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return mixed string If search is present, false otherwise. |
257 | 257 | */ |
258 | 258 | public function get_search() { |
259 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
259 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | |
274 | 274 | $data = array(); |
275 | 275 | $paged = $this->get_paged(); |
276 | - $offset = $this->per_page * ( $paged - 1 ); |
|
276 | + $offset = $this->per_page * ($paged - 1); |
|
277 | 277 | $search = $this->get_search(); |
278 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
279 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
278 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
279 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
280 | 280 | |
281 | 281 | $args = array( |
282 | 282 | 'number' => $this->per_page, |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | 'orderby' => $orderby |
286 | 286 | ); |
287 | 287 | |
288 | - if ( is_email( $search ) ) { |
|
288 | + if (is_email($search)) { |
|
289 | 289 | $args['email'] = $search; |
290 | - } elseif ( is_numeric( $search ) ) { |
|
290 | + } elseif (is_numeric($search)) { |
|
291 | 291 | $args['id'] = $search; |
292 | 292 | } else { |
293 | 293 | $args['name'] = $search; |
294 | 294 | } |
295 | 295 | |
296 | - $customers = Give()->customers->get_customers( $args ); |
|
296 | + $customers = Give()->customers->get_customers($args); |
|
297 | 297 | |
298 | - if ( $customers ) { |
|
298 | + if ($customers) { |
|
299 | 299 | |
300 | - foreach ( $customers as $customer ) { |
|
300 | + foreach ($customers as $customer) { |
|
301 | 301 | |
302 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
302 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
303 | 303 | |
304 | 304 | $data[] = array( |
305 | 305 | 'id' => $customer->id, |
@@ -333,16 +333,16 @@ discard block |
||
333 | 333 | $hidden = array(); // No hidden columns |
334 | 334 | $sortable = $this->get_sortable_columns(); |
335 | 335 | |
336 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
336 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
337 | 337 | |
338 | 338 | $this->items = $this->reports_data(); |
339 | 339 | |
340 | 340 | $this->total = give_count_total_customers(); |
341 | 341 | |
342 | - $this->set_pagination_args( array( |
|
342 | + $this->set_pagination_args(array( |
|
343 | 343 | 'total_items' => $this->total, |
344 | 344 | 'per_page' => $this->per_page, |
345 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
346 | - ) ); |
|
345 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
346 | + )); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_system_info_callback() { |
26 | 26 | |
27 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
27 | + if ( ! current_user_can('manage_give_settings')) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | ?> |
31 | - <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" aria-label="<?php esc_attr_e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'give' ); ?>"><?php echo give_tools_sysinfo_get(); ?></textarea> |
|
31 | + <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" aria-label="<?php esc_attr_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'give'); ?>"><?php echo give_tools_sysinfo_get(); ?></textarea> |
|
32 | 32 | <p class="submit"> |
33 | 33 | <input type="hidden" name="give-action" value="download_sysinfo"/> |
34 | - <?php submit_button( esc_html__( 'Download System Info File', 'give' ), 'secondary', 'give-download-sysinfo', false ); ?> |
|
34 | + <?php submit_button(esc_html__('Download System Info File', 'give'), 'secondary', 'give-download-sysinfo', false); ?> |
|
35 | 35 | </p> |
36 | 36 | <?php |
37 | 37 | } |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | * @return bool |
48 | 48 | */ |
49 | 49 | function give_allow_sessions_for_sysinfo() { |
50 | - if ( is_admin() && ( isset( $_GET['page'] ) && isset( $_GET['tab'] ) ) && ( $_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings' ) ) { |
|
50 | + if (is_admin() && (isset($_GET['page']) && isset($_GET['tab'])) && ($_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings')) { |
|
51 | 51 | return true; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | -add_filter( 'give_start_session', 'give_allow_sessions_for_sysinfo' ); |
|
55 | +add_filter('give_start_session', 'give_allow_sessions_for_sysinfo'); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | /** |
@@ -67,63 +67,63 @@ discard block |
||
67 | 67 | function give_tools_sysinfo_get() { |
68 | 68 | global $wpdb, $give_options; |
69 | 69 | |
70 | - if ( ! class_exists( 'Browser' ) ) { |
|
71 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php'; |
|
70 | + if ( ! class_exists('Browser')) { |
|
71 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/browser.php'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $browser = new Browser(); |
75 | 75 | |
76 | 76 | // Get theme info |
77 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
78 | - $theme_data = wp_get_theme( get_stylesheet_directory() . '/style.css' ); |
|
79 | - $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; |
|
77 | + if (get_bloginfo('version') < '3.4') { |
|
78 | + $theme_data = wp_get_theme(get_stylesheet_directory().'/style.css'); |
|
79 | + $theme = $theme_data['Name'].' '.$theme_data['Version']; |
|
80 | 80 | } else { |
81 | 81 | $theme_data = wp_get_theme(); |
82 | - $theme = $theme_data->Name . ' ' . $theme_data->Version; |
|
82 | + $theme = $theme_data->Name.' '.$theme_data->Version; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Try to identify the hosting provider |
86 | 86 | $host = give_get_host(); |
87 | 87 | |
88 | - $return = '### Begin System Info ###' . "\n\n"; |
|
88 | + $return = '### Begin System Info ###'."\n\n"; |
|
89 | 89 | |
90 | 90 | // Start with the basics... |
91 | - $return .= '-- Site Info' . "\n\n"; |
|
92 | - $return .= 'Site URL: ' . site_url() . "\n"; |
|
93 | - $return .= 'Home URL: ' . home_url() . "\n"; |
|
94 | - $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; |
|
91 | + $return .= '-- Site Info'."\n\n"; |
|
92 | + $return .= 'Site URL: '.site_url()."\n"; |
|
93 | + $return .= 'Home URL: '.home_url()."\n"; |
|
94 | + $return .= 'Multisite: '.(is_multisite() ? 'Yes' : 'No')."\n"; |
|
95 | 95 | |
96 | - $return = apply_filters( 'give_sysinfo_after_site_info', $return ); |
|
96 | + $return = apply_filters('give_sysinfo_after_site_info', $return); |
|
97 | 97 | |
98 | 98 | // Can we determine the site's host? |
99 | - if ( $host ) { |
|
100 | - $return .= "\n" . '-- Hosting Provider' . "\n\n"; |
|
101 | - $return .= 'Host: ' . $host . "\n"; |
|
99 | + if ($host) { |
|
100 | + $return .= "\n".'-- Hosting Provider'."\n\n"; |
|
101 | + $return .= 'Host: '.$host."\n"; |
|
102 | 102 | |
103 | - $return = apply_filters( 'give_sysinfo_after_host_info', $return ); |
|
103 | + $return = apply_filters('give_sysinfo_after_host_info', $return); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | // The local users' browser information, handled by the Browser class |
107 | - $return .= "\n" . '-- User Browser' . "\n\n"; |
|
107 | + $return .= "\n".'-- User Browser'."\n\n"; |
|
108 | 108 | $return .= $browser; |
109 | 109 | |
110 | - $return = apply_filters( 'give_sysinfo_after_user_browser', $return ); |
|
110 | + $return = apply_filters('give_sysinfo_after_user_browser', $return); |
|
111 | 111 | |
112 | 112 | // WordPress configuration |
113 | - $return .= "\n" . '-- WordPress Configuration' . "\n\n"; |
|
114 | - $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; |
|
115 | - $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; |
|
116 | - $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; |
|
117 | - $return .= 'Active Theme: ' . $theme . "\n"; |
|
118 | - $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; |
|
113 | + $return .= "\n".'-- WordPress Configuration'."\n\n"; |
|
114 | + $return .= 'Version: '.get_bloginfo('version')."\n"; |
|
115 | + $return .= 'Language: '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n"; |
|
116 | + $return .= 'Permalink Structure: '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n"; |
|
117 | + $return .= 'Active Theme: '.$theme."\n"; |
|
118 | + $return .= 'Show On Front: '.get_option('show_on_front')."\n"; |
|
119 | 119 | |
120 | 120 | // Only show page specs if frontpage is set to 'page' |
121 | - if ( get_option( 'show_on_front' ) == 'page' ) { |
|
122 | - $front_page_id = get_option( 'page_on_front' ); |
|
123 | - $blog_page_id = get_option( 'page_for_posts' ); |
|
121 | + if (get_option('show_on_front') == 'page') { |
|
122 | + $front_page_id = get_option('page_on_front'); |
|
123 | + $blog_page_id = get_option('page_for_posts'); |
|
124 | 124 | |
125 | - $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; |
|
126 | - $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; |
|
125 | + $return .= 'Page On Front: '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n"; |
|
126 | + $return .= 'Page For Posts: '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n"; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // Make sure wp_remote_post() is working |
@@ -132,205 +132,205 @@ discard block |
||
132 | 132 | $params = array( |
133 | 133 | 'sslverify' => false, |
134 | 134 | 'timeout' => 60, |
135 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
135 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
136 | 136 | 'body' => $request |
137 | 137 | ); |
138 | 138 | |
139 | - $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); |
|
139 | + $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); |
|
140 | 140 | |
141 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
141 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
142 | 142 | $WP_REMOTE_POST = 'wp_remote_post() works'; |
143 | 143 | } else { |
144 | 144 | $WP_REMOTE_POST = 'wp_remote_post() does not work'; |
145 | 145 | } |
146 | 146 | |
147 | - $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; |
|
148 | - $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; |
|
149 | - $return .= 'Admin AJAX: ' . ( give_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; |
|
150 | - $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; |
|
151 | - $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; |
|
152 | - $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; |
|
147 | + $return .= 'Remote Post: '.$WP_REMOTE_POST."\n"; |
|
148 | + $return .= 'Table Prefix: '.'Length: '.strlen($wpdb->prefix).' Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n"; |
|
149 | + $return .= 'Admin AJAX: '.(give_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n"; |
|
150 | + $return .= 'WP_DEBUG: '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n"; |
|
151 | + $return .= 'Memory Limit: '.WP_MEMORY_LIMIT."\n"; |
|
152 | + $return .= 'Registered Post Stati: '.implode(', ', get_post_stati())."\n"; |
|
153 | 153 | |
154 | - $return = apply_filters( 'give_sysinfo_after_wordpress_config', $return ); |
|
154 | + $return = apply_filters('give_sysinfo_after_wordpress_config', $return); |
|
155 | 155 | |
156 | 156 | // GIVE configuration |
157 | - $return .= "\n" . '-- Give Configuration' . "\n\n"; |
|
158 | - $return .= 'Version: ' . GIVE_VERSION . "\n"; |
|
159 | - $return .= 'Upgraded From: ' . get_option( 'give_version_upgraded_from', 'None' ) . "\n"; |
|
160 | - $return .= 'Test Mode: ' . ( give_is_test_mode() ? "Enabled\n" : "Disabled\n" ); |
|
161 | - $return .= 'Currency Code: ' . give_get_currency() . "\n"; |
|
162 | - $return .= 'Currency Position: ' . give_get_option( 'currency_position', 'before' ) . "\n"; |
|
163 | - $return .= 'Decimal Separator: ' . give_get_option( 'decimal_separator', '.' ) . "\n"; |
|
164 | - $return .= 'Thousands Separator: ' . give_get_option( 'thousands_separator', ',' ) . "\n"; |
|
157 | + $return .= "\n".'-- Give Configuration'."\n\n"; |
|
158 | + $return .= 'Version: '.GIVE_VERSION."\n"; |
|
159 | + $return .= 'Upgraded From: '.get_option('give_version_upgraded_from', 'None')."\n"; |
|
160 | + $return .= 'Test Mode: '.(give_is_test_mode() ? "Enabled\n" : "Disabled\n"); |
|
161 | + $return .= 'Currency Code: '.give_get_currency()."\n"; |
|
162 | + $return .= 'Currency Position: '.give_get_option('currency_position', 'before')."\n"; |
|
163 | + $return .= 'Decimal Separator: '.give_get_option('decimal_separator', '.')."\n"; |
|
164 | + $return .= 'Thousands Separator: '.give_get_option('thousands_separator', ',')."\n"; |
|
165 | 165 | |
166 | - $return = apply_filters( 'give_sysinfo_after_give_config', $return ); |
|
166 | + $return = apply_filters('give_sysinfo_after_give_config', $return); |
|
167 | 167 | |
168 | 168 | // GIVE pages |
169 | - $return .= "\n" . '-- Give Page Configuration' . "\n\n"; |
|
170 | - $return .= 'Success Page: ' . ( ! empty( $give_options['success_page'] ) ? get_permalink( $give_options['success_page'] ) . "\n" : "Unset\n" ); |
|
171 | - $return .= 'Failure Page: ' . ( ! empty( $give_options['failure_page'] ) ? get_permalink( $give_options['failure_page'] ) . "\n" : "Unset\n" ); |
|
172 | - $return .= 'Give Forms Slug: ' . ( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . "\n" : "/donations\n" ); |
|
169 | + $return .= "\n".'-- Give Page Configuration'."\n\n"; |
|
170 | + $return .= 'Success Page: '.( ! empty($give_options['success_page']) ? get_permalink($give_options['success_page'])."\n" : "Unset\n"); |
|
171 | + $return .= 'Failure Page: '.( ! empty($give_options['failure_page']) ? get_permalink($give_options['failure_page'])."\n" : "Unset\n"); |
|
172 | + $return .= 'Give Forms Slug: '.(defined('GIVE_SLUG') ? '/'.GIVE_SLUG."\n" : "/donations\n"); |
|
173 | 173 | |
174 | - $return = apply_filters( 'give_sysinfo_after_give_pages', $return ); |
|
174 | + $return = apply_filters('give_sysinfo_after_give_pages', $return); |
|
175 | 175 | |
176 | 176 | // GIVE gateways |
177 | - $return .= "\n" . '-- Give Gateway Configuration' . "\n\n"; |
|
177 | + $return .= "\n".'-- Give Gateway Configuration'."\n\n"; |
|
178 | 178 | |
179 | 179 | $active_gateways = give_get_enabled_payment_gateways(); |
180 | - if ( $active_gateways ) { |
|
181 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
182 | - if ( $default_gateway_is_active ) { |
|
183 | - $default_gateway = give_get_default_gateway( null ); |
|
184 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
180 | + if ($active_gateways) { |
|
181 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
182 | + if ($default_gateway_is_active) { |
|
183 | + $default_gateway = give_get_default_gateway(null); |
|
184 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
185 | 185 | } else { |
186 | 186 | $default_gateway = 'Test Donation'; |
187 | 187 | } |
188 | 188 | |
189 | 189 | $gateways = array(); |
190 | - foreach ( $active_gateways as $gateway ) { |
|
190 | + foreach ($active_gateways as $gateway) { |
|
191 | 191 | $gateways[] = $gateway['admin_label']; |
192 | 192 | } |
193 | 193 | |
194 | - $return .= 'Enabled Gateways: ' . implode( ', ', $gateways ) . "\n"; |
|
195 | - $return .= 'Default Gateway: ' . $default_gateway . "\n"; |
|
194 | + $return .= 'Enabled Gateways: '.implode(', ', $gateways)."\n"; |
|
195 | + $return .= 'Default Gateway: '.$default_gateway."\n"; |
|
196 | 196 | } else { |
197 | - $return .= 'Enabled Gateways: None' . "\n"; |
|
197 | + $return .= 'Enabled Gateways: None'."\n"; |
|
198 | 198 | } |
199 | 199 | |
200 | - $return = apply_filters( 'give_sysinfo_after_give_gateways', $return ); |
|
200 | + $return = apply_filters('give_sysinfo_after_give_gateways', $return); |
|
201 | 201 | |
202 | 202 | // GIVE Templates |
203 | - $dir = get_stylesheet_directory() . '/give_templates/*'; |
|
204 | - if ( is_dir( $dir ) && ( count( glob( "$dir/*" ) ) !== 0 ) ) { |
|
205 | - $return .= "\n" . '-- Give Template Overrides' . "\n\n"; |
|
203 | + $dir = get_stylesheet_directory().'/give_templates/*'; |
|
204 | + if (is_dir($dir) && (count(glob("$dir/*")) !== 0)) { |
|
205 | + $return .= "\n".'-- Give Template Overrides'."\n\n"; |
|
206 | 206 | |
207 | - foreach ( glob( $dir ) as $file ) { |
|
208 | - $return .= 'Filename: ' . basename( $file ) . "\n"; |
|
207 | + foreach (glob($dir) as $file) { |
|
208 | + $return .= 'Filename: '.basename($file)."\n"; |
|
209 | 209 | } |
210 | 210 | |
211 | - $return = apply_filters( 'give_sysinfo_after_give_templates', $return ); |
|
211 | + $return = apply_filters('give_sysinfo_after_give_templates', $return); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | // Must-use plugins |
215 | 215 | $muplugins = get_mu_plugins(); |
216 | - if ( count( $muplugins > 0 ) ) { |
|
217 | - $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; |
|
216 | + if (count($muplugins > 0)) { |
|
217 | + $return .= "\n".'-- Must-Use Plugins'."\n\n"; |
|
218 | 218 | |
219 | - foreach ( $muplugins as $plugin => $plugin_data ) { |
|
220 | - $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; |
|
219 | + foreach ($muplugins as $plugin => $plugin_data) { |
|
220 | + $return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n"; |
|
221 | 221 | } |
222 | 222 | |
223 | - $return = apply_filters( 'give_sysinfo_after_wordpress_mu_plugins', $return ); |
|
223 | + $return = apply_filters('give_sysinfo_after_wordpress_mu_plugins', $return); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | // WordPress active plugins |
227 | - $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; |
|
227 | + $return .= "\n".'-- WordPress Active Plugins'."\n\n"; |
|
228 | 228 | |
229 | 229 | $plugins = get_plugins(); |
230 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
230 | + $active_plugins = get_option('active_plugins', array()); |
|
231 | 231 | |
232 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
233 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
232 | + foreach ($plugins as $plugin_path => $plugin) { |
|
233 | + if ( ! in_array($plugin_path, $active_plugins)) { |
|
234 | 234 | continue; |
235 | 235 | } |
236 | 236 | |
237 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
237 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
238 | 238 | } |
239 | 239 | |
240 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins', $return ); |
|
240 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins', $return); |
|
241 | 241 | |
242 | 242 | // WordPress inactive plugins |
243 | - $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; |
|
243 | + $return .= "\n".'-- WordPress Inactive Plugins'."\n\n"; |
|
244 | 244 | |
245 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
246 | - if ( in_array( $plugin_path, $active_plugins ) ) { |
|
245 | + foreach ($plugins as $plugin_path => $plugin) { |
|
246 | + if (in_array($plugin_path, $active_plugins)) { |
|
247 | 247 | continue; |
248 | 248 | } |
249 | 249 | |
250 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
250 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
251 | 251 | } |
252 | 252 | |
253 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins_inactive', $return ); |
|
253 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins_inactive', $return); |
|
254 | 254 | |
255 | - if ( is_multisite() ) { |
|
255 | + if (is_multisite()) { |
|
256 | 256 | // WordPress Multisite active plugins |
257 | - $return .= "\n" . '-- Network Active Plugins' . "\n\n"; |
|
257 | + $return .= "\n".'-- Network Active Plugins'."\n\n"; |
|
258 | 258 | |
259 | 259 | $plugins = wp_get_active_network_plugins(); |
260 | - $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); |
|
260 | + $active_plugins = get_site_option('active_sitewide_plugins', array()); |
|
261 | 261 | |
262 | - foreach ( $plugins as $plugin_path ) { |
|
263 | - $plugin_base = plugin_basename( $plugin_path ); |
|
262 | + foreach ($plugins as $plugin_path) { |
|
263 | + $plugin_base = plugin_basename($plugin_path); |
|
264 | 264 | |
265 | - if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { |
|
265 | + if ( ! array_key_exists($plugin_base, $active_plugins)) { |
|
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
269 | - $plugin = get_plugin_data( $plugin_path ); |
|
270 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
269 | + $plugin = get_plugin_data($plugin_path); |
|
270 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
271 | 271 | } |
272 | 272 | |
273 | - $return = apply_filters( 'give_sysinfo_after_wordpress_ms_plugins', $return ); |
|
273 | + $return = apply_filters('give_sysinfo_after_wordpress_ms_plugins', $return); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | // Server configuration (really just versioning) |
277 | - $return .= "\n" . '-- Webserver Configuration' . "\n\n"; |
|
278 | - $return .= 'PHP Version: ' . PHP_VERSION . "\n"; |
|
279 | - $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; |
|
280 | - $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; |
|
277 | + $return .= "\n".'-- Webserver Configuration'."\n\n"; |
|
278 | + $return .= 'PHP Version: '.PHP_VERSION."\n"; |
|
279 | + $return .= 'MySQL Version: '.$wpdb->db_version()."\n"; |
|
280 | + $return .= 'Webserver Info: '.$_SERVER['SERVER_SOFTWARE']."\n"; |
|
281 | 281 | |
282 | - $return = apply_filters( 'give_sysinfo_after_webserver_config', $return ); |
|
282 | + $return = apply_filters('give_sysinfo_after_webserver_config', $return); |
|
283 | 283 | |
284 | 284 | // PHP configs... now we're getting to the important stuff |
285 | - $return .= "\n" . '-- PHP Configuration' . "\n\n"; |
|
286 | - $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); |
|
287 | - $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; |
|
288 | - $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
289 | - $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; |
|
290 | - $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
291 | - $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; |
|
292 | - $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; |
|
293 | - $return .= 'URL-aware fopen: ' . ( ini_get( 'allow_url_fopen' ) ? 'On (' . ini_get( 'allow_url_fopen' ) . ')' : 'N/A' ) . "\n"; |
|
294 | - $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; |
|
295 | - |
|
296 | - $return = apply_filters( 'give_sysinfo_after_php_config', $return ); |
|
285 | + $return .= "\n".'-- PHP Configuration'."\n\n"; |
|
286 | + $return .= 'Safe Mode: '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n"); |
|
287 | + $return .= 'Memory Limit: '.ini_get('memory_limit')."\n"; |
|
288 | + $return .= 'Upload Max Size: '.ini_get('upload_max_filesize')."\n"; |
|
289 | + $return .= 'Post Max Size: '.ini_get('post_max_size')."\n"; |
|
290 | + $return .= 'Upload Max Filesize: '.ini_get('upload_max_filesize')."\n"; |
|
291 | + $return .= 'Time Limit: '.ini_get('max_execution_time')."\n"; |
|
292 | + $return .= 'Max Input Vars: '.ini_get('max_input_vars')."\n"; |
|
293 | + $return .= 'URL-aware fopen: '.(ini_get('allow_url_fopen') ? 'On ('.ini_get('allow_url_fopen').')' : 'N/A')."\n"; |
|
294 | + $return .= 'Display Errors: '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n"; |
|
295 | + |
|
296 | + $return = apply_filters('give_sysinfo_after_php_config', $return); |
|
297 | 297 | |
298 | 298 | // PHP extensions and such |
299 | - $return .= "\n" . '-- PHP Extensions' . "\n\n"; |
|
300 | - $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
299 | + $return .= "\n".'-- PHP Extensions'."\n\n"; |
|
300 | + $return .= 'cURL: '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n"; |
|
301 | 301 | |
302 | 302 | //cURL version |
303 | - if ( function_exists( 'curl_init' ) && function_exists( 'curl_version' ) ) { |
|
303 | + if (function_exists('curl_init') && function_exists('curl_version')) { |
|
304 | 304 | $curl_values = curl_version(); |
305 | - $return .= 'cURL Version: ' . $curl_values["version"] . "\n"; |
|
305 | + $return .= 'cURL Version: '.$curl_values["version"]."\n"; |
|
306 | 306 | } |
307 | - $return .= 'zlib: ' . ( function_exists( 'gzcompress' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
308 | - $return .= 'GD: ' . ( ( extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
309 | - $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
310 | - $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
311 | - $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
312 | - $return .= 'DOM: ' . ( extension_loaded( 'dom' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
313 | - $return .= 'MBString: ' . ( extension_loaded( 'mbstring' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
307 | + $return .= 'zlib: '.(function_exists('gzcompress') ? 'Supported' : 'Not Supported')."\n"; |
|
308 | + $return .= 'GD: '.((extension_loaded('gd') && function_exists('gd_info')) ? 'Supported' : 'Not Supported')."\n"; |
|
309 | + $return .= 'fsockopen: '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n"; |
|
310 | + $return .= 'SOAP Client: '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n"; |
|
311 | + $return .= 'Suhosin: '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n"; |
|
312 | + $return .= 'DOM: '.(extension_loaded('dom') ? 'Installed' : 'Not Installed')."\n"; |
|
313 | + $return .= 'MBString: '.(extension_loaded('mbstring') ? 'Installed' : 'Not Installed')."\n"; |
|
314 | 314 | |
315 | - $return = apply_filters( 'give_sysinfo_after_php_ext', $return ); |
|
315 | + $return = apply_filters('give_sysinfo_after_php_ext', $return); |
|
316 | 316 | |
317 | 317 | // Session stuff |
318 | - $return .= "\n" . '-- Session Configuration' . "\n\n"; |
|
319 | - $return .= 'Give Use Sessions: ' . ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? 'Enforced' : ( Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled' ) ) . "\n"; |
|
320 | - $return .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n"; |
|
318 | + $return .= "\n".'-- Session Configuration'."\n\n"; |
|
319 | + $return .= 'Give Use Sessions: '.(defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? 'Enforced' : (Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled'))."\n"; |
|
320 | + $return .= 'Session: '.(isset($_SESSION) ? 'Enabled' : 'Disabled')."\n"; |
|
321 | 321 | |
322 | 322 | // The rest of this is only relevant is session is enabled |
323 | - if ( isset( $_SESSION ) ) { |
|
324 | - $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; |
|
325 | - $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; |
|
326 | - $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; |
|
327 | - $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
328 | - $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
323 | + if (isset($_SESSION)) { |
|
324 | + $return .= 'Session Name: '.esc_html(ini_get('session.name'))."\n"; |
|
325 | + $return .= 'Cookie Path: '.esc_html(ini_get('session.cookie_path'))."\n"; |
|
326 | + $return .= 'Save Path: '.esc_html(ini_get('session.save_path'))."\n"; |
|
327 | + $return .= 'Use Cookies: '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n"; |
|
328 | + $return .= 'Use Only Cookies: '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n"; |
|
329 | 329 | } |
330 | 330 | |
331 | - $return = apply_filters( 'give_sysinfo_after_session_config', $return ); |
|
331 | + $return = apply_filters('give_sysinfo_after_session_config', $return); |
|
332 | 332 | |
333 | - $return .= "\n" . '### End System Info ###'; |
|
333 | + $return .= "\n".'### End System Info ###'; |
|
334 | 334 | |
335 | 335 | return $return; |
336 | 336 | } |
@@ -344,17 +344,17 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function give_tools_sysinfo_download() { |
346 | 346 | |
347 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
347 | + if ( ! current_user_can('manage_give_settings')) { |
|
348 | 348 | return; |
349 | 349 | } |
350 | 350 | |
351 | 351 | nocache_headers(); |
352 | 352 | |
353 | - header( 'Content-Type: text/plain' ); |
|
354 | - header( 'Content-Disposition: attachment; filename="give-system-info.txt"' ); |
|
353 | + header('Content-Type: text/plain'); |
|
354 | + header('Content-Disposition: attachment; filename="give-system-info.txt"'); |
|
355 | 355 | |
356 | - echo wp_strip_all_tags( $_POST['give-sysinfo'] ); |
|
356 | + echo wp_strip_all_tags($_POST['give-sysinfo']); |
|
357 | 357 | give_die(); |
358 | 358 | } |
359 | 359 | |
360 | -add_action( 'give_download_sysinfo', 'give_tools_sysinfo_download' ); |
|
361 | 360 | \ No newline at end of file |
361 | +add_action('give_download_sysinfo', 'give_tools_sysinfo_download'); |
|
362 | 362 | \ 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 | |
@@ -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 1', 'give' ), |
|
48 | - 'address2' => esc_html__( 'Address 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__( '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 1', 'give'), |
|
48 | + 'address2' => esc_html__('Address 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__('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 | } |
@@ -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 |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded. |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | 50 | 'ajax' => false // Does this table support ajax?. |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name. |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item->payment_id ) ? esc_html__( 'n/a', 'give' ) : $item->payment_id; |
|
71 | + return empty($item->payment_id) ? esc_html__('n/a', 'give') : $item->payment_id; |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item->gateway ) ? esc_html__( 'n/a', 'give' ) : $item->gateway; |
|
73 | + return empty($item->gateway) ? esc_html__('n/a', 'give') : $item->gateway; |
|
74 | 74 | case 'error' : |
75 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' ); |
|
75 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give'); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { ?> |
|
92 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
91 | + public function column_message($item) { ?> |
|
92 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
93 | 93 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
94 | 94 | <?php |
95 | 95 | |
96 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
96 | + $log_message = get_post_field('post_content', $item['ID']); |
|
97 | 97 | |
98 | - $serialized = strpos( $log_message, '{"' ); |
|
98 | + $serialized = strpos($log_message, '{"'); |
|
99 | 99 | |
100 | 100 | // Check to see if the log message contains serialized information |
101 | - if ( $serialized !== false ) { |
|
102 | - $length = strlen( $log_message ) - $serialized; |
|
103 | - $intro = substr( $log_message, 0, - $length ); |
|
104 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
101 | + if ($serialized !== false) { |
|
102 | + $length = strlen($log_message) - $serialized; |
|
103 | + $intro = substr($log_message, 0, - $length); |
|
104 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
105 | 105 | |
106 | - echo wpautop( $intro ); |
|
107 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
108 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
106 | + echo wpautop($intro); |
|
107 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
108 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
109 | 109 | } else { |
110 | 110 | // No serialized data found |
111 | - echo wpautop( $log_message ); |
|
111 | + echo wpautop($log_message); |
|
112 | 112 | } |
113 | 113 | ?> |
114 | 114 | </div> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function get_columns() { |
126 | 126 | $columns = array( |
127 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
128 | - 'error' => esc_html__( 'Error', 'give' ), |
|
129 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
130 | - 'payment_id' => esc_html__( 'Donation ID', 'give' ), |
|
131 | - 'date' => esc_html__( 'Date', 'give' ), |
|
132 | - 'message' => esc_html__( 'Details', 'give' ) |
|
127 | + 'ID' => esc_html__('Log ID', 'give'), |
|
128 | + 'error' => esc_html__('Error', 'give'), |
|
129 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
130 | + 'payment_id' => esc_html__('Donation ID', 'give'), |
|
131 | + 'date' => esc_html__('Date', 'give'), |
|
132 | + 'message' => esc_html__('Details', 'give') |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | return $columns; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return int Current page number |
144 | 144 | */ |
145 | 145 | public function get_paged() { |
146 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
146 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @since 1.0 |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public function bulk_actions( $which = '' ) { |
|
156 | + public function bulk_actions($which = '') { |
|
157 | 157 | give_log_views(); |
158 | 158 | } |
159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | // Prevent the queries from getting cached. |
173 | 173 | // Without this there are occasional memory issues for some installs. |
174 | - wp_suspend_cache_addition( true ); |
|
174 | + wp_suspend_cache_addition(true); |
|
175 | 175 | |
176 | 176 | $logs_data = array(); |
177 | 177 | $paged = $this->get_paged(); |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | 'paged' => $paged |
181 | 181 | ); |
182 | 182 | |
183 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
183 | + $logs = $give_logs->get_connected_logs($log_query); |
|
184 | 184 | |
185 | - if ( $logs ) { |
|
186 | - foreach ( $logs as $log ) { |
|
185 | + if ($logs) { |
|
186 | + foreach ($logs as $log) { |
|
187 | 187 | |
188 | 188 | $logs_data[] = array( |
189 | 189 | 'ID' => $log->ID, |
190 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
190 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
191 | 191 | 'payment_id' => $log->post_parent, |
192 | 192 | 'error' => 'error', |
193 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
193 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
194 | 194 | 'date' => $log->post_date |
195 | 195 | ); |
196 | 196 | } |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param string $which |
214 | 214 | */ |
215 | - protected function display_tablenav( $which ) { |
|
216 | - if ( 'top' === $which ) { |
|
217 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
215 | + protected function display_tablenav($which) { |
|
216 | + if ('top' === $which) { |
|
217 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
218 | 218 | } |
219 | 219 | ?> |
220 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
220 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
221 | 221 | |
222 | 222 | <div class="alignleft actions bulkactions"> |
223 | - <?php $this->bulk_actions( $which ); ?> |
|
223 | + <?php $this->bulk_actions($which); ?> |
|
224 | 224 | </div> |
225 | 225 | <?php |
226 | - $this->extra_tablenav( $which ); |
|
227 | - $this->pagination( $which ); |
|
226 | + $this->extra_tablenav($which); |
|
227 | + $this->pagination($which); |
|
228 | 228 | ?> |
229 | 229 | |
230 | 230 | <br class="clear"/> |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | $columns = $this->get_columns(); |
252 | 252 | $hidden = array(); // No hidden columns |
253 | 253 | $sortable = $this->get_sortable_columns(); |
254 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
254 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
255 | 255 | $this->items = $this->get_logs(); |
256 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
256 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
257 | 257 | |
258 | - $this->set_pagination_args( array( |
|
258 | + $this->set_pagination_args(array( |
|
259 | 259 | 'total_items' => $total_items, |
260 | 260 | 'per_page' => $this->per_page, |
261 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
261 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
262 | 262 | ) |
263 | 263 | ); |
264 | 264 | } |
@@ -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 | /** |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | global $status, $page; |
63 | 63 | |
64 | 64 | // Set parent defaults |
65 | - parent::__construct( array( |
|
66 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
65 | + parent::__construct(array( |
|
66 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
67 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
68 | 68 | 'ajax' => false // Does this table support ajax? |
69 | - ) ); |
|
69 | + )); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return false |
85 | 85 | */ |
86 | - public function search_box( $text, $input_id ) { |
|
86 | + public function search_box($text, $input_id) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
@@ -98,20 +98,20 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - public function give_search_box( $text, $input_id ) { |
|
102 | - $input_id = $input_id . '-search-input'; |
|
101 | + public function give_search_box($text, $input_id) { |
|
102 | + $input_id = $input_id.'-search-input'; |
|
103 | 103 | |
104 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
105 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
104 | + if ( ! empty($_REQUEST['orderby'])) { |
|
105 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
106 | 106 | } |
107 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
108 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
107 | + if ( ! empty($_REQUEST['order'])) { |
|
108 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
109 | 109 | } |
110 | 110 | ?> |
111 | 111 | <p class="search-box donor-search" role="search"> |
112 | 112 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
113 | 113 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
114 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
114 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
115 | 115 | </p> |
116 | 116 | <?php |
117 | 117 | } |
@@ -124,29 +124,29 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $which |
126 | 126 | */ |
127 | - protected function display_tablenav( $which ) { |
|
127 | + protected function display_tablenav($which) { |
|
128 | 128 | |
129 | - if ( 'top' == $which ) { |
|
130 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
129 | + if ('top' == $which) { |
|
130 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
131 | 131 | } |
132 | 132 | ?> |
133 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
133 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
134 | 134 | |
135 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donors Report', 'give' ); ?></span></h3> |
|
135 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donors Report', 'give'); ?></span></h3> |
|
136 | 136 | |
137 | 137 | <div class="alignright tablenav-right"> |
138 | 138 | <div class="actions bulkactions"> |
139 | 139 | <?php |
140 | - if ( 'top' == $which ) { |
|
141 | - $this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' ); |
|
140 | + if ('top' == $which) { |
|
141 | + $this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search'); |
|
142 | 142 | } |
143 | 143 | |
144 | - $this->bulk_actions( $which ); ?> |
|
144 | + $this->bulk_actions($which); ?> |
|
145 | 145 | |
146 | 146 | </div> |
147 | 147 | <?php |
148 | - $this->extra_tablenav( $which ); |
|
149 | - $this->pagination( $which ); |
|
148 | + $this->extra_tablenav($which); |
|
149 | + $this->pagination($which); |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | |
@@ -168,25 +168,25 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @return string Column Name |
170 | 170 | */ |
171 | - public function column_default( $item, $column_name ) { |
|
172 | - switch ( $column_name ) { |
|
171 | + public function column_default($item, $column_name) { |
|
172 | + switch ($column_name) { |
|
173 | 173 | |
174 | 174 | case 'num_purchases' : |
175 | - $value = '<a href="' . |
|
176 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
177 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
175 | + $value = '<a href="'. |
|
176 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
177 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
178 | 178 | break; |
179 | 179 | |
180 | 180 | case 'amount_spent' : |
181 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
181 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
182 | 182 | break; |
183 | 183 | |
184 | 184 | default: |
185 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
185 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
186 | 186 | break; |
187 | 187 | } |
188 | 188 | |
189 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
189 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function get_columns() { |
200 | 200 | $columns = array( |
201 | - 'name' => esc_html__( 'Name', 'give' ), |
|
202 | - 'id' => esc_html__( 'ID', 'give' ), |
|
203 | - 'email' => esc_html__( 'Email', 'give' ), |
|
204 | - 'num_purchases' => esc_html__( 'Purchases', 'give' ), |
|
205 | - 'amount_spent' => esc_html__( 'Total Spent', 'give' ) |
|
201 | + 'name' => esc_html__('Name', 'give'), |
|
202 | + 'id' => esc_html__('ID', 'give'), |
|
203 | + 'email' => esc_html__('Email', 'give'), |
|
204 | + 'num_purchases' => esc_html__('Purchases', 'give'), |
|
205 | + 'amount_spent' => esc_html__('Total Spent', 'give') |
|
206 | 206 | ); |
207 | 207 | |
208 | - return apply_filters( 'give_report_donor_columns', $columns ); |
|
208 | + return apply_filters('give_report_donor_columns', $columns); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function get_sortable_columns() { |
220 | 220 | return array( |
221 | - 'id' => array( 'id', true ), |
|
222 | - 'name' => array( 'name', true ), |
|
223 | - 'num_purchases' => array( 'purchase_count', false ), |
|
224 | - 'amount_spent' => array( 'purchase_value', false ), |
|
221 | + 'id' => array('id', true), |
|
222 | + 'name' => array('name', true), |
|
223 | + 'num_purchases' => array('purchase_count', false), |
|
224 | + 'amount_spent' => array('purchase_value', false), |
|
225 | 225 | ); |
226 | 226 | } |
227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @since 1.0 |
233 | 233 | * @return void |
234 | 234 | */ |
235 | - public function bulk_actions( $which = '' ) { |
|
235 | + public function bulk_actions($which = '') { |
|
236 | 236 | // These aren't really bulk actions but this outputs the markup in the right place |
237 | 237 | give_report_views(); |
238 | 238 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return int Current page number |
246 | 246 | */ |
247 | 247 | public function get_paged() { |
248 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
248 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return mixed string If search is present, false otherwise |
257 | 257 | */ |
258 | 258 | public function get_search() { |
259 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
259 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | |
274 | 274 | $data = array(); |
275 | 275 | $paged = $this->get_paged(); |
276 | - $offset = $this->per_page * ( $paged - 1 ); |
|
276 | + $offset = $this->per_page * ($paged - 1); |
|
277 | 277 | $search = $this->get_search(); |
278 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
279 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
278 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
279 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
280 | 280 | |
281 | 281 | $args = array( |
282 | 282 | 'number' => $this->per_page, |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | 'orderby' => $orderby |
286 | 286 | ); |
287 | 287 | |
288 | - if ( is_email( $search ) ) { |
|
288 | + if (is_email($search)) { |
|
289 | 289 | $args['email'] = $search; |
290 | - } elseif ( is_numeric( $search ) ) { |
|
290 | + } elseif (is_numeric($search)) { |
|
291 | 291 | $args['id'] = $search; |
292 | 292 | } |
293 | 293 | |
294 | - $donors = Give()->customers->get_customers( $args ); |
|
294 | + $donors = Give()->customers->get_customers($args); |
|
295 | 295 | |
296 | - if ( $donors ) { |
|
296 | + if ($donors) { |
|
297 | 297 | |
298 | - $this->count = count( $donors ); |
|
298 | + $this->count = count($donors); |
|
299 | 299 | |
300 | - foreach ( $donors as $donor ) { |
|
300 | + foreach ($donors as $donor) { |
|
301 | 301 | |
302 | - $user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0; |
|
302 | + $user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0; |
|
303 | 303 | |
304 | 304 | $data[] = array( |
305 | 305 | 'id' => $donor->id, |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | $hidden = array(); // No hidden columns |
333 | 333 | $sortable = $this->get_sortable_columns(); |
334 | 334 | |
335 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
335 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
336 | 336 | |
337 | 337 | $this->items = $this->reports_data(); |
338 | 338 | |
339 | 339 | $this->total = give_count_total_customers(); |
340 | 340 | |
341 | - $this->set_pagination_args( array( |
|
341 | + $this->set_pagination_args(array( |
|
342 | 342 | 'total_items' => $this->total, |
343 | 343 | 'per_page' => $this->per_page, |
344 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
345 | - ) ); |
|
344 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
345 | + )); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -56,32 +56,32 @@ discard block |
||
56 | 56 | |
57 | 57 | $args = array( |
58 | 58 | 'number' => $this->per_step, |
59 | - 'offset' => $this->per_step * ( $this->step - 1 ), |
|
59 | + 'offset' => $this->per_step * ($this->step - 1), |
|
60 | 60 | 'orderby' => 'id', |
61 | 61 | 'order' => 'DESC', |
62 | 62 | ); |
63 | 63 | |
64 | - $customers = Give()->customers->get_customers( $args ); |
|
64 | + $customers = Give()->customers->get_customers($args); |
|
65 | 65 | |
66 | - if ( $customers ) { |
|
66 | + if ($customers) { |
|
67 | 67 | |
68 | - $allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() ); |
|
68 | + $allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys()); |
|
69 | 69 | |
70 | - foreach ( $customers as $customer ) { |
|
70 | + foreach ($customers as $customer) { |
|
71 | 71 | |
72 | - $attached_payment_ids = explode( ',', $customer->payment_ids ); |
|
72 | + $attached_payment_ids = explode(',', $customer->payment_ids); |
|
73 | 73 | |
74 | 74 | $attached_args = array( |
75 | 75 | 'post__in' => $attached_payment_ids, |
76 | - 'number' => - 1, |
|
76 | + 'number' => -1, |
|
77 | 77 | 'status' => $allowed_payment_status, |
78 | 78 | ); |
79 | 79 | |
80 | - $attached_payments = (array) give_get_payments( $attached_args ); |
|
80 | + $attached_payments = (array) give_get_payments($attached_args); |
|
81 | 81 | |
82 | 82 | $unattached_args = array( |
83 | 83 | 'post__not_in' => $attached_payment_ids, |
84 | - 'number' => - 1, |
|
84 | + 'number' => -1, |
|
85 | 85 | 'status' => $allowed_payment_status, |
86 | 86 | 'meta_query' => array( |
87 | 87 | array( |
@@ -92,29 +92,29 @@ discard block |
||
92 | 92 | ), |
93 | 93 | ); |
94 | 94 | |
95 | - $unattached_payments = give_get_payments( $unattached_args ); |
|
95 | + $unattached_payments = give_get_payments($unattached_args); |
|
96 | 96 | |
97 | - $payments = array_merge( $attached_payments, $unattached_payments ); |
|
97 | + $payments = array_merge($attached_payments, $unattached_payments); |
|
98 | 98 | |
99 | 99 | $purchase_value = 0.00; |
100 | 100 | $purchase_count = 0; |
101 | 101 | $payment_ids = array(); |
102 | 102 | |
103 | - if ( $payments ) { |
|
103 | + if ($payments) { |
|
104 | 104 | |
105 | - foreach ( $payments as $payment ) { |
|
105 | + foreach ($payments as $payment) { |
|
106 | 106 | |
107 | 107 | $should_process_payment = 'publish' == $payment->post_status ? true : false; |
108 | - $should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment ); |
|
108 | + $should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment); |
|
109 | 109 | |
110 | - if ( true === $should_process_payment ) { |
|
110 | + if (true === $should_process_payment) { |
|
111 | 111 | |
112 | - if ( apply_filters( 'give_customer_recount_should_increase_value', true, $payment ) ) { |
|
113 | - $purchase_value += give_get_payment_amount( $payment->ID ); |
|
112 | + if (apply_filters('give_customer_recount_should_increase_value', true, $payment)) { |
|
113 | + $purchase_value += give_get_payment_amount($payment->ID); |
|
114 | 114 | } |
115 | 115 | |
116 | - if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) { |
|
117 | - $purchase_count ++; |
|
116 | + if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) { |
|
117 | + $purchase_count++; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | } |
126 | 126 | |
127 | - $payment_ids = implode( ',', $payment_ids ); |
|
127 | + $payment_ids = implode(',', $payment_ids); |
|
128 | 128 | |
129 | 129 | $customer_update_data = array( |
130 | 130 | 'purchase_count' => $purchase_count, |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | 'payment_ids' => $payment_ids, |
133 | 133 | ); |
134 | 134 | |
135 | - $customer_instance = new Give_Customer( $customer->id ); |
|
136 | - $customer_instance->update( $customer_update_data ); |
|
135 | + $customer_instance = new Give_Customer($customer->id); |
|
136 | + $customer_instance->update($customer_update_data); |
|
137 | 137 | |
138 | 138 | } |
139 | 139 | |
@@ -153,21 +153,21 @@ discard block |
||
153 | 153 | public function get_percentage_complete() { |
154 | 154 | |
155 | 155 | $args = array( |
156 | - 'number' => - 1, |
|
156 | + 'number' => -1, |
|
157 | 157 | 'orderby' => 'id', |
158 | 158 | 'order' => 'DESC', |
159 | 159 | ); |
160 | 160 | |
161 | - $customers = Give()->customers->get_customers( $args ); |
|
162 | - $total = count( $customers ); |
|
161 | + $customers = Give()->customers->get_customers($args); |
|
162 | + $total = count($customers); |
|
163 | 163 | |
164 | 164 | $percentage = 100; |
165 | 165 | |
166 | - if ( $total > 0 ) { |
|
167 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
166 | + if ($total > 0) { |
|
167 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
168 | 168 | } |
169 | 169 | |
170 | - if ( $percentage > 100 ) { |
|
170 | + if ($percentage > 100) { |
|
171 | 171 | $percentage = 100; |
172 | 172 | } |
173 | 173 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @param array $request The Form Data passed into the batch processing |
183 | 183 | */ |
184 | - public function set_properties( $request ) { |
|
184 | + public function set_properties($request) { |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -192,19 +192,19 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function process_step() { |
194 | 194 | |
195 | - if ( ! $this->can_export() ) { |
|
196 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
195 | + if ( ! $this->can_export()) { |
|
196 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | $had_data = $this->get_data(); |
200 | 200 | |
201 | - if ( $had_data ) { |
|
201 | + if ($had_data) { |
|
202 | 202 | $this->done = false; |
203 | 203 | |
204 | 204 | return true; |
205 | 205 | } else { |
206 | 206 | $this->done = true; |
207 | - $this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' ); |
|
207 | + $this->message = esc_html__('Donor stats have been successfully recounted.', 'give'); |
|
208 | 208 | |
209 | 209 | return false; |
210 | 210 | } |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | * Headers |
215 | 215 | */ |
216 | 216 | public function headers() { |
217 | - ignore_user_abort( true ); |
|
217 | + ignore_user_abort(true); |
|
218 | 218 | |
219 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
220 | - set_time_limit( 0 ); |
|
219 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
220 | + set_time_limit(0); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 |
@@ -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 | |
@@ -54,39 +54,39 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function get_data() { |
56 | 56 | |
57 | - $customer = new Give_Customer( $this->customer_id ); |
|
58 | - $payments = $this->get_stored_data( 'give_recount_customer_payments_' . $customer->id, array() ); |
|
57 | + $customer = new Give_Customer($this->customer_id); |
|
58 | + $payments = $this->get_stored_data('give_recount_customer_payments_'.$customer->id, array()); |
|
59 | 59 | |
60 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
61 | - $step_items = array_slice( $payments, $offset, $this->per_step ); |
|
60 | + $offset = ($this->step - 1) * $this->per_step; |
|
61 | + $step_items = array_slice($payments, $offset, $this->per_step); |
|
62 | 62 | |
63 | - if ( count( $step_items ) > 0 ) { |
|
64 | - $pending_total = (float) $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 ); |
|
63 | + if (count($step_items) > 0) { |
|
64 | + $pending_total = (float) $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0); |
|
65 | 65 | $step_total = 0; |
66 | 66 | |
67 | - $found_payment_ids = $this->get_stored_data( 'give_stats_found_payments_' . $customer->id, array() ); |
|
67 | + $found_payment_ids = $this->get_stored_data('give_stats_found_payments_'.$customer->id, array()); |
|
68 | 68 | |
69 | - foreach ( $step_items as $payment ) { |
|
70 | - $payment = get_post( $payment->ID ); |
|
69 | + foreach ($step_items as $payment) { |
|
70 | + $payment = get_post($payment->ID); |
|
71 | 71 | |
72 | - if ( is_null( $payment ) || is_wp_error( $payment ) || 'give_payment' !== $payment->post_type ) { |
|
72 | + if (is_null($payment) || is_wp_error($payment) || 'give_payment' !== $payment->post_type) { |
|
73 | 73 | |
74 | - $missing_payments = $this->get_stored_data( 'give_stats_missing_payments' . $customer->id, array() ); |
|
74 | + $missing_payments = $this->get_stored_data('give_stats_missing_payments'.$customer->id, array()); |
|
75 | 75 | $missing_payments[] = $payment->ID; |
76 | - $this->store_data( 'give_stats_missing_payments' . $customer->id, $missing_payments ); |
|
76 | + $this->store_data('give_stats_missing_payments'.$customer->id, $missing_payments); |
|
77 | 77 | |
78 | 78 | continue; |
79 | 79 | } |
80 | 80 | |
81 | 81 | $should_process_payment = 'publish' == $payment->post_status ? true : false; |
82 | - $should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment ); |
|
82 | + $should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment); |
|
83 | 83 | |
84 | - if ( true === $should_process_payment ) { |
|
84 | + if (true === $should_process_payment) { |
|
85 | 85 | |
86 | 86 | $found_payment_ids[] = $payment->ID; |
87 | 87 | |
88 | - if ( apply_filters( 'give_customer_recount_sholud_increase_value', true, $payment ) ) { |
|
89 | - $payment_amount = give_get_payment_amount( $payment->ID ); |
|
88 | + if (apply_filters('give_customer_recount_sholud_increase_value', true, $payment)) { |
|
89 | + $payment_amount = give_get_payment_amount($payment->ID); |
|
90 | 90 | $step_total += $payment_amount; |
91 | 91 | } |
92 | 92 | |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | $updated_total = $pending_total + $step_total; |
98 | - $this->store_data( 'give_stats_customer_pending_total' . $customer->id, $updated_total ); |
|
99 | - $this->store_data( 'give_stats_found_payments_' . $customer->id, $found_payment_ids ); |
|
98 | + $this->store_data('give_stats_customer_pending_total'.$customer->id, $updated_total); |
|
99 | + $this->store_data('give_stats_found_payments_'.$customer->id, $found_payment_ids); |
|
100 | 100 | |
101 | 101 | return true; |
102 | 102 | } |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function get_percentage_complete() { |
115 | 115 | |
116 | - $payments = $this->get_stored_data( 'give_recount_customer_payments_' . $this->customer_id ); |
|
117 | - $total = count( $payments ); |
|
116 | + $payments = $this->get_stored_data('give_recount_customer_payments_'.$this->customer_id); |
|
117 | + $total = count($payments); |
|
118 | 118 | |
119 | 119 | $percentage = 100; |
120 | 120 | |
121 | - if ( $total > 0 ) { |
|
122 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
121 | + if ($total > 0) { |
|
122 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
123 | 123 | } |
124 | 124 | |
125 | - if ( $percentage > 100 ) { |
|
125 | + if ($percentage > 100) { |
|
126 | 126 | $percentage = 100; |
127 | 127 | } |
128 | 128 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @param array $request The Form Data passed into the batch processing |
138 | 138 | */ |
139 | - public function set_properties( $request ) { |
|
140 | - $this->customer_id = isset( $request['customer_id'] ) ? sanitize_text_field( $request['customer_id'] ) : false; |
|
139 | + public function set_properties($request) { |
|
140 | + $this->customer_id = isset($request['customer_id']) ? sanitize_text_field($request['customer_id']) : false; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -148,62 +148,62 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function process_step() { |
150 | 150 | |
151 | - if ( ! $this->can_export() ) { |
|
152 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
151 | + if ( ! $this->can_export()) { |
|
152 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $had_data = $this->get_data(); |
156 | 156 | |
157 | - if ( $had_data ) { |
|
157 | + if ($had_data) { |
|
158 | 158 | $this->done = false; |
159 | 159 | |
160 | 160 | return true; |
161 | 161 | } else { |
162 | - $customer = new Give_Customer( $this->customer_id ); |
|
163 | - $payment_ids = get_option( 'give_stats_found_payments_' . $customer->id, array() ); |
|
164 | - $this->delete_data( 'give_stats_found_payments_' . $customer->id ); |
|
162 | + $customer = new Give_Customer($this->customer_id); |
|
163 | + $payment_ids = get_option('give_stats_found_payments_'.$customer->id, array()); |
|
164 | + $this->delete_data('give_stats_found_payments_'.$customer->id); |
|
165 | 165 | |
166 | - $removed_payments = array_unique( get_option( 'give_stats_missing_payments' . $customer->id, array() ) ); |
|
166 | + $removed_payments = array_unique(get_option('give_stats_missing_payments'.$customer->id, array())); |
|
167 | 167 | |
168 | 168 | // Find non-existing payments (deleted) and total up the donation count |
169 | 169 | $purchase_count = 0; |
170 | - foreach ( $payment_ids as $key => $payment_id ) { |
|
171 | - if ( in_array( $payment_id, $removed_payments ) ) { |
|
172 | - unset( $payment_ids[ $key ] ); |
|
170 | + foreach ($payment_ids as $key => $payment_id) { |
|
171 | + if (in_array($payment_id, $removed_payments)) { |
|
172 | + unset($payment_ids[$key]); |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | |
176 | - $payment = get_post( $payment_id ); |
|
177 | - if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) { |
|
178 | - $purchase_count ++; |
|
176 | + $payment = get_post($payment_id); |
|
177 | + if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) { |
|
178 | + $purchase_count++; |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - $this->delete_data( 'give_stats_missing_payments' . $customer->id ); |
|
182 | + $this->delete_data('give_stats_missing_payments'.$customer->id); |
|
183 | 183 | |
184 | - $pending_total = $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 ); |
|
185 | - $this->delete_data( 'give_stats_customer_pending_total' . $customer->id ); |
|
186 | - $this->delete_data( 'give_recount_customer_stats_' . $customer->id ); |
|
187 | - $this->delete_data( 'give_recount_customer_payments_' . $this->customer_id ); |
|
184 | + $pending_total = $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0); |
|
185 | + $this->delete_data('give_stats_customer_pending_total'.$customer->id); |
|
186 | + $this->delete_data('give_recount_customer_stats_'.$customer->id); |
|
187 | + $this->delete_data('give_recount_customer_payments_'.$this->customer_id); |
|
188 | 188 | |
189 | - $payment_ids = implode( ',', $payment_ids ); |
|
190 | - $customer->update( array( 'payment_ids' => $payment_ids, |
|
189 | + $payment_ids = implode(',', $payment_ids); |
|
190 | + $customer->update(array('payment_ids' => $payment_ids, |
|
191 | 191 | 'purchase_count' => $purchase_count, |
192 | 192 | 'purchase_value' => $pending_total |
193 | - ) ); |
|
193 | + )); |
|
194 | 194 | |
195 | 195 | $this->done = true; |
196 | - $this->message = esc_html__( 'Donor stats successfully recounted.', 'give' ); |
|
196 | + $this->message = esc_html__('Donor stats successfully recounted.', 'give'); |
|
197 | 197 | |
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | 202 | public function headers() { |
203 | - ignore_user_abort( true ); |
|
203 | + ignore_user_abort(true); |
|
204 | 204 | |
205 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
206 | - set_time_limit( 0 ); |
|
205 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
206 | + set_time_limit(0); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -230,26 +230,26 @@ discard block |
||
230 | 230 | * @return void |
231 | 231 | */ |
232 | 232 | public function pre_fetch() { |
233 | - if ( $this->step === 1 ) { |
|
234 | - $allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() ); |
|
233 | + if ($this->step === 1) { |
|
234 | + $allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys()); |
|
235 | 235 | |
236 | 236 | // Before we start, let's zero out the customer's data |
237 | - $customer = new Give_Customer( $this->customer_id ); |
|
238 | - $customer->update( array( 'purchase_value' => give_format_amount( 0 ), 'purchase_count' => 0 ) ); |
|
237 | + $customer = new Give_Customer($this->customer_id); |
|
238 | + $customer->update(array('purchase_value' => give_format_amount(0), 'purchase_count' => 0)); |
|
239 | 239 | |
240 | - $attached_payment_ids = explode( ',', $customer->payment_ids ); |
|
240 | + $attached_payment_ids = explode(',', $customer->payment_ids); |
|
241 | 241 | |
242 | 242 | $attached_args = array( |
243 | 243 | 'post__in' => $attached_payment_ids, |
244 | - 'number' => - 1, |
|
244 | + 'number' => -1, |
|
245 | 245 | 'status' => $allowed_payment_status, |
246 | 246 | ); |
247 | 247 | |
248 | - $attached_payments = give_get_payments( $attached_args ); |
|
248 | + $attached_payments = give_get_payments($attached_args); |
|
249 | 249 | |
250 | 250 | $unattached_args = array( |
251 | 251 | 'post__not_in' => $attached_payment_ids, |
252 | - 'number' => - 1, |
|
252 | + 'number' => -1, |
|
253 | 253 | 'status' => $allowed_payment_status, |
254 | 254 | 'meta_query' => array( |
255 | 255 | array( |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | ), |
260 | 260 | ); |
261 | 261 | |
262 | - $unattached_payments = give_get_payments( $unattached_args ); |
|
262 | + $unattached_payments = give_get_payments($unattached_args); |
|
263 | 263 | |
264 | - $payments = array_merge( $attached_payments, $unattached_payments ); |
|
264 | + $payments = array_merge($attached_payments, $unattached_payments); |
|
265 | 265 | |
266 | - $this->store_data( 'give_recount_customer_payments_' . $customer->id, $payments ); |
|
266 | + $this->store_data('give_recount_customer_payments_'.$customer->id, $payments); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @return mixed Returns the data from the database |
278 | 278 | */ |
279 | - private function get_stored_data( $key ) { |
|
279 | + private function get_stored_data($key) { |
|
280 | 280 | global $wpdb; |
281 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
281 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
282 | 282 | |
283 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
283 | + return empty($value) ? false : maybe_unserialize($value); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @return void |
295 | 295 | */ |
296 | - private function store_data( $key, $value ) { |
|
296 | + private function store_data($key, $value) { |
|
297 | 297 | global $wpdb; |
298 | 298 | |
299 | - $value = maybe_serialize( $value ); |
|
299 | + $value = maybe_serialize($value); |
|
300 | 300 | |
301 | 301 | $data = array( |
302 | 302 | 'option_name' => $key, |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | '%s', |
311 | 311 | ); |
312 | 312 | |
313 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
313 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @return void |
324 | 324 | */ |
325 | - private function delete_data( $key ) { |
|
325 | + private function delete_data($key) { |
|
326 | 326 | global $wpdb; |
327 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
327 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | } |