@@ -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 | /** |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | global $status, $page; |
51 | 51 | |
52 | 52 | // Set parent defaults |
53 | - parent::__construct( array( |
|
54 | - 'singular' => esc_html( 'API Key', 'give' ), // Singular name of the listed records |
|
55 | - 'plural' => esc_html( 'API Keys', 'give' ), // Plural name of the listed records |
|
53 | + parent::__construct(array( |
|
54 | + 'singular' => esc_html('API Key', 'give'), // Singular name of the listed records |
|
55 | + 'plural' => esc_html('API Keys', 'give'), // Plural name of the listed records |
|
56 | 56 | 'ajax' => false // Does this table support ajax? |
57 | - ) ); |
|
57 | + )); |
|
58 | 58 | |
59 | 59 | $this->query(); |
60 | 60 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return string Column Name |
72 | 72 | */ |
73 | - public function column_default( $item, $column_name ) { |
|
74 | - return $item[ $column_name ]; |
|
73 | + public function column_default($item, $column_name) { |
|
74 | + return $item[$column_name]; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return string Column Name |
87 | 87 | */ |
88 | - public function column_key( $item ) { |
|
89 | - return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>'; |
|
88 | + public function column_key($item) { |
|
89 | + return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>'; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return string Column Name |
102 | 102 | */ |
103 | - public function column_token( $item ) { |
|
104 | - return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>'; |
|
103 | + public function column_token($item) { |
|
104 | + return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string Column Name |
117 | 117 | */ |
118 | - public function column_secret( $item ) { |
|
119 | - return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>'; |
|
118 | + public function column_secret($item) { |
|
119 | + return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,46 +126,46 @@ discard block |
||
126 | 126 | * @since 1.1 |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - public function column_user( $item ) { |
|
129 | + public function column_user($item) { |
|
130 | 130 | |
131 | 131 | $actions = array(); |
132 | 132 | |
133 | - if ( apply_filters( 'give_api_log_requests', true ) ) { |
|
133 | + if (apply_filters('give_api_log_requests', true)) { |
|
134 | 134 | $actions['view'] = sprintf( |
135 | 135 | '<a href="%s">%s</a>', |
136 | - esc_url( add_query_arg( array( |
|
136 | + esc_url(add_query_arg(array( |
|
137 | 137 | 'view' => 'api_requests', |
138 | 138 | 'post_type' => 'give_forms', |
139 | 139 | 'page' => 'give-reports', |
140 | 140 | 'tab' => 'logs', |
141 | 141 | 's' => $item['email'] |
142 | - ), 'edit.php' ) ), |
|
143 | - esc_html( 'View API Log', 'give' ) |
|
142 | + ), 'edit.php')), |
|
143 | + esc_html('View API Log', 'give') |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
147 | 147 | $actions['reissue'] = sprintf( |
148 | 148 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
149 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
149 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
150 | 150 | 'user_id' => $item['id'], |
151 | 151 | 'give_action' => 'process_api_key', |
152 | 152 | 'give_api_process' => 'regenerate' |
153 | - ) ), 'give-api-nonce' ) ), |
|
154 | - esc_html( 'Reissue', 'give' ) |
|
153 | + )), 'give-api-nonce')), |
|
154 | + esc_html('Reissue', 'give') |
|
155 | 155 | ); |
156 | - $actions['revoke'] = sprintf( |
|
156 | + $actions['revoke'] = sprintf( |
|
157 | 157 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
158 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
158 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
159 | 159 | 'user_id' => $item['id'], |
160 | 160 | 'give_action' => 'process_api_key', |
161 | 161 | 'give_api_process' => 'revoke' |
162 | - ) ), 'give-api-nonce' ) ), |
|
163 | - esc_html( 'Revoke', 'give' ) |
|
162 | + )), 'give-api-nonce')), |
|
163 | + esc_html('Revoke', 'give') |
|
164 | 164 | ); |
165 | 165 | |
166 | - $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
|
166 | + $actions = apply_filters('give_api_row_actions', array_filter($actions)); |
|
167 | 167 | |
168 | - return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) ); |
|
168 | + return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions)); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function get_columns() { |
179 | 179 | $columns = array( |
180 | - 'user' => esc_html( 'Username', 'give' ), |
|
181 | - 'key' => esc_html( 'Public Key', 'give' ), |
|
182 | - 'token' => esc_html( 'Token', 'give' ), |
|
183 | - 'secret' => esc_html( 'Secret Key', 'give' ) |
|
180 | + 'user' => esc_html('Username', 'give'), |
|
181 | + 'key' => esc_html('Public Key', 'give'), |
|
182 | + 'token' => esc_html('Token', 'give'), |
|
183 | + 'secret' => esc_html('Secret Key', 'give') |
|
184 | 184 | ); |
185 | 185 | |
186 | 186 | return $columns; |
@@ -193,19 +193,19 @@ discard block |
||
193 | 193 | * @since 1.1 |
194 | 194 | * @return void |
195 | 195 | */ |
196 | - function bulk_actions( $which = '' ) { |
|
196 | + function bulk_actions($which = '') { |
|
197 | 197 | // These aren't really bulk actions but this outputs the markup in the right place |
198 | 198 | static $give_api_is_bottom; |
199 | 199 | |
200 | - if ( $give_api_is_bottom ) { |
|
200 | + if ($give_api_is_bottom) { |
|
201 | 201 | return; |
202 | 202 | } |
203 | 203 | ?> |
204 | 204 | <input type="hidden" name="give_action" value="process_api_key"/> |
205 | 205 | <input type="hidden" name="give_api_process" value="generate"/> |
206 | - <?php wp_nonce_field( 'give-api-nonce' ); ?> |
|
206 | + <?php wp_nonce_field('give-api-nonce'); ?> |
|
207 | 207 | <?php echo Give()->html->ajax_user_search(); ?> |
208 | - <?php submit_button( esc_html( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?> |
|
208 | + <?php submit_button(esc_html('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?> |
|
209 | 209 | <?php |
210 | 210 | $give_api_is_bottom = true; |
211 | 211 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @return int Current page number |
219 | 219 | */ |
220 | 220 | public function get_paged() { |
221 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
221 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -229,21 +229,21 @@ discard block |
||
229 | 229 | * @return array |
230 | 230 | */ |
231 | 231 | public function query() { |
232 | - $users = get_users( array( |
|
232 | + $users = get_users(array( |
|
233 | 233 | 'meta_value' => 'give_user_secret_key', |
234 | 234 | 'number' => $this->per_page, |
235 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ) |
|
236 | - ) ); |
|
237 | - $keys = array(); |
|
238 | - |
|
239 | - foreach ( $users as $user ) { |
|
240 | - $keys[ $user->ID ]['id'] = $user->ID; |
|
241 | - $keys[ $user->ID ]['email'] = $user->user_email; |
|
242 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; |
|
243 | - |
|
244 | - $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
|
245 | - $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
|
246 | - $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
|
235 | + 'offset' => $this->per_page * ($this->get_paged() - 1) |
|
236 | + )); |
|
237 | + $keys = array(); |
|
238 | + |
|
239 | + foreach ($users as $user) { |
|
240 | + $keys[$user->ID]['id'] = $user->ID; |
|
241 | + $keys[$user->ID]['email'] = $user->user_email; |
|
242 | + $keys[$user->ID]['user'] = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>'; |
|
243 | + |
|
244 | + $keys[$user->ID]['key'] = Give()->api->get_user_public_key($user->ID); |
|
245 | + $keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID); |
|
246 | + $keys[$user->ID]['token'] = Give()->api->get_token($user->ID); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | return $keys; |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | public function total_items() { |
261 | 261 | global $wpdb; |
262 | 262 | |
263 | - if ( ! get_transient( 'give_total_api_keys' ) ) { |
|
264 | - $total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'" ); |
|
263 | + if ( ! get_transient('give_total_api_keys')) { |
|
264 | + $total_items = $wpdb->get_var("SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'"); |
|
265 | 265 | |
266 | - set_transient( 'give_total_api_keys', $total_items, 60 * 60 ); |
|
266 | + set_transient('give_total_api_keys', $total_items, 60 * 60); |
|
267 | 267 | } |
268 | 268 | |
269 | - return get_transient( 'give_total_api_keys' ); |
|
269 | + return get_transient('give_total_api_keys'); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $hidden = array(); // No hidden columns |
283 | 283 | $sortable = array(); // Not sortable... for now |
284 | 284 | |
285 | - $this->_column_headers = array( $columns, $hidden, $sortable, 'id' ); |
|
285 | + $this->_column_headers = array($columns, $hidden, $sortable, 'id'); |
|
286 | 286 | |
287 | 287 | $data = $this->query(); |
288 | 288 | |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | |
291 | 291 | $this->items = $data; |
292 | 292 | |
293 | - $this->set_pagination_args( array( |
|
293 | + $this->set_pagination_args(array( |
|
294 | 294 | 'total_items' => $total_items, |
295 | 295 | 'per_page' => $this->per_page, |
296 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
296 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
297 | 297 | ) |
298 | 298 | ); |
299 | 299 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | * @since 1.0 |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - add_action( 'admin_notices', array( $this, 'show_notices' ) ); |
|
31 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
32 | - add_action( 'admin_bar_menu', array( $this, 'give_admin_bar_menu' ), 1000 ); |
|
30 | + add_action('admin_notices', array($this, 'show_notices')); |
|
31 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
32 | + add_action('admin_bar_menu', array($this, 'give_admin_bar_menu'), 1000); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | public function give_admin_bar_menu() { |
43 | 43 | global $wp_admin_bar; |
44 | 44 | |
45 | - if ( ! give_is_test_mode() || ! current_user_can( 'view_give_reports' ) ) { |
|
45 | + if ( ! give_is_test_mode() || ! current_user_can('view_give_reports')) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | 49 | //Add the main siteadmin menu item |
50 | - $wp_admin_bar->add_menu( array( |
|
50 | + $wp_admin_bar->add_menu(array( |
|
51 | 51 | 'id' => 'give-test-notice', |
52 | - 'href' => admin_url() . 'edit.php?post_type=give_forms&page=give-settings&tab=gateways', |
|
52 | + 'href' => admin_url().'edit.php?post_type=give_forms&page=give-settings&tab=gateways', |
|
53 | 53 | 'parent' => 'top-secondary', |
54 | - 'title' => esc_html( 'Give Test Mode Active', 'give' ), |
|
55 | - 'meta' => array( 'class' => 'give-test-mode-active' ), |
|
56 | - ) ); |
|
54 | + 'title' => esc_html('Give Test Mode Active', 'give'), |
|
55 | + 'meta' => array('class' => 'give-test-mode-active'), |
|
56 | + )); |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | |
@@ -68,98 +68,98 @@ discard block |
||
68 | 68 | 'error' => array() |
69 | 69 | ); |
70 | 70 | |
71 | - if ( ! give_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_give_settings' ) ) { |
|
71 | + if ( ! give_test_ajax_works() && ! get_user_meta(get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true) && current_user_can('manage_give_settings')) { |
|
72 | 72 | echo '<div class="error">'; |
73 | - echo '<p>' . esc_html( 'Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give' ) . '</p>'; |
|
73 | + echo '<p>'.esc_html('Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give').'</p>'; |
|
74 | 74 | /* translators: %s: https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/ */ |
75 | - echo '<p>' . sprintf( __( 'Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give' ), esc_url( 'https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/' ) ) . '</p>'; |
|
76 | - echo '<p><a href="' . add_query_arg( array( |
|
75 | + echo '<p>'.sprintf(__('Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give'), esc_url('https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/')).'</p>'; |
|
76 | + echo '<p><a href="'.add_query_arg(array( |
|
77 | 77 | 'give_action' => 'dismiss_notices', |
78 | 78 | 'give_notice' => 'admin_ajax_inaccessible' |
79 | - ) ) . '">' . esc_html( 'Dismiss Notice', 'give' ) . '</a></p>'; |
|
79 | + )).'">'.esc_html('Dismiss Notice', 'give').'</a></p>'; |
|
80 | 80 | echo '</div>'; |
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | - if ( isset( $_GET['give-message'] ) ) { |
|
84 | + if (isset($_GET['give-message'])) { |
|
85 | 85 | |
86 | 86 | // Donation reports errors |
87 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
88 | - switch ( $_GET['give-message'] ) { |
|
87 | + if (current_user_can('view_give_reports')) { |
|
88 | + switch ($_GET['give-message']) { |
|
89 | 89 | case 'payment_deleted' : |
90 | - $notices['updated']['give-payment-deleted'] = esc_attr( 'The payment has been deleted.', 'give' ); |
|
90 | + $notices['updated']['give-payment-deleted'] = esc_attr('The payment has been deleted.', 'give'); |
|
91 | 91 | break; |
92 | 92 | case 'email_sent' : |
93 | - $notices['updated']['give-payment-sent'] = esc_attr( 'The donation receipt has been resent.', 'give' ); |
|
93 | + $notices['updated']['give-payment-sent'] = esc_attr('The donation receipt has been resent.', 'give'); |
|
94 | 94 | break; |
95 | 95 | case 'refreshed-reports' : |
96 | - $notices['updated']['give-refreshed-reports'] = esc_attr( 'The reports cache has been cleared.', 'give' ); |
|
96 | + $notices['updated']['give-refreshed-reports'] = esc_attr('The reports cache has been cleared.', 'give'); |
|
97 | 97 | break; |
98 | 98 | case 'payment-note-deleted' : |
99 | - $notices['updated']['give-payment-note-deleted'] = esc_attr( 'The payment note has been deleted.', 'give' ); |
|
99 | + $notices['updated']['give-payment-note-deleted'] = esc_attr('The payment note has been deleted.', 'give'); |
|
100 | 100 | break; |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | 104 | // Give settings notices and errors |
105 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
106 | - switch ( $_GET['give-message'] ) { |
|
105 | + if (current_user_can('manage_give_settings')) { |
|
106 | + switch ($_GET['give-message']) { |
|
107 | 107 | case 'settings-imported' : |
108 | - $notices['updated']['give-settings-imported'] = esc_attr( 'The settings have been imported.', 'give' ); |
|
108 | + $notices['updated']['give-settings-imported'] = esc_attr('The settings have been imported.', 'give'); |
|
109 | 109 | break; |
110 | 110 | case 'api-key-generated' : |
111 | - $notices['updated']['give-api-key-generated'] = esc_attr( 'API keys successfully generated.', 'give' ); |
|
111 | + $notices['updated']['give-api-key-generated'] = esc_attr('API keys successfully generated.', 'give'); |
|
112 | 112 | break; |
113 | 113 | case 'api-key-exists' : |
114 | - $notices['error']['give-api-key-exists'] = esc_attr( 'The specified user already has API keys.', 'give' ); |
|
114 | + $notices['error']['give-api-key-exists'] = esc_attr('The specified user already has API keys.', 'give'); |
|
115 | 115 | break; |
116 | 116 | case 'api-key-regenerated' : |
117 | - $notices['updated']['give-api-key-regenerated'] = esc_attr( 'API keys successfully regenerated.', 'give' ); |
|
117 | + $notices['updated']['give-api-key-regenerated'] = esc_attr('API keys successfully regenerated.', 'give'); |
|
118 | 118 | break; |
119 | 119 | case 'api-key-revoked' : |
120 | - $notices['updated']['give-api-key-revoked'] = esc_attr( 'API keys successfully revoked.', 'give' ); |
|
120 | + $notices['updated']['give-api-key-revoked'] = esc_attr('API keys successfully revoked.', 'give'); |
|
121 | 121 | break; |
122 | 122 | case 'sent-test-email' : |
123 | - $notices['updated']['give-sent-test-email'] = esc_attr( 'The test email has been sent.', 'give' ); |
|
123 | + $notices['updated']['give-sent-test-email'] = esc_attr('The test email has been sent.', 'give'); |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | // Payments errors |
128 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
129 | - switch ( $_GET['give-message'] ) { |
|
128 | + if (current_user_can('edit_give_payments')) { |
|
129 | + switch ($_GET['give-message']) { |
|
130 | 130 | case 'note-added' : |
131 | - $notices['updated']['give-note-added'] = esc_attr( 'The payment note has been added successfully.', 'give' ); |
|
131 | + $notices['updated']['give-note-added'] = esc_attr('The payment note has been added successfully.', 'give'); |
|
132 | 132 | break; |
133 | 133 | case 'payment-updated' : |
134 | - $notices['updated']['give-payment-updated'] = esc_attr( 'The payment has been successfully updated.', 'give' ); |
|
134 | + $notices['updated']['give-payment-updated'] = esc_attr('The payment has been successfully updated.', 'give'); |
|
135 | 135 | break; |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Customer Notices |
140 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
141 | - switch ( $_GET['give-message'] ) { |
|
140 | + if (current_user_can('edit_give_payments')) { |
|
141 | + switch ($_GET['give-message']) { |
|
142 | 142 | case 'customer-deleted' : |
143 | - $notices['updated']['give-customer-deleted'] = esc_attr( 'Donor successfully deleted.', 'give' ); |
|
143 | + $notices['updated']['give-customer-deleted'] = esc_attr('Donor successfully deleted.', 'give'); |
|
144 | 144 | break; |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | 148 | } |
149 | 149 | |
150 | - if ( count( $notices['updated'] ) > 0 ) { |
|
151 | - foreach ( $notices['updated'] as $notice => $message ) { |
|
152 | - add_settings_error( 'give-notices', $notice, $message, 'updated' ); |
|
150 | + if (count($notices['updated']) > 0) { |
|
151 | + foreach ($notices['updated'] as $notice => $message) { |
|
152 | + add_settings_error('give-notices', $notice, $message, 'updated'); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - if ( count( $notices['error'] ) > 0 ) { |
|
157 | - foreach ( $notices['error'] as $notice => $message ) { |
|
158 | - add_settings_error( 'give-notices', $notice, $message, 'error' ); |
|
156 | + if (count($notices['error']) > 0) { |
|
157 | + foreach ($notices['error'] as $notice => $message) { |
|
158 | + add_settings_error('give-notices', $notice, $message, 'error'); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - settings_errors( 'give-notices' ); |
|
162 | + settings_errors('give-notices'); |
|
163 | 163 | |
164 | 164 | } |
165 | 165 | |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | * @return void |
172 | 172 | */ |
173 | 173 | function give_admin_addons_notices() { |
174 | - add_settings_error( 'give-notices', 'give-addons-feed-error', esc_attr( 'There seems to be an issue with the server. Please try again in a few minutes.', 'give' ), 'error' ); |
|
175 | - settings_errors( 'give-notices' ); |
|
174 | + add_settings_error('give-notices', 'give-addons-feed-error', esc_attr('There seems to be an issue with the server. Please try again in a few minutes.', 'give'), 'error'); |
|
175 | + settings_errors('give-notices'); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * @return void |
184 | 184 | */ |
185 | 185 | function dismiss_notices() { |
186 | - if ( isset( $_GET['give_notice'] ) ) { |
|
187 | - update_user_meta( get_current_user_id(), '_give_' . $_GET['give_notice'] . '_dismissed', 1 ); |
|
188 | - wp_redirect( remove_query_arg( array( 'give_action', 'give_notice' ) ) ); |
|
186 | + if (isset($_GET['give_notice'])) { |
|
187 | + update_user_meta(get_current_user_id(), '_give_'.$_GET['give_notice'].'_dismissed', 1); |
|
188 | + wp_redirect(remove_query_arg(array('give_action', 'give_notice'))); |
|
189 | 189 | exit; |
190 | 190 | } |
191 | 191 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Exit if accessed directly |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param $_banner_details |
28 | 28 | */ |
29 | - function __construct( $_banner_details ) { |
|
29 | + function __construct($_banner_details) { |
|
30 | 30 | |
31 | 31 | global $current_user; |
32 | 32 | $this->banner_details = $_banner_details; |
33 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
34 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
33 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
34 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
35 | 35 | |
36 | 36 | //Get current user |
37 | 37 | $this->user_id = $current_user->ID; |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | public function init() { |
51 | 51 | |
52 | 52 | //Testing? |
53 | - if ( $this->test_mode ) { |
|
54 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
53 | + if ($this->test_mode) { |
|
54 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | //Get the current page to add the notice to |
58 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
59 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
58 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
59 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
60 | 60 | |
61 | 61 | |
62 | 62 | } |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | global $pagenow; |
72 | 72 | |
73 | 73 | //Make sure we're on the plugins page. |
74 | - if ( $pagenow !== 'plugins.php' ) { |
|
74 | + if ($pagenow !== 'plugins.php') { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | 78 | // If the user hasn't already dismissed our alert, |
79 | 79 | // Output the activation banner |
80 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?> |
|
80 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?> |
|
81 | 81 | |
82 | 82 | <!-- * I output inline styles here |
83 | 83 | * because there's no reason to keep these |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | <h3><?php |
158 | 158 | printf( |
159 | 159 | /* translators: %s: Add-on name */ |
160 | - esc_html( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
161 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
160 | + esc_html("Thank you for installing Give's %s Add-on!", 'give'), |
|
161 | + '<span>'.$this->banner_details['name'].'</span>' |
|
162 | 162 | ); |
163 | 163 | ?></h3> |
164 | 164 | |
165 | 165 | <a href="<?php |
166 | 166 | //The Dismiss Button |
167 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
168 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
167 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
168 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
169 | 169 | |
170 | 170 | <!-- * Now we output a few "actions" |
171 | 171 | * that the user can take from here --> |
@@ -173,21 +173,21 @@ discard block |
||
173 | 173 | <div class="alert-actions"> |
174 | 174 | |
175 | 175 | <?php //Point them to your settings page |
176 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
176 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
177 | 177 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
178 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?> |
|
178 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?> |
|
179 | 179 | </a> |
180 | 180 | <?php } ?> |
181 | 181 | |
182 | 182 | <?php |
183 | 183 | // Show them how to configure the Addon |
184 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
184 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
185 | 185 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
186 | 186 | <span class="dashicons dashicons-media-text"></span> |
187 | 187 | <?php |
188 | 188 | printf( |
189 | 189 | /* translators: %s: Add-on name */ |
190 | - esc_html( 'Documentation: %s Add-on', 'give' ), |
|
190 | + esc_html('Documentation: %s Add-on', 'give'), |
|
191 | 191 | $this->banner_details['name'] |
192 | 192 | ); |
193 | 193 | ?> |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | <?php } ?> |
196 | 196 | <?php |
197 | 197 | //Let them signup for plugin updates |
198 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
198 | + if (isset($this->banner_details['support_url'])) { ?> |
|
199 | 199 | |
200 | 200 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
201 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
201 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
202 | 202 | </a> |
203 | 203 | |
204 | 204 | <?php } ?> |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | /* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
221 | 221 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
222 | 222 | */ |
223 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
223 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
224 | 224 | |
225 | 225 | //Get the global user |
226 | 226 | global $current_user; |
227 | 227 | $user_id = $current_user->ID; |
228 | 228 | |
229 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
229 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | function give_add_ons_page() { |
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | - <h2><?php esc_html_e( 'Give Add-ons', 'give' ); ?> |
|
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e( 'Browse All Add-ons', 'give' ); ?>" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
28 | + <h2><?php esc_html_e('Give Add-ons', 'give'); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e('Browse All Add-ons', 'give'); ?>" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h2> |
32 | 32 | |
33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
51 | + $cache = get_transient('give_add_ons_feed'); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | - $cache = '<div class="error"><p>' . esc_html( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
62 | + $cache = '<div class="error"><p>'.esc_html('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,80 +22,80 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
29 | - do_action( 'give_tools_recount_stats_before' ); |
|
29 | + do_action('give_tools_recount_stats_before'); |
|
30 | 30 | ?> |
31 | 31 | <div id="poststuff"> |
32 | 32 | <div class="postbox"> |
33 | 33 | |
34 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
34 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
35 | 35 | |
36 | 36 | <div class="inside recount-stats-controls"> |
37 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
37 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
38 | 38 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
39 | 39 | |
40 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
40 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
41 | 41 | |
42 | 42 | <select name="give-export-class" id="recount-stats-type"> |
43 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
44 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
45 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
46 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
47 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
48 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
49 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
50 | - <?php do_action( 'give_recount_tool_options' ); ?> |
|
43 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
44 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
45 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
46 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
47 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
48 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
49 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
50 | + <?php do_action('give_recount_tool_options'); ?> |
|
51 | 51 | </select> |
52 | 52 | |
53 | 53 | <span id="tools-form-dropdown" style="display: none"> |
54 | 54 | <?php |
55 | 55 | $args = array( |
56 | 56 | 'name' => 'form_id', |
57 | - 'number' => - 1, |
|
57 | + 'number' => -1, |
|
58 | 58 | 'chosen' => true, |
59 | 59 | ); |
60 | - echo Give()->html->forms_dropdown( $args ); |
|
60 | + echo Give()->html->forms_dropdown($args); |
|
61 | 61 | ?> |
62 | 62 | </span> |
63 | 63 | |
64 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
64 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
65 | 65 | |
66 | 66 | <br/> |
67 | 67 | |
68 | 68 | <span class="give-recount-stats-descriptions"> |
69 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
69 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
70 | 70 | <span id="recount-form"><?php |
71 | 71 | printf( |
72 | 72 | /* translators: %s: form singular label */ |
73 | - esc_html( 'Recalculates the donation and income stats for a specific %s.', 'give' ), |
|
74 | - give_get_forms_label_singular( true ) |
|
73 | + esc_html('Recalculates the donation and income stats for a specific %s.', 'give'), |
|
74 | + give_get_forms_label_singular(true) |
|
75 | 75 | ); |
76 | 76 | ?></span> |
77 | 77 | <span id="recount-all"><?php |
78 | 78 | printf( |
79 | 79 | /* translators: %s: form plural label */ |
80 | - esc_html( 'Recalculates the earnings and sales stats for all %s.', 'give' ), |
|
81 | - give_get_forms_label_plural( true ) |
|
80 | + esc_html('Recalculates the earnings and sales stats for all %s.', 'give'), |
|
81 | + give_get_forms_label_plural(true) |
|
82 | 82 | ); |
83 | 83 | ?></span> |
84 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
85 | - <?php do_action( 'give_recount_tool_descriptions' ); ?> |
|
86 | - <span id="delete-test-transactions"><?php esc_html_e( '<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give' ); ?></span> |
|
87 | - <span id="reset-stats"><?php esc_html_e( '<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
84 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
85 | + <?php do_action('give_recount_tool_descriptions'); ?> |
|
86 | + <span id="delete-test-transactions"><?php esc_html_e('<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give'); ?></span> |
|
87 | + <span id="reset-stats"><?php esc_html_e('<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
88 | 88 | </span> |
89 | 89 | |
90 | 90 | <span class="spinner"></span> |
91 | 91 | |
92 | 92 | </form> |
93 | - <?php do_action( 'give_tools_recount_forms' ); ?> |
|
93 | + <?php do_action('give_tools_recount_forms'); ?> |
|
94 | 94 | </div><!-- .inside --> |
95 | 95 | </div><!-- .postbox --> |
96 | 96 | </div><!-- #poststuff --> |
97 | 97 | <?php |
98 | - do_action( 'give_tools_recount_stats_after' ); |
|
98 | + do_action('give_tools_recount_stats_after'); |
|
99 | 99 | } |
100 | 100 | |
101 | -add_action( 'give_reports_tab_tools', 'give_tools_recount_stats_display' ); |
|
101 | +add_action('give_reports_tab_tools', 'give_tools_recount_stats_display'); |
@@ -10,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 | /** |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | global $status, $page; |
51 | 51 | |
52 | 52 | // Set parent defaults |
53 | - parent::__construct( array( |
|
54 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
55 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
53 | + parent::__construct(array( |
|
54 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
55 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
56 | 56 | 'ajax' => false // Does this table support ajax? |
57 | - ) ); |
|
57 | + )); |
|
58 | 58 | |
59 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
59 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
60 | 60 | $this->query(); |
61 | 61 | |
62 | 62 | } |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string Column Name |
74 | 74 | */ |
75 | - public function column_default( $item, $column_name ) { |
|
76 | - switch ( $column_name ) { |
|
75 | + public function column_default($item, $column_name) { |
|
76 | + switch ($column_name) { |
|
77 | 77 | case 'earnings' : |
78 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
78 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
79 | 79 | case 'average_sales' : |
80 | - return round( $item[ $column_name ] ); |
|
80 | + return round($item[$column_name]); |
|
81 | 81 | case 'average_earnings' : |
82 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
82 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
83 | 83 | case 'details' : |
84 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $item['ID'] ) . '">' . esc_html( 'View Detailed Report', 'give' ) . '</a>'; |
|
84 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$item['ID']).'">'.esc_html('View Detailed Report', 'give').'</a>'; |
|
85 | 85 | default: |
86 | - return $item[ $column_name ]; |
|
86 | + return $item[$column_name]; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | public function get_columns() { |
98 | 98 | $columns = array( |
99 | 99 | 'title' => give_get_forms_label_singular(), |
100 | - 'sales' => esc_html( 'Donations', 'give' ), |
|
101 | - 'earnings' => esc_html( 'Income', 'give' ), |
|
102 | - 'average_sales' => esc_html( 'Monthly Average Donations', 'give' ), |
|
103 | - 'average_earnings' => esc_html( 'Monthly Average Income', 'give' ), |
|
104 | - 'details' => esc_html( 'Detailed Report', 'give' ) |
|
100 | + 'sales' => esc_html('Donations', 'give'), |
|
101 | + 'earnings' => esc_html('Income', 'give'), |
|
102 | + 'average_sales' => esc_html('Monthly Average Donations', 'give'), |
|
103 | + 'average_earnings' => esc_html('Monthly Average Income', 'give'), |
|
104 | + 'details' => esc_html('Detailed Report', 'give') |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | return $columns; |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function get_sortable_columns() { |
118 | 118 | return array( |
119 | - 'title' => array( 'title', true ), |
|
120 | - 'sales' => array( 'sales', false ), |
|
121 | - 'earnings' => array( 'earnings', false ), |
|
119 | + 'title' => array('title', true), |
|
120 | + 'sales' => array('sales', false), |
|
121 | + 'earnings' => array('earnings', false), |
|
122 | 122 | ); |
123 | 123 | } |
124 | 124 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @return int Current page number |
131 | 131 | */ |
132 | 132 | public function get_paged() { |
133 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
133 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @return int Category ID |
143 | 143 | */ |
144 | 144 | public function get_category() { |
145 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
145 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function get_total_forms() { |
157 | 157 | $total = 0; |
158 | - $counts = wp_count_posts( 'give_forms', 'readable' ); |
|
159 | - foreach ( $counts as $status => $count ) { |
|
158 | + $counts = wp_count_posts('give_forms', 'readable'); |
|
159 | + foreach ($counts as $status => $count) { |
|
160 | 160 | $total += $count; |
161 | 161 | } |
162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @since 1.0 |
171 | 171 | * @return void |
172 | 172 | */ |
173 | - public function bulk_actions( $which = '' ) { |
|
173 | + public function bulk_actions($which = '') { |
|
174 | 174 | // These aren't really bulk actions but this outputs the markup in the right place |
175 | 175 | give_report_views(); |
176 | 176 | } |
@@ -183,23 +183,23 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param string $which |
185 | 185 | */ |
186 | - protected function display_tablenav( $which ) { |
|
186 | + protected function display_tablenav($which) { |
|
187 | 187 | |
188 | - if ( 'top' == $which ) { |
|
189 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
188 | + if ('top' == $which) { |
|
189 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
190 | 190 | } |
191 | 191 | ?> |
192 | - <div class="tablenav give-clearfix <?php esc_attr_e( $which ); ?>"> |
|
192 | + <div class="tablenav give-clearfix <?php esc_attr_e($which); ?>"> |
|
193 | 193 | |
194 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span></h3> |
|
194 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donation Forms Report', 'give'); ?></span></h3> |
|
195 | 195 | |
196 | 196 | <div class="alignright tablenav-right"> |
197 | 197 | <div class="actions bulkactions"> |
198 | - <?php $this->bulk_actions( $which ); ?> |
|
198 | + <?php $this->bulk_actions($which); ?> |
|
199 | 199 | </div> |
200 | 200 | <?php |
201 | - $this->extra_tablenav( $which ); |
|
202 | - $this->pagination( $which ); |
|
201 | + $this->extra_tablenav($which); |
|
202 | + $this->pagination($which); |
|
203 | 203 | ?> |
204 | 204 | </div> |
205 | 205 | |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function category_filter() { |
221 | 221 | |
222 | - $categories = get_terms( 'form_category' ); |
|
223 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
224 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
222 | + $categories = get_terms('form_category'); |
|
223 | + if ($categories && ! is_wp_error($categories)) { |
|
224 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function query() { |
237 | 237 | |
238 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
239 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
238 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
239 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
240 | 240 | $category = $this->get_category(); |
241 | 241 | |
242 | 242 | $args = array( |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | 'suppress_filters' => true |
250 | 250 | ); |
251 | 251 | |
252 | - if ( ! empty( $category ) ) { |
|
252 | + if ( ! empty($category)) { |
|
253 | 253 | $args['tax_query'] = array( |
254 | 254 | array( |
255 | 255 | 'taxonomy' => 'form_category', |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | ); |
259 | 259 | } |
260 | 260 | |
261 | - switch ( $orderby ) : |
|
261 | + switch ($orderby) : |
|
262 | 262 | case 'title' : |
263 | 263 | $args['orderby'] = 'title'; |
264 | 264 | break; |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | break; |
275 | 275 | endswitch; |
276 | 276 | |
277 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
277 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
278 | 278 | |
279 | - $this->products = new WP_Query( $args ); |
|
279 | + $this->products = new WP_Query($args); |
|
280 | 280 | |
281 | 281 | } |
282 | 282 | |
@@ -292,15 +292,15 @@ discard block |
||
292 | 292 | |
293 | 293 | $give_forms = $this->products->posts; |
294 | 294 | |
295 | - if ( $give_forms ) { |
|
296 | - foreach ( $give_forms as $form ) { |
|
295 | + if ($give_forms) { |
|
296 | + foreach ($give_forms as $form) { |
|
297 | 297 | $reports_data[] = array( |
298 | 298 | 'ID' => $form, |
299 | - 'title' => get_the_title( $form ), |
|
300 | - 'sales' => give_get_form_sales_stats( $form ), |
|
301 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
302 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
303 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
299 | + 'title' => get_the_title($form), |
|
300 | + 'sales' => give_get_form_sales_stats($form), |
|
301 | + 'earnings' => give_get_form_earnings_stats($form), |
|
302 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
303 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
304 | 304 | ); |
305 | 305 | } |
306 | 306 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | |
329 | 329 | $sortable = $this->get_sortable_columns(); |
330 | 330 | |
331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
332 | 332 | |
333 | 333 | $data = $this->reports_data(); |
334 | 334 | |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | |
337 | 337 | $this->items = $data; |
338 | 338 | |
339 | - $this->set_pagination_args( array( |
|
339 | + $this->set_pagination_args(array( |
|
340 | 340 | 'total_items' => $total_items, |
341 | 341 | 'per_page' => $this->per_page, |
342 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
342 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
343 | 343 | ) |
344 | 344 | ); |
345 | 345 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
68 | - switch ( $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | + switch ($column_name) { |
|
69 | 69 | default: |
70 | - return $item[ $column_name ]; |
|
70 | + return $item[$column_name]; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function get_columns() { |
82 | 82 | $columns = array( |
83 | - 'label' => esc_attr( 'Gateway', 'give' ), |
|
84 | - 'complete_sales' => esc_attr( 'Complete Transactions', 'give' ), |
|
85 | - 'pending_sales' => esc_attr( 'Pending / Failed Transactions', 'give' ), |
|
86 | - 'total_sales' => esc_attr( 'Total Transactions', 'give' ), |
|
87 | - 'total_donations' => esc_attr( 'Total Donations', 'give' ) |
|
83 | + 'label' => esc_attr('Gateway', 'give'), |
|
84 | + 'complete_sales' => esc_attr('Complete Transactions', 'give'), |
|
85 | + 'pending_sales' => esc_attr('Pending / Failed Transactions', 'give'), |
|
86 | + 'total_sales' => esc_attr('Total Transactions', 'give'), |
|
87 | + 'total_donations' => esc_attr('Total Donations', 'give') |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return int Current page number |
100 | 100 | */ |
101 | 101 | public function get_paged() { |
102 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
102 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @since 1.0 |
111 | 111 | * @return void |
112 | 112 | */ |
113 | - public function bulk_actions( $which = '' ) { |
|
113 | + public function bulk_actions($which = '') { |
|
114 | 114 | // These aren't really bulk actions but this outputs the markup in the right place |
115 | 115 | give_report_views(); |
116 | 116 | } |
@@ -123,23 +123,23 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param string $which |
125 | 125 | */ |
126 | - protected function display_tablenav( $which ) { |
|
126 | + protected function display_tablenav($which) { |
|
127 | 127 | |
128 | - if ( 'top' == $which ) { |
|
129 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
128 | + if ('top' == $which) { |
|
129 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
130 | 130 | } |
131 | 131 | ?> |
132 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php esc_attr_e( $which ); ?>"> |
|
132 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php esc_attr_e($which); ?>"> |
|
133 | 133 | |
134 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Payment Methods Report', 'give' ); ?></span></h3> |
|
134 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Payment Methods Report', 'give'); ?></span></h3> |
|
135 | 135 | |
136 | 136 | <div class="alignright tablenav-right"> |
137 | 137 | <div class="actions bulkactions"> |
138 | - <?php $this->bulk_actions( $which ); ?> |
|
138 | + <?php $this->bulk_actions($which); ?> |
|
139 | 139 | </div> |
140 | 140 | <?php |
141 | - $this->extra_tablenav( $which ); |
|
142 | - $this->pagination( $which ); |
|
141 | + $this->extra_tablenav($which); |
|
142 | + $this->pagination($which); |
|
143 | 143 | ?> |
144 | 144 | </div> |
145 | 145 | |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | $gateways = give_get_payment_gateways(); |
165 | 165 | $stats = new Give_Payment_Stats(); |
166 | 166 | |
167 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
167 | + foreach ($gateways as $gateway_id => $gateway) { |
|
168 | 168 | |
169 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
170 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
169 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
170 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
171 | 171 | |
172 | 172 | $reports_data[] = array( |
173 | 173 | 'ID' => $gateway_id, |
174 | 174 | 'label' => $gateway['admin_label'], |
175 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
176 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
177 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
178 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ) |
|
175 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
176 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
177 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
178 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))) |
|
179 | 179 | ); |
180 | 180 | } |
181 | 181 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $columns = $this->get_columns(); |
198 | 198 | $hidden = array(); // No hidden columns |
199 | 199 | $sortable = $this->get_sortable_columns(); |
200 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
200 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
201 | 201 | $this->items = $this->reports_data(); |
202 | 202 | |
203 | 203 | } |
@@ -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,13 +44,13 @@ discard block |
||
44 | 44 | global $status, $page; |
45 | 45 | |
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 | - add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) ); |
|
53 | + add_action('give_log_view_actions', array($this, 'give_forms_filter')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -64,37 +64,37 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | 68 | |
69 | - $payment = give_get_payment_by( 'id', $item['payment_id'] ); |
|
69 | + $payment = give_get_payment_by('id', $item['payment_id']); |
|
70 | 70 | |
71 | - switch ( $column_name ) { |
|
71 | + switch ($column_name) { |
|
72 | 72 | case 'form' : |
73 | - return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . get_the_title( $item[ $column_name ] ) . '</a>'; |
|
73 | + return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.get_the_title($item[$column_name]).'</a>'; |
|
74 | 74 | |
75 | 75 | case 'user_id' : |
76 | - return '<a href="' . |
|
77 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . ( ! empty( $item['user_id'] ) ? urlencode( $item['user_id'] ) : give_get_payment_user_email( $item['payment_id'] ) ) ) . |
|
78 | - '">' . $item['user_name'] . '</a>'; |
|
76 | + return '<a href="'. |
|
77 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.( ! empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))). |
|
78 | + '">'.$item['user_name'].'</a>'; |
|
79 | 79 | |
80 | 80 | case 'amount' : |
81 | - return give_currency_filter( give_format_amount( $item['amount'] ) ); |
|
81 | + return give_currency_filter(give_format_amount($item['amount'])); |
|
82 | 82 | |
83 | 83 | case 'status' : |
84 | 84 | |
85 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
85 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
86 | 86 | |
87 | - if ( $payment->mode == 'test' ) { |
|
88 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr( 'This payment was made in test mode', 'give' ) . '">' . esc_html( 'Test', 'give' ) . '</span>'; |
|
87 | + if ($payment->mode == 'test') { |
|
88 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr('This payment was made in test mode', 'give').'">'.esc_html('Test', 'give').'</span>'; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $value; |
92 | 92 | |
93 | 93 | case 'payment_id' : |
94 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id'] ) . '">' . give_get_payment_number( $item['payment_id'] ) . '</a>'; |
|
94 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$item['payment_id']).'">'.give_get_payment_number($item['payment_id']).'</a>'; |
|
95 | 95 | |
96 | 96 | default: |
97 | - return $item[ $column_name ]; |
|
97 | + return $item[$column_name]; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function get_columns() { |
109 | 109 | $columns = array( |
110 | - 'ID' => esc_html( 'Log ID', 'give' ), |
|
111 | - 'user_id' => esc_html( 'Donor', 'give' ), |
|
110 | + 'ID' => esc_html('Log ID', 'give'), |
|
111 | + 'user_id' => esc_html('Donor', 'give'), |
|
112 | 112 | 'form' => give_get_forms_label_singular(), |
113 | - 'amount' => esc_html( 'Donation Amount', 'give' ), |
|
114 | - 'status' => esc_html( 'Status', 'give' ), |
|
115 | - 'payment_id' => esc_html( 'Transaction ID', 'give' ), |
|
116 | - 'date' => esc_html( 'Date', 'give' ) |
|
113 | + 'amount' => esc_html('Donation Amount', 'give'), |
|
114 | + 'status' => esc_html('Status', 'give'), |
|
115 | + 'payment_id' => esc_html('Transaction ID', 'give'), |
|
116 | + 'date' => esc_html('Date', 'give') |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | return $columns; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return int Current page number |
128 | 128 | */ |
129 | 129 | public function get_paged() { |
130 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
130 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return mixed int If User ID, string If Email/Login |
139 | 139 | */ |
140 | 140 | public function get_filtered_user() { |
141 | - return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false; |
|
141 | + return isset($_GET['user']) ? absint($_GET['user']) : false; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return int Download ID |
150 | 150 | */ |
151 | 151 | public function get_filtered_give_form() { |
152 | - return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false; |
|
152 | + return ! empty($_GET['form']) ? absint($_GET['form']) : false; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return mixed string If search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,20 +176,20 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
179 | + protected function display_tablenav($which) { |
|
180 | 180 | |
181 | - if ( 'top' === $which ) { |
|
182 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
181 | + if ('top' === $which) { |
|
182 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
183 | 183 | } |
184 | 184 | ?> |
185 | - <div class="tablenav <?php esc_attr_e( $which ); ?>"> |
|
185 | + <div class="tablenav <?php esc_attr_e($which); ?>"> |
|
186 | 186 | |
187 | 187 | <div class="alignleft actions bulkactions"> |
188 | - <?php $this->bulk_actions( $which ); ?> |
|
188 | + <?php $this->bulk_actions($which); ?> |
|
189 | 189 | </div> |
190 | 190 | <?php |
191 | - $this->extra_tablenav( $which ); |
|
192 | - $this->pagination( $which ); |
|
191 | + $this->extra_tablenav($which); |
|
192 | + $this->pagination($which); |
|
193 | 193 | ?> |
194 | 194 | |
195 | 195 | <br class="clear"/> |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | $meta_query = array(); |
214 | 214 | |
215 | - if ( $user ) { |
|
215 | + if ($user) { |
|
216 | 216 | // Show only logs from a specific user |
217 | 217 | $meta_query[] = array( |
218 | 218 | 'key' => '_give_log_user_id', |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | $search = $this->get_search(); |
224 | - if ( $search ) { |
|
225 | - if ( is_email( $search ) ) { |
|
224 | + if ($search) { |
|
225 | + if (is_email($search)) { |
|
226 | 226 | // This is an email search. We use this to ensure it works for guest users and logged-in users |
227 | 227 | $key = '_give_log_user_info'; |
228 | 228 | $compare = 'LIKE'; |
@@ -231,32 +231,32 @@ discard block |
||
231 | 231 | $key = '_give_log_user_id'; |
232 | 232 | $compare = 'LIKE'; |
233 | 233 | |
234 | - if ( ! is_numeric( $search ) ) { |
|
234 | + if ( ! is_numeric($search)) { |
|
235 | 235 | // Searching for user by username |
236 | - $user = get_user_by( 'login', $search ); |
|
236 | + $user = get_user_by('login', $search); |
|
237 | 237 | |
238 | - if ( $user ) { |
|
238 | + if ($user) { |
|
239 | 239 | // Found one, set meta value to user's ID |
240 | 240 | $search = $user->ID; |
241 | 241 | } else { |
242 | 242 | // No user found so let's do a real search query |
243 | - $users = new WP_User_Query( array( |
|
243 | + $users = new WP_User_Query(array( |
|
244 | 244 | 'search' => $search, |
245 | - 'search_columns' => array( 'user_url', 'user_nicename' ), |
|
245 | + 'search_columns' => array('user_url', 'user_nicename'), |
|
246 | 246 | 'number' => 1, |
247 | 247 | 'fields' => 'ids' |
248 | - ) ); |
|
248 | + )); |
|
249 | 249 | |
250 | 250 | $found_user = $users->get_results(); |
251 | 251 | |
252 | - if ( $found_user ) { |
|
252 | + if ($found_user) { |
|
253 | 253 | $search = $found_user[0]; |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - if ( ! $this->file_search ) { |
|
259 | + if ( ! $this->file_search) { |
|
260 | 260 | // Meta query only works for non file name searche |
261 | 261 | $meta_query[] = array( |
262 | 262 | 'key' => $key, |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @since 1.0 |
278 | 278 | * @return void |
279 | 279 | */ |
280 | - function bulk_actions( $which = '' ) { |
|
280 | + function bulk_actions($which = '') { |
|
281 | 281 | give_log_views(); |
282 | 282 | } |
283 | 283 | |
@@ -289,22 +289,22 @@ discard block |
||
289 | 289 | * @return void |
290 | 290 | */ |
291 | 291 | public function give_forms_filter() { |
292 | - $give_forms = get_posts( array( |
|
292 | + $give_forms = get_posts(array( |
|
293 | 293 | 'post_type' => 'give_forms', |
294 | 294 | 'post_status' => 'any', |
295 | - 'posts_per_page' => - 1, |
|
295 | + 'posts_per_page' => -1, |
|
296 | 296 | 'orderby' => 'title', |
297 | 297 | 'order' => 'ASC', |
298 | 298 | 'fields' => 'ids', |
299 | 299 | 'update_post_meta_cache' => false, |
300 | 300 | 'update_post_term_cache' => false |
301 | - ) ); |
|
301 | + )); |
|
302 | 302 | |
303 | - if ( $give_forms ) { |
|
303 | + if ($give_forms) { |
|
304 | 304 | echo '<select name="form" id="give-log-form-filter">'; |
305 | - echo '<option value="0">' . esc_html( 'All', 'give' ) . '</option>'; |
|
306 | - foreach ( $give_forms as $form ) { |
|
307 | - echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html( get_the_title( $form ) ) . '</option>'; |
|
305 | + echo '<option value="0">'.esc_html('All', 'give').'</option>'; |
|
306 | + foreach ($give_forms as $form) { |
|
307 | + echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html(get_the_title($form)).'</option>'; |
|
308 | 308 | } |
309 | 309 | echo '</select>'; |
310 | 310 | } |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | global $give_logs; |
323 | 323 | |
324 | 324 | // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs |
325 | - wp_suspend_cache_addition( true ); |
|
325 | + wp_suspend_cache_addition(true); |
|
326 | 326 | |
327 | 327 | $logs_data = array(); |
328 | 328 | $paged = $this->get_paged(); |
329 | - $give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null; |
|
329 | + $give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null; |
|
330 | 330 | $user = $this->get_filtered_user(); |
331 | 331 | |
332 | 332 | $log_query = array( |
@@ -336,26 +336,26 @@ discard block |
||
336 | 336 | 'meta_query' => $this->get_meta_query() |
337 | 337 | ); |
338 | 338 | |
339 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
339 | + $logs = $give_logs->get_connected_logs($log_query); |
|
340 | 340 | |
341 | - if ( $logs ) { |
|
342 | - foreach ( $logs as $log ) { |
|
343 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
341 | + if ($logs) { |
|
342 | + foreach ($logs as $log) { |
|
343 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
344 | 344 | |
345 | 345 | // Make sure this payment hasn't been deleted |
346 | - if ( get_post( $payment_id ) ) : |
|
347 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
348 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
349 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
346 | + if (get_post($payment_id)) : |
|
347 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
348 | + $payment_meta = give_get_payment_meta($payment_id); |
|
349 | + $payment_amount = give_get_payment_amount($payment_id); |
|
350 | 350 | |
351 | 351 | $logs_data[] = array( |
352 | - 'ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', |
|
352 | + 'ID' => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>', |
|
353 | 353 | 'payment_id' => $payment_id, |
354 | 354 | 'form' => $log->post_parent, |
355 | 355 | 'amount' => $payment_amount, |
356 | 356 | 'user_id' => $user_info['id'], |
357 | - 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], |
|
358 | - 'date' => get_post_field( 'post_date', $payment_id ) |
|
357 | + 'user_name' => $user_info['first_name'].' '.$user_info['last_name'], |
|
358 | + 'date' => get_post_field('post_date', $payment_id) |
|
359 | 359 | ); |
360 | 360 | |
361 | 361 | endif; |
@@ -384,15 +384,15 @@ discard block |
||
384 | 384 | $columns = $this->get_columns(); |
385 | 385 | $hidden = array(); |
386 | 386 | $sortable = $this->get_sortable_columns(); |
387 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
387 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
388 | 388 | $current_page = $this->get_pagenum(); |
389 | 389 | $this->items = $this->get_logs(); |
390 | - $total_items = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() ); |
|
390 | + $total_items = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query()); |
|
391 | 391 | |
392 | - $this->set_pagination_args( array( |
|
392 | + $this->set_pagination_args(array( |
|
393 | 393 | 'total_items' => $total_items, |
394 | 394 | 'per_page' => $this->per_page, |
395 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
395 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
396 | 396 | ) |
397 | 397 | ); |
398 | 398 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
67 | - $input_id = $input_id . '-search-input'; |
|
66 | + public function search_box($text, $input_id) { |
|
67 | + $input_id = $input_id.'-search-input'; |
|
68 | 68 | |
69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
71 | 71 | } |
72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
73 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
72 | + if ( ! empty($_REQUEST['order'])) { |
|
73 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | <p class="search-box"> |
77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
80 | 80 | </p> |
81 | 81 | <?php |
82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_columns() { |
92 | 92 | $columns = array( |
93 | - 'ID' => esc_html( 'Log ID', 'give' ), |
|
94 | - 'details' => esc_html( 'Request Details', 'give' ), |
|
95 | - 'ip' => esc_html( 'Request IP', 'give' ), |
|
96 | - 'date' => esc_html( 'Date', 'give' ) |
|
93 | + 'ID' => esc_html('Log ID', 'give'), |
|
94 | + 'details' => esc_html('Request Details', 'give'), |
|
95 | + 'ip' => esc_html('Request IP', 'give'), |
|
96 | + 'date' => esc_html('Date', 'give') |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | default: |
116 | - return $item[ $column_name ]; |
|
116 | + return $item[$column_name]; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function column_details( $item ) { |
|
130 | + public function column_details($item) { |
|
131 | 131 | ?> |
132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e( 'View Request Details', 'give' ); ?> "><?php esc_html_e( 'View Request', 'give' ); ?></a> |
|
132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e('View Request Details', 'give'); ?> "><?php esc_html_e('View Request', 'give'); ?></a> |
|
133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
134 | 134 | <?php |
135 | 135 | |
136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
138 | - echo '<p><strong>' . esc_html( 'API Request:', 'give' ) . '</strong></p>'; |
|
139 | - echo '<div>' . $request . '</div>'; |
|
140 | - if ( ! empty( $error ) ) { |
|
141 | - echo '<p><strong>' . esc_html( 'Error', 'give' ) . '</strong></p>'; |
|
142 | - echo '<div>' . esc_html( $error ) . '</div>'; |
|
136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
137 | + $error = get_post_field('post_content', $item['ID']); |
|
138 | + echo '<p><strong>'.esc_html('API Request:', 'give').'</strong></p>'; |
|
139 | + echo '<div>'.$request.'</div>'; |
|
140 | + if ( ! empty($error)) { |
|
141 | + echo '<p><strong>'.esc_html('Error', 'give').'</strong></p>'; |
|
142 | + echo '<div>'.esc_html($error).'</div>'; |
|
143 | 143 | } |
144 | - echo '<p><strong>' . esc_html( 'API User:', 'give' ) . '</strong></p>'; |
|
145 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
146 | - echo '<p><strong>' . esc_html( 'API Key:', 'give' ) . '</strong></p>'; |
|
147 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
148 | - echo '<p><strong>' . esc_html( 'Request Date:', 'give' ) . '</strong></p>'; |
|
149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
144 | + echo '<p><strong>'.esc_html('API User:', 'give').'</strong></p>'; |
|
145 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
146 | + echo '<p><strong>'.esc_html('API Key:', 'give').'</strong></p>'; |
|
147 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
148 | + echo '<p><strong>'.esc_html('Request Date:', 'give').'</strong></p>'; |
|
149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return mixed String if search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
180 | - if ( 'top' === $which ) { |
|
181 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
179 | + protected function display_tablenav($which) { |
|
180 | + if ('top' === $which) { |
|
181 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
182 | 182 | } |
183 | 183 | ?> |
184 | - <div class="tablenav <?php esc_attr_e( $which ); ?>"> |
|
184 | + <div class="tablenav <?php esc_attr_e($which); ?>"> |
|
185 | 185 | |
186 | 186 | <div class="alignleft actions bulkactions"> |
187 | - <?php $this->bulk_actions( $which ); ?> |
|
187 | + <?php $this->bulk_actions($which); ?> |
|
188 | 188 | </div> |
189 | 189 | <?php |
190 | - $this->extra_tablenav( $which ); |
|
191 | - $this->pagination( $which ); |
|
190 | + $this->extra_tablenav($which); |
|
191 | + $this->pagination($which); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <br class="clear"/> |
@@ -210,31 +210,31 @@ discard block |
||
210 | 210 | |
211 | 211 | $search = $this->get_search(); |
212 | 212 | |
213 | - if ( $search ) { |
|
214 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
213 | + if ($search) { |
|
214 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
215 | 215 | // This is an IP address search |
216 | 216 | $key = '_give_log_request_ip'; |
217 | - } else if ( is_email( $search ) ) { |
|
217 | + } else if (is_email($search)) { |
|
218 | 218 | // This is an email search |
219 | - $userdata = get_user_by( 'email', $search ); |
|
219 | + $userdata = get_user_by('email', $search); |
|
220 | 220 | |
221 | - if ( $userdata ) { |
|
221 | + if ($userdata) { |
|
222 | 222 | $search = $userdata->ID; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $key = '_give_log_user'; |
226 | - } elseif ( strlen( $search ) == 32 ) { |
|
226 | + } elseif (strlen($search) == 32) { |
|
227 | 227 | // Look for an API key |
228 | 228 | $key = '_give_log_key'; |
229 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
229 | + } elseif (stristr($search, 'token:')) { |
|
230 | 230 | // Look for an API token |
231 | - $search = str_ireplace( 'token:', '', $search ); |
|
231 | + $search = str_ireplace('token:', '', $search); |
|
232 | 232 | $key = '_give_log_token'; |
233 | 233 | } else { |
234 | 234 | // This is (probably) a user ID search |
235 | - $userdata = get_userdata( $search ); |
|
235 | + $userdata = get_userdata($search); |
|
236 | 236 | |
237 | - if ( $userdata ) { |
|
237 | + if ($userdata) { |
|
238 | 238 | $search = $userdata->ID; |
239 | 239 | } |
240 | 240 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return int Current page number |
261 | 261 | */ |
262 | 262 | public function get_paged() { |
263 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
263 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - function bulk_actions( $which = '' ) { |
|
273 | + function bulk_actions($which = '') { |
|
274 | 274 | give_log_views(); |
275 | 275 | } |
276 | 276 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | 'meta_query' => $this->get_meta_query() |
294 | 294 | ); |
295 | 295 | |
296 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
296 | + $logs = $give_logs->get_connected_logs($log_query); |
|
297 | 297 | |
298 | - if ( $logs ) { |
|
299 | - foreach ( $logs as $log ) { |
|
298 | + if ($logs) { |
|
299 | + foreach ($logs as $log) { |
|
300 | 300 | |
301 | 301 | $logs_data[] = array( |
302 | 302 | 'ID' => $log->ID, |
303 | - 'ip' => get_post_meta( $log->ID, '_give_log_request_ip', true ), |
|
303 | + 'ip' => get_post_meta($log->ID, '_give_log_request_ip', true), |
|
304 | 304 | 'date' => $log->post_date |
305 | 305 | ); |
306 | 306 | } |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | $columns = $this->get_columns(); |
329 | 329 | $hidden = array(); // No hidden columns |
330 | 330 | $sortable = $this->get_sortable_columns(); |
331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
332 | 332 | $this->items = $this->get_logs(); |
333 | - $total_items = $give_logs->get_log_count( 0, 'api_requests' ); |
|
333 | + $total_items = $give_logs->get_log_count(0, 'api_requests'); |
|
334 | 334 | |
335 | - $this->set_pagination_args( array( |
|
335 | + $this->set_pagination_args(array( |
|
336 | 336 | 'total_items' => $total_items, |
337 | 337 | 'per_page' => $this->per_page, |
338 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
338 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
339 | 339 | ) |
340 | 340 | ); |
341 | 341 | } |