Completed
Push — master ( 4e5e5b...82e76a )
by Devin
37:33 queued 17:37
created
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
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
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
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,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string Column Name
65 65
 	 */
66
-	public function column_default( $item, $column_name ) {
67
-		switch ( $column_name ) {
66
+	public function column_default($item, $column_name) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'error' :
71
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : __( 'Payment Error', 'give' );
71
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : __('Payment Error', 'give');
72 72
 			default:
73
-				return $item[ $column_name ];
73
+				return $item[$column_name];
74 74
 		}
75 75
 	}
76 76
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return void
86 86
 	 */
87
-	public function column_message( $item ) {
87
+	public function column_message($item) {
88 88
 
89 89
 		?>
90
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e( 'View Log Message', 'give' ); ?> "><?php _e( 'View Log Message', 'give' ); ?></a>
90
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e('View Log Message', 'give'); ?> "><?php _e('View Log Message', 'give'); ?></a>
91 91
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
92 92
 			<?php
93 93
 
94
-			$log_message = get_post_field( 'post_content', $item['ID'] );
94
+			$log_message = get_post_field('post_content', $item['ID']);
95 95
 
96
-			$serialized  = strpos( $log_message, '{"' );
96
+			$serialized  = strpos($log_message, '{"');
97 97
 
98 98
 			// Check to see if the log message contains serialized information
99
-			if ( $serialized !== false ) {
100
-				$length = strlen( $log_message ) - $serialized;
101
-				$intro  = substr( $log_message, 0, - $length );
102
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
99
+			if ($serialized !== false) {
100
+				$length = strlen($log_message) - $serialized;
101
+				$intro  = substr($log_message, 0, - $length);
102
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
103 103
 
104
-				echo wpautop( $intro );
105
-				echo wpautop( __( '<strong>Log data:</strong>', 'give' ) );
106
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
104
+				echo wpautop($intro);
105
+				echo wpautop(__('<strong>Log data:</strong>', 'give'));
106
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
107 107
 			} else {
108 108
 				// No serialized data found
109
-				echo wpautop( $log_message );
109
+				echo wpautop($log_message);
110 110
 			}
111 111
 			?>
112 112
 		</div>
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function get_columns() {
124 124
 		$columns = array(
125
-			'ID'         => __( 'Log ID', 'give' ),
126
-			'payment_id' => __( 'Payment ID', 'give' ),
127
-			'error'      => __( 'Error', 'give' ),
128
-			'message'    => __( 'Error Message', 'give' ),
129
-			'gateway'    => __( 'Gateway', 'give' ),
130
-			'date'       => __( 'Date', 'give' )
125
+			'ID'         => __('Log ID', 'give'),
126
+			'payment_id' => __('Payment ID', 'give'),
127
+			'error'      => __('Error', 'give'),
128
+			'message'    => __('Error Message', 'give'),
129
+			'gateway'    => __('Gateway', 'give'),
130
+			'date'       => __('Date', 'give')
131 131
 		);
132 132
 
133 133
 		return $columns;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return int Current page number
142 142
 	 */
143 143
 	public function get_paged() {
144
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
144
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since  1.0
152 152
 	 * @return void
153 153
 	 */
154
-	public function bulk_actions( $which = '' ) {
154
+	public function bulk_actions($which = '') {
155 155
 		give_log_views();
156 156
 	}
157 157
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		global $give_logs;
168 168
 
169 169
 		// Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
170
-		wp_suspend_cache_addition( true );
170
+		wp_suspend_cache_addition(true);
171 171
 
172 172
 		$logs_data = array();
173 173
 		$paged     = $this->get_paged();
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
 			'paged'    => $paged
177 177
 		);
178 178
 
179
-		$logs = $give_logs->get_connected_logs( $log_query );
179
+		$logs = $give_logs->get_connected_logs($log_query);
180 180
 
181
-		if ( $logs ) {
182
-			foreach ( $logs as $log ) {
181
+		if ($logs) {
182
+			foreach ($logs as $log) {
183 183
 
184 184
 				$logs_data[] = array(
185 185
 					'ID'         => $log->ID,
186
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
186
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
187 187
 					'payment_id' => $log->post_parent,
188 188
 					'error'      => 'error',
189
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
189
+					'gateway'    => give_get_payment_gateway($log->post_parent),
190 190
 					'date'       => $log->post_date
191 191
 				);
192 192
 			}
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $which
209 209
 	 */
210
-	protected function display_tablenav( $which ) {
211
-		if ( 'top' === $which ) {
212
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
210
+	protected function display_tablenav($which) {
211
+		if ('top' === $which) {
212
+			wp_nonce_field('bulk-'.$this->_args['plural']);
213 213
 		}
214 214
 		?>
215
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
215
+		<div class="tablenav <?php echo esc_attr($which); ?>">
216 216
 
217 217
 			<div class="alignleft actions bulkactions">
218
-				<?php $this->bulk_actions( $which ); ?>
218
+				<?php $this->bulk_actions($which); ?>
219 219
 			</div>
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
 		$columns               = $this->get_columns();
247 247
 		$hidden                = array(); // No hidden columns
248 248
 		$sortable              = $this->get_sortable_columns();
249
-		$this->_column_headers = array( $columns, $hidden, $sortable );
249
+		$this->_column_headers = array($columns, $hidden, $sortable);
250 250
 		$current_page          = $this->get_pagenum();
251 251
 		$this->items           = $this->get_logs();
252
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
252
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
253 253
 
254
-		$this->set_pagination_args( array(
254
+		$this->set_pagination_args(array(
255 255
 				'total_items' => $total_items,
256 256
 				'per_page'    => $this->per_page,
257
-				'total_pages' => ceil( $total_items / $this->per_page )
257
+				'total_pages' => ceil($total_items / $this->per_page)
258 258
 			)
259 259
 		);
260 260
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-api-requests-logs-list-table.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
90 90
 	 */
91 91
 	public function get_columns() {
92 92
 		$columns = array(
93
-			'ID'      => __( 'Log ID', 'give' ),
94
-			'details' => __( 'Request Details', 'give' ),
95
-			'ip'      => __( 'Request IP', 'give' ),
96
-			'date'    => __( 'Date', 'give' )
93
+			'ID'      => __('Log ID', 'give'),
94
+			'details' => __('Request Details', 'give'),
95
+			'ip'      => __('Request IP', 'give'),
96
+			'date'    => __('Date', 'give')
97 97
 		);
98 98
 
99 99
 		return $columns;
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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&amp;inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e( 'View Request Details', 'give' ); ?> "><?php _e( 'View Request', 'give' ); ?></a>
132
+		<a href="#TB_inline?width=640&amp;inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e('View Request Details', 'give'); ?> "><?php _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>' . __( 'API Request:', 'give' ) . '</strong></p>';
139
-			echo '<div>' . $request . '</div>';
140
-			if ( ! empty( $error ) ) {
141
-				echo '<p><strong>' . __( '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>'.__('API Request:', 'give').'</strong></p>';
139
+			echo '<div>'.$request.'</div>';
140
+			if ( ! empty($error)) {
141
+				echo '<p><strong>'.__('Error', 'give').'</strong></p>';
142
+				echo '<div>'.esc_html($error).'</div>';
143 143
 			}
144
-			echo '<p><strong>' . __( 'API User:', 'give' ) . '</strong></p>';
145
-			echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>';
146
-			echo '<p><strong>' . __( 'API Key:', 'give' ) . '</strong></p>';
147
-			echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>';
148
-			echo '<p><strong>' . __( 'Request Date:', 'give' ) . '</strong></p>';
149
-			echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>';
144
+			echo '<p><strong>'.__('API User:', 'give').'</strong></p>';
145
+			echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>';
146
+			echo '<p><strong>'.__('API Key:', 'give').'</strong></p>';
147
+			echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>';
148
+			echo '<p><strong>'.__('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
 block discarded – undo
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
 block discarded – undo
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 echo esc_attr( $which ); ?>">
184
+		<div class="tablenav <?php echo esc_attr($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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-sales-logs-list-table.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,24 +64,24 @@  discard block
 block discarded – undo
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
 			case 'form' :
70
-				return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . get_the_title( $item[ $column_name ] ) . '</a>';
70
+				return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.get_the_title($item[$column_name]).'</a>';
71 71
 
72 72
 			case 'user_id' :
73
-				return '<a href="' .
74
-				       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'] ) ) ) .
75
-				       '">' . $item['user_name'] . '</a>';
73
+				return '<a href="'.
74
+				       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']))).
75
+				       '">'.$item['user_name'].'</a>';
76 76
 
77 77
 			case 'amount' :
78
-				return give_currency_filter( give_format_amount( $item['amount'] ) );
78
+				return give_currency_filter(give_format_amount($item['amount']));
79 79
 
80 80
 			case 'payment_id' :
81
-				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>';
81
+				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>';
82 82
 
83 83
 			default:
84
-				return $item[ $column_name ];
84
+				return $item[$column_name];
85 85
 		}
86 86
 	}
87 87
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function get_columns() {
96 96
 		$columns = array(
97
-			'ID'         => __( 'Log ID', 'give' ),
98
-			'user_id'    => __( 'User', 'give' ),
97
+			'ID'         => __('Log ID', 'give'),
98
+			'user_id'    => __('User', 'give'),
99 99
 			'form'       => give_get_forms_label_singular(),
100
-			'amount'     => __( 'Item Amount', 'give' ),
101
-			'payment_id' => __( 'Payment ID', 'give' ),
102
-			'date'       => __( 'Date', 'give' )
100
+			'amount'     => __('Item Amount', 'give'),
101
+			'payment_id' => __('Payment ID', 'give'),
102
+			'date'       => __('Date', 'give')
103 103
 		);
104 104
 
105 105
 		return $columns;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @return int Current page number
114 114
 	 */
115 115
 	public function get_paged() {
116
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
116
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
117 117
 	}
118 118
 
119 119
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @return mixed int If User ID, string If Email/Login
125 125
 	 */
126 126
 	public function get_filtered_user() {
127
-		return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false;
127
+		return isset($_GET['user']) ? absint($_GET['user']) : false;
128 128
 	}
129 129
 
130 130
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @return int Download ID
136 136
 	 */
137 137
 	public function get_filtered_give_form() {
138
-		return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false;
138
+		return ! empty($_GET['form']) ? absint($_GET['form']) : false;
139 139
 	}
140 140
 
141 141
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return mixed string If search is present, false otherwise
147 147
 	 */
148 148
 	public function get_search() {
149
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
149
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
150 150
 	}
151 151
 
152 152
 
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @param string $which
164 164
 	 */
165
-	protected function display_tablenav( $which ) {
165
+	protected function display_tablenav($which) {
166 166
 
167
-		if ( 'top' === $which ) {
168
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
167
+		if ('top' === $which) {
168
+			wp_nonce_field('bulk-'.$this->_args['plural']);
169 169
 		}
170 170
 		?>
171
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
171
+		<div class="tablenav <?php echo esc_attr($which); ?>">
172 172
 
173 173
 			<div class="alignleft actions bulkactions">
174
-				<?php $this->bulk_actions( $which ); ?>
174
+				<?php $this->bulk_actions($which); ?>
175 175
 			</div>
176 176
 			<?php
177
-			$this->extra_tablenav( $which );
178
-			$this->pagination( $which );
177
+			$this->extra_tablenav($which);
178
+			$this->pagination($which);
179 179
 			?>
180 180
 
181 181
 			<br class="clear"/>
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
 		$meta_query = array();
200 200
 
201
-		if ( $user ) {
201
+		if ($user) {
202 202
 			// Show only logs from a specific user
203 203
 			$meta_query[] = array(
204 204
 				'key'   => '_give_log_user_id',
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 		}
208 208
 
209 209
 		$search = $this->get_search();
210
-		if ( $search ) {
211
-			if ( is_email( $search ) ) {
210
+		if ($search) {
211
+			if (is_email($search)) {
212 212
 				// This is an email search. We use this to ensure it works for guest users and logged-in users
213 213
 				$key     = '_give_log_user_info';
214 214
 				$compare = 'LIKE';
@@ -217,32 +217,32 @@  discard block
 block discarded – undo
217 217
 				$key     = '_give_log_user_id';
218 218
 				$compare = 'LIKE';
219 219
 
220
-				if ( ! is_numeric( $search ) ) {
220
+				if ( ! is_numeric($search)) {
221 221
 					// Searching for user by username
222
-					$user = get_user_by( 'login', $search );
222
+					$user = get_user_by('login', $search);
223 223
 
224
-					if ( $user ) {
224
+					if ($user) {
225 225
 						// Found one, set meta value to user's ID
226 226
 						$search = $user->ID;
227 227
 					} else {
228 228
 						// No user found so let's do a real search query
229
-						$users = new WP_User_Query( array(
229
+						$users = new WP_User_Query(array(
230 230
 							'search'         => $search,
231
-							'search_columns' => array( 'user_url', 'user_nicename' ),
231
+							'search_columns' => array('user_url', 'user_nicename'),
232 232
 							'number'         => 1,
233 233
 							'fields'         => 'ids'
234
-						) );
234
+						));
235 235
 
236 236
 						$found_user = $users->get_results();
237 237
 
238
-						if ( $found_user ) {
238
+						if ($found_user) {
239 239
 							$search = $found_user[0];
240 240
 						}
241 241
 					}
242 242
 				}
243 243
 			}
244 244
 
245
-			if ( ! $this->file_search ) {
245
+			if ( ! $this->file_search) {
246 246
 				// Meta query only works for non file name searche
247 247
 				$meta_query[] = array(
248 248
 					'key'     => $key,
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 * @since  1.0
264 264
 	 * @return void
265 265
 	 */
266
-	function bulk_actions( $which = '' ) {
266
+	function bulk_actions($which = '') {
267 267
 		give_log_views();
268 268
 	}
269 269
 
@@ -275,22 +275,22 @@  discard block
 block discarded – undo
275 275
 	 * @return void
276 276
 	 */
277 277
 	public function give_forms_filter() {
278
-		$give_forms = get_posts( array(
278
+		$give_forms = get_posts(array(
279 279
 			'post_type'              => 'give_forms',
280 280
 			'post_status'            => 'any',
281
-			'posts_per_page'         => - 1,
281
+			'posts_per_page'         => -1,
282 282
 			'orderby'                => 'title',
283 283
 			'order'                  => 'ASC',
284 284
 			'fields'                 => 'ids',
285 285
 			'update_post_meta_cache' => false,
286 286
 			'update_post_term_cache' => false
287
-		) );
287
+		));
288 288
 
289
-		if ( $give_forms ) {
289
+		if ($give_forms) {
290 290
 			echo '<select name="form" id="give-log-form-filter">';
291
-			echo '<option value="0">' . __( 'All', 'give' ) . '</option>';
292
-			foreach ( $give_forms as $form ) {
293
-				echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html( get_the_title( $form ) ) . '</option>';
291
+			echo '<option value="0">'.__('All', 'give').'</option>';
292
+			foreach ($give_forms as $form) {
293
+				echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html(get_the_title($form)).'</option>';
294 294
 			}
295 295
 			echo '</select>';
296 296
 		}
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 		global $give_logs;
309 309
 
310 310
 		// Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
311
-		wp_suspend_cache_addition( true );
311
+		wp_suspend_cache_addition(true);
312 312
 
313 313
 		$logs_data = array();
314 314
 		$paged     = $this->get_paged();
315
-		$give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null;
315
+		$give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null;
316 316
 		$user      = $this->get_filtered_user();
317 317
 
318 318
 		$log_query = array(
@@ -322,26 +322,26 @@  discard block
 block discarded – undo
322 322
 			'meta_query'  => $this->get_meta_query()
323 323
 		);
324 324
 
325
-		$logs = $give_logs->get_connected_logs( $log_query );
325
+		$logs = $give_logs->get_connected_logs($log_query);
326 326
 
327
-		if ( $logs ) {
328
-			foreach ( $logs as $log ) {
329
-				$payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true );
327
+		if ($logs) {
328
+			foreach ($logs as $log) {
329
+				$payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
330 330
 
331 331
 				// Make sure this payment hasn't been deleted
332
-				if ( get_post( $payment_id ) ) :
333
-					$user_info      = give_get_payment_meta_user_info( $payment_id );
334
-					$payment_meta   = give_get_payment_meta( $payment_id );
335
-					$payment_amount = give_get_payment_amount( $payment_id );
332
+				if (get_post($payment_id)) :
333
+					$user_info      = give_get_payment_meta_user_info($payment_id);
334
+					$payment_meta   = give_get_payment_meta($payment_id);
335
+					$payment_amount = give_get_payment_amount($payment_id);
336 336
 
337 337
 					$logs_data[] = array(
338
-						'ID'         => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>',
338
+						'ID'         => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>',
339 339
 						'payment_id' => $payment_id,
340 340
 						'form'       => $log->post_parent,
341 341
 						'amount'     => $payment_amount,
342 342
 						'user_id'    => $user_info['id'],
343
-						'user_name'  => $user_info['first_name'] . ' ' . $user_info['last_name'],
344
-						'date'       => get_post_field( 'post_date', $payment_id )
343
+						'user_name'  => $user_info['first_name'].' '.$user_info['last_name'],
344
+						'date'       => get_post_field('post_date', $payment_id)
345 345
 					);
346 346
 
347 347
 				endif;
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 		$columns               = $this->get_columns();
371 371
 		$hidden                = array();
372 372
 		$sortable              = $this->get_sortable_columns();
373
-		$this->_column_headers = array( $columns, $hidden, $sortable );
373
+		$this->_column_headers = array($columns, $hidden, $sortable);
374 374
 		$current_page          = $this->get_pagenum();
375 375
 		$this->items           = $this->get_logs();
376
-		$total_items           = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() );
376
+		$total_items           = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query());
377 377
 
378
-		$this->set_pagination_args( array(
378
+		$this->set_pagination_args(array(
379 379
 				'total_items' => $total_items,
380 380
 				'per_page'    => $this->per_page,
381
-				'total_pages' => ceil( $total_items / $this->per_page )
381
+				'total_pages' => ceil($total_items / $this->per_page)
382 382
 			)
383 383
 		);
384 384
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/logs.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return void
24 24
  */
25 25
 function give_logs_view_sales() {
26
-	include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' );
26
+	include(dirname(__FILE__).'/class-sales-logs-list-table.php');
27 27
 
28 28
 	$logs_table = new Give_Sales_Log_Table();
29 29
 	$logs_table->prepare_items();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 }
33 33
 
34
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
34
+add_action('give_logs_view_sales', 'give_logs_view_sales');
35 35
 
36 36
 
37 37
 /**
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
  * @return void
44 44
  */
45 45
 function give_logs_view_gateway_errors() {
46
-	include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' );
46
+	include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php');
47 47
 
48 48
 	$logs_table = new Give_Gateway_Error_Log_Table();
49 49
 	$logs_table->prepare_items();
50 50
 	$logs_table->display();
51 51
 }
52 52
 
53
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
53
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
54 54
 
55 55
 /**
56 56
  * API Request Logs
@@ -62,28 +62,28 @@  discard block
 block discarded – undo
62 62
  * @return void
63 63
  */
64 64
 function give_logs_view_api_requests() {
65
-	include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' );
65
+	include(dirname(__FILE__).'/class-api-requests-logs-list-table.php');
66 66
 
67 67
 	$logs_table = new Give_API_Request_Log_Table();
68 68
 	$logs_table->prepare_items();
69 69
 	?>
70 70
 	<div class="wrap">
71
-		<?php do_action( 'give_logs_api_requests_top' ); ?>
72
-		<form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>">
71
+		<?php do_action('give_logs_api_requests_top'); ?>
72
+		<form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>">
73 73
 			<?php
74
-			$logs_table->search_box( __( 'Search', 'give' ), 'give-api-requests' );
74
+			$logs_table->search_box(__('Search', 'give'), 'give-api-requests');
75 75
 			$logs_table->display();
76 76
 			?>
77 77
 			<input type="hidden" name="post_type" value="give_forms"/>
78 78
 			<input type="hidden" name="page" value="give-reports"/>
79 79
 			<input type="hidden" name="tab" value="logs"/>
80 80
 		</form>
81
-		<?php do_action( 'give_logs_api_requests_bottom' ); ?>
81
+		<?php do_action('give_logs_api_requests_bottom'); ?>
82 82
 	</div>
83 83
 	<?php
84 84
 }
85 85
 
86
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
86
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
87 87
 
88 88
 
89 89
 /**
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function give_log_default_views() {
96 96
 	$views = array(
97
-		'sales'          => __( 'Donations', 'give' ),
98
-		'gateway_errors' => __( 'Payment Errors', 'give' ),
99
-		'api_requests'   => __( 'API Requests', 'give' )
97
+		'sales'          => __('Donations', 'give'),
98
+		'gateway_errors' => __('Payment Errors', 'give'),
99
+		'api_requests'   => __('API Requests', 'give')
100 100
 	);
101 101
 
102
-	$views = apply_filters( 'give_log_views', $views );
102
+	$views = apply_filters('give_log_views', $views);
103 103
 
104 104
 	return $views;
105 105
 }
@@ -112,24 +112,24 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function give_log_views() {
114 114
 	$views        = give_log_default_views();
115
-	$current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales';
115
+	$current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales';
116 116
 	?>
117 117
 	<form id="give-logs-filter" method="get" action="edit.php">
118 118
 		<select id="give-logs-view" name="view">
119 119
 			<optgroup label="Log Type:">
120
-				<?php foreach ( $views as $view_id => $label ): ?>
121
-					<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
120
+				<?php foreach ($views as $view_id => $label): ?>
121
+					<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
122 122
 				<?php endforeach; ?>
123 123
 			</optgroup>
124 124
 		</select>
125 125
 
126
-		<?php do_action( 'give_log_view_actions' ); ?>
126
+		<?php do_action('give_log_view_actions'); ?>
127 127
 
128 128
 		<input type="hidden" name="post_type" value="give_forms"/>
129 129
 		<input type="hidden" name="page" value="give-reports"/>
130 130
 		<input type="hidden" name="tab" value="logs"/>
131 131
 
132
-		<?php submit_button( __( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
132
+		<?php submit_button(__('Apply', 'give'), 'secondary', 'submit', false); ?>
133 133
 	</form>
134 134
 	<?php
135 135
 }
136 136
\ No newline at end of file
Please login to merge, or discard this patch.