Completed
Pull Request — master (#1907)
by
unknown
35:40 queued 15:43
created
includes/admin/tools/logs/class-gateway-error-logs-list-table.php 1 patch
Spacing   +50 added lines, -50 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,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 		// Set parent defaults.
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
50 50
 			'ajax'     => false                        // Does this table support ajax?.
51
-		) );
51
+		));
52 52
 	}
53 53
 
54 54
 	/**
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string Column Name.
64 64
 	 */
65
-	public function column_default( $item, $column_name ) {
65
+	public function column_default($item, $column_name) {
66 66
 
67
-		switch ( $column_name ) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'payment_id' :
71
-				return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) );
71
+				return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id']));
72 72
 			case 'gateway' :
73
-				return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway'];
73
+				return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway'];
74 74
 			case 'error' :
75
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' );
75
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give');
76 76
 			default:
77
-				return $item[ $column_name ];
77
+				return $item[$column_name];
78 78
 		}
79 79
 	}
80 80
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return void
90 90
 	 */
91
-	public function column_message( $item ) { ?>
92
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a>
91
+	public function column_message($item) { ?>
92
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a>
93 93
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
94 94
 			<?php
95 95
 
96
-			$log_message = get_post_field( 'post_content', $item['ID'] );
96
+			$log_message = get_post_field('post_content', $item['ID']);
97 97
 
98
-			$serialized = strpos( $log_message, '{"' );
98
+			$serialized = strpos($log_message, '{"');
99 99
 
100 100
 			// Check to see if the log message contains serialized information
101
-			if ( $serialized !== false ) {
102
-				$length = strlen( $log_message ) - $serialized;
103
-				$intro  = substr( $log_message, 0, - $length );
104
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
101
+			if ($serialized !== false) {
102
+				$length = strlen($log_message) - $serialized;
103
+				$intro  = substr($log_message, 0, - $length);
104
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
105 105
 
106
-				echo wpautop( $intro );
107
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
108
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
106
+				echo wpautop($intro);
107
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
108
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
109 109
 			} else {
110 110
 				// No serialized data found
111
-				echo wpautop( $log_message );
111
+				echo wpautop($log_message);
112 112
 			}
113 113
 			?>
114 114
 		</div>
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function get_columns() {
126 126
 		$columns = array(
127
-			'ID'         => esc_html__( 'Log ID', 'give' ),
128
-			'error'      => esc_html__( 'Error', 'give' ),
129
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
130
-			'payment_id' => esc_html__( 'Donation ID', 'give' ),
131
-			'date'       => esc_html__( 'Date', 'give' ),
132
-			'message'    => esc_html__( 'Details', 'give' )
127
+			'ID'         => esc_html__('Log ID', 'give'),
128
+			'error'      => esc_html__('Error', 'give'),
129
+			'gateway'    => esc_html__('Gateway', 'give'),
130
+			'payment_id' => esc_html__('Donation ID', 'give'),
131
+			'date'       => esc_html__('Date', 'give'),
132
+			'message'    => esc_html__('Details', 'give')
133 133
 		);
134 134
 
135 135
 		return $columns;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return int Current page number
144 144
 	 */
145 145
 	public function get_paged() {
146
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
146
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
147 147
 	}
148 148
 
149 149
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @since  1.0
154 154
 	 * @return void
155 155
 	 */
156
-	public function bulk_actions( $which = '' ) {
156
+	public function bulk_actions($which = '') {
157 157
 		give_log_views();
158 158
 	}
159 159
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		// Prevent the queries from getting cached.
173 173
 		// Without this there are occasional memory issues for some installs.
174
-		wp_suspend_cache_addition( true );
174
+		wp_suspend_cache_addition(true);
175 175
 
176 176
 		$logs_data = array();
177 177
 		$paged     = $this->get_paged();
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
 			'posts_per_page' => $this->per_page,
182 182
 		);
183 183
 
184
-		$logs = $give_logs->get_connected_logs( $log_query );
184
+		$logs = $give_logs->get_connected_logs($log_query);
185 185
 
186
-		if ( $logs ) {
187
-			foreach ( $logs as $log ) {
186
+		if ($logs) {
187
+			foreach ($logs as $log) {
188 188
 
189 189
 				$logs_data[] = array(
190 190
 					'ID'         => $log->ID,
191
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
191
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
192 192
 					'payment_id' => $log->post_parent,
193 193
 					'error'      => 'error',
194
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
194
+					'gateway'    => give_get_payment_gateway($log->post_parent),
195 195
 					'date'       => $log->post_date
196 196
 				);
197 197
 			}
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
 	 *
214 214
 	 * @param string $which
215 215
 	 */
216
-	protected function display_tablenav( $which ) {
217
-		if ( 'top' === $which ) {
218
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
216
+	protected function display_tablenav($which) {
217
+		if ('top' === $which) {
218
+			wp_nonce_field('bulk-'.$this->_args['plural']);
219 219
 		}
220 220
 		?>
221
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
221
+		<div class="tablenav <?php echo esc_attr($which); ?>">
222 222
 
223 223
 			<div class="alignleft actions bulkactions">
224
-				<?php $this->bulk_actions( $which ); ?>
224
+				<?php $this->bulk_actions($which); ?>
225 225
 			</div>
226 226
 			<?php
227
-			$this->extra_tablenav( $which );
228
-			$this->pagination( $which );
227
+			$this->extra_tablenav($which);
228
+			$this->pagination($which);
229 229
 			?>
230 230
 
231 231
 			<br class="clear"/>
@@ -252,14 +252,14 @@  discard block
 block discarded – undo
252 252
 		$columns               = $this->get_columns();
253 253
 		$hidden                = array(); // No hidden columns
254 254
 		$sortable              = $this->get_sortable_columns();
255
-		$this->_column_headers = array( $columns, $hidden, $sortable );
255
+		$this->_column_headers = array($columns, $hidden, $sortable);
256 256
 		$this->items           = $this->get_logs();
257
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
257
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
258 258
 
259
-		$this->set_pagination_args( array(
259
+		$this->set_pagination_args(array(
260 260
 				'total_items' => $total_items,
261 261
 				'per_page'    => $this->per_page,
262
-				'total_pages' => ceil( $total_items / $this->per_page ),
262
+				'total_pages' => ceil($total_items / $this->per_page),
263 263
 			)
264 264
 		);
265 265
 	}
Please login to merge, or discard this patch.
includes/install.php 1 patch
Spacing   +62 added lines, -62 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,15 +26,15 @@  discard block
 block discarded – undo
26 26
  * @global     $wpdb
27 27
  * @return void
28 28
  */
29
-function give_install( $network_wide = false ) {
29
+function give_install($network_wide = false) {
30 30
 
31 31
 	global $wpdb;
32 32
 
33
-	if ( is_multisite() && $network_wide ) {
33
+	if (is_multisite() && $network_wide) {
34 34
 
35
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
35
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
36 36
 
37
-			switch_to_blog( $blog_id );
37
+			switch_to_blog($blog_id);
38 38
 			give_run_install();
39 39
 			restore_current_blog();
40 40
 
@@ -62,34 +62,34 @@  discard block
 block discarded – undo
62 62
 	give_setup_post_types();
63 63
 
64 64
 	// Clear the permalinks.
65
-	flush_rewrite_rules( false );
65
+	flush_rewrite_rules(false);
66 66
 
67 67
 	// Add Upgraded From Option.
68
-	$current_version = get_option( 'give_version' );
69
-	if ( $current_version ) {
70
-		update_option( 'give_version_upgraded_from', $current_version );
68
+	$current_version = get_option('give_version');
69
+	if ($current_version) {
70
+		update_option('give_version_upgraded_from', $current_version);
71 71
 	}
72 72
 
73 73
 	// Setup some default options.
74 74
 	$options = array();
75 75
 
76 76
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
77
-	if ( empty( $current_version ) ) {
78
-		$options = array_merge( $options, give_get_default_settings() );
77
+	if (empty($current_version)) {
78
+		$options = array_merge($options, give_get_default_settings());
79 79
 	}
80 80
 
81 81
 	// Populate the default values.
82
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
82
+	update_option('give_settings', array_merge($give_options, $options));
83 83
 
84 84
 	/**
85 85
 	 * Run plugin upgrades.
86 86
 	 *
87 87
 	 * @since 1.8
88 88
 	 */
89
-	do_action( 'give_upgrades' );
89
+	do_action('give_upgrades');
90 90
 
91
-	if ( GIVE_VERSION !== get_option( 'give_version' ) ) {
92
-		update_option( 'give_version', GIVE_VERSION );
91
+	if (GIVE_VERSION !== get_option('give_version')) {
92
+		update_option('give_version', GIVE_VERSION);
93 93
 	}
94 94
 
95 95
 	// Create Give roles.
@@ -98,18 +98,18 @@  discard block
 block discarded – undo
98 98
 	$roles->add_caps();
99 99
 
100 100
 	$api = new Give_API();
101
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
101
+	update_option('give_default_api_version', 'v'.$api->get_version());
102 102
 
103 103
 	// Check for PHP Session support, and enable if available.
104 104
 	$give_sessions = new Give_Session();
105 105
 	$give_sessions->use_php_sessions();
106 106
 
107 107
 	// Add a temporary option to note that Give pages have been created.
108
-	Give_Cache::set( '_give_installed', $options, 30, true );
108
+	Give_Cache::set('_give_installed', $options, 30, true);
109 109
 
110
-	if ( ! $current_version ) {
110
+	if ( ! $current_version) {
111 111
 
112
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
112
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
113 113
 
114 114
 		// When new upgrade routines are added, mark them as complete on fresh install.
115 115
 		$upgrade_routines = array(
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 			'v189_upgrades_levels_post_meta'
122 122
 		);
123 123
 
124
-		foreach ( $upgrade_routines as $upgrade ) {
125
-			give_set_upgrade_complete( $upgrade );
124
+		foreach ($upgrade_routines as $upgrade) {
125
+			give_set_upgrade_complete($upgrade);
126 126
 		}
127 127
 	}
128 128
 
129 129
 	// Bail if activating from network, or bulk.
130
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
130
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
131 131
 		return;
132 132
 	}
133 133
 
134 134
 	// Add the transient to redirect.
135
-	Give_Cache::set( '_give_activation_redirect', true, 30, true );
135
+	Give_Cache::set('_give_activation_redirect', true, 30, true);
136 136
 
137 137
 	// Set 'Donation Form' meta box enabled by default.
138 138
 	give_nav_donation_metabox_enabled();
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
  * @param  int $site_id The Site ID.
153 153
  * @param  array $meta Blog Meta.
154 154
  */
155
-function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
155
+function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
156 156
 
157
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
157
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
158 158
 
159
-		switch_to_blog( $blog_id );
159
+		switch_to_blog($blog_id);
160 160
 		give_install();
161 161
 		restore_current_blog();
162 162
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 }
166 166
 
167
-add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 );
167
+add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6);
168 168
 
169 169
 
170 170
 /**
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return array          The tables to drop.
179 179
  */
180
-function give_wpmu_drop_tables( $tables, $blog_id ) {
180
+function give_wpmu_drop_tables($tables, $blog_id) {
181 181
 
182
-	switch_to_blog( $blog_id );
182
+	switch_to_blog($blog_id);
183 183
 	$donors_db     = new Give_DB_Donors();
184 184
 	$donor_meta_db = new Give_DB_Donor_Meta();
185 185
 
186
-	if ( $donors_db->installed() ) {
186
+	if ($donors_db->installed()) {
187 187
 		$tables[] = $donors_db->table_name;
188 188
 		$tables[] = $donor_meta_db->table_name;
189 189
 	}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
 }
195 195
 
196
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
196
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
197 197
 
198 198
 /**
199 199
  * Post-installation
@@ -205,16 +205,16 @@  discard block
 block discarded – undo
205 205
  */
206 206
 function give_after_install() {
207 207
 
208
-	if ( ! is_admin() ) {
208
+	if ( ! is_admin()) {
209 209
 		return;
210 210
 	}
211 211
 
212
-	$give_options     = Give_Cache::get( '_give_installed', true );
213
-	$give_table_check = get_option( '_give_table_check', false );
212
+	$give_options     = Give_Cache::get('_give_installed', true);
213
+	$give_table_check = get_option('_give_table_check', false);
214 214
 
215
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
215
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
216 216
 
217
-		if ( ! @Give()->donor_meta->installed() ) {
217
+		if ( ! @Give()->donor_meta->installed()) {
218 218
 
219 219
 			// Create the donor meta database.
220 220
 			// (this ensures it creates it on multisite instances where it is network activated).
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
 		}
224 224
 
225
-		if ( ! @Give()->donors->installed() ) {
225
+		if ( ! @Give()->donors->installed()) {
226 226
 			// Create the donor database.
227 227
 			// (this ensures it creates it on multisite instances where it is network activated).
228 228
 			@Give()->donors->create_table();
@@ -234,22 +234,22 @@  discard block
 block discarded – undo
234 234
 			 *
235 235
 			 * @param array $give_options Give plugin options.
236 236
 			 */
237
-			do_action( 'give_after_install', $give_options );
237
+			do_action('give_after_install', $give_options);
238 238
 		}
239 239
 
240
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) );
240
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS));
241 241
 
242 242
 	}
243 243
 
244 244
 	// Delete the transient
245
-	if ( false !== $give_options ) {
246
-		Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) );
245
+	if (false !== $give_options) {
246
+		Give_Cache::delete(Give_Cache::get_key('_give_installed'));
247 247
 	}
248 248
 
249 249
 
250 250
 }
251 251
 
252
-add_action( 'admin_init', 'give_after_install' );
252
+add_action('admin_init', 'give_after_install');
253 253
 
254 254
 
255 255
 /**
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 
265 265
 	global $wp_roles;
266 266
 
267
-	if ( ! is_object( $wp_roles ) ) {
267
+	if ( ! is_object($wp_roles)) {
268 268
 		return;
269 269
 	}
270 270
 
271
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
271
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
272 272
 
273 273
 		// Create Give plugin roles
274 274
 		$roles = new Give_Roles();
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
 }
281 281
 
282
-add_action( 'admin_init', 'give_install_roles_on_network' );
282
+add_action('admin_init', 'give_install_roles_on_network');
283 283
 
284 284
 /**
285 285
  * Default core setting values.
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 		'uninstall_on_delete'                         => 'disabled',
316 316
 		'the_content_filter'                          => 'enabled',
317 317
 		'scripts_footer'                              => 'disabled',
318
-		'agree_to_terms_label'                        => __( 'Agree to Terms?', 'give' ),
318
+		'agree_to_terms_label'                        => __('Agree to Terms?', 'give'),
319 319
 		'agreement_text'                              => give_get_default_agreement_text(),
320 320
 
321 321
 		// Paypal IPN verification.
322 322
 		'paypal_verification'                         => 'enabled',
323 323
 
324 324
 		// Default is manual gateway.
325
-		'gateways'                                    => array( 'manual' => 1, 'offline' => 1 ),
325
+		'gateways'                                    => array('manual' => 1, 'offline' => 1),
326 326
 		'default_gateway'                             => 'manual',
327 327
 
328 328
 		// Offline gateway setup.
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function give_get_default_agreement_text() {
349 349
 
350
-	$org_name = get_bloginfo( 'name' );
350
+	$org_name = get_bloginfo('name');
351 351
 
352 352
 	$agreement = sprintf(
353 353
 		'<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The  %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the  %1$s.</p>
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		$org_name
362 362
 	);
363 363
 
364
-	return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name );
364
+	return apply_filters('give_get_default_agreement_text', $agreement, $org_name);
365 365
 }
366 366
 
367 367
 
@@ -370,22 +370,22 @@  discard block
 block discarded – undo
370 370
  *
371 371
  * @since 1.8.11
372 372
  */
373
-function give_create_pages(){
373
+function give_create_pages() {
374 374
 
375 375
 	// Bailout if pages already created.
376
-	if( get_option( 'give_install_pages_created') ) {
376
+	if (get_option('give_install_pages_created')) {
377 377
 		return false;
378 378
 	}
379 379
 
380 380
 	$options = array();
381 381
 
382 382
 	// Checks if the Success Page option exists AND that the page exists.
383
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
383
+	if ( ! get_post(give_get_option('success_page'))) {
384 384
 
385 385
 		// Donation Confirmation (Success) Page
386 386
 		$success = wp_insert_post(
387 387
 			array(
388
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
388
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
389 389
 				'post_content'   => '[give_receipt]',
390 390
 				'post_status'    => 'publish',
391 391
 				'post_author'    => 1,
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
 	}
400 400
 
401 401
 	// Checks if the Failure Page option exists AND that the page exists.
402
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
402
+	if ( ! get_post(give_get_option('failure_page'))) {
403 403
 
404 404
 		// Failed Donation Page
405 405
 		$failed = wp_insert_post(
406 406
 			array(
407
-				'post_title'     => esc_html__( 'Donation Failed', 'give' ),
408
-				'post_content'   => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ),
407
+				'post_title'     => esc_html__('Donation Failed', 'give'),
408
+				'post_content'   => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'),
409 409
 				'post_status'    => 'publish',
410 410
 				'post_author'    => 1,
411 411
 				'post_type'      => 'page',
@@ -417,11 +417,11 @@  discard block
 block discarded – undo
417 417
 	}
418 418
 
419 419
 	// Checks if the History Page option exists AND that the page exists.
420
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
420
+	if ( ! get_post(give_get_option('history_page'))) {
421 421
 		// Donation History Page
422 422
 		$history = wp_insert_post(
423 423
 			array(
424
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
424
+				'post_title'     => esc_html__('Donation History', 'give'),
425 425
 				'post_content'   => '[donation_history]',
426 426
 				'post_status'    => 'publish',
427 427
 				'post_author'    => 1,
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
 		$options['history_page'] = $history;
434 434
 	}
435 435
 
436
-	if( ! empty( $options ) ) {
437
-		update_option( 'give_settings', array_merge( give_get_settings(), $options ) );
436
+	if ( ! empty($options)) {
437
+		update_option('give_settings', array_merge(give_get_settings(), $options));
438 438
 	}
439 439
 
440
-	add_option( 'give_install_pages_created', 1, '', 'no' );
440
+	add_option('give_install_pages_created', 1, '', 'no');
441 441
 }
442
-add_action( 'admin_init', 'give_create_pages', -1 );
442
+add_action('admin_init', 'give_create_pages', -1);
Please login to merge, or discard this patch.
includes/admin/reports/class-donor-reports-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
@@ -185,8 +185,8 @@
 block discarded – undo
185 185
 				
186 186
 			case 'num_donations' :
187 187
 				$value = '<a href="' .
188
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
-				         ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
188
+						 admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
+						 ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
190 190
 				break;
191 191
 
192 192
 			case 'amount_spent' :
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 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
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		global $status, $page;
63 63
 
64 64
 		// Set parent defaults
65
-		parent::__construct( array(
66
-			'singular' => esc_html__( 'Donor', 'give' ),     // Singular name of the listed records
67
-			'plural'   => esc_html__( 'Donors', 'give' ),    // Plural name of the listed records
68
-			'ajax'     => false,// Does this table support ajax?
69
-		) );
65
+		parent::__construct(array(
66
+			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records
67
+			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records
68
+			'ajax'     => false, // Does this table support ajax?
69
+		));
70 70
 
71 71
 	}
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return false
85 85
 	 */
86
-	public function search_box( $text, $input_id ) {
86
+	public function search_box($text, $input_id) {
87 87
 		return false;
88 88
 	}
89 89
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return void
100 100
 	 */
101
-	public function give_search_box( $text, $input_id ) {
102
-		$input_id = $input_id . '-search-input';
101
+	public function give_search_box($text, $input_id) {
102
+		$input_id = $input_id.'-search-input';
103 103
 
104
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
105
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
104
+		if ( ! empty($_REQUEST['orderby'])) {
105
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
106 106
 		}
107
-		if ( ! empty( $_REQUEST['order'] ) ) {
108
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
107
+		if ( ! empty($_REQUEST['order'])) {
108
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
109 109
 		}
110 110
 		?>
111 111
 		<p class="search-box donor-search" role="search">
112 112
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
113 113
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
114
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
114
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
115 115
 		</p>
116 116
 	<?php
117 117
 	}
@@ -124,33 +124,33 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param string $which
126 126
 	 */
127
-	protected function display_tablenav( $which ) {
127
+	protected function display_tablenav($which) {
128 128
 
129
-		if ( 'top' === $which ) {
130
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
129
+		if ('top' === $which) {
130
+			wp_nonce_field('bulk-'.$this->_args['plural']);
131 131
 		}
132 132
 		?>
133
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
133
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
134 134
 
135
-			<?php if ( 'top' === $which ) { ?>
135
+			<?php if ('top' === $which) { ?>
136 136
 				<h3 class="alignleft reports-earnings-title">
137
-					<span><?php esc_html_e( 'Donors Report', 'give' ); ?></span>
137
+					<span><?php esc_html_e('Donors Report', 'give'); ?></span>
138 138
 				</h3>
139 139
 			<?php } ?>
140 140
 
141 141
 			<div class="alignright tablenav-right">
142 142
 				<div class="actions bulkactions">
143 143
 					<?php
144
-					if ( 'top' === $which ) {
145
-						$this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' );
144
+					if ('top' === $which) {
145
+						$this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search');
146 146
 					}
147 147
 
148
-					$this->bulk_actions( $which ); ?>
148
+					$this->bulk_actions($which); ?>
149 149
 
150 150
 				</div>
151 151
 				<?php
152
-				$this->extra_tablenav( $which );
153
-				$this->pagination( $which );
152
+				$this->extra_tablenav($which);
153
+				$this->pagination($which);
154 154
 				?>
155 155
 			</div>
156 156
 
@@ -172,33 +172,33 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string Column Name
174 174
 	 */
175
-	public function column_default( $item, $column_name ) {
175
+	public function column_default($item, $column_name) {
176 176
 
177
-		switch ( $column_name ) {
177
+		switch ($column_name) {
178 178
 
179 179
 			case 'name' :
180
-				$name = '#' . $item['id'] . ' ';
181
-				$name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>';
182
-				$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] );
183
-				$value    = '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>';
180
+				$name = '#'.$item['id'].' ';
181
+				$name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>';
182
+				$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']);
183
+				$value    = '<a href="'.esc_url($view_url).'">'.$name.'</a>';
184 184
 				break;
185 185
 
186 186
 			case 'num_donations' :
187
-				$value = '<a href="' .
188
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
-				         ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
187
+				$value = '<a href="'.
188
+				         admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
189
+				         ).'">'.esc_html($item['num_donations']).'</a>';
190 190
 				break;
191 191
 
192 192
 			case 'amount_spent' :
193
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
193
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
194 194
 				break;
195 195
 
196 196
 			default:
197
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
197
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
198 198
 				break;
199 199
 		}
200 200
 
201
-		return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] );
201
+		return apply_filters("give_report_column_{$column_name}", $value, $item['id']);
202 202
 	}
203 203
 
204 204
 	/**
@@ -210,13 +210,13 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function get_columns() {
212 212
 		$columns = array(
213
-			'name'          => __( 'Name', 'give' ),
214
-			'email'         => __( 'Email', 'give' ),
215
-			'num_donations' => __( 'Donations', 'give' ),
216
-			'amount_spent'  => __( 'Total Donated', 'give' ),
213
+			'name'          => __('Name', 'give'),
214
+			'email'         => __('Email', 'give'),
215
+			'num_donations' => __('Donations', 'give'),
216
+			'amount_spent'  => __('Total Donated', 'give'),
217 217
 		);
218 218
 
219
-		return apply_filters( 'give_report_donor_columns', $columns );
219
+		return apply_filters('give_report_donor_columns', $columns);
220 220
 
221 221
 	}
222 222
 
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	public function get_sortable_columns() {
231 231
 		return array(
232
-			'id'            => array( 'id', true ),
233
-			'name'          => array( 'name', true ),
234
-			'num_donations' => array( 'purchase_count', false ),
235
-			'amount_spent'  => array( 'purchase_value', false ),
232
+			'id'            => array('id', true),
233
+			'name'          => array('name', true),
234
+			'num_donations' => array('purchase_count', false),
235
+			'amount_spent'  => array('purchase_value', false),
236 236
 		);
237 237
 	}
238 238
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @since  1.0
244 244
 	 * @return void
245 245
 	 */
246
-	public function bulk_actions( $which = '' ) {
246
+	public function bulk_actions($which = '') {
247 247
 
248 248
 	}
249 249
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @return int Current page number
256 256
 	 */
257 257
 	public function get_paged() {
258
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
258
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
259 259
 	}
260 260
 
261 261
 	/**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * @return mixed string If search is present, false otherwise
267 267
 	 */
268 268
 	public function get_search() {
269
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
269
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
270 270
 	}
271 271
 
272 272
 	/**
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 
286 286
 		// Get donor query.
287 287
 		$args   = $this->get_donor_query();
288
-		$donors = Give()->donors->get_donors( $args );
288
+		$donors = Give()->donors->get_donors($args);
289 289
 
290
-		if ( $donors ) {
290
+		if ($donors) {
291 291
 
292
-			$this->count = count( $donors );
292
+			$this->count = count($donors);
293 293
 
294
-			foreach ( $donors as $donor ) {
294
+			foreach ($donors as $donor) {
295 295
 
296
-				$user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0;
296
+				$user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0;
297 297
 
298 298
 				$data[] = array(
299 299
 					'id'            => $donor->id,
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 
322 322
 		$_donor_query['number'] = -1;
323 323
 		$_donor_query['offset'] = 0;
324
-		$donors = Give()->donors->get_donors( $_donor_query );
324
+		$donors = Give()->donors->get_donors($_donor_query);
325 325
 
326
-		return count( $donors );
326
+		return count($donors);
327 327
 	}
328 328
 
329 329
 	/**
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 	 */
336 336
 	public function get_donor_query() {
337 337
 		$paged   = $this->get_paged();
338
-		$offset  = $this->per_page * ( $paged - 1 );
338
+		$offset  = $this->per_page * ($paged - 1);
339 339
 		$search  = $this->get_search();
340
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
341
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
340
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
341
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
342 342
 
343 343
 		$args = array(
344 344
 			'number'  => $this->per_page,
@@ -347,10 +347,10 @@  discard block
 block discarded – undo
347 347
 			'orderby' => $orderby,
348 348
 		);
349 349
 
350
-		if( $search ) {
351
-			if ( is_email( $search ) ) {
350
+		if ($search) {
351
+			if (is_email($search)) {
352 352
 				$args['email'] = $search;
353
-			} elseif ( is_numeric( $search ) ) {
353
+			} elseif (is_numeric($search)) {
354 354
 				$args['id'] = $search;
355 355
 			} else {
356 356
 				$args['name'] = $search;
@@ -377,16 +377,16 @@  discard block
 block discarded – undo
377 377
 		$hidden   = array(); // No hidden columns
378 378
 		$sortable = $this->get_sortable_columns();
379 379
 
380
-		$this->_column_headers = array( $columns, $hidden, $sortable );
380
+		$this->_column_headers = array($columns, $hidden, $sortable);
381 381
 
382 382
 		$this->items = $this->reports_data();
383 383
 
384 384
 		$this->total = $this->get_donor_count();
385 385
 
386
-		$this->set_pagination_args( array(
386
+		$this->set_pagination_args(array(
387 387
 			'total_items' => $this->total,
388 388
 			'per_page'    => $this->per_page,
389
-			'total_pages' => ceil( $this->total / $this->per_page ),
390
-		) );
389
+			'total_pages' => ceil($this->total / $this->per_page),
390
+		));
391 391
 	}
392 392
 }
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +71 added lines, -71 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'         => __( 'Amount', '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'         => __('Amount', '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_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
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,59 +66,59 @@  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
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form_category':
74
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
74
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
75 75
 				break;
76 76
 			case 'form_tag':
77
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
77
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
78 78
 				break;
79 79
 			case 'price':
80
-				if ( give_has_variable_prices( $post_id ) ) {
81
-					echo give_price_range( $post_id );
80
+				if (give_has_variable_prices($post_id)) {
81
+					echo give_price_range($post_id);
82 82
 				} else {
83
-					echo give_price( $post_id, false );
84
-					echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />';
83
+					echo give_price($post_id, false);
84
+					echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />';
85 85
 				}
86 86
 				break;
87 87
 			case 'goal':
88
-				if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) {
89
-					echo give_goal( $post_id, false );
88
+				if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) {
89
+					echo give_goal($post_id, false);
90 90
 				} else {
91
-					esc_html_e( 'No Goal Set', 'give' );
91
+					esc_html_e('No Goal Set', 'give');
92 92
 				}
93 93
 
94
-				echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />';
94
+				echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />';
95 95
 				break;
96 96
 			case 'donations':
97
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
98
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ) . '">';
99
-					echo give_get_form_sales_stats( $post_id );
97
+				if (current_user_can('view_give_form_stats', $post_id)) {
98
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)).'">';
99
+					echo give_get_form_sales_stats($post_id);
100 100
 					echo '</a>';
101 101
 				} else {
102 102
 					echo '-';
103 103
 				}
104 104
 				break;
105 105
 			case 'earnings':
106
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
107
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ) . '">';
108
-					echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) );
106
+				if (current_user_can('view_give_form_stats', $post_id)) {
107
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)).'">';
108
+					echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id)));
109 109
 					echo '</a>';
110 110
 				} else {
111 111
 					echo '-';
112 112
 				}
113 113
 				break;
114 114
 			case 'shortcode':
115
-				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;' . absint( $post_id ) . '&#34;]">';
115
+				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;'.absint($post_id).'&#34;]">';
116 116
 				break;
117 117
 		}// End switch().
118 118
 	}// End if().
119 119
 }
120 120
 
121
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
121
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
122 122
 
123 123
 /**
124 124
  * Registers the sortable columns in the list table
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  *
130 130
  * @return array $columns Array of sortable columns
131 131
  */
132
-function give_sortable_form_columns( $columns ) {
132
+function give_sortable_form_columns($columns) {
133 133
 	$columns['price']     = 'amount';
134 134
 	$columns['sales']     = 'sales';
135 135
 	$columns['earnings']  = 'earnings';
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	return $columns;
140 140
 }
141 141
 
142
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
142
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
143 143
 
144 144
 /**
145 145
  * Sorts Columns in the Forms List Table
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
  *
151 151
  * @return array $vars Array of all the sort variables.
152 152
  */
153
-function give_sort_forms( $vars ) {
153
+function give_sort_forms($vars) {
154 154
 	// Check if we're viewing the "give_forms" post type.
155
-	if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) {
155
+	if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) {
156 156
 		return $vars;
157 157
 	}
158 158
 
159
-	switch ( $vars['orderby'] ) {
159
+	switch ($vars['orderby']) {
160 160
 		// Check if 'orderby' is set to "sales".
161 161
 		case 'sales':
162 162
 			$vars = array_merge(
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 		// Check if "orderby" is set to "price/amount".
183 183
 		case 'amount':
184
-			$multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
184
+			$multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
185 185
 
186 186
 			$vars['orderby']    = 'meta_value_num';
187 187
 			$vars['meta_query'] = array(
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
  *
234 234
  * @return array       Array of all sort variables.
235 235
  */
236
-function give_filter_forms( $vars ) {
237
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
236
+function give_filter_forms($vars) {
237
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
238 238
 
239 239
 		// If an author ID was passed, use it
240
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
240
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
241 241
 
242 242
 			$author_id = $_REQUEST['author'];
243
-			if ( (int) $author_id !== get_current_user_id() ) {
244
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array(
243
+			if ((int) $author_id !== get_current_user_id()) {
244
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array(
245 245
 					'response' => 403,
246
-				) );
246
+				));
247 247
 			}
248 248
 			$vars = array_merge(
249 249
 				$vars,
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
  * @return void
268 268
  */
269 269
 function give_forms_load() {
270
-	add_filter( 'request', 'give_sort_forms' );
271
-	add_filter( 'request', 'give_filter_forms' );
270
+	add_filter('request', 'give_sort_forms');
271
+	add_filter('request', 'give_filter_forms');
272 272
 }
273 273
 
274
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
274
+add_action('load-edit.php', 'give_forms_load', 9999);
275 275
 
276 276
 /**
277 277
  * Remove Forms Month Filter
@@ -285,17 +285,17 @@  discard block
 block discarded – undo
285 285
  * @global      $typenow The post type we are viewing.
286 286
  * @return array Empty array disables the dropdown.
287 287
  */
288
-function give_remove_month_filter( $dates ) {
288
+function give_remove_month_filter($dates) {
289 289
 	global $typenow;
290 290
 
291
-	if ( $typenow == 'give_forms' ) {
291
+	if ($typenow == 'give_forms') {
292 292
 		$dates = array();
293 293
 	}
294 294
 
295 295
 	return $dates;
296 296
 }
297 297
 
298
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
298
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
299 299
 
300 300
 /**
301 301
  * Updates price when saving post
@@ -306,23 +306,23 @@  discard block
 block discarded – undo
306 306
  *
307 307
  * @return int|null
308 308
  */
309
-function give_price_save_quick_edit( $post_id ) {
310
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
309
+function give_price_save_quick_edit($post_id) {
310
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
311 311
 		return;
312 312
 	}
313
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
313
+	if ( ! current_user_can('edit_post', $post_id)) {
314 314
 		return $post_id;
315 315
 	}
316
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
316
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
317 317
 		return $post_id;
318 318
 	}
319 319
 
320
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
321
-		give_update_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) );
320
+	if (isset($_REQUEST['_give_regprice'])) {
321
+		give_update_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice'])));
322 322
 	}
323 323
 }
324 324
 
325
-add_action( 'save_post', 'give_price_save_quick_edit' );
325
+add_action('save_post', 'give_price_save_quick_edit');
326 326
 
327 327
 /**
328 328
  * Process bulk edit actions via AJAX
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
  */
333 333
 function give_save_bulk_edit() {
334 334
 
335
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
335
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
336 336
 
337
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
338
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
339
-		foreach ( $post_ids as $post_id ) {
337
+	if ( ! empty($post_ids) && is_array($post_ids)) {
338
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
339
+		foreach ($post_ids as $post_id) {
340 340
 
341
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
341
+			if ( ! current_user_can('edit_post', $post_id)) {
342 342
 				continue;
343 343
 			}
344 344
 
345
-			if ( ! empty( $price ) ) {
346
-				give_update_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) );
345
+			if ( ! empty($price)) {
346
+				give_update_meta($post_id, '_give_set_price', give_sanitize_amount($price));
347 347
 			}
348 348
 		}
349 349
 	}
@@ -351,4 +351,4 @@  discard block
 block discarded – undo
351 351
 	die();
352 352
 }
353 353
 
354
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
354
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -25,48 +25,48 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ) :
49
+		case version_compare($give_version, '1.8.7', '<') :
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 
53
-		case version_compare( $give_version, '1.8.8', '<' ) :
53
+		case version_compare($give_version, '1.8.8', '<') :
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ) :
57
+		case version_compare($give_version, '1.8.9', '<') :
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61 61
 	}
62 62
 
63
-	if ( $did_upgrade ) {
64
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
63
+	if ($did_upgrade) {
64
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
65 65
 	}
66 66
 }
67 67
 
68
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
69
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
68
+add_action('admin_init', 'give_do_automatic_upgrades');
69
+add_action('give_upgrades', 'give_do_automatic_upgrades');
70 70
 
71 71
 /**
72 72
  * Display Upgrade Notices
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
  *
79 79
  * @return void
80 80
  */
81
-function give_show_upgrade_notices( $give_updates ) {
81
+function give_show_upgrade_notices($give_updates) {
82 82
 	// v1.3.2 Upgrades
83 83
 	$give_updates->register(
84 84
 		array(
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	);
118 118
 }
119 119
 
120
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
120
+add_action('give_register_updates', 'give_show_upgrade_notices');
121 121
 
122 122
 /**
123 123
  * Triggers all upgrade functions
@@ -129,29 +129,29 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function give_trigger_upgrades() {
131 131
 
132
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
133
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
132
+	if ( ! current_user_can('manage_give_settings')) {
133
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
134 134
 			'response' => 403,
135
-		) );
135
+		));
136 136
 	}
137 137
 
138
-	$give_version = get_option( 'give_version' );
138
+	$give_version = get_option('give_version');
139 139
 
140
-	if ( ! $give_version ) {
140
+	if ( ! $give_version) {
141 141
 		// 1.0 is the first version to use this option so we must add it.
142 142
 		$give_version = '1.0';
143
-		add_option( 'give_version', $give_version );
143
+		add_option('give_version', $give_version);
144 144
 	}
145 145
 
146
-	update_option( 'give_version', GIVE_VERSION );
147
-	delete_option( 'give_doing_upgrade' );
146
+	update_option('give_version', GIVE_VERSION);
147
+	delete_option('give_doing_upgrade');
148 148
 
149
-	if ( DOING_AJAX ) {
150
-		die( 'complete' );
149
+	if (DOING_AJAX) {
150
+		die('complete');
151 151
 	} // End if().
152 152
 }
153 153
 
154
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
154
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
155 155
 
156 156
 /**
157 157
  * Check if the upgrade routine has been run for a specific action
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
  *
163 163
  * @return bool                   If the action has been added to the completed actions array
164 164
  */
165
-function give_has_upgrade_completed( $upgrade_action = '' ) {
165
+function give_has_upgrade_completed($upgrade_action = '') {
166 166
 
167
-	if ( empty( $upgrade_action ) ) {
167
+	if (empty($upgrade_action)) {
168 168
 		return false;
169 169
 	}
170 170
 
171 171
 	$completed_upgrades = give_get_completed_upgrades();
172 172
 
173
-	return in_array( $upgrade_action, $completed_upgrades );
173
+	return in_array($upgrade_action, $completed_upgrades);
174 174
 
175 175
 }
176 176
 
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
183 183
  */
184 184
 function give_maybe_resume_upgrade() {
185
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
186
-	if ( empty( $doing_upgrade ) ) {
185
+	$doing_upgrade = get_option('give_doing_upgrade', false);
186
+	if (empty($doing_upgrade)) {
187 187
 		return false;
188 188
 	}
189 189
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
  *
200 200
  * @return bool                   If the function was successfully added
201 201
  */
202
-function give_set_upgrade_complete( $upgrade_action = '' ) {
202
+function give_set_upgrade_complete($upgrade_action = '') {
203 203
 
204
-	if ( empty( $upgrade_action ) ) {
204
+	if (empty($upgrade_action)) {
205 205
 		return false;
206 206
 	}
207 207
 
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 	$completed_upgrades[] = $upgrade_action;
210 210
 
211 211
 	// Remove any blanks, and only show uniques.
212
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
212
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
213 213
 
214 214
 	/**
215 215
 	 * Fire the action when any upgrade set to complete.
216 216
 	 *
217 217
 	 * @since 1.8.12
218 218
 	 */
219
-	do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades );
219
+	do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades);
220 220
 
221
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
221
+	return update_option('give_completed_upgrades', $completed_upgrades);
222 222
 }
223 223
 
224 224
 /**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function give_get_completed_upgrades() {
231 231
 
232
-	return (array) get_option( 'give_completed_upgrades' );
232
+	return (array) get_option('give_completed_upgrades');
233 233
 
234 234
 }
235 235
 
@@ -246,24 +246,24 @@  discard block
 block discarded – undo
246 246
 	/* @var Give_Updates $give_updates */
247 247
 	$give_updates = Give_Updates::get_instance();
248 248
 
249
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
250
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
249
+	if ( ! current_user_can('manage_give_settings')) {
250
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
251 251
 			'response' => 403,
252
-		) );
252
+		));
253 253
 	}
254 254
 
255
-	ignore_user_abort( true );
255
+	ignore_user_abort(true);
256 256
 
257
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
258
-		@set_time_limit( 0 );
257
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
258
+		@set_time_limit(0);
259 259
 	}
260 260
 
261 261
 	// UPDATE DB METAKEYS.
262 262
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
263
-	$query = $wpdb->query( $sql );
263
+	$query = $wpdb->query($sql);
264 264
 
265 265
 	$give_updates::$percentage = 100;
266
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
266
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
267 267
 }
268 268
 
269 269
 
@@ -287,24 +287,24 @@  discard block
 block discarded – undo
287 287
 	$where  .= "AND ( p.post_status = 'abandoned' )";
288 288
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
289 289
 
290
-	$sql            = $select . $join . $where;
291
-	$found_payments = $wpdb->get_col( $sql );
290
+	$sql            = $select.$join.$where;
291
+	$found_payments = $wpdb->get_col($sql);
292 292
 
293
-	foreach ( $found_payments as $payment ) {
293
+	foreach ($found_payments as $payment) {
294 294
 
295 295
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
296
-		$modified_time = get_post_modified_time( 'U', false, $payment );
296
+		$modified_time = get_post_modified_time('U', false, $payment);
297 297
 
298 298
 		// 1450124863 =  12/10/2015 20:42:25.
299
-		if ( $modified_time >= 1450124863 ) {
299
+		if ($modified_time >= 1450124863) {
300 300
 
301
-			give_update_payment_status( $payment, 'pending' );
301
+			give_update_payment_status($payment, 'pending');
302 302
 
303 303
 		}
304 304
 	}
305 305
 
306 306
 	$give_updates::$percentage = 100;
307
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
307
+	give_set_upgrade_complete('upgrade_give_offline_status');
308 308
 }
309 309
 
310 310
 
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function give_v152_cleanup_users() {
319 319
 
320
-	$give_version = get_option( 'give_version' );
320
+	$give_version = get_option('give_version');
321 321
 
322
-	if ( ! $give_version ) {
322
+	if ( ! $give_version) {
323 323
 		// 1.0 is the first version to use this option so we must add it.
324 324
 		$give_version = '1.0';
325 325
 	}
326 326
 
327
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
327
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
328 328
 
329 329
 	// v1.5.2 Upgrades
330
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
330
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
331 331
 
332 332
 		// Delete all caps with "ss".
333 333
 		// Also delete all unused "campaign" roles.
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 		);
375 375
 
376 376
 		global $wp_roles;
377
-		foreach ( $delete_caps as $cap ) {
378
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
379
-				$wp_roles->remove_cap( $role, $cap );
377
+		foreach ($delete_caps as $cap) {
378
+			foreach (array_keys($wp_roles->roles) as $role) {
379
+				$wp_roles->remove_cap($role, $cap);
380 380
 			}
381 381
 		}
382 382
 
@@ -386,15 +386,15 @@  discard block
 block discarded – undo
386 386
 		$roles->add_caps();
387 387
 
388 388
 		// The Update Ran.
389
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
390
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
391
-		delete_option( 'give_doing_upgrade' );
389
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
390
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
391
+		delete_option('give_doing_upgrade');
392 392
 
393 393
 	}// End if().
394 394
 
395 395
 }
396 396
 
397
-add_action( 'admin_init', 'give_v152_cleanup_users' );
397
+add_action('admin_init', 'give_v152_cleanup_users');
398 398
 
399 399
 /**
400 400
  * 1.6 Upgrade routine to create the customer meta table.
@@ -437,53 +437,53 @@  discard block
 block discarded – undo
437 437
 
438 438
 	// Get addons license key.
439 439
 	$addons = array();
440
-	foreach ( $give_options as $key => $value ) {
441
-		if ( false !== strpos( $key, '_license_key' ) ) {
442
-			$addons[ $key ] = $value;
440
+	foreach ($give_options as $key => $value) {
441
+		if (false !== strpos($key, '_license_key')) {
442
+			$addons[$key] = $value;
443 443
 		}
444 444
 	}
445 445
 
446 446
 	// Bailout: We do not have any addon license data to upgrade.
447
-	if ( empty( $addons ) ) {
447
+	if (empty($addons)) {
448 448
 		return false;
449 449
 	}
450 450
 
451
-	foreach ( $addons as $key => $addon_license ) {
451
+	foreach ($addons as $key => $addon_license) {
452 452
 
453 453
 		// Get addon shortname.
454
-		$shortname = str_replace( '_license_key', '', $key );
454
+		$shortname = str_replace('_license_key', '', $key);
455 455
 
456 456
 		// Addon license option name.
457
-		$addon_license_option_name = $shortname . '_license_active';
457
+		$addon_license_option_name = $shortname.'_license_active';
458 458
 
459 459
 		// bailout if license is empty.
460
-		if ( empty( $addon_license ) ) {
461
-			delete_option( $addon_license_option_name );
460
+		if (empty($addon_license)) {
461
+			delete_option($addon_license_option_name);
462 462
 			continue;
463 463
 		}
464 464
 
465 465
 		// Get addon name.
466 466
 		$addon_name       = array();
467
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
468
-		foreach ( $addon_name_parts as $name_part ) {
467
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
468
+		foreach ($addon_name_parts as $name_part) {
469 469
 
470 470
 			// Fix addon name
471
-			switch ( $name_part ) {
471
+			switch ($name_part) {
472 472
 				case 'authorizenet' :
473 473
 					$name_part = 'authorize.net';
474 474
 					break;
475 475
 			}
476 476
 
477
-			$addon_name[] = ucfirst( $name_part );
477
+			$addon_name[] = ucfirst($name_part);
478 478
 		}
479 479
 
480
-		$addon_name = implode( ' ', $addon_name );
480
+		$addon_name = implode(' ', $addon_name);
481 481
 
482 482
 		// Data to send to the API
483 483
 		$api_params = array(
484 484
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
485 485
 			'license'    => $addon_license,
486
-			'item_name'  => urlencode( $addon_name ),
486
+			'item_name'  => urlencode($addon_name),
487 487
 			'url'        => home_url(),
488 488
 		);
489 489
 
@@ -498,17 +498,17 @@  discard block
 block discarded – undo
498 498
 		);
499 499
 
500 500
 		// Make sure there are no errors.
501
-		if ( is_wp_error( $response ) ) {
502
-			delete_option( $addon_license_option_name );
501
+		if (is_wp_error($response)) {
502
+			delete_option($addon_license_option_name);
503 503
 			continue;
504 504
 		}
505 505
 
506 506
 		// Tell WordPress to look for updates.
507
-		set_site_transient( 'update_plugins', null );
507
+		set_site_transient('update_plugins', null);
508 508
 
509 509
 		// Decode license data.
510
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
511
-		update_option( $addon_license_option_name, $license_data );
510
+		$license_data = json_decode(wp_remote_retrieve_body($response));
511
+		update_option($addon_license_option_name, $license_data);
512 512
 	}// End foreach().
513 513
 }
514 514
 
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
 	);
539 539
 
540 540
 	global $wp_roles;
541
-	foreach ( $delete_caps as $cap ) {
542
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
543
-			$wp_roles->remove_cap( $role, $cap );
541
+	foreach ($delete_caps as $cap) {
542
+		foreach (array_keys($wp_roles->roles) as $role) {
543
+			$wp_roles->remove_cap($role, $cap);
544 544
 		}
545 545
 	}
546 546
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 function give_v18_upgrades_core_setting() {
575 575
 	// Core settings which changes from checkbox to radio.
576 576
 	$core_setting_names = array_merge(
577
-		array_keys( give_v18_renamed_core_settings() ),
577
+		array_keys(give_v18_renamed_core_settings()),
578 578
 		array(
579 579
 			'uninstall_on_delete',
580 580
 			'scripts_footer',
@@ -586,48 +586,48 @@  discard block
 block discarded – undo
586 586
 	);
587 587
 
588 588
 	// Bailout: If not any setting define.
589
-	if ( $give_settings = get_option( 'give_settings' ) ) {
589
+	if ($give_settings = get_option('give_settings')) {
590 590
 
591 591
 		$setting_changed = false;
592 592
 
593 593
 		// Loop: check each setting field.
594
-		foreach ( $core_setting_names as $setting_name ) {
594
+		foreach ($core_setting_names as $setting_name) {
595 595
 			// New setting name.
596
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
596
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
597 597
 
598 598
 			// Continue: If setting already set.
599 599
 			if (
600
-				array_key_exists( $new_setting_name, $give_settings )
601
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
600
+				array_key_exists($new_setting_name, $give_settings)
601
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
602 602
 			) {
603 603
 				continue;
604 604
 			}
605 605
 
606 606
 			// Set checkbox value to radio value.
607
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
607
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
608 608
 
609 609
 			// @see https://github.com/WordImpress/Give/issues/1063
610
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
610
+			if (false !== strpos($setting_name, 'disable_')) {
611 611
 
612
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
613
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
612
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
613
+			} elseif (false !== strpos($setting_name, 'enable_')) {
614 614
 
615
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
615
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
616 616
 			}
617 617
 
618 618
 			// Tell bot to update core setting to db.
619
-			if ( ! $setting_changed ) {
619
+			if ( ! $setting_changed) {
620 620
 				$setting_changed = true;
621 621
 			}
622 622
 		}
623 623
 
624 624
 		// Update setting only if they changed.
625
-		if ( $setting_changed ) {
626
-			update_option( 'give_settings', $give_settings );
625
+		if ($setting_changed) {
626
+			update_option('give_settings', $give_settings);
627 627
 		}
628 628
 	}// End if().
629 629
 
630
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
630
+	give_set_upgrade_complete('v18_upgrades_core_setting');
631 631
 }
632 632
 
633 633
 /**
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 	$give_updates = Give_Updates::get_instance();
642 642
 
643 643
 	// form query
644
-	$forms = new WP_Query( array(
644
+	$forms = new WP_Query(array(
645 645
 			'paged'          => $give_updates::$step,
646 646
 			'status'         => 'any',
647 647
 			'order'          => 'ASC',
@@ -650,43 +650,43 @@  discard block
 block discarded – undo
650 650
 		)
651 651
 	);
652 652
 
653
-	if ( $forms->have_posts() ) {
654
-		$give_updates::$percentage = ( ( $give_updates::$step * 20 ) / $forms->found_posts  ) * 100;
653
+	if ($forms->have_posts()) {
654
+		$give_updates::$percentage = (($give_updates::$step * 20) / $forms->found_posts) * 100;
655 655
 
656
-		error_log( print_r( "{$give_updates::$step}-{$forms->found_posts}-{$give_updates::$percentage}", true ) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log' );
656
+		error_log(print_r("{$give_updates::$step}-{$forms->found_posts}-{$give_updates::$percentage}", true)."\n", 3, WP_CONTENT_DIR.'/debug_new.log');
657 657
 
658
-		while ( $forms->have_posts() ) {
658
+		while ($forms->have_posts()) {
659 659
 			$forms->the_post();
660 660
 
661 661
 			// Form content.
662 662
 			// Note in version 1.8 display content setting split into display content and content placement setting.
663 663
 			// You can delete _give_content_option in future
664
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
665
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
666
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
667
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
664
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
665
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
666
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
667
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
668 668
 
669
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
670
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
669
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
670
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
671 671
 			}
672 672
 
673 673
 			// "Disable" Guest Donation. Checkbox
674 674
 			// See: https://github.com/WordImpress/Give/issues/1470
675
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
676
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
677
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
675
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
676
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
677
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
678 678
 
679 679
 			// Offline Donations
680 680
 			// See: https://github.com/WordImpress/Give/issues/1579
681
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
682
-			if ( 'no' === $offline_donation ) {
681
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
682
+			if ('no' === $offline_donation) {
683 683
 				$offline_donation_newval = 'global';
684
-			} elseif ( 'yes' === $offline_donation ) {
684
+			} elseif ('yes' === $offline_donation) {
685 685
 				$offline_donation_newval = 'enabled';
686 686
 			} else {
687 687
 				$offline_donation_newval = 'disabled';
688 688
 			}
689
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
689
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
690 690
 
691 691
 			// Convert yes/no setting field to enabled/disabled.
692 692
 			$form_radio_settings = array(
@@ -706,15 +706,15 @@  discard block
 block discarded – undo
706 706
 				'_give_offline_donation_enable_billing_fields_single',
707 707
 			);
708 708
 
709
-			foreach ( $form_radio_settings as $meta_key ) {
709
+			foreach ($form_radio_settings as $meta_key) {
710 710
 				// Get value.
711
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
711
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
712 712
 
713 713
 				// Convert meta value only if it is in yes/no/none.
714
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
714
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
715 715
 
716
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
717
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
716
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
717
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
718 718
 				}
719 719
 			}
720 720
 		}// End while().
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 
724 724
 	} else {
725 725
 		// No more forms found, finish up.
726
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
726
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
727 727
 	}
728 728
 }
729 729
 
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 				'_transient_give_stats_',
773 773
 				'give_cache',
774 774
 				'_transient_give_add_ons_feed',
775
-				'_transient__give_ajax_works' .
775
+				'_transient__give_ajax_works'.
776 776
 				'_transient_give_total_api_keys',
777 777
 				'_transient_give_i18n_give_promo_hide',
778 778
 				'_transient_give_contributors',
@@ -799,24 +799,24 @@  discard block
 block discarded – undo
799 799
 		ARRAY_A
800 800
 	);
801 801
 
802
-	if ( ! empty( $user_apikey_options ) ) {
803
-		foreach ( $user_apikey_options as $user ) {
804
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
805
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
806
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
802
+	if ( ! empty($user_apikey_options)) {
803
+		foreach ($user_apikey_options as $user) {
804
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
805
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
806
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
807 807
 		}
808 808
 	}
809 809
 
810
-	if ( ! empty( $cached_options ) ) {
811
-		foreach ( $cached_options as $option ) {
812
-			switch ( true ) {
813
-				case ( false !== strpos( $option, 'transient' ) ):
814
-					$option = str_replace( '_transient_', '', $option );
815
-					delete_transient( $option );
810
+	if ( ! empty($cached_options)) {
811
+		foreach ($cached_options as $option) {
812
+			switch (true) {
813
+				case (false !== strpos($option, 'transient')):
814
+					$option = str_replace('_transient_', '', $option);
815
+					delete_transient($option);
816 816
 					break;
817 817
 
818 818
 				default:
819
-					delete_option( $option );
819
+					delete_option($option);
820 820
 			}
821 821
 		}
822 822
 	}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 	global $wp_roles;
835 835
 
836 836
 	// Get the role object.
837
-	$give_worker = get_role( 'give_worker' );
837
+	$give_worker = get_role('give_worker');
838 838
 
839 839
 	// A list of capabilities to add for give workers.
840 840
 	$caps_to_add = array(
@@ -842,9 +842,9 @@  discard block
 block discarded – undo
842 842
 		'edit_pages',
843 843
 	);
844 844
 
845
-	foreach ( $caps_to_add as $cap ) {
845
+	foreach ($caps_to_add as $cap) {
846 846
 		// Add the capability.
847
-		$give_worker->add_cap( $cap );
847
+		$give_worker->add_cap($cap);
848 848
 	}
849 849
 
850 850
 }
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 	$give_updates = Give_Updates::get_instance();
862 862
 
863 863
 	// form query
864
-	$donation_forms = new WP_Query( array(
864
+	$donation_forms = new WP_Query(array(
865 865
 			'paged'          => $give_updates::$step,
866 866
 			'status'         => 'any',
867 867
 			'order'          => 'ASC',
@@ -870,10 +870,10 @@  discard block
 block discarded – undo
870 870
 		)
871 871
 	);
872 872
 
873
-	if ( $donation_forms->have_posts() ) {
874
-		$give_updates::$percentage = ( ( $give_updates::$step * 20 ) / $donation_forms->found_posts  ) * 100;
873
+	if ($donation_forms->have_posts()) {
874
+		$give_updates::$percentage = (($give_updates::$step * 20) / $donation_forms->found_posts) * 100;
875 875
 
876
-		while ( $donation_forms->have_posts() ) {
876
+		while ($donation_forms->have_posts()) {
877 877
 			$donation_forms->the_post();
878 878
 			$form_id = get_the_ID();
879 879
 
@@ -881,41 +881,41 @@  discard block
 block discarded – undo
881 881
 			update_post_meta(
882 882
 				$form_id,
883 883
 				'_give_set_price',
884
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
884
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
885 885
 			);
886 886
 
887 887
 			// Remove formatting from _give_custom_amount_minimum
888 888
 			update_post_meta(
889 889
 				$form_id,
890 890
 				'_give_custom_amount_minimum',
891
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
891
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
892 892
 			);
893 893
 
894 894
 			// Bailout.
895
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
895
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
896 896
 				continue;
897 897
 			}
898 898
 
899
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
899
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
900 900
 
901
-			if ( ! empty( $donation_levels ) ) {
901
+			if ( ! empty($donation_levels)) {
902 902
 
903
-				foreach ( $donation_levels as $index => $donation_level ) {
904
-					if ( isset( $donation_level['_give_amount'] ) ) {
905
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
903
+				foreach ($donation_levels as $index => $donation_level) {
904
+					if (isset($donation_level['_give_amount'])) {
905
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
906 906
 					}
907 907
 				}
908 908
 
909
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
909
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
910 910
 
911
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
911
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
912 912
 
913
-				$min_amount = min( $donation_levels_amounts );
914
-				$max_amount = max( $donation_levels_amounts );
913
+				$min_amount = min($donation_levels_amounts);
914
+				$max_amount = max($donation_levels_amounts);
915 915
 
916 916
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
917
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
918
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
917
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
918
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
919 919
 			}
920 920
 
921 921
 		}
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 		wp_reset_postdata();
925 925
 	} else {
926 926
 		// The Update Ran.
927
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
927
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
928 928
 	}
929 929
 
930 930
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<div class="postbox-container">
23 23
 			<div class="postbox">
24 24
 				<div class="inside">
25 25
 					<div class="panel-content">
26
-						<h2><?php _e( 'You have updates. Please <a href="%s">create a backup</a> of your site before updating. It is important to always stay up-to-date with latest versions of Give core and it\'s add-ons. We regularly release new features, bug fixes, and enhancements. To update add-ons be sure your <a href="%s">license keys</a> are active.', 'give' ); ?></h2>
26
+						<h2><?php _e('You have updates. Please <a href="%s">create a backup</a> of your site before updating. It is important to always stay up-to-date with latest versions of Give core and it\'s add-ons. We regularly release new features, bug fixes, and enhancements. To update add-ons be sure your <a href="%s">license keys</a> are active.', 'give'); ?></h2>
27 27
 					</div>
28 28
 				</div>
29 29
 				<!-- .inside -->
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
 		<?php $update_counter = 1; ?>
34 34
 
35 35
 		<?php $db_updates = $give_updates->get_db_update_count(); ?>
36
-		<?php if ( ! empty( $db_updates ) ) : ?>
37
-			<?php $db_update_url = add_query_arg( array( 'type' => 'database' ) ); ?>
36
+		<?php if ( ! empty($db_updates)) : ?>
37
+			<?php $db_update_url = add_query_arg(array('type' => 'database')); ?>
38 38
 			<div id="give-db-updates">
39 39
 				<div class="postbox-container">
40 40
 					<div class="postbox">
41
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
41
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
42 42
 						<div class="inside">
43 43
 							<div class="panel-content">
44
-								<p><?php echo sprintf( __( 'Give needs to update the database. <a href="%s">Update now ></a>', 'give' ), $db_update_url ); ?></p>
44
+								<p><?php echo sprintf(__('Give needs to update the database. <a href="%s">Update now ></a>', 'give'), $db_update_url); ?></p>
45 45
 							</div>
46 46
 							<div class="progress-container give-hidden">
47
-								<strong class="update-message" data-update-count="<?php echo $db_updates; ?>" data-resume-update="<?php echo $give_updates->resume_updates(); ?>"><?php echo sprintf( __( 'Update 1 of %s', 'give' ), $db_updates ); ?></strong>
47
+								<strong class="update-message" data-update-count="<?php echo $db_updates; ?>" data-resume-update="<?php echo $give_updates->resume_updates(); ?>"><?php echo sprintf(__('Update 1 of %s', 'give'), $db_updates); ?></strong>
48 48
 								<div class="progress-content"></div>
49 49
 							</div>
50 50
 						</div>
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 		<?php endif; ?>
56 56
 
57 57
 		<?php $plugin_updates = $give_updates->get_plugin_update_count(); ?>
58
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
59
-			<?php $plugin_update_url = add_query_arg( array( 's' => 'Give' ), admin_url( '/plugins.php' ) ); ?>
58
+		<?php if ( ! empty($plugin_updates)) : ?>
59
+			<?php $plugin_update_url = add_query_arg(array('s' => 'Give'), admin_url('/plugins.php')); ?>
60 60
 			<div id="give-plugin-updates">
61 61
 				<div class="postbox-container">
62 62
 					<div class="postbox">
63
-						<h2 class="hndle"><?php _e( 'Plugin Updates', 'give' ); ?></h2>
63
+						<h2 class="hndle"><?php _e('Plugin Updates', 'give'); ?></h2>
64 64
 						<!--<h2 class="hndle"><span>-->
65 65
 						<?php //echo sprintf( __( 'Update 1 of %s', 'give' ), $db_updates ); ?><!--</span></h2>-->
66 66
 						<div class="inside">
67 67
 							<div class="panel-content">
68
-								<p><?php echo sprintf( __( 'There are %s Give %s that need to be updated. <a href="%s">Update now ></a>', 'give' ), $plugin_updates, _n( 'addon', 'addons', $plugin_updates, 'give' ), $plugin_update_url ); ?></p>
68
+								<p><?php echo sprintf(__('There are %s Give %s that need to be updated. <a href="%s">Update now ></a>', 'give'), $plugin_updates, _n('addon', 'addons', $plugin_updates, 'give'), $plugin_update_url); ?></p>
69 69
 								<?php include_once 'plugins-update-section.php'; ?>
70 70
 							</div>
71 71
 						</div>
Please login to merge, or discard this patch.
includes/admin/upgrades/views/plugins-update-section.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* @var Give_Updates $give_updates */
3
-$plugins = $give_updates->get_updates( 'plugin' );
4
-if( empty( $plugins ) ) {
3
+$plugins = $give_updates->get_updates('plugin');
4
+if (empty($plugins)) {
5 5
 	return;
6 6
 }
7 7
 
8 8
 ob_start();
9
-foreach ( $plugins as $plugin_data ) {
10
-	if ( 'active' != $plugin_data['Status'] ||  'add-on' != $plugin_data['Type'] ) {
9
+foreach ($plugins as $plugin_data) {
10
+	if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) {
11 11
 		continue;
12 12
 	}
13 13
 
@@ -15,39 +15,39 @@  discard block
 block discarded – undo
15 15
 	$author_name = $plugin_data['Author'];
16 16
 
17 17
 	// Link the plugin name to the plugin URL if available.
18
-	if ( ! empty( $plugin_data['PluginURI'] ) ) {
18
+	if ( ! empty($plugin_data['PluginURI'])) {
19 19
 		$plugin_name = sprintf(
20 20
 			'<a href="%s" title="%s">%s</a>(%s)',
21
-			esc_url( $plugin_data['PluginURI'] ),
22
-			esc_attr__( 'Visit plugin homepage' , 'give' ),
21
+			esc_url($plugin_data['PluginURI']),
22
+			esc_attr__('Visit plugin homepage', 'give'),
23 23
 			$plugin_name,
24
-			esc_html( $plugin_data['Version'] )
24
+			esc_html($plugin_data['Version'])
25 25
 		);
26 26
 	}
27 27
 
28 28
 	// Link the author name to the author URL if available.
29
-	if ( ! empty( $plugin_data['AuthorURI'] ) ) {
29
+	if ( ! empty($plugin_data['AuthorURI'])) {
30 30
 		$author_name = sprintf(
31 31
 			'<a href="%s" title="%s">%s</a>',
32
-			esc_url( $plugin_data['AuthorURI'] ),
33
-			esc_attr__( 'Visit author homepage' , 'give' ),
32
+			esc_url($plugin_data['AuthorURI']),
33
+			esc_attr__('Visit author homepage', 'give'),
34 34
 			$author_name
35 35
 		);
36 36
 	}
37 37
 	?>
38 38
 	<tr>
39
-		<td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td>
39
+		<td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td>
40 40
 		<td>
41 41
 			<?php
42 42
 			echo sprintf(
43 43
 				'<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> %s',
44
-				( true === $plugin_data['License'] ? __( 'Licensed', 'give' ) : __( 'Unlicensed', 'give' ) )
44
+				(true === $plugin_data['License'] ? __('Licensed', 'give') : __('Unlicensed', 'give'))
45 45
 			);
46 46
 
47 47
 			echo sprintf(
48 48
 				' &ndash; %s &ndash; %s',
49
-				sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ),
50
-				sprintf( __( '( Latest Version: %s )' ), $plugin_data['update']->new_version )
49
+				sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))),
50
+				sprintf(__('( Latest Version: %s )'), $plugin_data['update']->new_version)
51 51
 			);
52 52
 			?>
53 53
 		</td>
Please login to merge, or discard this patch.
includes/admin/upgrades/class-give-updates.php 1 patch
Spacing   +73 added lines, -74 removed lines patch added patch discarded remove patch
@@ -72,24 +72,24 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param array $args
74 74
 	 */
75
-	public function register( $args ) {
75
+	public function register($args) {
76 76
 		$args_default = array(
77 77
 			'id'       => '',
78 78
 			'version'  => '',
79 79
 			'callback' => '',
80 80
 		);
81 81
 
82
-		$args = wp_parse_args( $args, $args_default );
82
+		$args = wp_parse_args($args, $args_default);
83 83
 
84 84
 		// You can only register database upgrade.
85 85
 		$args['type'] = 'database';
86 86
 
87 87
 		// Bailout.
88
-		if ( empty( $args['id'] ) || empty( $args['version'] ) || empty( $args['callback'] ) || ! is_callable( $args['callback'] ) ) {
88
+		if (empty($args['id']) || empty($args['version']) || empty($args['callback']) || ! is_callable($args['callback'])) {
89 89
 			return;
90 90
 		}
91 91
 
92
-		self::$updates[ $args['type'] ][] = $args;
92
+		self::$updates[$args['type']][] = $args;
93 93
 	}
94 94
 
95 95
 
@@ -104,33 +104,33 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return array
106 106
 	 */
107
-	public function get_updates( $update_type = '', $status = 'all' ) {
107
+	public function get_updates($update_type = '', $status = 'all') {
108 108
 		// return all updates.
109
-		if ( empty( $update_type ) ) {
109
+		if (empty($update_type)) {
110 110
 			return self::$updates;
111 111
 		}
112 112
 
113 113
 		// Get specific update.
114
-		$updates = ! empty( self::$updates[ $update_type ] ) ? self::$updates[ $update_type ] : array();
114
+		$updates = ! empty(self::$updates[$update_type]) ? self::$updates[$update_type] : array();
115 115
 
116 116
 		// Bailout.
117
-		if ( empty( $updates ) ) {
117
+		if (empty($updates)) {
118 118
 			return $updates;
119 119
 		}
120 120
 
121
-		switch ( $status ) {
121
+		switch ($status) {
122 122
 			case 'new':
123 123
 				// Remove already completed updates.
124 124
 
125 125
 				$completed_updates = give_get_completed_upgrades();
126 126
 
127
-				if ( ! empty( $completed_updates ) ) {
128
-					foreach ( $updates as $index => $update ) {
129
-						if ( in_array( $update['id'], $completed_updates ) ) {
130
-							unset( $updates[ $index ] );
127
+				if ( ! empty($completed_updates)) {
128
+					foreach ($updates as $index => $update) {
129
+						if (in_array($update['id'], $completed_updates)) {
130
+							unset($updates[$index]);
131 131
 						}
132 132
 					}
133
-					$updates = array_values( $updates );
133
+					$updates = array_values($updates);
134 134
 				}
135 135
 
136 136
 				break;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @return static
149 149
 	 */
150 150
 	static function get_instance() {
151
-		if ( null === static::$instance ) {
151
+		if (null === static::$instance) {
152 152
 			self::$instance = new static();
153 153
 		}
154 154
 
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 		/**
168 168
 		 * Setup hooks.
169 169
 		 */
170
-		add_action( 'init', array( $this, '__register_upgrade' ), 9999 );
171
-		add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 );
172
-		add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
173
-		add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 );
174
-		add_action( 'wp_ajax_give_do_ajax_updates', array( $this, '__give_ajax_updates' ) );
170
+		add_action('init', array($this, '__register_upgrade'), 9999);
171
+		add_action('admin_init', array($this, '__change_donations_label'), 9999);
172
+		add_action('admin_menu', array($this, '__register_menu'), 9999);
173
+		add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999);
174
+		add_action('wp_ajax_give_do_ajax_updates', array($this, '__give_ajax_updates'));
175 175
 
176 176
 		/**
177 177
 		 * Load file
178 178
 		 */
179
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
179
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
180 180
 	}
181 181
 
182 182
 	/**
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
 		$addons         = give_get_plugins();
190 190
 		$plugin_updates = get_plugin_updates();
191 191
 
192
-		foreach ( $addons as $key => $info ) {
193
-			if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) {
192
+		foreach ($addons as $key => $info) {
193
+			if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) {
194 194
 				continue;
195 195
 			}
196 196
 
197
-			self::$updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] );
197
+			self::$updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]);
198 198
 		}
199 199
 	}
200 200
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * @access public
207 207
 	 */
208 208
 	public function __register_upgrade() {
209
-		if ( ! is_admin() ) {
209
+		if ( ! is_admin()) {
210 210
 			return;
211 211
 		}
212 212
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		 *
216 216
 		 * @since 1.8.12
217 217
 		 */
218
-		do_action( 'give_register_updates', $this );
218
+		do_action('give_register_updates', $this);
219 219
 	}
220 220
 
221 221
 	/**
@@ -229,17 +229,17 @@  discard block
 block discarded – undo
229 229
 		global $submenu;
230 230
 
231 231
 		// Bailout.
232
-		if ( empty( $menu ) || ! $this->get_update_count() ) {
232
+		if (empty($menu) || ! $this->get_update_count()) {
233 233
 			return;
234 234
 		}
235 235
 
236
-		foreach ( $menu as $index => $menu_item ) {
237
-			if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) {
236
+		foreach ($menu as $index => $menu_item) {
237
+			if ('edit.php?post_type=give_forms' !== $menu_item[2]) {
238 238
 				continue;
239 239
 			}
240 240
 
241
-			$menu[ $index ][0] = sprintf(
242
-				__( 'Donations <span class="update-plugins count-%1$d"><span class="plugin-count">%1$d</span></span>', 'give' ),
241
+			$menu[$index][0] = sprintf(
242
+				__('Donations <span class="update-plugins count-%1$d"><span class="plugin-count">%1$d</span></span>', 'give'),
243 243
 				$this->get_update_count()
244 244
 			);
245 245
 
@@ -258,22 +258,22 @@  discard block
 block discarded – undo
258 258
 		$this->__register_plugin_addon_updates();
259 259
 
260 260
 		// Bailout.
261
-		if ( ! $this->get_update_count() ) {
261
+		if ( ! $this->get_update_count()) {
262 262
 			return;
263 263
 		}
264 264
 
265 265
 		//Upgrades
266 266
 		add_submenu_page(
267 267
 			'edit.php?post_type=give_forms',
268
-			esc_html__( 'Give Updates', 'give' ),
268
+			esc_html__('Give Updates', 'give'),
269 269
 			sprintf(
270 270
 				'%1$s <span class="update-plugins count-%2$d"><span class="plugin-count">%2$d</span></span>',
271
-				__( 'Updates', 'give' ),
271
+				__('Updates', 'give'),
272 272
 				$this->get_update_count()
273 273
 			),
274 274
 			'manage_give_settings',
275 275
 			'give-updates',
276
-			array( $this, 'render_page' )
276
+			array($this, 'render_page')
277 277
 		);
278 278
 	}
279 279
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * @return int
286 286
 	 */
287 287
 	public function get_db_update_count() {
288
-		return count( $this->get_updates( 'database', 'new' ) );
288
+		return count($this->get_updates('database', 'new'));
289 289
 	}
290 290
 
291 291
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 * @access public
297 297
 	 */
298 298
 	public function render_page() {
299
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php';
299
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php';
300 300
 	}
301 301
 
302 302
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @return int
308 308
 	 */
309 309
 	public function get_plugin_update_count() {
310
-		return count( $this->get_updates( 'plugin' ) );
310
+		return count($this->get_updates('plugin'));
311 311
 	}
312 312
 
313 313
 	/**
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 		$db_update_count     = $this->get_db_update_count();
323 323
 		$plugin_update_count = $this->get_plugin_update_count();
324 324
 
325
-		return ( $db_update_count + $plugin_update_count );
325
+		return ($db_update_count + $plugin_update_count);
326 326
 	}
327 327
 
328 328
 
@@ -333,12 +333,11 @@  discard block
 block discarded – undo
333 333
 	 * @access public
334 334
 	 */
335 335
 	public function __flush_resume_updates() {
336
-		delete_option( 'give_doing_upgrade' );
337
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
336
+		delete_option('give_doing_upgrade');
337
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
338 338
 
339 339
 		// Reset counter.
340
-		self::$step = self::$percentage = 0;
341
-		++ self::$update;
340
+		self::$step = self::$percentage = 0;++ self::$update;
342 341
 	}
343 342
 
344 343
 	/**
@@ -349,30 +348,30 @@  discard block
 block discarded – undo
349 348
 	 */
350 349
 	public function __give_ajax_updates() {
351 350
 		// Check permission.
352
-		if ( ! current_user_can( 'manage_give_settings' ) ) {
351
+		if ( ! current_user_can('manage_give_settings')) {
353 352
 			$this->send_ajax_response(
354 353
 				array(
355
-					'message' => esc_html__( 'You do not have permission to do Give upgrades.', 'give' ),
354
+					'message' => esc_html__('You do not have permission to do Give upgrades.', 'give'),
356 355
 				),
357 356
 				'error'
358 357
 			);
359 358
 		}
360 359
 
361 360
 		// Update timeout error.
362
-		ignore_user_abort( true );
363
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
364
-			@set_time_limit( 0 );
361
+		ignore_user_abort(true);
362
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
363
+			@set_time_limit(0);
365 364
 		}
366 365
 
367 366
 		// Set params.
368
-		self::$step   = absint( $_POST['step'] );
369
-		self::$update = absint( $_POST['update'] );
367
+		self::$step   = absint($_POST['step']);
368
+		self::$update = absint($_POST['update']);
370 369
 
371 370
 		// Bailout: step and update must be positive and greater then zero.
372
-		if ( ! self::$step ) {
371
+		if ( ! self::$step) {
373 372
 			$this->send_ajax_response(
374 373
 				array(
375
-					'message'    => __( 'Error: please reload this page  and try again', 'give' ),
374
+					'message'    => __('Error: please reload this page  and try again', 'give'),
376 375
 					'heading'    => '',
377 376
 					'percentage' => 0,
378 377
 				),
@@ -382,14 +381,14 @@  discard block
 block discarded – undo
382 381
 
383 382
 		// Get updates.
384 383
 		// $all_updates = $this->get_updates( 'database' );
385
-		$updates = $this->get_updates( 'database', 'new' );
384
+		$updates = $this->get_updates('database', 'new');
386 385
 
387 386
 
388 387
 		// Bailout if we do not have nay updates.
389
-		if ( empty( $updates ) ) {
388
+		if (empty($updates)) {
390 389
 			$this->send_ajax_response(
391 390
 				array(
392
-					'message'    => __( 'Database already up to date.', 'give' ),
391
+					'message'    => __('Database already up to date.', 'give'),
393 392
 					'heading'    => '',
394 393
 					'percentage' => 0,
395 394
 				),
@@ -398,25 +397,25 @@  discard block
 block discarded – undo
398 397
 		}
399 398
 
400 399
 		// Process update.
401
-		foreach ( $updates as $index => $update ) {
400
+		foreach ($updates as $index => $update) {
402 401
 			// Check if update depend upon any other update.
403
-			if ( ! empty( $update['depend'] ) && ! give_has_upgrade_completed( $update['depend'] ) ) {
402
+			if ( ! empty($update['depend']) && ! give_has_upgrade_completed($update['depend'])) {
404 403
 				continue;
405 404
 			}
406 405
 
407 406
 			// Run update.
408
-			if ( is_array( $update['callback'] ) ) {
407
+			if (is_array($update['callback'])) {
409 408
 				$update['callback'][0]->$update['callback'][1]();
410 409
 			} else {
411 410
 				$update['callback']();
412 411
 			}
413 412
 
414 413
 			// Check if current update completed or not.
415
-			if ( give_has_upgrade_completed( $update['id'] ) ) {
416
-				if ( 1 === count( $updates ) ) {
414
+			if (give_has_upgrade_completed($update['id'])) {
415
+				if (1 === count($updates)) {
417 416
 					$this->send_ajax_response(
418 417
 						array(
419
-							'message'    => __( 'Database updated successfully.', 'give' ),
418
+							'message'    => __('Database updated successfully.', 'give'),
420 419
 							'heading'    => '',
421 420
 							'percentage' => 0,
422 421
 						),
@@ -426,20 +425,20 @@  discard block
 block discarded – undo
426 425
 			}
427 426
 
428 427
 			// Verify percentage.
429
-			self::$percentage = ( 100 < self::$percentage ) ? 100 : self::$percentage;
428
+			self::$percentage = (100 < self::$percentage) ? 100 : self::$percentage;
430 429
 
431 430
 			$doing_upgrade_args = array(
432 431
 				'update_info' => $update,
433
-				'step'        => ++ self::$step,
432
+				'step'        =>++ self::$step,
434 433
 				'update'      => self::$update,
435
-				'heading'     => sprintf( 'Update %s of {update_count}', self::$update ),
434
+				'heading'     => sprintf('Update %s of {update_count}', self::$update),
436 435
 				'percentage'  => self::$percentage,
437 436
 			);
438 437
 
439 438
 			// Cache upgrade.
440
-			update_option( 'give_doing_upgrade', $doing_upgrade_args );
439
+			update_option('give_doing_upgrade', $doing_upgrade_args);
441 440
 
442
-			$this->send_ajax_response( $doing_upgrade_args );
441
+			$this->send_ajax_response($doing_upgrade_args);
443 442
 		}
444 443
 	}
445 444
 
@@ -452,7 +451,7 @@  discard block
 block discarded – undo
452 451
 	 * @param        $data
453 452
 	 * @param string $type
454 453
 	 */
455
-	public function send_ajax_response( $data, $type = '' ) {
454
+	public function send_ajax_response($data, $type = '') {
456 455
 		$default = array(
457 456
 			'message'    => '',
458 457
 			'heading'    => '',
@@ -462,19 +461,19 @@  discard block
 block discarded – undo
462 461
 		);
463 462
 
464 463
 		// Set data.
465
-		$data = wp_parse_args( $data, $default );
464
+		$data = wp_parse_args($data, $default);
466 465
 
467
-		switch ( $type ) {
466
+		switch ($type) {
468 467
 			case 'success':
469
-				wp_send_json_success( $data );
468
+				wp_send_json_success($data);
470 469
 				break;
471 470
 
472 471
 			case 'error':
473
-				wp_send_json_success( $data );
472
+				wp_send_json_success($data);
474 473
 				break;
475 474
 
476 475
 			default:
477
-				wp_send_json( array( 'data' => $data ) );
476
+				wp_send_json(array('data' => $data));
478 477
 				break;
479 478
 		}
480 479
 	}
@@ -490,8 +489,8 @@  discard block
 block discarded – undo
490 489
 	public function resume_updates() {
491 490
 		$status = false;
492 491
 
493
-		if ( $update = get_option( 'give_doing_upgrade' ) ) {
494
-			$status = ! empty( $update['step'] ) ? $update['step'] : $status;
492
+		if ($update = get_option('give_doing_upgrade')) {
493
+			$status = ! empty($update['step']) ? $update['step'] : $status;
495 494
 		}
496 495
 
497 496
 		return $status;
Please login to merge, or discard this patch.
includes/admin/reports/class-gateways-report.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Gateways_Report' ) ) :
16
+if ( ! class_exists('Give_Gateways_Report')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Gateways_Report.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'gateways';
46
-			$this->label = esc_html__( 'Donation Methods', 'give' );
46
+			$this->label = esc_html__('Donation Methods', 'give');
47 47
 
48
-			add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_report_gateways', array( $this, 'render_report_gateways_field' ), 10, 2 );
48
+			add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-reports_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_report_gateways', array($this, 'render_report_gateways_field'), 10, 2);
51 51
 
52 52
 			// Do not use main form for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-reports_open_form', '__return_empty_string' );
55
-				add_action( 'give-reports_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-reports_open_form', '__return_empty_string');
55
+				add_action('give-reports_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_reports_gateways',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'gateways',
98
-						'name' => esc_html__( 'Gateways', 'give' ),
98
+						'name' => esc_html__('Gateways', 'give'),
99 99
 						'type' => 'report_gateways',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_report_gateways_field( $field, $option_value ) {
135
-			do_action( 'give_reports_view_gateways');
134
+		public function render_report_gateways_field($field, $option_value) {
135
+			do_action('give_reports_view_gateways');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.