Completed
Push — master ( 4e7b4c...a8a8a5 )
by Matt
37:00 queued 17:02
created
includes/admin/class-admin-notices.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 	 *
38 38
 	 * Display admin bar when active
39 39
 	 *
40
-	 * @return bool
40
+	 * @return false|null
41 41
 	 */
42 42
 	public function give_admin_bar_menu() {
43 43
 		global $wp_admin_bar;
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 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
 
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'  => __( 'Give Test Mode Active', 'give' ),
55
-			'meta'   => array( 'class' => 'give-test-mode-active' ),
56
-		) );
54
+			'title'  => __('Give Test Mode Active', 'give'),
55
+			'meta'   => array('class' => 'give-test-mode-active'),
56
+		));
57 57
 
58 58
 	}
59 59
 
@@ -68,97 +68,97 @@  discard block
 block discarded – undo
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>' . __( 'Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give' ) . '</p>';
74
-			echo '<p>' . sprintf( esc_attr__( 'Please see %1$sthis reference%2$s for possible solutions.', 'give' ), '<a href="https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/" target="_blank">', '</a>' ) . '</p>';
75
-			echo '<p><a href="' . add_query_arg( array(
73
+			echo '<p>'.__('Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give').'</p>';
74
+			echo '<p>'.sprintf(esc_attr__('Please see %1$sthis reference%2$s for possible solutions.', 'give'), '<a href="https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/" target="_blank">', '</a>').'</p>';
75
+			echo '<p><a href="'.add_query_arg(array(
76 76
 					'give_action' => 'dismiss_notices',
77 77
 					'give_notice' => 'admin_ajax_inaccessible'
78
-				) ) . '">' . esc_attr__( 'Dismiss Notice', 'give' ) . '</a></p>';
78
+				)).'">'.esc_attr__('Dismiss Notice', 'give').'</a></p>';
79 79
 			echo '</div>';
80 80
 		}
81 81
 
82 82
 
83
-		if ( isset( $_GET['give-message'] ) ) {
83
+		if (isset($_GET['give-message'])) {
84 84
 
85 85
 			// Donation reports errors
86
-			if ( current_user_can( 'view_give_reports' ) ) {
87
-				switch ( $_GET['give-message'] ) {
86
+			if (current_user_can('view_give_reports')) {
87
+				switch ($_GET['give-message']) {
88 88
 					case 'payment_deleted' :
89
-						$notices['updated']['give-payment-deleted'] = esc_attr__( 'The payment has been deleted.', 'give' );
89
+						$notices['updated']['give-payment-deleted'] = esc_attr__('The payment has been deleted.', 'give');
90 90
 						break;
91 91
 					case 'email_sent' :
92
-						$notices['updated']['give-payment-sent'] = esc_attr__( 'The donation receipt has been resent.', 'give' );
92
+						$notices['updated']['give-payment-sent'] = esc_attr__('The donation receipt has been resent.', 'give');
93 93
 						break;
94 94
 					case 'refreshed-reports' :
95
-						$notices['updated']['give-refreshed-reports'] = esc_attr__( 'The reports cache has been cleared.', 'give' );
95
+						$notices['updated']['give-refreshed-reports'] = esc_attr__('The reports cache has been cleared.', 'give');
96 96
 						break;
97 97
 					case 'payment-note-deleted' :
98
-						$notices['updated']['give-payment-note-deleted'] = esc_attr__( 'The payment note has been deleted.', 'give' );
98
+						$notices['updated']['give-payment-note-deleted'] = esc_attr__('The payment note has been deleted.', 'give');
99 99
 						break;
100 100
 				}
101 101
 			}
102 102
 
103 103
 			// Give settings notices and errors
104
-			if ( current_user_can( 'manage_give_settings' ) ) {
105
-				switch ( $_GET['give-message'] ) {
104
+			if (current_user_can('manage_give_settings')) {
105
+				switch ($_GET['give-message']) {
106 106
 					case 'settings-imported' :
107
-						$notices['updated']['give-settings-imported'] = esc_attr__( 'The settings have been imported.', 'give' );
107
+						$notices['updated']['give-settings-imported'] = esc_attr__('The settings have been imported.', 'give');
108 108
 						break;
109 109
 					case 'api-key-generated' :
110
-						$notices['updated']['give-api-key-generated'] = esc_attr__( 'API keys successfully generated.', 'give' );
110
+						$notices['updated']['give-api-key-generated'] = esc_attr__('API keys successfully generated.', 'give');
111 111
 						break;
112 112
 					case 'api-key-exists' :
113
-						$notices['error']['give-api-key-exists'] = esc_attr__( 'The specified user already has API keys.', 'give' );
113
+						$notices['error']['give-api-key-exists'] = esc_attr__('The specified user already has API keys.', 'give');
114 114
 						break;
115 115
 					case 'api-key-regenerated' :
116
-						$notices['updated']['give-api-key-regenerated'] = esc_attr__( 'API keys successfully regenerated.', 'give' );
116
+						$notices['updated']['give-api-key-regenerated'] = esc_attr__('API keys successfully regenerated.', 'give');
117 117
 						break;
118 118
 					case 'api-key-revoked' :
119
-						$notices['updated']['give-api-key-revoked'] = esc_attr__( 'API keys successfully revoked.', 'give' );
119
+						$notices['updated']['give-api-key-revoked'] = esc_attr__('API keys successfully revoked.', 'give');
120 120
 						break;
121 121
 					case 'sent-test-email' :
122
-						$notices['updated']['give-sent-test-email'] = esc_attr__( 'The test email has been sent.', 'give' );
122
+						$notices['updated']['give-sent-test-email'] = esc_attr__('The test email has been sent.', 'give');
123 123
 						break;
124 124
 				}
125 125
 			}
126 126
 			// Payments errors
127
-			if ( current_user_can( 'edit_give_payments' ) ) {
128
-				switch ( $_GET['give-message'] ) {
127
+			if (current_user_can('edit_give_payments')) {
128
+				switch ($_GET['give-message']) {
129 129
 					case 'note-added' :
130
-						$notices['updated']['give-note-added'] = esc_attr__( 'The payment note has been added successfully.', 'give' );
130
+						$notices['updated']['give-note-added'] = esc_attr__('The payment note has been added successfully.', 'give');
131 131
 						break;
132 132
 					case 'payment-updated' :
133
-						$notices['updated']['give-payment-updated'] = esc_attr__( 'The payment has been successfully updated.', 'give' );
133
+						$notices['updated']['give-payment-updated'] = esc_attr__('The payment has been successfully updated.', 'give');
134 134
 						break;
135 135
 				}
136 136
 			}
137 137
 
138 138
 			// Customer Notices
139
-			if ( current_user_can( 'edit_give_payments' ) ) {
140
-				switch ( $_GET['give-message'] ) {
139
+			if (current_user_can('edit_give_payments')) {
140
+				switch ($_GET['give-message']) {
141 141
 					case 'customer-deleted' :
142
-						$notices['updated']['give-customer-deleted'] = esc_attr__( 'Donor successfully deleted', 'give' );
142
+						$notices['updated']['give-customer-deleted'] = esc_attr__('Donor successfully deleted', 'give');
143 143
 						break;
144 144
 				}
145 145
 			}
146 146
 
147 147
 		}
148 148
 
149
-		if ( count( $notices['updated'] ) > 0 ) {
150
-			foreach ( $notices['updated'] as $notice => $message ) {
151
-				add_settings_error( 'give-notices', $notice, $message, 'updated' );
149
+		if (count($notices['updated']) > 0) {
150
+			foreach ($notices['updated'] as $notice => $message) {
151
+				add_settings_error('give-notices', $notice, $message, 'updated');
152 152
 			}
153 153
 		}
154 154
 
155
-		if ( count( $notices['error'] ) > 0 ) {
156
-			foreach ( $notices['error'] as $notice => $message ) {
157
-				add_settings_error( 'give-notices', $notice, $message, 'error' );
155
+		if (count($notices['error']) > 0) {
156
+			foreach ($notices['error'] as $notice => $message) {
157
+				add_settings_error('give-notices', $notice, $message, 'error');
158 158
 			}
159 159
 		}
160 160
 
161
-		settings_errors( 'give-notices' );
161
+		settings_errors('give-notices');
162 162
 
163 163
 	}
164 164
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @return void
171 171
 	 */
172 172
 	function give_admin_addons_notices() {
173
-		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' );
174
-		settings_errors( 'give-notices' );
173
+		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');
174
+		settings_errors('give-notices');
175 175
 	}
176 176
 
177 177
 
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 	 * @return void
183 183
 	 */
184 184
 	function dismiss_notices() {
185
-		if ( isset( $_GET['give_notice'] ) ) {
186
-			update_user_meta( get_current_user_id(), '_give_' . $_GET['give_notice'] . '_dismissed', 1 );
187
-			wp_redirect( remove_query_arg( array( 'give_action', 'give_notice' ) ) );
185
+		if (isset($_GET['give_notice'])) {
186
+			update_user_meta(get_current_user_id(), '_give_'.$_GET['give_notice'].'_dismissed', 1);
187
+			wp_redirect(remove_query_arg(array('give_action', 'give_notice')));
188 188
 			exit;
189 189
 		}
190 190
 	}
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 3 patches
Doc Comments   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,7 +81,6 @@  discard block
 block discarded – undo
81 81
 	 * @since  1.1
82 82
 	 *
83 83
 	 * @param array  $item        Contains all the data of the keys
84
-	 * @param string $column_name The name of the column
85 84
 	 *
86 85
 	 * @return string Column Name
87 86
 	 */
@@ -96,7 +95,6 @@  discard block
 block discarded – undo
96 95
 	 * @since  1.1
97 96
 	 *
98 97
 	 * @param array  $item        Contains all the data of the keys
99
-	 * @param string $column_name The name of the column
100 98
 	 *
101 99
 	 * @return string Column Name
102 100
 	 */
@@ -111,7 +109,6 @@  discard block
 block discarded – undo
111 109
 	 * @since  1.1
112 110
 	 *
113 111
 	 * @param array  $item        Contains all the data of the keys
114
-	 * @param string $column_name The name of the column
115 112
 	 *
116 113
 	 * @return string Column Name
117 114
 	 */
@@ -124,7 +121,7 @@  discard block
 block discarded – undo
124 121
 	 *
125 122
 	 * @access public
126 123
 	 * @since  1.1
127
-	 * @return void
124
+	 * @return string
128 125
 	 */
129 126
 	public function column_user( $item ) {
130 127
 
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136 136
 				esc_url( add_query_arg( array( 'view'      => 'api_requests',
137
-				                               'post_type' => 'give_forms',
138
-				                               'page'      => 'give-reports',
139
-				                               'tab'       => 'logs',
140
-				                               's'         => $item['email']
137
+											   'post_type' => 'give_forms',
138
+											   'page'      => 'give-reports',
139
+											   'tab'       => 'logs',
140
+											   's'         => $item['email']
141 141
 				), 'edit.php' ) ),
142 142
 				__( 'View API Log', 'give' )
143 143
 			);
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
 		$actions['reissue'] = sprintf(
147 147
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
148 148
 			esc_url( wp_nonce_url( add_query_arg( array( 'user_id'          => $item['id'],
149
-			                                             'give_action'      => 'process_api_key',
150
-			                                             'give_api_process' => 'regenerate'
149
+														 'give_action'      => 'process_api_key',
150
+														 'give_api_process' => 'regenerate'
151 151
 			) ), 'give-api-nonce' ) ),
152 152
 			__( 'Reissue', 'give' )
153 153
 		);
154 154
 		$actions['revoke']  = sprintf(
155 155
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
156 156
 			esc_url( wp_nonce_url( add_query_arg( array( 'user_id'          => $item['id'],
157
-			                                             'give_action'      => 'process_api_key',
158
-			                                             'give_api_process' => 'revoke'
157
+														 'give_action'      => 'process_api_key',
158
+														 'give_api_process' => 'revoke'
159 159
 			) ), 'give-api-nonce' ) ),
160 160
 			__( 'Revoke', 'give' )
161 161
 		);
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 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
 /**
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => __( 'API Key', 'give' ),     // Singular name of the listed records
55
-			'plural'   => __( 'API Keys', 'give' ),    // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => __('API Key', 'give'), // Singular name of the listed records
55
+			'plural'   => __('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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,43 +126,43 @@  discard block
 block discarded – undo
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( 'view'      => 'api_requests',
136
+				esc_url(add_query_arg(array('view'      => 'api_requests',
137 137
 				                               'post_type' => 'give_forms',
138 138
 				                               'page'      => 'give-reports',
139 139
 				                               'tab'       => 'logs',
140 140
 				                               's'         => $item['email']
141
-				), 'edit.php' ) ),
142
-				__( 'View API Log', 'give' )
141
+				), 'edit.php')),
142
+				__('View API Log', 'give')
143 143
 			);
144 144
 		}
145 145
 
146 146
 		$actions['reissue'] = sprintf(
147 147
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
148
-			esc_url( wp_nonce_url( add_query_arg( array( 'user_id'          => $item['id'],
148
+			esc_url(wp_nonce_url(add_query_arg(array('user_id'          => $item['id'],
149 149
 			                                             'give_action'      => 'process_api_key',
150 150
 			                                             'give_api_process' => 'regenerate'
151
-			) ), 'give-api-nonce' ) ),
152
-			__( 'Reissue', 'give' )
151
+			)), 'give-api-nonce')),
152
+			__('Reissue', 'give')
153 153
 		);
154
-		$actions['revoke']  = sprintf(
154
+		$actions['revoke'] = sprintf(
155 155
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
156
-			esc_url( wp_nonce_url( add_query_arg( array( 'user_id'          => $item['id'],
156
+			esc_url(wp_nonce_url(add_query_arg(array('user_id'          => $item['id'],
157 157
 			                                             'give_action'      => 'process_api_key',
158 158
 			                                             'give_api_process' => 'revoke'
159
-			) ), 'give-api-nonce' ) ),
160
-			__( 'Revoke', 'give' )
159
+			)), 'give-api-nonce')),
160
+			__('Revoke', 'give')
161 161
 		);
162 162
 
163
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
163
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
164 164
 
165
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
165
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
166 166
 	}
167 167
 
168 168
 	/**
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function get_columns() {
176 176
 		$columns = array(
177
-			'user'   => __( 'Username', 'give' ),
178
-			'key'    => __( 'Public Key', 'give' ),
179
-			'token'  => __( 'Token', 'give' ),
180
-			'secret' => __( 'Secret Key', 'give' )
177
+			'user'   => __('Username', 'give'),
178
+			'key'    => __('Public Key', 'give'),
179
+			'token'  => __('Token', 'give'),
180
+			'secret' => __('Secret Key', 'give')
181 181
 		);
182 182
 
183 183
 		return $columns;
@@ -190,20 +190,20 @@  discard block
 block discarded – undo
190 190
 	 * @since  1.1
191 191
 	 * @return void
192 192
 	 */
193
-	function bulk_actions( $which = '' ) {
193
+	function bulk_actions($which = '') {
194 194
 		// These aren't really bulk actions but this outputs the markup in the right place
195 195
 		static $give_api_is_bottom;
196 196
 
197
-		if ( $give_api_is_bottom ) {
197
+		if ($give_api_is_bottom) {
198 198
 			return;
199 199
 		}
200 200
 		?>
201
-		<form method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=api' ); ?>">
201
+		<form method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-settings&tab=api'); ?>">
202 202
 			<input type="hidden" name="give_action" value="process_api_key" />
203 203
 			<input type="hidden" name="give_api_process" value="generate" />
204
-			<?php wp_nonce_field( 'give-api-nonce' ); ?>
204
+			<?php wp_nonce_field('give-api-nonce'); ?>
205 205
 			<?php echo Give()->html->ajax_user_search(); ?>
206
-			<?php submit_button( __( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
206
+			<?php submit_button(__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?>
207 207
 		</form>
208 208
 		<?php
209 209
 		$give_api_is_bottom = true;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @return int Current page number
218 218
 	 */
219 219
 	public function get_paged() {
220
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
220
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
221 221
 	}
222 222
 
223 223
 	/**
@@ -228,21 +228,21 @@  discard block
 block discarded – undo
228 228
 	 * @return void
229 229
 	 */
230 230
 	public function query() {
231
-		$users = get_users( array(
231
+		$users = get_users(array(
232 232
 			'meta_value' => 'give_user_secret_key',
233 233
 			'number'     => $this->per_page,
234
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 )
235
-		) );
236
-		$keys  = array();
237
-
238
-		foreach ( $users as $user ) {
239
-			$keys[ $user->ID ]['id']    = $user->ID;
240
-			$keys[ $user->ID ]['email'] = $user->user_email;
241
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
242
-
243
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
244
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
245
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
234
+			'offset'     => $this->per_page * ($this->get_paged() - 1)
235
+		));
236
+		$keys = array();
237
+
238
+		foreach ($users as $user) {
239
+			$keys[$user->ID]['id']    = $user->ID;
240
+			$keys[$user->ID]['email'] = $user->user_email;
241
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
242
+
243
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
244
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
245
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
246 246
 		}
247 247
 
248 248
 		return $keys;
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	public function total_items() {
260 260
 		global $wpdb;
261 261
 
262
-		if ( ! get_transient( 'give_total_api_keys' ) ) {
263
-			$total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'" );
262
+		if ( ! get_transient('give_total_api_keys')) {
263
+			$total_items = $wpdb->get_var("SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'");
264 264
 
265
-			set_transient( 'give_total_api_keys', $total_items, 60 * 60 );
265
+			set_transient('give_total_api_keys', $total_items, 60 * 60);
266 266
 		}
267 267
 
268
-		return get_transient( 'give_total_api_keys' );
268
+		return get_transient('give_total_api_keys');
269 269
 	}
270 270
 
271 271
 	/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		$hidden   = array(); // No hidden columns
282 282
 		$sortable = array(); // Not sortable... for now
283 283
 
284
-		$this->_column_headers = array( $columns, $hidden, $sortable, 'id' );
284
+		$this->_column_headers = array($columns, $hidden, $sortable, 'id');
285 285
 
286 286
 		$data = $this->query();
287 287
 
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 
290 290
 		$this->items = $data;
291 291
 
292
-		$this->set_pagination_args( array(
292
+		$this->set_pagination_args(array(
293 293
 				'total_items' => $total_items,
294 294
 				'per_page'    => $this->per_page,
295
-				'total_pages' => ceil( $total_items / $this->per_page )
295
+				'total_pages' => ceil($total_items / $this->per_page)
296 296
 			)
297 297
 		);
298 298
 	}
Please login to merge, or discard this patch.
includes/admin/EDD_SL_Plugin_Updater.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
      * @uses api_request()
68 68
      *
69 69
      * @param array   $_transient_data Update array build by WordPress.
70
-     * @return array Modified update array with custom plugin data.
70
+     * @return stdClass Modified update array with custom plugin data.
71 71
      */
72 72
     function check_update( $_transient_data ) {
73 73
 
Please login to merge, or discard this patch.
Indentation   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -13,328 +13,328 @@
 block discarded – undo
13 13
  * @version 1.6
14 14
  */
15 15
 class EDD_SL_Plugin_Updater {
16
-    private $api_url   = '';
17
-    private $api_data  = array();
18
-    private $name      = '';
19
-    private $slug      = '';
20
-
21
-    /**
22
-     * Class constructor.
23
-     *
24
-     * @uses plugin_basename()
25
-     * @uses hook()
26
-     *
27
-     * @param string  $_api_url     The URL pointing to the custom API endpoint.
28
-     * @param string  $_plugin_file Path to the plugin file.
29
-     * @param array   $_api_data    Optional data to send with API calls.
30
-     * @return void
31
-     */
32
-    function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
33
-        $this->api_url  = trailingslashit( $_api_url );
34
-        $this->api_data = $_api_data;
35
-        $this->name     = plugin_basename( $_plugin_file );
36
-        $this->slug     = basename( $_plugin_file, '.php' );
37
-        $this->version  = $_api_data['version'];
38
-
39
-        // Set up hooks.
40
-        $this->init();
41
-        add_action( 'admin_init', array( $this, 'show_changelog' ) );
42
-    }
43
-
44
-    /**
45
-     * Set up WordPress filters to hook into WP's update process.
46
-     *
47
-     * @uses add_filter()
48
-     *
49
-     * @return void
50
-     */
51
-    public function init() {
16
+	private $api_url   = '';
17
+	private $api_data  = array();
18
+	private $name      = '';
19
+	private $slug      = '';
20
+
21
+	/**
22
+	 * Class constructor.
23
+	 *
24
+	 * @uses plugin_basename()
25
+	 * @uses hook()
26
+	 *
27
+	 * @param string  $_api_url     The URL pointing to the custom API endpoint.
28
+	 * @param string  $_plugin_file Path to the plugin file.
29
+	 * @param array   $_api_data    Optional data to send with API calls.
30
+	 * @return void
31
+	 */
32
+	function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
33
+		$this->api_url  = trailingslashit( $_api_url );
34
+		$this->api_data = $_api_data;
35
+		$this->name     = plugin_basename( $_plugin_file );
36
+		$this->slug     = basename( $_plugin_file, '.php' );
37
+		$this->version  = $_api_data['version'];
38
+
39
+		// Set up hooks.
40
+		$this->init();
41
+		add_action( 'admin_init', array( $this, 'show_changelog' ) );
42
+	}
43
+
44
+	/**
45
+	 * Set up WordPress filters to hook into WP's update process.
46
+	 *
47
+	 * @uses add_filter()
48
+	 *
49
+	 * @return void
50
+	 */
51
+	public function init() {
52 52
 
53
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
54
-        add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
53
+		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
54
+		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
55 55
 
56
-        add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
57
-    }
56
+		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
57
+	}
58 58
 
59
-    /**
60
-     * Check for Updates at the defined API endpoint and modify the update array.
61
-     *
62
-     * This function dives into the update API just when WordPress creates its update array,
63
-     * then adds a custom API call and injects the custom plugin data retrieved from the API.
64
-     * It is reassembled from parts of the native WordPress plugin update code.
65
-     * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
66
-     *
67
-     * @uses api_request()
68
-     *
69
-     * @param array   $_transient_data Update array build by WordPress.
70
-     * @return array Modified update array with custom plugin data.
71
-     */
72
-    function check_update( $_transient_data ) {
59
+	/**
60
+	 * Check for Updates at the defined API endpoint and modify the update array.
61
+	 *
62
+	 * This function dives into the update API just when WordPress creates its update array,
63
+	 * then adds a custom API call and injects the custom plugin data retrieved from the API.
64
+	 * It is reassembled from parts of the native WordPress plugin update code.
65
+	 * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
66
+	 *
67
+	 * @uses api_request()
68
+	 *
69
+	 * @param array   $_transient_data Update array build by WordPress.
70
+	 * @return array Modified update array with custom plugin data.
71
+	 */
72
+	function check_update( $_transient_data ) {
73 73
 
74
-        global $pagenow;
74
+		global $pagenow;
75 75
 
76
-        if( ! is_object( $_transient_data ) ) {
77
-            $_transient_data = new stdClass;
78
-        }
76
+		if( ! is_object( $_transient_data ) ) {
77
+			$_transient_data = new stdClass;
78
+		}
79 79
 
80
-        if( 'plugins.php' == $pagenow && is_multisite() ) {
81
-            return $_transient_data;
82
-        }
80
+		if( 'plugins.php' == $pagenow && is_multisite() ) {
81
+			return $_transient_data;
82
+		}
83 83
 
84
-        if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
84
+		if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
85 85
 
86
-            $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
86
+			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
87 87
 
88
-            if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
88
+			if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
89 89
 
90
-                $this->did_check = true;
90
+				$this->did_check = true;
91 91
 
92
-                if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
92
+				if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
93 93
 
94
-                    $_transient_data->response[ $this->name ] = $version_info;
94
+					$_transient_data->response[ $this->name ] = $version_info;
95 95
 
96
-                }
96
+				}
97 97
 
98
-                $_transient_data->last_checked = time();
99
-                $_transient_data->checked[ $this->name ] = $this->version;
98
+				$_transient_data->last_checked = time();
99
+				$_transient_data->checked[ $this->name ] = $this->version;
100 100
 
101
-            }
101
+			}
102 102
 
103
-        }
103
+		}
104 104
 
105
-        return $_transient_data;
106
-    }
105
+		return $_transient_data;
106
+	}
107 107
 
108
-    /**
109
-     * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
110
-     *
111
-     * @param string  $file
112
-     * @param array   $plugin
113
-     */
114
-    public function show_update_notification( $file, $plugin ) {
108
+	/**
109
+	 * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
110
+	 *
111
+	 * @param string  $file
112
+	 * @param array   $plugin
113
+	 */
114
+	public function show_update_notification( $file, $plugin ) {
115 115
 
116
-        if( ! current_user_can( 'update_plugins' ) ) {
117
-            return;
118
-        }
116
+		if( ! current_user_can( 'update_plugins' ) ) {
117
+			return;
118
+		}
119 119
 
120
-        if( ! is_multisite() ) {
121
-            return;
122
-        }
120
+		if( ! is_multisite() ) {
121
+			return;
122
+		}
123 123
 
124
-        if ( $this->name != $file ) {
125
-            return;
126
-        }
124
+		if ( $this->name != $file ) {
125
+			return;
126
+		}
127 127
 
128
-        // Remove our filter on the site transient
129
-        remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
128
+		// Remove our filter on the site transient
129
+		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
130 130
 
131
-        $update_cache = get_site_transient( 'update_plugins' );
131
+		$update_cache = get_site_transient( 'update_plugins' );
132 132
 
133
-        if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
133
+		if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
134 134
 
135
-            $cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
136
-            $version_info = get_transient( $cache_key );
135
+			$cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
136
+			$version_info = get_transient( $cache_key );
137 137
 
138
-            if( false === $version_info ) {
138
+			if( false === $version_info ) {
139 139
 
140
-                $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
140
+				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
141 141
 
142
-                set_transient( $cache_key, $version_info, 3600 );
143
-            }
142
+				set_transient( $cache_key, $version_info, 3600 );
143
+			}
144 144
 
145 145
 
146
-            if( ! is_object( $version_info ) ) {
147
-                return;
148
-            }
146
+			if( ! is_object( $version_info ) ) {
147
+				return;
148
+			}
149 149
 
150
-            if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
150
+			if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
151 151
 
152
-                $update_cache->response[ $this->name ] = $version_info;
152
+				$update_cache->response[ $this->name ] = $version_info;
153 153
 
154
-            }
154
+			}
155 155
 
156
-            $update_cache->last_checked = time();
157
-            $update_cache->checked[ $this->name ] = $this->version;
156
+			$update_cache->last_checked = time();
157
+			$update_cache->checked[ $this->name ] = $this->version;
158 158
 
159
-            set_site_transient( 'update_plugins', $update_cache );
159
+			set_site_transient( 'update_plugins', $update_cache );
160 160
 
161
-        } else {
161
+		} else {
162 162
 
163
-            $version_info = $update_cache->response[ $this->name ];
163
+			$version_info = $update_cache->response[ $this->name ];
164 164
 
165
-        }
165
+		}
166 166
 
167
-        // Restore our filter
168
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
167
+		// Restore our filter
168
+		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
169 169
 
170
-        if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
170
+		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
171 171
 
172
-            // build a plugin list row, with update notification
173
-            $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
174
-            echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
172
+			// build a plugin list row, with update notification
173
+			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
174
+			echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
175 175
 
176
-            $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
176
+			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
177 177
 
178
-            if ( empty( $version_info->download_link ) ) {
179
-                printf(
180
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
181
-                    esc_html( $version_info->name ),
182
-                    esc_url( $changelog_link ),
183
-                    esc_html( $version_info->new_version )
184
-                );
185
-            } else {
186
-                printf(
187
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
188
-                    esc_html( $version_info->name ),
189
-                    esc_url( $changelog_link ),
190
-                    esc_html( $version_info->new_version ),
191
-                    esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
192
-                );
193
-            }
178
+			if ( empty( $version_info->download_link ) ) {
179
+				printf(
180
+					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
181
+					esc_html( $version_info->name ),
182
+					esc_url( $changelog_link ),
183
+					esc_html( $version_info->new_version )
184
+				);
185
+			} else {
186
+				printf(
187
+					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
188
+					esc_html( $version_info->name ),
189
+					esc_url( $changelog_link ),
190
+					esc_html( $version_info->new_version ),
191
+					esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
192
+				);
193
+			}
194 194
 
195
-            echo '</div></td></tr>';
196
-        }
197
-    }
195
+			echo '</div></td></tr>';
196
+		}
197
+	}
198 198
 
199 199
 
200
-    /**
201
-     * Updates information on the "View version x.x details" page with custom data.
202
-     *
203
-     * @uses api_request()
204
-     *
205
-     * @param mixed   $_data
206
-     * @param string  $_action
207
-     * @param object  $_args
208
-     * @return object $_data
209
-     */
210
-    function plugins_api_filter( $_data, $_action = '', $_args = null ) {
200
+	/**
201
+	 * Updates information on the "View version x.x details" page with custom data.
202
+	 *
203
+	 * @uses api_request()
204
+	 *
205
+	 * @param mixed   $_data
206
+	 * @param string  $_action
207
+	 * @param object  $_args
208
+	 * @return object $_data
209
+	 */
210
+	function plugins_api_filter( $_data, $_action = '', $_args = null ) {
211 211
 
212 212
 
213
-        if ( $_action != 'plugin_information' ) {
213
+		if ( $_action != 'plugin_information' ) {
214 214
 
215
-            return $_data;
215
+			return $_data;
216 216
 
217
-        }
217
+		}
218 218
 
219
-        if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
219
+		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
220 220
 
221
-            return $_data;
221
+			return $_data;
222 222
 
223
-        }
223
+		}
224 224
 
225
-        $to_send = array(
226
-            'slug'   => $this->slug,
227
-            'is_ssl' => is_ssl(),
228
-            'fields' => array(
229
-                'banners' => false, // These will be supported soon hopefully
230
-                'reviews' => false
231
-            )
232
-        );
225
+		$to_send = array(
226
+			'slug'   => $this->slug,
227
+			'is_ssl' => is_ssl(),
228
+			'fields' => array(
229
+				'banners' => false, // These will be supported soon hopefully
230
+				'reviews' => false
231
+			)
232
+		);
233 233
 
234
-        $api_response = $this->api_request( 'plugin_information', $to_send );
234
+		$api_response = $this->api_request( 'plugin_information', $to_send );
235 235
 
236
-        if ( false !== $api_response ) {
237
-            $_data = $api_response;
238
-        }
236
+		if ( false !== $api_response ) {
237
+			$_data = $api_response;
238
+		}
239 239
 
240
-        return $_data;
241
-    }
240
+		return $_data;
241
+	}
242 242
 
243 243
 
244
-    /**
245
-     * Disable SSL verification in order to prevent download update failures
246
-     *
247
-     * @param array   $args
248
-     * @param string  $url
249
-     * @return object $array
250
-     */
251
-    function http_request_args( $args, $url ) {
252
-        // If it is an https request and we are performing a package download, disable ssl verification
253
-        if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
254
-            $args['sslverify'] = false;
255
-        }
256
-        return $args;
257
-    }
244
+	/**
245
+	 * Disable SSL verification in order to prevent download update failures
246
+	 *
247
+	 * @param array   $args
248
+	 * @param string  $url
249
+	 * @return object $array
250
+	 */
251
+	function http_request_args( $args, $url ) {
252
+		// If it is an https request and we are performing a package download, disable ssl verification
253
+		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
254
+			$args['sslverify'] = false;
255
+		}
256
+		return $args;
257
+	}
258 258
 
259
-    /**
260
-     * Calls the API and, if successfull, returns the object delivered by the API.
261
-     *
262
-     * @uses get_bloginfo()
263
-     * @uses wp_remote_post()
264
-     * @uses is_wp_error()
265
-     *
266
-     * @param string  $_action The requested action.
267
-     * @param array   $_data   Parameters for the API action.
268
-     * @return false||object
269
-     */
270
-    private function api_request( $_action, $_data ) {
271
-
272
-        global $wp_version;
273
-
274
-        $data = array_merge( $this->api_data, $_data );
275
-
276
-        if ( $data['slug'] != $this->slug )
277
-            return;
278
-
279
-        if ( empty( $data['license'] ) )
280
-            return;
281
-
282
-        if( $this->api_url == home_url() ) {
283
-            return false; // Don't allow a plugin to ping itself
284
-        }
285
-
286
-        $api_params = array(
287
-            'edd_action' => 'get_version',
288
-            'license'    => $data['license'],
289
-            'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
290
-            'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
291
-            'slug'       => $data['slug'],
292
-            'author'     => $data['author'],
293
-            'url'        => home_url()
294
-        );
259
+	/**
260
+	 * Calls the API and, if successfull, returns the object delivered by the API.
261
+	 *
262
+	 * @uses get_bloginfo()
263
+	 * @uses wp_remote_post()
264
+	 * @uses is_wp_error()
265
+	 *
266
+	 * @param string  $_action The requested action.
267
+	 * @param array   $_data   Parameters for the API action.
268
+	 * @return false||object
269
+	 */
270
+	private function api_request( $_action, $_data ) {
271
+
272
+		global $wp_version;
273
+
274
+		$data = array_merge( $this->api_data, $_data );
275
+
276
+		if ( $data['slug'] != $this->slug )
277
+			return;
278
+
279
+		if ( empty( $data['license'] ) )
280
+			return;
281
+
282
+		if( $this->api_url == home_url() ) {
283
+			return false; // Don't allow a plugin to ping itself
284
+		}
285
+
286
+		$api_params = array(
287
+			'edd_action' => 'get_version',
288
+			'license'    => $data['license'],
289
+			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
290
+			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
291
+			'slug'       => $data['slug'],
292
+			'author'     => $data['author'],
293
+			'url'        => home_url()
294
+		);
295 295
 
296
-        $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
296
+		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
297 297
 
298
-        if ( ! is_wp_error( $request ) ) {
299
-            $request = json_decode( wp_remote_retrieve_body( $request ) );
300
-        }
298
+		if ( ! is_wp_error( $request ) ) {
299
+			$request = json_decode( wp_remote_retrieve_body( $request ) );
300
+		}
301 301
 
302
-        if ( $request && isset( $request->sections ) ) {
303
-            $request->sections = maybe_unserialize( $request->sections );
304
-        } else {
305
-            $request = false;
306
-        }
302
+		if ( $request && isset( $request->sections ) ) {
303
+			$request->sections = maybe_unserialize( $request->sections );
304
+		} else {
305
+			$request = false;
306
+		}
307 307
 
308
-        return $request;
309
-    }
308
+		return $request;
309
+	}
310 310
 
311
-    public function show_changelog() {
311
+	public function show_changelog() {
312 312
 
313 313
 
314
-        if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
315
-            return;
316
-        }
314
+		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
315
+			return;
316
+		}
317 317
 
318
-        if( empty( $_REQUEST['plugin'] ) ) {
319
-            return;
320
-        }
321
-
322
-        if( empty( $_REQUEST['slug'] ) ) {
323
-            return;
324
-        }
325
-
326
-        if( ! current_user_can( 'update_plugins' ) ) {
327
-            wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
328
-        }
329
-
330
-        $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
331
-
332
-        if( $response && isset( $response->sections['changelog'] ) ) {
333
-            echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
334
-        }
335
-
336
-
337
-        exit;
338
-    }
318
+		if( empty( $_REQUEST['plugin'] ) ) {
319
+			return;
320
+		}
321
+
322
+		if( empty( $_REQUEST['slug'] ) ) {
323
+			return;
324
+		}
325
+
326
+		if( ! current_user_can( 'update_plugins' ) ) {
327
+			wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
328
+		}
329
+
330
+		$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
331
+
332
+		if( $response && isset( $response->sections['changelog'] ) ) {
333
+			echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
334
+		}
335
+
336
+
337
+		exit;
338
+	}
339 339
 
340 340
 }
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 //set_site_transient( 'update_plugins', null );
5 5
 
6 6
 // Exit if accessed directly
7
-if ( ! defined( 'ABSPATH' ) ) exit;
7
+if ( ! defined('ABSPATH')) exit;
8 8
 
9 9
 /**
10 10
  * Allows plugins to use their own update API.
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
      * @param array   $_api_data    Optional data to send with API calls.
30 30
      * @return void
31 31
      */
32
-    function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
33
-        $this->api_url  = trailingslashit( $_api_url );
32
+    function __construct($_api_url, $_plugin_file, $_api_data = null) {
33
+        $this->api_url  = trailingslashit($_api_url);
34 34
         $this->api_data = $_api_data;
35
-        $this->name     = plugin_basename( $_plugin_file );
36
-        $this->slug     = basename( $_plugin_file, '.php' );
35
+        $this->name     = plugin_basename($_plugin_file);
36
+        $this->slug     = basename($_plugin_file, '.php');
37 37
         $this->version  = $_api_data['version'];
38 38
 
39 39
         // Set up hooks.
40 40
         $this->init();
41
-        add_action( 'admin_init', array( $this, 'show_changelog' ) );
41
+        add_action('admin_init', array($this, 'show_changelog'));
42 42
     }
43 43
 
44 44
     /**
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function init() {
52 52
 
53
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
54
-        add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
53
+        add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
54
+        add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
55 55
 
56
-        add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
56
+        add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
57 57
     }
58 58
 
59 59
     /**
@@ -69,34 +69,34 @@  discard block
 block discarded – undo
69 69
      * @param array   $_transient_data Update array build by WordPress.
70 70
      * @return array Modified update array with custom plugin data.
71 71
      */
72
-    function check_update( $_transient_data ) {
72
+    function check_update($_transient_data) {
73 73
 
74 74
         global $pagenow;
75 75
 
76
-        if( ! is_object( $_transient_data ) ) {
76
+        if ( ! is_object($_transient_data)) {
77 77
             $_transient_data = new stdClass;
78 78
         }
79 79
 
80
-        if( 'plugins.php' == $pagenow && is_multisite() ) {
80
+        if ('plugins.php' == $pagenow && is_multisite()) {
81 81
             return $_transient_data;
82 82
         }
83 83
 
84
-        if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
84
+        if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) {
85 85
 
86
-            $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
86
+            $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
87 87
 
88
-            if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
88
+            if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
89 89
 
90 90
                 $this->did_check = true;
91 91
 
92
-                if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
92
+                if (version_compare($this->version, $version_info->new_version, '<')) {
93 93
 
94
-                    $_transient_data->response[ $this->name ] = $version_info;
94
+                    $_transient_data->response[$this->name] = $version_info;
95 95
 
96 96
                 }
97 97
 
98 98
                 $_transient_data->last_checked = time();
99
-                $_transient_data->checked[ $this->name ] = $this->version;
99
+                $_transient_data->checked[$this->name] = $this->version;
100 100
 
101 101
             }
102 102
 
@@ -111,84 +111,84 @@  discard block
 block discarded – undo
111 111
      * @param string  $file
112 112
      * @param array   $plugin
113 113
      */
114
-    public function show_update_notification( $file, $plugin ) {
114
+    public function show_update_notification($file, $plugin) {
115 115
 
116
-        if( ! current_user_can( 'update_plugins' ) ) {
116
+        if ( ! current_user_can('update_plugins')) {
117 117
             return;
118 118
         }
119 119
 
120
-        if( ! is_multisite() ) {
120
+        if ( ! is_multisite()) {
121 121
             return;
122 122
         }
123 123
 
124
-        if ( $this->name != $file ) {
124
+        if ($this->name != $file) {
125 125
             return;
126 126
         }
127 127
 
128 128
         // Remove our filter on the site transient
129
-        remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
129
+        remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
130 130
 
131
-        $update_cache = get_site_transient( 'update_plugins' );
131
+        $update_cache = get_site_transient('update_plugins');
132 132
 
133
-        if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
133
+        if ( ! is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) {
134 134
 
135
-            $cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
136
-            $version_info = get_transient( $cache_key );
135
+            $cache_key    = md5('edd_plugin_'.sanitize_key($this->name).'_version_info');
136
+            $version_info = get_transient($cache_key);
137 137
 
138
-            if( false === $version_info ) {
138
+            if (false === $version_info) {
139 139
 
140
-                $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
140
+                $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
141 141
 
142
-                set_transient( $cache_key, $version_info, 3600 );
142
+                set_transient($cache_key, $version_info, 3600);
143 143
             }
144 144
 
145 145
 
146
-            if( ! is_object( $version_info ) ) {
146
+            if ( ! is_object($version_info)) {
147 147
                 return;
148 148
             }
149 149
 
150
-            if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
150
+            if (version_compare($this->version, $version_info->new_version, '<')) {
151 151
 
152
-                $update_cache->response[ $this->name ] = $version_info;
152
+                $update_cache->response[$this->name] = $version_info;
153 153
 
154 154
             }
155 155
 
156 156
             $update_cache->last_checked = time();
157
-            $update_cache->checked[ $this->name ] = $this->version;
157
+            $update_cache->checked[$this->name] = $this->version;
158 158
 
159
-            set_site_transient( 'update_plugins', $update_cache );
159
+            set_site_transient('update_plugins', $update_cache);
160 160
 
161 161
         } else {
162 162
 
163
-            $version_info = $update_cache->response[ $this->name ];
163
+            $version_info = $update_cache->response[$this->name];
164 164
 
165 165
         }
166 166
 
167 167
         // Restore our filter
168
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
168
+        add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
169 169
 
170
-        if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
170
+        if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
171 171
 
172 172
             // build a plugin list row, with update notification
173
-            $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
174
-            echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
173
+            $wp_list_table = _get_list_table('WP_Plugins_List_Table');
174
+            echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
175 175
 
176
-            $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
176
+            $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
177 177
 
178
-            if ( empty( $version_info->download_link ) ) {
178
+            if (empty($version_info->download_link)) {
179 179
                 printf(
180
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
181
-                    esc_html( $version_info->name ),
182
-                    esc_url( $changelog_link ),
183
-                    esc_html( $version_info->new_version )
180
+                    __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd'),
181
+                    esc_html($version_info->name),
182
+                    esc_url($changelog_link),
183
+                    esc_html($version_info->new_version)
184 184
                 );
185 185
             } else {
186 186
                 printf(
187
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
188
-                    esc_html( $version_info->name ),
189
-                    esc_url( $changelog_link ),
190
-                    esc_html( $version_info->new_version ),
191
-                    esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
187
+                    __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd'),
188
+                    esc_html($version_info->name),
189
+                    esc_url($changelog_link),
190
+                    esc_html($version_info->new_version),
191
+                    esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name))
192 192
                 );
193 193
             }
194 194
 
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
      * @param object  $_args
208 208
      * @return object $_data
209 209
      */
210
-    function plugins_api_filter( $_data, $_action = '', $_args = null ) {
210
+    function plugins_api_filter($_data, $_action = '', $_args = null) {
211 211
 
212 212
 
213
-        if ( $_action != 'plugin_information' ) {
213
+        if ($_action != 'plugin_information') {
214 214
 
215 215
             return $_data;
216 216
 
217 217
         }
218 218
 
219
-        if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
219
+        if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
220 220
 
221 221
             return $_data;
222 222
 
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
             )
232 232
         );
233 233
 
234
-        $api_response = $this->api_request( 'plugin_information', $to_send );
234
+        $api_response = $this->api_request('plugin_information', $to_send);
235 235
 
236
-        if ( false !== $api_response ) {
236
+        if (false !== $api_response) {
237 237
             $_data = $api_response;
238 238
         }
239 239
 
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
      * @param string  $url
249 249
      * @return object $array
250 250
      */
251
-    function http_request_args( $args, $url ) {
251
+    function http_request_args($args, $url) {
252 252
         // If it is an https request and we are performing a package download, disable ssl verification
253
-        if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
253
+        if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
254 254
             $args['sslverify'] = false;
255 255
         }
256 256
         return $args;
@@ -267,40 +267,40 @@  discard block
 block discarded – undo
267 267
      * @param array   $_data   Parameters for the API action.
268 268
      * @return false||object
269 269
      */
270
-    private function api_request( $_action, $_data ) {
270
+    private function api_request($_action, $_data) {
271 271
 
272 272
         global $wp_version;
273 273
 
274
-        $data = array_merge( $this->api_data, $_data );
274
+        $data = array_merge($this->api_data, $_data);
275 275
 
276
-        if ( $data['slug'] != $this->slug )
276
+        if ($data['slug'] != $this->slug)
277 277
             return;
278 278
 
279
-        if ( empty( $data['license'] ) )
279
+        if (empty($data['license']))
280 280
             return;
281 281
 
282
-        if( $this->api_url == home_url() ) {
282
+        if ($this->api_url == home_url()) {
283 283
             return false; // Don't allow a plugin to ping itself
284 284
         }
285 285
 
286 286
         $api_params = array(
287 287
             'edd_action' => 'get_version',
288 288
             'license'    => $data['license'],
289
-            'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
290
-            'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
289
+            'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
290
+            'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
291 291
             'slug'       => $data['slug'],
292 292
             'author'     => $data['author'],
293 293
             'url'        => home_url()
294 294
         );
295 295
 
296
-        $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
296
+        $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
297 297
 
298
-        if ( ! is_wp_error( $request ) ) {
299
-            $request = json_decode( wp_remote_retrieve_body( $request ) );
298
+        if ( ! is_wp_error($request)) {
299
+            $request = json_decode(wp_remote_retrieve_body($request));
300 300
         }
301 301
 
302
-        if ( $request && isset( $request->sections ) ) {
303
-            $request->sections = maybe_unserialize( $request->sections );
302
+        if ($request && isset($request->sections)) {
303
+            $request->sections = maybe_unserialize($request->sections);
304 304
         } else {
305 305
             $request = false;
306 306
         }
@@ -311,26 +311,26 @@  discard block
 block discarded – undo
311 311
     public function show_changelog() {
312 312
 
313 313
 
314
-        if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
314
+        if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
315 315
             return;
316 316
         }
317 317
 
318
-        if( empty( $_REQUEST['plugin'] ) ) {
318
+        if (empty($_REQUEST['plugin'])) {
319 319
             return;
320 320
         }
321 321
 
322
-        if( empty( $_REQUEST['slug'] ) ) {
322
+        if (empty($_REQUEST['slug'])) {
323 323
             return;
324 324
         }
325 325
 
326
-        if( ! current_user_can( 'update_plugins' ) ) {
327
-            wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
326
+        if ( ! current_user_can('update_plugins')) {
327
+            wp_die(__('You do not have permission to install plugin updates', 'edd'), __('Error', 'edd'), array('response' => 403));
328 328
         }
329 329
 
330
-        $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
330
+        $response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug']));
331 331
 
332
-        if( $response && isset( $response->sections['changelog'] ) ) {
333
-            echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
332
+        if ($response && isset($response->sections['changelog'])) {
333
+            echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>';
334 334
         }
335 335
 
336 336
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@  discard block
 block discarded – undo
4 4
 //set_site_transient( 'update_plugins', null );
5 5
 
6 6
 // Exit if accessed directly
7
-if ( ! defined( 'ABSPATH' ) ) exit;
7
+if ( ! defined( 'ABSPATH' ) ) {
8
+	exit;
9
+}
8 10
 
9 11
 /**
10 12
  * Allows plugins to use their own update API.
@@ -273,11 +275,13 @@  discard block
 block discarded – undo
273 275
 
274 276
         $data = array_merge( $this->api_data, $_data );
275 277
 
276
-        if ( $data['slug'] != $this->slug )
277
-            return;
278
+        if ( $data['slug'] != $this->slug ) {
279
+                    return;
280
+        }
278 281
 
279
-        if ( empty( $data['license'] ) )
280
-            return;
282
+        if ( empty( $data['license'] ) ) {
283
+                    return;
284
+        }
281 285
 
282 286
         if( $this->api_url == home_url() ) {
283 287
             return false; // Don't allow a plugin to ping itself
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -321,7 +321,7 @@
 block discarded – undo
321 321
  *
322 322
  * @param int $post_id Download (Post) ID
323 323
  *
324
- * @return void
324
+ * @return null|integer
325 325
  */
326 326
 function give_price_save_quick_edit( $post_id ) {
327 327
 	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 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
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	//Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => __( 'Name', 'give' ),
36
-		'form_category' => __( 'Categories', 'give' ),
37
-		'form_tag'      => __( 'Tags', 'give' ),
38
-		'price'         => __( 'Price', 'give' ),
39
-		'goal'          => __( 'Goal', 'give' ),
40
-		'donations'     => __( 'Donations', 'give' ),
41
-		'earnings'      => __( 'Income', 'give' ),
42
-		'shortcode'     => __( 'Shortcode', 'give' ),
43
-		'date'          => __( 'Date', 'give' )
35
+		'title'         => __('Name', 'give'),
36
+		'form_category' => __('Categories', 'give'),
37
+		'form_tag'      => __('Tags', 'give'),
38
+		'price'         => __('Price', 'give'),
39
+		'goal'          => __('Goal', 'give'),
40
+		'donations'     => __('Donations', 'give'),
41
+		'earnings'      => __('Income', 'give'),
42
+		'shortcode'     => __('Shortcode', 'give'),
43
+		'date'          => __('Date', 'give')
44 44
 	);
45 45
 
46 46
 	//Does the user want categories / tags?
47
-	if ( give_get_option( 'enable_categories' ) !== 'on' ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if (give_get_option('enable_categories') !== 'on') {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( give_get_option( 'enable_tags' ) !== 'on' ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if (give_get_option('enable_tags') !== 'on') {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,67 +66,67 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 		global $give_options;
72 72
 
73
-		$style = isset( $give_options['button_style'] ) ? $give_options['button_style'] : 'button';
74
-		$color = isset( $give_options['checkout_color'] ) ? $give_options['checkout_color'] : 'blue';
75
-		$color = ( $color == 'inherit' ) ? '' : $color;
73
+		$style = isset($give_options['button_style']) ? $give_options['button_style'] : 'button';
74
+		$color = isset($give_options['checkout_color']) ? $give_options['checkout_color'] : 'blue';
75
+		$color = ($color == 'inherit') ? '' : $color;
76 76
 
77
-		$purchase_text = ! empty( $give_options['add_to_cart_text'] ) ? $give_options['add_to_cart_text'] : __( 'Purchase', 'give' );
77
+		$purchase_text = ! empty($give_options['add_to_cart_text']) ? $give_options['add_to_cart_text'] : __('Purchase', 'give');
78 78
 
79
-		switch ( $column_name ) {
79
+		switch ($column_name) {
80 80
 			case 'form_category':
81
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
81
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
82 82
 				break;
83 83
 			case 'form_tag':
84
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
84
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
85 85
 				break;
86 86
 			case 'price':
87
-				if ( give_has_variable_prices( $post_id ) ) {
88
-					echo give_price_range( $post_id );
87
+				if (give_has_variable_prices($post_id)) {
88
+					echo give_price_range($post_id);
89 89
 				} else {
90
-					echo give_price( $post_id, false );
91
-					echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />';
90
+					echo give_price($post_id, false);
91
+					echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />';
92 92
 				}
93 93
 				break;
94 94
 			case 'goal':
95
-				$goal_option = get_post_meta( $post_id, '_give_goal_option', true );
96
-				if ( ! empty( $goal_option ) && $goal_option === 'yes' ) {
97
-					echo give_goal( $post_id, false );
95
+				$goal_option = get_post_meta($post_id, '_give_goal_option', true);
96
+				if ( ! empty($goal_option) && $goal_option === 'yes') {
97
+					echo give_goal($post_id, false);
98 98
 				} else {
99
-					echo __( 'No Goal Set', 'give' );
99
+					echo __('No Goal Set', 'give');
100 100
 				}
101 101
 
102
-				echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />';
102
+				echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />';
103 103
 				break;
104 104
 			case 'donations':
105
-				if ( current_user_can( 'view_give_forms_stats', $post_id ) ) {
106
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form=' . $post_id ) ) . '">';
107
-					echo give_get_form_sales_stats( $post_id );
105
+				if (current_user_can('view_give_forms_stats', $post_id)) {
106
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form='.$post_id)).'">';
107
+					echo give_get_form_sales_stats($post_id);
108 108
 					echo '</a>';
109 109
 				} else {
110 110
 					echo '-';
111 111
 				}
112 112
 				break;
113 113
 			case 'earnings':
114
-				if ( current_user_can( 'view_give_forms_stats', $post_id ) ) {
115
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $post_id ) ) . '">';
116
-					echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) );
114
+				if (current_user_can('view_give_forms_stats', $post_id)) {
115
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$post_id)).'">';
116
+					echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id)));
117 117
 					echo '</a>';
118 118
 				} else {
119 119
 					echo '-';
120 120
 				}
121 121
 				break;
122 122
 			case 'shortcode':
123
-				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;' . absint( $post_id ) . '&#34;]">';
123
+				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;'.absint($post_id).'&#34;]">';
124 124
 				break;
125 125
 		}
126 126
 	}
127 127
 }
128 128
 
129
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
129
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
130 130
 
131 131
 /**
132 132
  * Registers the sortable columns in the list table
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
  *
138 138
  * @return array $columns Array of sortable columns
139 139
  */
140
-function give_sortable_form_columns( $columns ) {
140
+function give_sortable_form_columns($columns) {
141 141
 	$columns['price']    = 'price';
142 142
 	$columns['sales']    = 'sales';
143 143
 	$columns['earnings'] = 'earnings';
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	return $columns;
147 147
 }
148 148
 
149
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
149
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
150 150
 
151 151
 /**
152 152
  * Sorts Columns in the Forms List Table
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
  *
158 158
  * @return array $vars Array of all the sort variables
159 159
  */
160
-function give_sort_forms( $vars ) {
160
+function give_sort_forms($vars) {
161 161
 	// Check if we're viewing the "give_forms" post type
162
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
162
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
163 163
 		// Check if 'orderby' is set to "sales"
164
-		if ( isset( $vars['orderby'] ) && 'sales' == $vars['orderby'] ) {
164
+		if (isset($vars['orderby']) && 'sales' == $vars['orderby']) {
165 165
 			$vars = array_merge(
166 166
 				$vars,
167 167
 				array(
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 		}
173 173
 
174 174
 		// Check if "orderby" is set to "earnings"
175
-		if ( isset( $vars['orderby'] ) && 'earnings' == $vars['orderby'] ) {
175
+		if (isset($vars['orderby']) && 'earnings' == $vars['orderby']) {
176 176
 			$vars = array_merge(
177 177
 				$vars,
178 178
 				array(
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		}
184 184
 
185 185
 		// Check if "orderby" is set to "price"
186
-		if ( isset( $vars['orderby'] ) && 'price' == $vars['orderby'] ) {
186
+		if (isset($vars['orderby']) && 'price' == $vars['orderby']) {
187 187
 			$vars = array_merge(
188 188
 				$vars,
189 189
 				array(
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 
196 196
 		// Check if "orderby" is set to "goal"
197
-		if ( isset( $vars['orderby'] ) && 'goal' == $vars['orderby'] ) {
197
+		if (isset($vars['orderby']) && 'goal' == $vars['orderby']) {
198 198
 			$vars = array_merge(
199 199
 				$vars,
200 200
 				array(
@@ -217,16 +217,16 @@  discard block
 block discarded – undo
217 217
  *
218 218
  * @return array       Array of all sort variables
219 219
  */
220
-function give_filter_forms( $vars ) {
221
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
220
+function give_filter_forms($vars) {
221
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
222 222
 
223 223
 		// If an author ID was passed, use it
224
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
224
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
225 225
 
226 226
 			$author_id = $_REQUEST['author'];
227
-			if ( (int) $author_id !== get_current_user_id() ) {
227
+			if ((int) $author_id !== get_current_user_id()) {
228 228
 				// Tried to view the products of another person, sorry
229
-				wp_die( __( 'You do not have permission to view this data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
229
+				wp_die(__('You do not have permission to view this data.', 'give'), __('Error', 'give'), array('response' => 403));
230 230
 			}
231 231
 			$vars = array_merge(
232 232
 				$vars,
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
  * @return void
252 252
  */
253 253
 function give_forms_load() {
254
-	add_filter( 'request', 'give_sort_forms' );
255
-	add_filter( 'request', 'give_filter_forms' );
254
+	add_filter('request', 'give_sort_forms');
255
+	add_filter('request', 'give_filter_forms');
256 256
 }
257 257
 
258
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
258
+add_action('load-edit.php', 'give_forms_load', 9999);
259 259
 
260 260
 /**
261 261
  * Remove Forms Month Filter
@@ -269,17 +269,17 @@  discard block
 block discarded – undo
269 269
  * @global      $typenow The post type we are viewing
270 270
  * @return array Empty array disables the dropdown
271 271
  */
272
-function give_remove_month_filter( $dates ) {
272
+function give_remove_month_filter($dates) {
273 273
 	global $typenow;
274 274
 
275
-	if ( $typenow == 'give_forms' ) {
275
+	if ($typenow == 'give_forms') {
276 276
 		$dates = array();
277 277
 	}
278 278
 
279 279
 	return $dates;
280 280
 }
281 281
 
282
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
282
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
283 283
 
284 284
 /**
285 285
  * Adds price field to Quick Edit options
@@ -291,16 +291,16 @@  discard block
 block discarded – undo
291 291
  *
292 292
  * @return void
293 293
  */
294
-function give_price_field_quick_edit( $column_name, $post_type ) {
295
-	if ( $column_name != 'price' || $post_type != 'give_forms' ) {
294
+function give_price_field_quick_edit($column_name, $post_type) {
295
+	if ($column_name != 'price' || $post_type != 'give_forms') {
296 296
 		return;
297 297
 	}
298 298
 	?>
299 299
 	<fieldset class="inline-edit-col-left">
300 300
 		<div id="give-give-data" class="inline-edit-col">
301
-			<h4><?php echo sprintf( __( '%s Configuration', 'give' ), give_get_forms_label_singular() ); ?></h4>
301
+			<h4><?php echo sprintf(__('%s Configuration', 'give'), give_get_forms_label_singular()); ?></h4>
302 302
 			<label>
303
-				<span class="title"><?php _e( 'Price', 'give' ); ?></span>
303
+				<span class="title"><?php _e('Price', 'give'); ?></span>
304 304
 				<span class="input-text-wrap">
305 305
 					<input type="text" name="_give_regprice" class="text regprice" />
306 306
 				</span>
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 	<?php
312 312
 }
313 313
 
314
-add_action( 'quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2 );
315
-add_action( 'bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2 );
314
+add_action('quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2);
315
+add_action('bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2);
316 316
 
317 317
 /**
318 318
  * Updates price when saving post
@@ -323,23 +323,23 @@  discard block
 block discarded – undo
323 323
  *
324 324
  * @return void
325 325
  */
326
-function give_price_save_quick_edit( $post_id ) {
327
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
326
+function give_price_save_quick_edit($post_id) {
327
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
328 328
 		return;
329 329
 	}
330
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
330
+	if ( ! current_user_can('edit_post', $post_id)) {
331 331
 		return $post_id;
332 332
 	}
333
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
333
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
334 334
 		return $post_id;
335 335
 	}
336 336
 
337
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
338
-		update_post_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) );
337
+	if (isset($_REQUEST['_give_regprice'])) {
338
+		update_post_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice'])));
339 339
 	}
340 340
 }
341 341
 
342
-add_action( 'save_post', 'give_price_save_quick_edit' );
342
+add_action('save_post', 'give_price_save_quick_edit');
343 343
 
344 344
 /**
345 345
  * Process bulk edit actions via AJAX
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
  */
350 350
 function give_save_bulk_edit() {
351 351
 
352
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
352
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
353 353
 
354
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
355
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
356
-		foreach ( $post_ids as $post_id ) {
354
+	if ( ! empty($post_ids) && is_array($post_ids)) {
355
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
356
+		foreach ($post_ids as $post_id) {
357 357
 
358
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
358
+			if ( ! current_user_can('edit_post', $post_id)) {
359 359
 				continue;
360 360
 			}
361 361
 
362
-			if ( ! empty( $price ) ) {
363
-				update_post_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) );
362
+			if ( ! empty($price)) {
363
+				update_post_meta($post_id, '_give_set_price', give_sanitize_amount($price));
364 364
 			}
365 365
 		}
366 366
 	}
@@ -368,4 +368,4 @@  discard block
 block discarded – undo
368 368
 	die();
369 369
 }
370 370
 
371
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
371
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -297,7 +297,6 @@
 block discarded – undo
297 297
  *
298 298
  * @since 1.0
299 299
  *
300
- * @param array $data Arguments passed
301 300
  *
302 301
  * @return void
303 302
  */
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 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
 
@@ -26,109 +26,109 @@  discard block
 block discarded – undo
26 26
  * @return      void
27 27
  *
28 28
  */
29
-function give_update_payment_details( $data ) {
29
+function give_update_payment_details($data) {
30 30
 
31
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
32
-		wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
31
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
32
+		wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
33 33
 	}
34 34
 
35
-	check_admin_referer( 'give_update_payment_details_nonce' );
35
+	check_admin_referer('give_update_payment_details_nonce');
36 36
 
37 37
 	// Retrieve the payment ID
38
-	$payment_id = absint( $data['give_payment_id'] );
38
+	$payment_id = absint($data['give_payment_id']);
39 39
 
40 40
 	// Retrieve existing payment meta
41
-	$meta      = give_get_payment_meta( $payment_id );
42
-	$user_info = give_get_payment_meta_user_info( $payment_id );
41
+	$meta      = give_get_payment_meta($payment_id);
42
+	$user_info = give_get_payment_meta_user_info($payment_id);
43 43
 
44 44
 	$status  = $data['give-payment-status'];
45
-	$user_id = isset( $data['give-payment-user-id'] ) ? intval( $data['give-payment-user-id'] ) : '';
46
-	$date    = sanitize_text_field( $data['give-payment-date'] );
47
-	$hour    = sanitize_text_field( $data['give-payment-time-hour'] );
45
+	$user_id = isset($data['give-payment-user-id']) ? intval($data['give-payment-user-id']) : '';
46
+	$date    = sanitize_text_field($data['give-payment-date']);
47
+	$hour    = sanitize_text_field($data['give-payment-time-hour']);
48 48
 	$form_id = give_get_payment_form_id($payment_id);
49 49
 
50 50
 	// Restrict to our high and low
51
-	if ( $hour > 23 ) {
51
+	if ($hour > 23) {
52 52
 		$hour = 23;
53
-	} elseif ( $hour < 0 ) {
53
+	} elseif ($hour < 0) {
54 54
 		$hour = 00;
55 55
 	}
56 56
 
57
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
57
+	$minute = sanitize_text_field($data['give-payment-time-min']);
58 58
 
59 59
 	// Restrict to our high and low
60
-	if ( $minute > 59 ) {
60
+	if ($minute > 59) {
61 61
 		$minute = 59;
62
-	} elseif ( $minute < 0 ) {
62
+	} elseif ($minute < 0) {
63 63
 		$minute = 00;
64 64
 	}
65 65
 
66
-	$address          = array_map( 'trim', $data['give-payment-address'][0] );
67
-	$date             = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
68
-	$curr_total       = give_sanitize_amount( give_get_payment_amount( $payment_id ) );
69
-	$new_total        = give_sanitize_amount( $_POST['give-payment-total'] );
70
-	$curr_customer_id = sanitize_text_field( $data['give-current-customer'] );
71
-	$new_customer_id  = sanitize_text_field( $data['customer-id'] );
66
+	$address          = array_map('trim', $data['give-payment-address'][0]);
67
+	$date             = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
68
+	$curr_total       = give_sanitize_amount(give_get_payment_amount($payment_id));
69
+	$new_total        = give_sanitize_amount($_POST['give-payment-total']);
70
+	$curr_customer_id = sanitize_text_field($data['give-current-customer']);
71
+	$new_customer_id  = sanitize_text_field($data['customer-id']);
72 72
 
73
-	do_action( 'give_update_edited_purchase', $payment_id );
73
+	do_action('give_update_edited_purchase', $payment_id);
74 74
 
75 75
 	// Update main payment record
76
-	$updated = wp_update_post( array(
76
+	$updated = wp_update_post(array(
77 77
 		'ID'        => $payment_id,
78 78
 		'edit_date' => true,
79 79
 		'post_date' => $date
80
-	) );
80
+	));
81 81
 
82
-	if ( 0 === $updated ) {
83
-		wp_die( esc_attr__( 'Error Updating Payment', 'give' ), esc_attr__( 'Error', 'give' ), array( 'response' => 400 ) );
82
+	if (0 === $updated) {
83
+		wp_die(esc_attr__('Error Updating Payment', 'give'), esc_attr__('Error', 'give'), array('response' => 400));
84 84
 	}
85 85
 
86 86
 	$customer_changed = false;
87 87
 
88
-	if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) {
88
+	if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') {
89 89
 
90
-		$email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : '';
91
-		$names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : '';
90
+		$email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : '';
91
+		$names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : '';
92 92
 
93
-		if ( empty( $email ) || empty( $names ) ) {
94
-			wp_die( esc_attr__( 'New Customers require a name and email address', 'give' ) );
93
+		if (empty($email) || empty($names)) {
94
+			wp_die(esc_attr__('New Customers require a name and email address', 'give'));
95 95
 		}
96 96
 
97
-		$customer = new Give_Customer( $email );
98
-		if ( empty( $customer->id ) ) {
99
-			$customer_data = array( 'name' => $names, 'email' => $email );
100
-			$user_id       = email_exists( $email );
101
-			if ( false !== $user_id ) {
97
+		$customer = new Give_Customer($email);
98
+		if (empty($customer->id)) {
99
+			$customer_data = array('name' => $names, 'email' => $email);
100
+			$user_id       = email_exists($email);
101
+			if (false !== $user_id) {
102 102
 				$customer_data['user_id'] = $user_id;
103 103
 			}
104 104
 
105
-			if ( ! $customer->create( $customer_data ) ) {
105
+			if ( ! $customer->create($customer_data)) {
106 106
 				// Failed to crete the new donor, assume the previous donor
107 107
 				$customer_changed = false;
108
-				$customer         = new Give_Customer( $curr_customer_id );
109
-				give_set_error( 'give-payment-new-customer-fail', __( 'Error creating new donor', 'give' ) );
108
+				$customer         = new Give_Customer($curr_customer_id);
109
+				give_set_error('give-payment-new-customer-fail', __('Error creating new donor', 'give'));
110 110
 			}
111 111
 		}
112 112
 
113 113
 		$new_customer_id = $customer->id;
114 114
 
115
-		$previous_customer = new Give_Customer( $curr_customer_id );
115
+		$previous_customer = new Give_Customer($curr_customer_id);
116 116
 
117 117
 		$customer_changed = true;
118 118
 
119
-	} elseif ( $curr_customer_id !== $new_customer_id ) {
119
+	} elseif ($curr_customer_id !== $new_customer_id) {
120 120
 
121
-		$customer = new Give_Customer( $new_customer_id );
121
+		$customer = new Give_Customer($new_customer_id);
122 122
 		$email    = $customer->email;
123 123
 		$names    = $customer->name;
124 124
 
125
-		$previous_customer = new Give_Customer( $curr_customer_id );
125
+		$previous_customer = new Give_Customer($curr_customer_id);
126 126
 
127 127
 		$customer_changed = true;
128 128
 
129 129
 	} else {
130 130
 
131
-		$customer = new Give_Customer( $curr_customer_id );
131
+		$customer = new Give_Customer($curr_customer_id);
132 132
 		$email    = $customer->email;
133 133
 		$names    = $customer->name;
134 134
 
@@ -136,32 +136,32 @@  discard block
 block discarded – undo
136 136
 
137 137
 
138 138
 	// Setup first and last name from input values
139
-	$names      = explode( ' ', $names );
140
-	$first_name = ! empty( $names[0] ) ? $names[0] : '';
139
+	$names      = explode(' ', $names);
140
+	$first_name = ! empty($names[0]) ? $names[0] : '';
141 141
 	$last_name  = '';
142
-	if ( ! empty( $names[1] ) ) {
143
-		unset( $names[0] );
144
-		$last_name = implode( ' ', $names );
142
+	if ( ! empty($names[1])) {
143
+		unset($names[0]);
144
+		$last_name = implode(' ', $names);
145 145
 	}
146 146
 
147 147
 
148
-	if ( $customer_changed ) {
148
+	if ($customer_changed) {
149 149
 
150 150
 		// Remove the stats and payment from the previous customer and attach it to the new customer
151
-		$previous_customer->remove_payment( $payment_id, false );
152
-		$customer->attach_payment( $payment_id, false );
151
+		$previous_customer->remove_payment($payment_id, false);
152
+		$customer->attach_payment($payment_id, false);
153 153
 
154 154
 		// If purchase was completed and not ever refunded, adjust stats of customers
155
-		if ( 'revoked' == $status || 'publish' == $status ) {
155
+		if ('revoked' == $status || 'publish' == $status) {
156 156
 
157 157
 			$previous_customer->decrease_purchase_count();
158
-			$previous_customer->decrease_value( $new_total );
158
+			$previous_customer->decrease_value($new_total);
159 159
 
160 160
 			$customer->increase_purchase_count();
161
-			$customer->increase_value( $new_total );
161
+			$customer->increase_value($new_total);
162 162
 		}
163 163
 
164
-		update_post_meta( $payment_id, '_give_payment_customer_id', $customer->id );
164
+		update_post_meta($payment_id, '_give_payment_customer_id', $customer->id);
165 165
 
166 166
 	}
167 167
 
@@ -176,47 +176,47 @@  discard block
 block discarded – undo
176 176
 
177 177
 
178 178
 	// Check for payment notes
179
-	if ( ! empty( $data['give-payment-note'] ) ) {
179
+	if ( ! empty($data['give-payment-note'])) {
180 180
 
181
-		$note = wp_kses( $data['give-payment-note'], array() );
182
-		give_insert_payment_note( $payment_id, $note );
181
+		$note = wp_kses($data['give-payment-note'], array());
182
+		give_insert_payment_note($payment_id, $note);
183 183
 
184 184
 	}
185 185
 
186 186
 	// Set new status
187
-	give_update_payment_status( $payment_id, $status );
187
+	give_update_payment_status($payment_id, $status);
188 188
 
189
-	give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
190
-	give_update_payment_meta( $payment_id, '_give_payment_user_email', $customer->email );
191
-	give_update_payment_meta( $payment_id, '_give_payment_meta', $meta );
192
-	give_update_payment_meta( $payment_id, '_give_payment_total', $new_total );
189
+	give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id);
190
+	give_update_payment_meta($payment_id, '_give_payment_user_email', $customer->email);
191
+	give_update_payment_meta($payment_id, '_give_payment_meta', $meta);
192
+	give_update_payment_meta($payment_id, '_give_payment_total', $new_total);
193 193
 
194 194
 	// Adjust total store earnings if the payment total has been changed
195
-	if ( $new_total !== $curr_total && ( 'publish' == $status || 'revoked' == $status ) ) {
195
+	if ($new_total !== $curr_total && ('publish' == $status || 'revoked' == $status)) {
196 196
 
197
-		if ( $new_total > $curr_total ) {
197
+		if ($new_total > $curr_total) {
198 198
 			// Increase if our new total is higher
199 199
 			$difference = $new_total - $curr_total;
200
-			give_increase_total_earnings( $difference );
201
-			$form = new Give_Donate_Form( $form_id );
202
-			$form->increase_earnings( $difference );
203
-		} elseif ( $curr_total > $new_total ) {
200
+			give_increase_total_earnings($difference);
201
+			$form = new Give_Donate_Form($form_id);
202
+			$form->increase_earnings($difference);
203
+		} elseif ($curr_total > $new_total) {
204 204
 			// Decrease if our new total is lower
205 205
 			$difference = $curr_total - $new_total;
206
-			give_decrease_total_earnings( $difference );
207
-			$form = new Give_Donate_Form( $form_id );
208
-			$form->decrease_earnings( $difference );
206
+			give_decrease_total_earnings($difference);
207
+			$form = new Give_Donate_Form($form_id);
208
+			$form->decrease_earnings($difference);
209 209
 		}
210 210
 
211 211
 	}
212 212
 
213
-	do_action( 'give_updated_edited_purchase', $payment_id );
213
+	do_action('give_updated_edited_purchase', $payment_id);
214 214
 
215
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) );
215
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id));
216 216
 	exit;
217 217
 }
218 218
 
219
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
219
+add_action('give_update_payment_details', 'give_update_payment_details');
220 220
 
221 221
 /**
222 222
  * Trigger a Purchase Deletion
@@ -227,45 +227,45 @@  discard block
 block discarded – undo
227 227
  *
228 228
  * @return void
229 229
  */
230
-function give_trigger_purchase_delete( $data ) {
231
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_payment_nonce' ) ) {
230
+function give_trigger_purchase_delete($data) {
231
+	if (wp_verify_nonce($data['_wpnonce'], 'give_payment_nonce')) {
232 232
 
233
-		$payment_id = absint( $data['purchase_id'] );
233
+		$payment_id = absint($data['purchase_id']);
234 234
 
235
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
236
-			wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
235
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
236
+			wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
237 237
 		}
238 238
 
239
-		give_delete_purchase( $payment_id );
240
-		wp_redirect( admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted' ) );
239
+		give_delete_purchase($payment_id);
240
+		wp_redirect(admin_url('/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted'));
241 241
 		give_die();
242 242
 	}
243 243
 }
244 244
 
245
-add_action( 'give_delete_payment', 'give_trigger_purchase_delete' );
245
+add_action('give_delete_payment', 'give_trigger_purchase_delete');
246 246
 
247 247
 function give_ajax_store_payment_note() {
248 248
 
249
-	$payment_id = absint( $_POST['payment_id'] );
250
-	$note       = wp_kses( $_POST['note'], array() );
249
+	$payment_id = absint($_POST['payment_id']);
250
+	$note       = wp_kses($_POST['note'], array());
251 251
 
252
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
253
-		wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
252
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
253
+		wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
254 254
 	}
255 255
 
256
-	if ( empty( $payment_id ) ) {
257
-		die( '-1' );
256
+	if (empty($payment_id)) {
257
+		die('-1');
258 258
 	}
259 259
 
260
-	if ( empty( $note ) ) {
261
-		die( '-1' );
260
+	if (empty($note)) {
261
+		die('-1');
262 262
 	}
263 263
 
264
-	$note_id = give_insert_payment_note( $payment_id, $note );
265
-	die( give_get_payment_note_html( $note_id ) );
264
+	$note_id = give_insert_payment_note($payment_id, $note);
265
+	die(give_get_payment_note_html($note_id));
266 266
 }
267 267
 
268
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
268
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
269 269
 
270 270
 /**
271 271
  * Triggers a payment note deletion without ajax
@@ -276,24 +276,24 @@  discard block
 block discarded – undo
276 276
  *
277 277
  * @return void
278 278
  */
279
-function give_trigger_payment_note_deletion( $data ) {
279
+function give_trigger_payment_note_deletion($data) {
280 280
 
281
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
281
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
282 282
 		return;
283 283
 	}
284 284
 
285
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
286
-		wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
285
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
286
+		wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
287 287
 	}
288 288
 
289
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id=' . absint( $data['payment_id'] ) );
289
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id='.absint($data['payment_id']));
290 290
 
291
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
291
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
292 292
 
293
-	wp_redirect( $edit_order_url );
293
+	wp_redirect($edit_order_url);
294 294
 }
295 295
 
296
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
296
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
297 297
 
298 298
 /**
299 299
  * Delete a payment note deletion with ajax
@@ -306,16 +306,16 @@  discard block
 block discarded – undo
306 306
  */
307 307
 function give_ajax_delete_payment_note() {
308 308
 
309
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
310
-		wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
309
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
310
+		wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
311 311
 	}
312 312
 
313
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
314
-		die( '1' );
313
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
314
+		die('1');
315 315
 	} else {
316
-		die( '-1' );
316
+		die('-1');
317 317
 	}
318 318
 
319 319
 }
320 320
 
321
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
322 321
\ No newline at end of file
322
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
323 323
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -279,7 +279,6 @@
 block discarded – undo
279 279
 	 * @access public
280 280
 	 * @since  1.0
281 281
 	 *
282
-	 * @param array  $item        Contains all the data of the discount code
283 282
 	 * @param string $column_name The name of the column
284 283
 	 *
285 284
 	 * @return string Column Name
Please login to merge, or discard this patch.
Spacing   +165 added lines, -165 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
 /**
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
 		global $status, $page;
121 121
 
122 122
 		// Set parent defaults
123
-		parent::__construct( array(
124
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
125
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
123
+		parent::__construct(array(
124
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
125
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
126 126
 			'ajax'     => false                        // Does this table support ajax?
127
-		) );
127
+		));
128 128
 
129 129
 		$this->get_payment_counts();
130 130
 		$this->process_bulk_action();
131
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
131
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
132 132
 	}
133 133
 
134 134
 	public function advanced_filters() {
135
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
136
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
137
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
135
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
136
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
137
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
138 138
 		?>
139 139
 		<div id="give-payment-filters">
140 140
 			<span id="give-payment-date-filters">
141
-				<label for="start-date" class="give-start-date-label"><?php _e( 'Start Date:', 'give' ); ?></label>
141
+				<label for="start-date" class="give-start-date-label"><?php _e('Start Date:', 'give'); ?></label>
142 142
 				<input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" />
143
-				<label for="end-date" class="give-end-date-label"><?php _e( 'End Date:', 'give' ); ?></label>
143
+				<label for="end-date" class="give-end-date-label"><?php _e('End Date:', 'give'); ?></label>
144 144
 				<input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" />
145
-				<input type="submit" class="button-secondary" value="<?php _e( 'Apply', 'give' ); ?>" />
145
+				<input type="submit" class="button-secondary" value="<?php _e('Apply', 'give'); ?>" />
146 146
 			</span>
147
-			<?php if ( ! empty( $status ) ) : ?>
148
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" />
147
+			<?php if ( ! empty($status)) : ?>
148
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" />
149 149
 			<?php endif; ?>
150
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
151
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php _e( 'Clear Filter', 'give' ); ?></a>
150
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
151
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php _e('Clear Filter', 'give'); ?></a>
152 152
 			<?php endif; ?>
153
-			<?php $this->search_box( __( 'Search', 'give' ), 'give-payments' ); ?>
153
+			<?php $this->search_box(__('Search', 'give'), 'give-payments'); ?>
154 154
 		</div>
155 155
 
156 156
 		<?php
@@ -167,25 +167,25 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return void
169 169
 	 */
170
-	public function search_box( $text, $input_id ) {
171
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
170
+	public function search_box($text, $input_id) {
171
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
172 172
 			return;
173 173
 		}
174 174
 
175
-		$input_id = $input_id . '-search-input';
175
+		$input_id = $input_id.'-search-input';
176 176
 
177
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
178
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
177
+		if ( ! empty($_REQUEST['orderby'])) {
178
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
179 179
 		}
180
-		if ( ! empty( $_REQUEST['order'] ) ) {
181
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
180
+		if ( ! empty($_REQUEST['order'])) {
181
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
182 182
 		}
183 183
 		?>
184 184
 		<p class="search-box">
185
-			<?php do_action( 'give_payment_history_search' ); ?>
185
+			<?php do_action('give_payment_history_search'); ?>
186 186
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
187 187
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
188
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br />
188
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br />
189 189
 		</p>
190 190
 		<?php
191 191
 	}
@@ -199,52 +199,52 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function get_views() {
201 201
 
202
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
203
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
204
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
205
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
206
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
207
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
208
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
209
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
210
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
202
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
203
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
204
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
205
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
206
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
207
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
208
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
209
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
210
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
211 211
 
212 212
 		$views = array(
213
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
213
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
214 214
 				'status',
215 215
 				'paged'
216
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', __( 'All', 'give' ) . $total_count ),
217
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
216
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', __('All', 'give').$total_count),
217
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
218 218
 				'status' => 'publish',
219 219
 				'paged'  => false
220
-			) ) ), $current === 'publish' ? ' class="current"' : '', __( 'Completed', 'give' ) . $complete_count ),
221
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
220
+			))), $current === 'publish' ? ' class="current"' : '', __('Completed', 'give').$complete_count),
221
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
222 222
 				'status' => 'pending',
223 223
 				'paged'  => false
224
-			) ) ), $current === 'pending' ? ' class="current"' : '', __( 'Pending', 'give' ) . $pending_count ),
225
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
224
+			))), $current === 'pending' ? ' class="current"' : '', __('Pending', 'give').$pending_count),
225
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
226 226
 				'status' => 'refunded',
227 227
 				'paged'  => false
228
-			) ) ), $current === 'refunded' ? ' class="current"' : '', __( 'Refunded', 'give' ) . $refunded_count ),
229
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
228
+			))), $current === 'refunded' ? ' class="current"' : '', __('Refunded', 'give').$refunded_count),
229
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
230 230
 				'status' => 'revoked',
231 231
 				'paged'  => false
232
-			) ) ), $current === 'revoked' ? ' class="current"' : '', __( 'Revoked', 'give' ) . $revoked_count ),
233
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
232
+			))), $current === 'revoked' ? ' class="current"' : '', __('Revoked', 'give').$revoked_count),
233
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
234 234
 				'status' => 'failed',
235 235
 				'paged'  => false
236
-			) ) ), $current === 'failed' ? ' class="current"' : '', __( 'Failed', 'give' ) . $failed_count ),
237
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
236
+			))), $current === 'failed' ? ' class="current"' : '', __('Failed', 'give').$failed_count),
237
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
238 238
 				'status' => 'cancelled',
239 239
 				'paged'  => false
240
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', __( 'Cancelled', 'give' ) . $cancelled_count ),
241
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
240
+			))), $current === 'cancelled' ? ' class="current"' : '', __('Cancelled', 'give').$cancelled_count),
241
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
242 242
 				'status' => 'abandoned',
243 243
 				'paged'  => false
244
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', __( 'Abandoned', 'give' ) . $abandoned_count )
244
+			))), $current === 'abandoned' ? ' class="current"' : '', __('Abandoned', 'give').$abandoned_count)
245 245
 		);
246 246
 
247
-		return apply_filters( 'give_payments_table_views', $views );
247
+		return apply_filters('give_payments_table_views', $views);
248 248
 	}
249 249
 
250 250
 	/**
@@ -257,16 +257,16 @@  discard block
 block discarded – undo
257 257
 	public function get_columns() {
258 258
 		$columns = array(
259 259
 			'cb'      => '<input type="checkbox" />', //Render a checkbox instead of text
260
-			'email'   => __( 'Email', 'give' ),
261
-			'details' => __( 'Details', 'give' ),
262
-			'amount'  => __( 'Amount', 'give' ),
263
-			'status'  => __( 'Status', 'give' ),
264
-			'date'    => __( 'Date', 'give' ),
265
-			'donor'   => __( 'Donor', 'give' ),
266
-			'ID'      => __( 'ID', 'give' ),
260
+			'email'   => __('Email', 'give'),
261
+			'details' => __('Details', 'give'),
262
+			'amount'  => __('Amount', 'give'),
263
+			'status'  => __('Status', 'give'),
264
+			'date'    => __('Date', 'give'),
265
+			'donor'   => __('Donor', 'give'),
266
+			'ID'      => __('ID', 'give'),
267 267
 		);
268 268
 
269
-		return apply_filters( 'give_payments_table_columns', $columns );
269
+		return apply_filters('give_payments_table_columns', $columns);
270 270
 	}
271 271
 
272 272
 	/**
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function get_sortable_columns() {
280 280
 		$columns = array(
281
-			'ID'     => array( 'ID', true ),
282
-			'amount' => array( 'amount', false ),
283
-			'date'   => array( 'date', false )
281
+			'ID'     => array('ID', true),
282
+			'amount' => array('amount', false),
283
+			'date'   => array('date', false)
284 284
 		);
285 285
 
286
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
286
+		return apply_filters('give_payments_table_sortable_columns', $columns);
287 287
 	}
288 288
 
289 289
 	/**
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 	 *
298 298
 	 * @return string Column Name
299 299
 	 */
300
-	public function column_default( $payment, $column_name ) {
301
-		switch ( $column_name ) {
300
+	public function column_default($payment, $column_name) {
301
+		switch ($column_name) {
302 302
 			case 'amount' :
303
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
304
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
303
+				$amount = ! empty($payment->total) ? $payment->total : 0;
304
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
305 305
 				break;
306 306
 			case 'date' :
307
-				$date  = strtotime( $payment->date );
308
-				$value = date_i18n( get_option( 'date_format' ), $date );
307
+				$date  = strtotime($payment->date);
308
+				$value = date_i18n(get_option('date_format'), $date);
309 309
 				break;
310 310
 			case 'status' :
311
-				$payment = get_post( $payment->ID );
312
-				$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>';
311
+				$payment = get_post($payment->ID);
312
+				$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>';
313 313
 				break;
314 314
 			case 'details' :
315
-				$value = '<div class="give-payment-details-link-wrap"><a href="' . esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ) . '" class="give-payment-details-link button button-small">' . __( 'View Donation Details', 'give' ) . '</a></div>';
315
+				$value = '<div class="give-payment-details-link-wrap"><a href="'.esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))).'" class="give-payment-details-link button button-small">'.__('View Donation Details', 'give').'</a></div>';
316 316
 				break;
317 317
 			default:
318
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
318
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
319 319
 				break;
320 320
 
321 321
 		}
322 322
 
323
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
323
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
324 324
 	}
325 325
 
326 326
 	/**
@@ -333,32 +333,32 @@  discard block
 block discarded – undo
333 333
 	 *
334 334
 	 * @return string Data shown in the Email column
335 335
 	 */
336
-	public function column_email( $payment ) {
336
+	public function column_email($payment) {
337 337
 
338 338
 		$row_actions = array();
339 339
 
340
-		if ( give_is_payment_complete( $payment->ID ) ) {
341
-			$row_actions['email_links'] = '<a href="' . add_query_arg( array(
340
+		if (give_is_payment_complete($payment->ID)) {
341
+			$row_actions['email_links'] = '<a href="'.add_query_arg(array(
342 342
 					'give-action' => 'email_links',
343 343
 					'purchase_id' => $payment->ID
344
-				), $this->base_url ) . '">' . __( 'Resend Donation Receipt', 'give' ) . '</a>';
344
+				), $this->base_url).'">'.__('Resend Donation Receipt', 'give').'</a>';
345 345
 
346 346
 		}
347 347
 
348
-		$row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array(
348
+		$row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array(
349 349
 				'give-action' => 'delete_payment',
350 350
 				'purchase_id' => $payment->ID
351
-			), $this->base_url ), 'give_payment_nonce' ) . '">' . __( 'Delete', 'give' ) . '</a>';
351
+			), $this->base_url), 'give_payment_nonce').'">'.__('Delete', 'give').'</a>';
352 352
 
353
-		$row_actions = apply_filters( 'give_payment_row_actions', $row_actions, $payment );
353
+		$row_actions = apply_filters('give_payment_row_actions', $row_actions, $payment);
354 354
 
355
-		if ( ! isset( $payment->user_info['email'] ) ) {
356
-			$payment->user_info['email'] = __( '(unknown)', 'give' );
355
+		if ( ! isset($payment->user_info['email'])) {
356
+			$payment->user_info['email'] = __('(unknown)', 'give');
357 357
 		}
358 358
 
359
-		$value = '<span class="give-email-column-value">' . $payment->user_info['email'] . '</span>' . $this->row_actions( $row_actions );
359
+		$value = '<span class="give-email-column-value">'.$payment->user_info['email'].'</span>'.$this->row_actions($row_actions);
360 360
 
361
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
361
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
362 362
 	}
363 363
 
364 364
 	/**
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return string Displays a checkbox
373 373
 	 */
374
-	public function column_cb( $payment ) {
374
+	public function column_cb($payment) {
375 375
 		return sprintf(
376 376
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
377 377
 			'payment',
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 	 *
390 390
 	 * @return string Displays a checkbox
391 391
 	 */
392
-	public function column_ID( $payment ) {
393
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
392
+	public function column_ID($payment) {
393
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
394 394
 	}
395 395
 
396 396
 	/**
@@ -403,18 +403,18 @@  discard block
 block discarded – undo
403 403
 	 *
404 404
 	 * @return string Data shown in the User column
405 405
 	 */
406
-	public function column_donor( $payment ) {
406
+	public function column_donor($payment) {
407 407
 
408 408
 		//		$user_id = give_get_payment_user_id( $payment->ID );
409 409
 
410
-		$customer_id = give_get_payment_customer_id( $payment->ID );
411
-		$customer    = new Give_Customer( $customer_id );
410
+		$customer_id = give_get_payment_customer_id($payment->ID);
411
+		$customer    = new Give_Customer($customer_id);
412 412
 
413
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id );
413
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id);
414 414
 
415
-		$value = '<a href="' . esc_url( $view_url ) . '" data-tooltip="' . __( 'Click here to view this Donor\'s profile', 'give' ) . '">' . $customer->name . '</a>';
415
+		$value = '<a href="'.esc_url($view_url).'" data-tooltip="'.__('Click here to view this Donor\'s profile', 'give').'">'.$customer->name.'</a>';
416 416
 
417
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
417
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
418 418
 	}
419 419
 
420 420
 	/**
@@ -426,18 +426,18 @@  discard block
 block discarded – undo
426 426
 	 */
427 427
 	public function get_bulk_actions() {
428 428
 		$actions = array(
429
-			'delete'               => __( 'Delete', 'give' ),
430
-			'set-status-publish'   => __( 'Set To Completed', 'give' ),
431
-			'set-status-pending'   => __( 'Set To Pending', 'give' ),
432
-			'set-status-refunded'  => __( 'Set To Refunded', 'give' ),
433
-			'set-status-revoked'   => __( 'Set To Revoked', 'give' ),
434
-			'set-status-failed'    => __( 'Set To Failed', 'give' ),
435
-			'set-status-cancelled' => __( 'Set To Cancelled', 'give' ),
436
-			'set-status-abandoned' => __( 'Set To Abandoned', 'give' ),
437
-			'resend-receipt'       => __( 'Resend Email Receipts', 'give' )
429
+			'delete'               => __('Delete', 'give'),
430
+			'set-status-publish'   => __('Set To Completed', 'give'),
431
+			'set-status-pending'   => __('Set To Pending', 'give'),
432
+			'set-status-refunded'  => __('Set To Refunded', 'give'),
433
+			'set-status-revoked'   => __('Set To Revoked', 'give'),
434
+			'set-status-failed'    => __('Set To Failed', 'give'),
435
+			'set-status-cancelled' => __('Set To Cancelled', 'give'),
436
+			'set-status-abandoned' => __('Set To Abandoned', 'give'),
437
+			'resend-receipt'       => __('Resend Email Receipts', 'give')
438 438
 		);
439 439
 
440
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
440
+		return apply_filters('give_payments_table_bulk_actions', $actions);
441 441
 	}
442 442
 
443 443
 	/**
@@ -448,57 +448,57 @@  discard block
 block discarded – undo
448 448
 	 * @return void
449 449
 	 */
450 450
 	public function process_bulk_action() {
451
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
451
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
452 452
 		$action = $this->current_action();
453 453
 
454
-		if ( ! is_array( $ids ) ) {
455
-			$ids = array( $ids );
454
+		if ( ! is_array($ids)) {
455
+			$ids = array($ids);
456 456
 		}
457 457
 
458
-		if ( empty( $action ) ) {
458
+		if (empty($action)) {
459 459
 			return;
460 460
 		}
461 461
 
462
-		foreach ( $ids as $id ) {
462
+		foreach ($ids as $id) {
463 463
 
464 464
 			// Detect when a bulk action is being triggered...
465
-			if ( 'delete' === $this->current_action() ) {
466
-				give_delete_purchase( $id );
465
+			if ('delete' === $this->current_action()) {
466
+				give_delete_purchase($id);
467 467
 			}
468 468
 
469
-			if ( 'set-status-publish' === $this->current_action() ) {
470
-				give_update_payment_status( $id, 'publish' );
469
+			if ('set-status-publish' === $this->current_action()) {
470
+				give_update_payment_status($id, 'publish');
471 471
 			}
472 472
 
473
-			if ( 'set-status-pending' === $this->current_action() ) {
474
-				give_update_payment_status( $id, 'pending' );
473
+			if ('set-status-pending' === $this->current_action()) {
474
+				give_update_payment_status($id, 'pending');
475 475
 			}
476 476
 
477
-			if ( 'set-status-refunded' === $this->current_action() ) {
478
-				give_update_payment_status( $id, 'refunded' );
477
+			if ('set-status-refunded' === $this->current_action()) {
478
+				give_update_payment_status($id, 'refunded');
479 479
 			}
480 480
 
481
-			if ( 'set-status-revoked' === $this->current_action() ) {
482
-				give_update_payment_status( $id, 'revoked' );
481
+			if ('set-status-revoked' === $this->current_action()) {
482
+				give_update_payment_status($id, 'revoked');
483 483
 			}
484 484
 
485
-			if ( 'set-status-failed' === $this->current_action() ) {
486
-				give_update_payment_status( $id, 'failed' );
485
+			if ('set-status-failed' === $this->current_action()) {
486
+				give_update_payment_status($id, 'failed');
487 487
 			}
488 488
 
489
-			if ( 'set-status-cancelled' === $this->current_action() ) {
490
-				give_update_payment_status( $id, 'cancelled' );
489
+			if ('set-status-cancelled' === $this->current_action()) {
490
+				give_update_payment_status($id, 'cancelled');
491 491
 			}
492 492
 
493
-			if ( 'set-status-abandoned' === $this->current_action() ) {
494
-				give_update_payment_status( $id, 'abandoned' );
493
+			if ('set-status-abandoned' === $this->current_action()) {
494
+				give_update_payment_status($id, 'abandoned');
495 495
 			}
496 496
 
497
-			if ( 'resend-receipt' === $this->current_action() ) {
498
-				give_email_donation_receipt( $id, false );
497
+			if ('resend-receipt' === $this->current_action()) {
498
+				give_email_donation_receipt($id, false);
499 499
 			}
500 500
 
501
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
501
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
502 502
 		}
503 503
 
504 504
 	}
@@ -516,21 +516,21 @@  discard block
 block discarded – undo
516 516
 
517 517
 		$args = array();
518 518
 
519
-		if ( isset( $_GET['user'] ) ) {
520
-			$args['user'] = urldecode( $_GET['user'] );
521
-		} elseif ( isset( $_GET['s'] ) ) {
522
-			$args['s'] = urldecode( $_GET['s'] );
519
+		if (isset($_GET['user'])) {
520
+			$args['user'] = urldecode($_GET['user']);
521
+		} elseif (isset($_GET['s'])) {
522
+			$args['s'] = urldecode($_GET['s']);
523 523
 		}
524 524
 
525
-		if ( ! empty( $_GET['start-date'] ) ) {
526
-			$args['start-date'] = urldecode( $_GET['start-date'] );
525
+		if ( ! empty($_GET['start-date'])) {
526
+			$args['start-date'] = urldecode($_GET['start-date']);
527 527
 		}
528 528
 
529
-		if ( ! empty( $_GET['end-date'] ) ) {
530
-			$args['end-date'] = urldecode( $_GET['end-date'] );
529
+		if ( ! empty($_GET['end-date'])) {
530
+			$args['end-date'] = urldecode($_GET['end-date']);
531 531
 		}
532 532
 
533
-		$payment_count         = give_count_payments( $args );
533
+		$payment_count         = give_count_payments($args);
534 534
 		$this->complete_count  = $payment_count->publish;
535 535
 		$this->pending_count   = $payment_count->pending;
536 536
 		$this->refunded_count  = $payment_count->refunded;
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 		$this->cancelled_count = $payment_count->cancelled;
540 540
 		$this->abandoned_count = $payment_count->abandoned;
541 541
 
542
-		foreach ( $payment_count as $count ) {
542
+		foreach ($payment_count as $count) {
543 543
 			$this->total_count += $count;
544 544
 		}
545 545
 	}
@@ -554,26 +554,26 @@  discard block
 block discarded – undo
554 554
 	public function payments_data() {
555 555
 
556 556
 		$per_page   = $this->per_page;
557
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
558
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
559
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
560
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
561
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
562
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
563
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
564
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
565
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
566
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
567
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
568
-
569
-		if ( ! empty( $search ) ) {
557
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
558
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
559
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
560
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
561
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
562
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
563
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
564
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
565
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
566
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
567
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
568
+
569
+		if ( ! empty($search)) {
570 570
 			$status = 'any'; // Force all payment statuses when searching
571 571
 		}
572 572
 
573 573
 		$args = array(
574 574
 			'output'     => 'payments',
575 575
 			'number'     => $per_page,
576
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
576
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
577 577
 			'orderby'    => $orderby,
578 578
 			'order'      => $order,
579 579
 			'user'       => $user,
@@ -587,14 +587,14 @@  discard block
 block discarded – undo
587 587
 			'end_date'   => $end_date,
588 588
 		);
589 589
 
590
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
590
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
591 591
 
592 592
 			$args['search_in_notes'] = true;
593
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
593
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
594 594
 
595 595
 		}
596 596
 
597
-		$p_query = new Give_Payments_Query( $args );
597
+		$p_query = new Give_Payments_Query($args);
598 598
 
599 599
 		return $p_query->get_payments();
600 600
 
@@ -614,17 +614,17 @@  discard block
 block discarded – undo
614 614
 	 */
615 615
 	public function prepare_items() {
616 616
 
617
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
617
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
618 618
 
619 619
 		$columns  = $this->get_columns();
620 620
 		$hidden   = array(); // No hidden columns
621 621
 		$sortable = $this->get_sortable_columns();
622 622
 		$data     = $this->payments_data();
623
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
623
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
624 624
 
625
-		$this->_column_headers = array( $columns, $hidden, $sortable );
625
+		$this->_column_headers = array($columns, $hidden, $sortable);
626 626
 
627
-		switch ( $status ) {
627
+		switch ($status) {
628 628
 			case 'publish':
629 629
 				$total_items = $this->complete_count;
630 630
 				break;
@@ -651,18 +651,18 @@  discard block
 block discarded – undo
651 651
 				break;
652 652
 			default:
653 653
 				// Retrieve the count of the non-default-Give status
654
-				$count       = wp_count_posts( 'give_payment' );
654
+				$count       = wp_count_posts('give_payment');
655 655
 				$total_items = $count->{$status};
656 656
 		}
657 657
 
658 658
 		$this->items = $data;
659 659
 
660
-		$this->set_pagination_args( array(
660
+		$this->set_pagination_args(array(
661 661
 				'total_items' => $total_items,
662 662
 				// WE have to calculate the total number of items
663 663
 				'per_page'    => $this->per_page,
664 664
 				// WE have to determine how many items to show on a page
665
-				'total_pages' => ceil( $total_items / $this->per_page )
665
+				'total_pages' => ceil($total_items / $this->per_page)
666 666
 				// WE have to calculate the total number of pages
667 667
 			)
668 668
 		);
Please login to merge, or discard this patch.
includes/admin/reporting/class-api-requests-logs-list-table.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
 	 *
158 158
 	 * @access public
159 159
 	 * @since  1.0
160
-	 * @return mixed String if search is present, false otherwise
160
+	 * @return string|false String if search is present, false otherwise
161 161
 	 */
162 162
 	public function get_search() {
163 163
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this 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 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
 	 *
144 144
 	 * @access public
145 145
 	 * @since  1.0
146
-	 * @return mixed string If search is present, false otherwise
146
+	 * @return string|false string If search is present, false otherwise
147 147
 	 */
148 148
 	public function get_search() {
149 149
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@
 block discarded – undo
71 71
 
72 72
 			case 'user_id' :
73 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>';
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 78
 				return give_currency_filter( give_format_amount( $item['amount'] ) );
Please login to merge, or discard this 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/graphing.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -576,7 +576,7 @@
 block discarded – undo
576 576
  * selected date-range (if any)
577 577
  *
578 578
  * @since 1.0
579
- * @return array
579
+ * @return integer|null
580 580
  */
581 581
 function give_get_report_dates() {
582 582
 	$dates = array();
Please login to merge, or discard this patch.
Spacing   +243 added lines, -243 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
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	$dates = give_get_report_dates();
26 26
 
27 27
 	// Determine graph options
28
-	switch ( $dates['range'] ) :
28
+	switch ($dates['range']) :
29 29
 		case 'today' :
30 30
 		case 'yesterday' :
31 31
 			$day_by_day = true;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			$day_by_day = false;
38 38
 			break;
39 39
 		case 'other' :
40
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) {
40
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) {
41 41
 				$day_by_day = false;
42 42
 			} else {
43 43
 				$day_by_day = true;
@@ -49,61 +49,61 @@  discard block
 block discarded – undo
49 49
 	endswitch;
50 50
 
51 51
 	$earnings_totals = 0.00; // Total earnings for time period shown
52
-	$sales_totals    = 0;            // Total sales for time period shown
52
+	$sales_totals    = 0; // Total sales for time period shown
53 53
 
54 54
 	$earnings_data = array();
55 55
 	$sales_data    = array();
56 56
 
57
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
57
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
58 58
 		// Hour by hour
59 59
 		$hour  = 1;
60
-		$month = date( 'n', current_time( 'timestamp' ) );
61
-		while ( $hour <= 23 ) :
60
+		$month = date('n', current_time('timestamp'));
61
+		while ($hour <= 23) :
62 62
 
63
-			$sales    = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour );
64
-			$earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour );
63
+			$sales    = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour);
64
+			$earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour);
65 65
 
66 66
 			$sales_totals += $sales;
67 67
 			$earnings_totals += $earnings;
68 68
 
69
-			$date            = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000;
70
-			$sales_data[]    = array( $date, $sales );
71
-			$earnings_data[] = array( $date, $earnings );
69
+			$date            = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000;
70
+			$sales_data[]    = array($date, $sales);
71
+			$earnings_data[] = array($date, $earnings);
72 72
 
73
-			$hour ++;
73
+			$hour++;
74 74
 		endwhile;
75 75
 
76
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
76
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
77 77
 
78 78
 		// Day by day
79 79
 		$day     = $dates['day'];
80 80
 		$day_end = $dates['day_end'];
81 81
 		$month   = $dates['m_start'];
82
-		while ( $day <= $day_end ) :
83
-			$sales = give_get_sales_by_date( $day, $month, $dates['year'] );
82
+		while ($day <= $day_end) :
83
+			$sales = give_get_sales_by_date($day, $month, $dates['year']);
84 84
 			$sales_totals += $sales;
85 85
 
86
-			$earnings = give_get_earnings_by_date( $day, $month, $dates['year'] );
86
+			$earnings = give_get_earnings_by_date($day, $month, $dates['year']);
87 87
 			$earnings_totals += $earnings;
88 88
 
89
-			$date            = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000;
90
-			$sales_data[]    = array( $date, $sales );
91
-			$earnings_data[] = array( $date, $earnings );
92
-			$day ++;
89
+			$date            = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000;
90
+			$sales_data[]    = array($date, $sales);
91
+			$earnings_data[] = array($date, $earnings);
92
+			$day++;
93 93
 		endwhile;
94 94
 
95 95
 	} else {
96 96
 
97 97
 		$y = $dates['year'];
98
-		while ( $y <= $dates['year_end'] ) :
98
+		while ($y <= $dates['year_end']) :
99 99
 
100
-			if ( $dates['year'] == $dates['year_end'] ) {
100
+			if ($dates['year'] == $dates['year_end']) {
101 101
 				$month_start = $dates['m_start'];
102 102
 				$month_end   = $dates['m_end'];
103
-			} elseif ( $y == $dates['year'] ) {
103
+			} elseif ($y == $dates['year']) {
104 104
 				$month_start = $dates['m_start'];
105 105
 				$month_end   = 12;
106
-			} elseif ( $y == $dates['year_end'] ) {
106
+			} elseif ($y == $dates['year_end']) {
107 107
 				$month_start = 1;
108 108
 				$month_end   = $dates['m_end'];
109 109
 			} else {
@@ -112,48 +112,48 @@  discard block
 block discarded – undo
112 112
 			}
113 113
 
114 114
 			$i = $month_start;
115
-			while ( $i <= $month_end ) :
115
+			while ($i <= $month_end) :
116 116
 
117
-				if ( $day_by_day ) :
117
+				if ($day_by_day) :
118 118
 
119
-					if ( $i == $month_end ) {
119
+					if ($i == $month_end) {
120 120
 
121 121
 						$num_of_days = $dates['day_end'];
122 122
 
123 123
 					} else {
124 124
 
125
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
125
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
126 126
 
127 127
 					}
128 128
 
129 129
 					$d = $dates['day'];
130 130
 
131
-					while ( $d <= $num_of_days ) :
131
+					while ($d <= $num_of_days) :
132 132
 
133
-						$sales = give_get_sales_by_date( $d, $i, $y );
133
+						$sales = give_get_sales_by_date($d, $i, $y);
134 134
 						$sales_totals += $sales;
135 135
 
136
-						$earnings = give_get_earnings_by_date( $d, $i, $y );
136
+						$earnings = give_get_earnings_by_date($d, $i, $y);
137 137
 						$earnings_totals += $earnings;
138 138
 
139
-						$date            = mktime( 0, 0, 0, $i, $d, $y ) * 1000;
140
-						$sales_data[]    = array( $date, $sales );
141
-						$earnings_data[] = array( $date, $earnings );
142
-						$d ++;
139
+						$date            = mktime(0, 0, 0, $i, $d, $y) * 1000;
140
+						$sales_data[]    = array($date, $sales);
141
+						$earnings_data[] = array($date, $earnings);
142
+						$d++;
143 143
 
144 144
 					endwhile;
145 145
 
146 146
 				else :
147 147
 
148
-					$sales = give_get_sales_by_date( null, $i, $y );
148
+					$sales = give_get_sales_by_date(null, $i, $y);
149 149
 					$sales_totals += $sales;
150 150
 
151
-					$earnings = give_get_earnings_by_date( null, $i, $y );
151
+					$earnings = give_get_earnings_by_date(null, $i, $y);
152 152
 					$earnings_totals += $earnings;
153 153
 
154
-					if ( $i == $month_end ) {
154
+					if ($i == $month_end) {
155 155
 
156
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
156
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
157 157
 
158 158
 					} else {
159 159
 
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
 
162 162
 					}
163 163
 
164
-					$date            = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000;
165
-					$sales_data[]    = array( $date, $sales );
166
-					$earnings_data[] = array( $date, $earnings );
164
+					$date            = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000;
165
+					$sales_data[]    = array($date, $sales);
166
+					$earnings_data[] = array($date, $earnings);
167 167
 
168 168
 				endif;
169 169
 
170
-				$i ++;
170
+				$i++;
171 171
 
172 172
 			endwhile;
173 173
 
174
-			$y ++;
174
+			$y++;
175 175
 		endwhile;
176 176
 
177 177
 	}
178 178
 
179 179
 	$data = array(
180
-		__( 'Income', 'give' )    => $earnings_data,
181
-		__( 'Donations', 'give' ) => $sales_data
180
+		__('Income', 'give')    => $earnings_data,
181
+		__('Donations', 'give') => $sales_data
182 182
 	);
183 183
 
184 184
 	// start our own output buffer
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 			<div class="postbox">
191 191
 				<div class="inside">
192 192
 					<?php
193
-					$graph = new Give_Graph( $data );
194
-					$graph->set( 'x_mode', 'time' );
195
-					$graph->set( 'multiple_y_axes', true );
193
+					$graph = new Give_Graph($data);
194
+					$graph->set('x_mode', 'time');
195
+					$graph->set('multiple_y_axes', true);
196 196
 					$graph->display();
197 197
 
198
-					if ( 'this_month' == $dates['range'] ) {
198
+					if ('this_month' == $dates['range']) {
199 199
 						$estimated = give_estimated_monthly_stats();
200 200
 					}
201 201
 					?>
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 				<tbody>
207 207
 				<tr>
208 208
 					<td class="row-title">
209
-						<label for="tablecell"><?php _e( 'Total income for period: ', 'give' ); ?></label></td>
210
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
209
+						<label for="tablecell"><?php _e('Total income for period: ', 'give'); ?></label></td>
210
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
211 211
 				</tr>
212 212
 				<tr class="alternate">
213 213
 					<td class="row-title">
214
-						<label for="tablecell"><?php _e( 'Total donations for period shown: ', 'give' ); ?></label>
214
+						<label for="tablecell"><?php _e('Total donations for period shown: ', 'give'); ?></label>
215 215
 					</td>
216
-					<td><?php echo give_format_amount( $sales_totals, false ); ?></td>
216
+					<td><?php echo give_format_amount($sales_totals, false); ?></td>
217 217
 				</tr>
218
-				<?php if ( 'this_month' == $dates['range'] ) : ?>
218
+				<?php if ('this_month' == $dates['range']) : ?>
219 219
 					<tr>
220 220
 						<td class="row-title">
221
-							<label for="tablecell"><?php _e( 'Estimated monthly income: ', 'give' ); ?></label>
221
+							<label for="tablecell"><?php _e('Estimated monthly income: ', 'give'); ?></label>
222 222
 						</td>
223
-						<td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td>
223
+						<td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td>
224 224
 					</tr>
225 225
 					<tr class="alternate">
226 226
 						<td class="row-title">
227
-							<label for="tablecell"><?php _e( 'Estimated monthly donations: ', 'give' ); ?></label>
227
+							<label for="tablecell"><?php _e('Estimated monthly donations: ', 'give'); ?></label>
228 228
 						</td>
229
-						<td><?php echo give_format_amount( $estimated['sales'], false ); ?></td>
229
+						<td><?php echo give_format_amount($estimated['sales'], false); ?></td>
230 230
 					</tr>
231 231
 				<?php endif; ?>
232 232
 			</table>
233 233
 
234
-			<?php do_action( 'give_reports_graph_additional_stats' ); ?>
234
+			<?php do_action('give_reports_graph_additional_stats'); ?>
235 235
 
236 236
 		</div>
237 237
 	</div>
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
  * @since 1.0
250 250
  * @return void
251 251
  */
252
-function give_reports_graph_of_form( $form_id = 0 ) {
252
+function give_reports_graph_of_form($form_id = 0) {
253 253
 	// Retrieve the queried dates
254 254
 	$dates = give_get_report_dates();
255 255
 
256 256
 	// Determine graph options
257
-	switch ( $dates['range'] ) :
257
+	switch ($dates['range']) :
258 258
 		case 'today' :
259 259
 		case 'yesterday' :
260 260
 			$day_by_day = true;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			$day_by_day = false;
273 273
 			break;
274 274
 		case 'other' :
275
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) {
275
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) {
276 276
 				$day_by_day = false;
277 277
 			} else {
278 278
 				$day_by_day = true;
@@ -284,75 +284,75 @@  discard block
 block discarded – undo
284 284
 	endswitch;
285 285
 
286 286
 	$earnings_totals = (float) 0.00; // Total earnings for time period shown
287
-	$sales_totals    = 0;            // Total sales for time period shown
287
+	$sales_totals    = 0; // Total sales for time period shown
288 288
 
289 289
 	$earnings_data = array();
290 290
 	$sales_data    = array();
291 291
 	$stats         = new Give_Payment_Stats;
292 292
 
293
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
293
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
294 294
 
295 295
 		// Hour by hour
296 296
 		$month  = $dates['m_start'];
297 297
 		$hour   = 1;
298 298
 		$minute = 0;
299 299
 		$second = 0;
300
-		while ( $hour <= 23 ) :
300
+		while ($hour <= 23) :
301 301
 
302
-			if ( $hour == 23 ) {
302
+			if ($hour == 23) {
303 303
 				$minute = $second = 59;
304 304
 			}
305 305
 
306
-			$date     = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] );
307
-			$date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] );
306
+			$date     = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']);
307
+			$date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']);
308 308
 
309
-			$sales = $stats->get_sales( $form_id, $date, $date_end );
309
+			$sales = $stats->get_sales($form_id, $date, $date_end);
310 310
 			$sales_totals += $sales;
311 311
 
312
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
312
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
313 313
 			$earnings_totals += $earnings;
314 314
 
315
-			$sales_data[]    = array( $date * 1000, $sales );
316
-			$earnings_data[] = array( $date * 1000, $earnings );
315
+			$sales_data[]    = array($date * 1000, $sales);
316
+			$earnings_data[] = array($date * 1000, $earnings);
317 317
 
318
-			$hour ++;
318
+			$hour++;
319 319
 		endwhile;
320 320
 
321
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
321
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
322 322
 
323 323
 		//Day by day
324 324
 		$day     = $dates['day'];
325 325
 		$day_end = $dates['day_end'];
326 326
 		$month   = $dates['m_start'];
327
-		while ( $day <= $day_end ) :
327
+		while ($day <= $day_end) :
328 328
 
329
-			$date     = mktime( 0, 0, 0, $month, $day, $dates['year'] );
330
-			$date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] );
331
-			$sales    = $stats->get_sales( $form_id, $date, $date_end );
329
+			$date     = mktime(0, 0, 0, $month, $day, $dates['year']);
330
+			$date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']);
331
+			$sales    = $stats->get_sales($form_id, $date, $date_end);
332 332
 			$sales_totals += $sales;
333 333
 
334
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
334
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
335 335
 			$earnings_totals += $earnings;
336 336
 
337
-			$sales_data[]    = array( $date * 1000, $sales );
338
-			$earnings_data[] = array( $date * 1000, $earnings );
337
+			$sales_data[]    = array($date * 1000, $sales);
338
+			$earnings_data[] = array($date * 1000, $earnings);
339 339
 
340
-			$day ++;
340
+			$day++;
341 341
 		endwhile;
342 342
 
343 343
 	} else {
344 344
 
345 345
 		$y = $dates['year'];
346 346
 
347
-		while ( $y <= $dates['year_end'] ) :
347
+		while ($y <= $dates['year_end']) :
348 348
 
349 349
 			$last_year = false;
350 350
 
351
-			if ( $dates['year'] == $dates['year_end'] ) {
351
+			if ($dates['year'] == $dates['year_end']) {
352 352
 				$month_start = $dates['m_start'];
353 353
 				$month_end   = $dates['m_end'];
354 354
 				$last_year   = true;
355
-			} elseif ( $y == $dates['year'] ) {
355
+			} elseif ($y == $dates['year']) {
356 356
 				$month_start = $dates['m_start'];
357 357
 				$month_end   = 12;
358 358
 			} else {
@@ -361,79 +361,79 @@  discard block
 block discarded – undo
361 361
 			}
362 362
 
363 363
 			$i = $month_start;
364
-			while ( $i <= $month_end ) :
364
+			while ($i <= $month_end) :
365 365
 
366
-				if ( $day_by_day ) :
366
+				if ($day_by_day) :
367 367
 
368
-					if ( $i == $month_end && $last_year ) {
368
+					if ($i == $month_end && $last_year) {
369 369
 
370 370
 						$num_of_days = $dates['day_end'];
371 371
 
372 372
 					} else {
373 373
 
374
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
374
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
375 375
 
376 376
 					}
377 377
 
378 378
 					$d = $dates['day'];
379
-					while ( $d <= $num_of_days ) :
379
+					while ($d <= $num_of_days) :
380 380
 
381
-						$date     = mktime( 0, 0, 0, $i, $d, $y );
382
-						$end_date = mktime( 23, 59, 59, $i, $d, $y );
381
+						$date     = mktime(0, 0, 0, $i, $d, $y);
382
+						$end_date = mktime(23, 59, 59, $i, $d, $y);
383 383
 
384
-						$sales = $stats->get_sales( $form_id, $date, $end_date );
384
+						$sales = $stats->get_sales($form_id, $date, $end_date);
385 385
 						$sales_totals += $sales;
386 386
 
387
-						$earnings = $stats->get_earnings( $form_id, $date, $end_date );
387
+						$earnings = $stats->get_earnings($form_id, $date, $end_date);
388 388
 						$earnings_totals += $earnings;
389 389
 
390
-						$sales_data[]    = array( $date * 1000, $sales );
391
-						$earnings_data[] = array( $date * 1000, $earnings );
392
-						$d ++;
390
+						$sales_data[]    = array($date * 1000, $sales);
391
+						$earnings_data[] = array($date * 1000, $earnings);
392
+						$d++;
393 393
 
394 394
 					endwhile;
395 395
 
396 396
 				else :
397 397
 
398
-					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
398
+					$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
399 399
 
400
-					$date     = mktime( 0, 0, 0, $i, 1, $y );
401
-					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
400
+					$date     = mktime(0, 0, 0, $i, 1, $y);
401
+					$end_date = mktime(23, 59, 59, $i, $num_of_days, $y);
402 402
 
403
-					$sales = $stats->get_sales( $form_id, $date, $end_date );
403
+					$sales = $stats->get_sales($form_id, $date, $end_date);
404 404
 					$sales_totals += $sales;
405 405
 
406
-					$earnings = $stats->get_earnings( $form_id, $date, $end_date );
406
+					$earnings = $stats->get_earnings($form_id, $date, $end_date);
407 407
 					$earnings_totals += $earnings;
408 408
 
409
-					$sales_data[]    = array( $date * 1000, $sales );
410
-					$earnings_data[] = array( $date * 1000, $earnings );
409
+					$sales_data[]    = array($date * 1000, $sales);
410
+					$earnings_data[] = array($date * 1000, $earnings);
411 411
 				endif;
412 412
 
413
-				$i ++;
413
+				$i++;
414 414
 
415 415
 			endwhile;
416 416
 
417
-			$y ++;
417
+			$y++;
418 418
 		endwhile;
419 419
 
420 420
 	}
421 421
 
422 422
 	$data = array(
423
-		__( 'Income', 'give' )    => $earnings_data,
424
-		__( 'Donations', 'give' ) => $sales_data
423
+		__('Income', 'give')    => $earnings_data,
424
+		__('Donations', 'give') => $sales_data
425 425
 	);
426 426
 
427 427
 	?>
428
-	<h3><span><?php printf( __( 'Income Over Time for %s', 'give' ), get_the_title( $form_id ) ); ?></span></h3>
428
+	<h3><span><?php printf(__('Income Over Time for %s', 'give'), get_the_title($form_id)); ?></span></h3>
429 429
 
430 430
 	<div class="metabox-holder" style="padding-top: 0;">
431 431
 		<div class="postbox">
432 432
 			<div class="inside">
433 433
 				<?php
434
-				$graph = new Give_Graph( $data );
435
-				$graph->set( 'x_mode', 'time' );
436
-				$graph->set( 'multiple_y_axes', true );
434
+				$graph = new Give_Graph($data);
435
+				$graph->set('x_mode', 'time');
436
+				$graph->set('multiple_y_axes', true);
437 437
 				$graph->display();
438 438
 				?>
439 439
 			</div>
@@ -443,26 +443,26 @@  discard block
 block discarded – undo
443 443
 			<tbody>
444 444
 			<tr>
445 445
 				<td class="row-title">
446
-					<label for="tablecell"><?php _e( 'Total income for period: ', 'give' ); ?></label></td>
447
-				<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
446
+					<label for="tablecell"><?php _e('Total income for period: ', 'give'); ?></label></td>
447
+				<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
448 448
 			</tr>
449 449
 			<tr class="alternate">
450 450
 				<td class="row-title">
451
-					<label for="tablecell"><?php _e( 'Total donations for period: ', 'give' ); ?></label>
451
+					<label for="tablecell"><?php _e('Total donations for period: ', 'give'); ?></label>
452 452
 				</td>
453 453
 				<td><?php echo $sales_totals; ?></td>
454 454
 			</tr>
455 455
 			<tr>
456 456
 				<td class="row-title">
457
-					<label for="tablecell"><?php _e( 'Average monthly income: %s', 'give' ); ?></label>
457
+					<label for="tablecell"><?php _e('Average monthly income: %s', 'give'); ?></label>
458 458
 				</td>
459
-				<td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td>
459
+				<td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td>
460 460
 			</tr>
461 461
 			<tr class="alternate">
462 462
 				<td class="row-title">
463
-					<label for="tablecell"><?php _e( 'Average monthly donations: %s', 'give' ); ?></label>
463
+					<label for="tablecell"><?php _e('Average monthly donations: %s', 'give'); ?></label>
464 464
 				</td>
465
-				<td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
465
+				<td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td>
466 466
 			</tr>
467 467
 			</tbody>
468 468
 		</table>
@@ -479,30 +479,30 @@  discard block
 block discarded – undo
479 479
  * @return void
480 480
  */
481 481
 function give_reports_graph_controls() {
482
-	$date_options = apply_filters( 'give_report_date_options', array(
483
-		'today'        => __( 'Today', 'give' ),
484
-		'yesterday'    => __( 'Yesterday', 'give' ),
485
-		'this_week'    => __( 'This Week', 'give' ),
486
-		'last_week'    => __( 'Last Week', 'give' ),
487
-		'this_month'   => __( 'This Month', 'give' ),
488
-		'last_month'   => __( 'Last Month', 'give' ),
489
-		'this_quarter' => __( 'This Quarter', 'give' ),
490
-		'last_quarter' => __( 'Last Quarter', 'give' ),
491
-		'this_year'    => __( 'This Year', 'give' ),
492
-		'last_year'    => __( 'Last Year', 'give' ),
493
-		'other'        => __( 'Custom', 'give' )
494
-	) );
482
+	$date_options = apply_filters('give_report_date_options', array(
483
+		'today'        => __('Today', 'give'),
484
+		'yesterday'    => __('Yesterday', 'give'),
485
+		'this_week'    => __('This Week', 'give'),
486
+		'last_week'    => __('Last Week', 'give'),
487
+		'this_month'   => __('This Month', 'give'),
488
+		'last_month'   => __('Last Month', 'give'),
489
+		'this_quarter' => __('This Quarter', 'give'),
490
+		'last_quarter' => __('Last Quarter', 'give'),
491
+		'this_year'    => __('This Year', 'give'),
492
+		'last_year'    => __('Last Year', 'give'),
493
+		'other'        => __('Custom', 'give')
494
+	));
495 495
 
496 496
 	$dates   = give_get_report_dates();
497 497
 	$display = $dates['range'] == 'other' ? '' : 'style="display:none;"';
498 498
 	$view    = give_get_reporting_view();
499 499
 
500
-	if ( empty( $dates['day_end'] ) ) {
501
-		$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
500
+	if (empty($dates['day_end'])) {
501
+		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y'));
502 502
 	}
503 503
 
504 504
 	//echo '<pre>'; print_r( $dates ); echo '</pre>';
505
-	do_action( 'give_report_graph_controls_before' );
505
+	do_action('give_report_graph_controls_before');
506 506
 	?>
507 507
 	<form id="give-graphs-filter" method="get" class="alignright">
508 508
 		<div class="tablenav top alignright">
@@ -510,53 +510,53 @@  discard block
 block discarded – undo
510 510
 
511 511
 				<input type="hidden" name="post_type" value="give_forms" />
512 512
 				<input type="hidden" name="page" value="give-reports" />
513
-				<input type="hidden" name="view" value="<?php echo esc_attr( $view ); ?>" />
513
+				<input type="hidden" name="view" value="<?php echo esc_attr($view); ?>" />
514 514
 
515
-				<?php if ( isset( $_GET['form-id'] ) ) : ?>
516
-					<input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" />
515
+				<?php if (isset($_GET['form-id'])) : ?>
516
+					<input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" />
517 517
 				<?php endif; ?>
518 518
 
519 519
 				<div id="give-graphs-date-options-wrap" class="alignright">
520 520
 					<select id="give-graphs-date-options" name="range">
521
-						<?php foreach ( $date_options as $key => $option ) : ?>
522
-							<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
521
+						<?php foreach ($date_options as $key => $option) : ?>
522
+							<option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option>
523 523
 						<?php endforeach; ?>
524 524
 					</select>
525 525
 
526
-					<input type="submit" class="button-secondary" value="<?php _e( 'Filter', 'give' ); ?>" />
526
+					<input type="submit" class="button-secondary" value="<?php _e('Filter', 'give'); ?>" />
527 527
 				</div>
528 528
 
529 529
 				<div id="give-date-range-options" <?php echo $display; ?>>
530
-					<span><?php _e( 'From', 'give' ); ?>&nbsp;</span>
530
+					<span><?php _e('From', 'give'); ?>&nbsp;</span>
531 531
 					<select id="give-graphs-month-start" name="m_start">
532
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
533
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_start'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
532
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
533
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_start']); ?>><?php echo give_month_num_to_name($i); ?></option>
534 534
 						<?php endfor; ?>
535 535
 					</select>
536 536
 					<select id="give-graphs-day-start" name="day">
537
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
538
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day'] ); ?>><?php echo $i; ?></option>
537
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
538
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day']); ?>><?php echo $i; ?></option>
539 539
 						<?php endfor; ?>
540 540
 					</select>
541 541
 					<select id="give-graphs-year-start" name="year">
542
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
543
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year'] ); ?>><?php echo $i; ?></option>
542
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
543
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year']); ?>><?php echo $i; ?></option>
544 544
 						<?php endfor; ?>
545 545
 					</select>
546
-					<span><?php _e( 'To', 'give' ); ?>&nbsp;</span>
546
+					<span><?php _e('To', 'give'); ?>&nbsp;</span>
547 547
 					<select id="give-graphs-month-end" name="m_end">
548
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
549
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_end'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
548
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
549
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_end']); ?>><?php echo give_month_num_to_name($i); ?></option>
550 550
 						<?php endfor; ?>
551 551
 					</select>
552 552
 					<select id="give-graphs-day-end" name="day_end">
553
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
554
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day_end'] ); ?>><?php echo $i; ?></option>
553
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
554
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day_end']); ?>><?php echo $i; ?></option>
555 555
 						<?php endfor; ?>
556 556
 					</select>
557 557
 					<select id="give-graphs-year-end" name="year_end">
558
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
559
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year_end'] ); ?>><?php echo $i; ?></option>
558
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
559
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year_end']); ?>><?php echo $i; ?></option>
560 560
 						<?php endfor; ?>
561 561
 					</select>
562 562
 				</div>
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		</div>
567 567
 	</form>
568 568
 	<?php
569
-	do_action( 'give_report_graph_controls_after' );
569
+	do_action('give_report_graph_controls_after');
570 570
 }
571 571
 
572 572
 /**
@@ -581,65 +581,65 @@  discard block
 block discarded – undo
581 581
 function give_get_report_dates() {
582 582
 	$dates = array();
583 583
 
584
-	$current_time = current_time( 'timestamp' );
584
+	$current_time = current_time('timestamp');
585 585
 
586
-	$dates['range']    = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
587
-	$dates['year']     = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
588
-	$dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' );
589
-	$dates['m_start']  = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1;
590
-	$dates['m_end']    = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12;
591
-	$dates['day']      = isset( $_GET['day'] ) ? $_GET['day'] : 1;
592
-	$dates['day_end']  = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
586
+	$dates['range']    = isset($_GET['range']) ? $_GET['range'] : 'this_month';
587
+	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y');
588
+	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y');
589
+	$dates['m_start']  = isset($_GET['m_start']) ? $_GET['m_start'] : 1;
590
+	$dates['m_end']    = isset($_GET['m_end']) ? $_GET['m_end'] : 12;
591
+	$dates['day']      = isset($_GET['day']) ? $_GET['day'] : 1;
592
+	$dates['day_end']  = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
593 593
 
594 594
 	// Modify dates based on predefined ranges
595
-	switch ( $dates['range'] ) :
595
+	switch ($dates['range']) :
596 596
 
597 597
 		case 'this_month' :
598
-			$dates['m_start']  = date( 'n', $current_time );
599
-			$dates['m_end']    = date( 'n', $current_time );
598
+			$dates['m_start']  = date('n', $current_time);
599
+			$dates['m_end']    = date('n', $current_time);
600 600
 			$dates['day']      = 1;
601
-			$dates['day_end']  = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
602
-			$dates['year']     = date( 'Y' );
603
-			$dates['year_end'] = date( 'Y' );
601
+			$dates['day_end']  = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
602
+			$dates['year']     = date('Y');
603
+			$dates['year_end'] = date('Y');
604 604
 			break;
605 605
 
606 606
 		case 'last_month' :
607
-			if ( date( 'n' ) == 1 ) {
607
+			if (date('n') == 1) {
608 608
 				$dates['m_start']  = 12;
609 609
 				$dates['m_end']    = 12;
610
-				$dates['year']     = date( 'Y', $current_time ) - 1;
611
-				$dates['year_end'] = date( 'Y', $current_time ) - 1;
610
+				$dates['year']     = date('Y', $current_time) - 1;
611
+				$dates['year_end'] = date('Y', $current_time) - 1;
612 612
 			} else {
613
-				$dates['m_start']  = date( 'n' ) - 1;
614
-				$dates['m_end']    = date( 'n' ) - 1;
613
+				$dates['m_start']  = date('n') - 1;
614
+				$dates['m_end']    = date('n') - 1;
615 615
 				$dates['year_end'] = $dates['year'];
616 616
 			}
617
-			$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
617
+			$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
618 618
 			break;
619 619
 
620 620
 		case 'today' :
621
-			$dates['day']     = date( 'd', $current_time );
622
-			$dates['m_start'] = date( 'n', $current_time );
623
-			$dates['m_end']   = date( 'n', $current_time );
624
-			$dates['year']    = date( 'Y', $current_time );
621
+			$dates['day']     = date('d', $current_time);
622
+			$dates['m_start'] = date('n', $current_time);
623
+			$dates['m_end']   = date('n', $current_time);
624
+			$dates['year']    = date('Y', $current_time);
625 625
 			break;
626 626
 
627 627
 		case 'yesterday' :
628 628
 
629
-			$year  = date( 'Y', $current_time );
630
-			$month = date( 'n', $current_time );
631
-			$day   = date( 'd', $current_time );
629
+			$year  = date('Y', $current_time);
630
+			$month = date('n', $current_time);
631
+			$day   = date('d', $current_time);
632 632
 
633
-			if ( $month == 1 && $day == 1 ) {
633
+			if ($month == 1 && $day == 1) {
634 634
 
635 635
 				$year -= 1;
636 636
 				$month = 12;
637
-				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
637
+				$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
638 638
 
639
-			} elseif ( $month > 1 && $day == 1 ) {
639
+			} elseif ($month > 1 && $day == 1) {
640 640
 
641 641
 				$month -= 1;
642
-				$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
642
+				$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
643 643
 
644 644
 			} else {
645 645
 
@@ -655,91 +655,91 @@  discard block
 block discarded – undo
655 655
 			break;
656 656
 
657 657
 		case 'this_week' :
658
-			$dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;
659
-			$dates['day'] += get_option( 'start_of_week' );
658
+			$dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1;
659
+			$dates['day'] += get_option('start_of_week');
660 660
 			$dates['day_end'] = $dates['day'] + 6;
661
-			$dates['m_start'] = date( 'n', $current_time );
662
-			$dates['m_end']   = date( 'n', $current_time );
663
-			$dates['year']    = date( 'Y', $current_time );
661
+			$dates['m_start'] = date('n', $current_time);
662
+			$dates['m_end']   = date('n', $current_time);
663
+			$dates['year']    = date('Y', $current_time);
664 664
 			break;
665 665
 
666 666
 		case 'last_week' :
667
-			$dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8;
668
-			$dates['day'] += get_option( 'start_of_week' );
667
+			$dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8;
668
+			$dates['day'] += get_option('start_of_week');
669 669
 			$dates['day_end'] = $dates['day'] + 6;
670
-			$dates['year']    = date( 'Y' );
671
-
672
-			if ( date( 'j', $current_time ) <= 7 ) {
673
-				$dates['m_start'] = date( 'n', $current_time ) - 1;
674
-				$dates['m_end']   = date( 'n', $current_time ) - 1;
675
-				if ( $dates['m_start'] <= 1 ) {
676
-					$dates['year']     = date( 'Y', $current_time ) - 1;
677
-					$dates['year_end'] = date( 'Y', $current_time ) - 1;
670
+			$dates['year']    = date('Y');
671
+
672
+			if (date('j', $current_time) <= 7) {
673
+				$dates['m_start'] = date('n', $current_time) - 1;
674
+				$dates['m_end']   = date('n', $current_time) - 1;
675
+				if ($dates['m_start'] <= 1) {
676
+					$dates['year']     = date('Y', $current_time) - 1;
677
+					$dates['year_end'] = date('Y', $current_time) - 1;
678 678
 				}
679 679
 			} else {
680
-				$dates['m_start'] = date( 'n', $current_time );
681
-				$dates['m_end']   = date( 'n', $current_time );
680
+				$dates['m_start'] = date('n', $current_time);
681
+				$dates['m_end']   = date('n', $current_time);
682 682
 			}
683 683
 			break;
684 684
 
685 685
 		case 'this_quarter' :
686
-			$month_now = date( 'n', $current_time );
686
+			$month_now = date('n', $current_time);
687 687
 
688
-			if ( $month_now <= 3 ) {
688
+			if ($month_now <= 3) {
689 689
 
690 690
 				$dates['m_start'] = 1;
691 691
 				$dates['m_end']   = 4;
692
-				$dates['year']    = date( 'Y', $current_time );
692
+				$dates['year']    = date('Y', $current_time);
693 693
 
694
-			} else if ( $month_now <= 6 ) {
694
+			} else if ($month_now <= 6) {
695 695
 
696 696
 				$dates['m_start'] = 4;
697 697
 				$dates['m_end']   = 7;
698
-				$dates['year']    = date( 'Y', $current_time );
698
+				$dates['year']    = date('Y', $current_time);
699 699
 
700
-			} else if ( $month_now <= 9 ) {
700
+			} else if ($month_now <= 9) {
701 701
 
702 702
 				$dates['m_start'] = 7;
703 703
 				$dates['m_end']   = 10;
704
-				$dates['year']    = date( 'Y', $current_time );
704
+				$dates['year']    = date('Y', $current_time);
705 705
 
706 706
 			} else {
707 707
 
708 708
 				$dates['m_start']  = 10;
709 709
 				$dates['m_end']    = 1;
710
-				$dates['year']     = date( 'Y', $current_time );
711
-				$dates['year_end'] = date( 'Y', $current_time ) + 1;
710
+				$dates['year']     = date('Y', $current_time);
711
+				$dates['year_end'] = date('Y', $current_time) + 1;
712 712
 
713 713
 			}
714 714
 			break;
715 715
 
716 716
 		case 'last_quarter' :
717
-			$month_now = date( 'n' );
717
+			$month_now = date('n');
718 718
 
719
-			if ( $month_now <= 3 ) {
719
+			if ($month_now <= 3) {
720 720
 
721 721
 				$dates['m_start']  = 10;
722 722
 				$dates['m_end']    = 12;
723
-				$dates['year']     = date( 'Y', $current_time ) - 1; // Previous year
724
-				$dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year
723
+				$dates['year']     = date('Y', $current_time) - 1; // Previous year
724
+				$dates['year_end'] = date('Y', $current_time) - 1; // Previous year
725 725
 
726
-			} else if ( $month_now <= 6 ) {
726
+			} else if ($month_now <= 6) {
727 727
 
728 728
 				$dates['m_start'] = 1;
729 729
 				$dates['m_end']   = 3;
730
-				$dates['year']    = date( 'Y', $current_time );
730
+				$dates['year']    = date('Y', $current_time);
731 731
 
732
-			} else if ( $month_now <= 9 ) {
732
+			} else if ($month_now <= 9) {
733 733
 
734 734
 				$dates['m_start'] = 4;
735 735
 				$dates['m_end']   = 6;
736
-				$dates['year']    = date( 'Y', $current_time );
736
+				$dates['year']    = date('Y', $current_time);
737 737
 
738 738
 			} else {
739 739
 
740 740
 				$dates['m_start'] = 7;
741 741
 				$dates['m_end']   = 9;
742
-				$dates['year']    = date( 'Y', $current_time );
742
+				$dates['year']    = date('Y', $current_time);
743 743
 
744 744
 			}
745 745
 			break;
@@ -747,19 +747,19 @@  discard block
 block discarded – undo
747 747
 		case 'this_year' :
748 748
 			$dates['m_start'] = 1;
749 749
 			$dates['m_end']   = 12;
750
-			$dates['year']    = date( 'Y', $current_time );
750
+			$dates['year']    = date('Y', $current_time);
751 751
 			break;
752 752
 
753 753
 		case 'last_year' :
754 754
 			$dates['m_start']  = 1;
755 755
 			$dates['m_end']    = 12;
756
-			$dates['year']     = date( 'Y', $current_time ) - 1;
757
-			$dates['year_end'] = date( 'Y', $current_time ) - 1;
756
+			$dates['year']     = date('Y', $current_time) - 1;
757
+			$dates['year_end'] = date('Y', $current_time) - 1;
758 758
 			break;
759 759
 
760 760
 	endswitch;
761 761
 
762
-	return apply_filters( 'give_report_dates', $dates );
762
+	return apply_filters('give_report_dates', $dates);
763 763
 }
764 764
 
765 765
 /**
@@ -769,17 +769,17 @@  discard block
 block discarded – undo
769 769
  *
770 770
  * @param $data
771 771
  */
772
-function give_parse_report_dates( $data ) {
772
+function give_parse_report_dates($data) {
773 773
 	$dates = give_get_report_dates();
774 774
 
775 775
 	$view = give_get_reporting_view();
776
-	$id   = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
776
+	$id   = isset($_GET['form-id']) ? $_GET['form-id'] : null;
777 777
 
778
-	wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) );
778
+	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&view='.esc_attr($view).'&form-id='.absint($id))));
779 779
 	give_die();
780 780
 }
781 781
 
782
-add_action( 'give_filter_reports', 'give_parse_report_dates' );
782
+add_action('give_filter_reports', 'give_parse_report_dates');
783 783
 
784 784
 
785 785
 /**
@@ -789,16 +789,16 @@  discard block
 block discarded – undo
789 789
  */
790 790
 function give_reports_refresh_button() {
791 791
 
792
-	$url = wp_nonce_url( add_query_arg( array(
792
+	$url = wp_nonce_url(add_query_arg(array(
793 793
 		'give_action'  => 'refresh_reports_transients',
794 794
 		'give-message' => 'refreshed-reports'
795
-	) ), 'give-refresh-reports' );
795
+	)), 'give-refresh-reports');
796 796
 
797
-	echo '<a href="' . $url . '" data-tooltip="' . __( 'Clicking this will clear the reports cache.', 'give' ) . '" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">' . __( 'Refresh Reports', 'give' ) . '</a>';
797
+	echo '<a href="'.$url.'" data-tooltip="'.__('Clicking this will clear the reports cache.', 'give').'" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">'.__('Refresh Reports', 'give').'</a>';
798 798
 
799 799
 }
800 800
 
801
-add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );
801
+add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button');
802 802
 
803 803
 /**
804 804
  * Trigger the refresh of reports transients
@@ -809,18 +809,18 @@  discard block
 block discarded – undo
809 809
  *
810 810
  * @return void
811 811
  */
812
-function give_run_refresh_reports_transients( $data ) {
812
+function give_run_refresh_reports_transients($data) {
813 813
 
814
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) {
814
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) {
815 815
 		return;
816 816
 	}
817 817
 
818 818
 	//Delete transients
819
-	delete_transient( 'give_estimated_monthly_stats' );
820
-	delete_transient( 'give_earnings_total' );
821
-	delete_transient( md5( 'give_earnings_this_monththis_month' ) );
822
-	delete_transient( md5( 'give_earnings_todaytoday' ) );
819
+	delete_transient('give_estimated_monthly_stats');
820
+	delete_transient('give_earnings_total');
821
+	delete_transient(md5('give_earnings_this_monththis_month'));
822
+	delete_transient(md5('give_earnings_todaytoday'));
823 823
 
824 824
 }
825 825
 
826
-add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' );
827 826
\ No newline at end of file
827
+add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients');
828 828
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,9 +143,11 @@  discard block
 block discarded – undo
143 143
 
144 144
 					endwhile;
145 145
 
146
-				else :
146
+				else {
147
+					:
147 148
 
148 149
 					$sales = give_get_sales_by_date( null, $i, $y );
150
+				}
149 151
 					$sales_totals += $sales;
150 152
 
151 153
 					$earnings = give_get_earnings_by_date( null, $i, $y );
@@ -393,9 +395,11 @@  discard block
 block discarded – undo
393 395
 
394 396
 					endwhile;
395 397
 
396
-				else :
398
+				else {
399
+					:
397 400
 
398 401
 					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
402
+				}
399 403
 
400 404
 					$date     = mktime( 0, 0, 0, $i, 1, $y );
401 405
 					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
Please login to merge, or discard this patch.