Test Failed
Pull Request — master (#3256)
by Devin
07:52 queued 10s
created
includes/admin/abstract-admin-settings-page.php 1 patch
Spacing   +34 added lines, -34 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_Settings_Page' ) ) :
16
+if ( ! class_exists('Give_Settings_Page')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Page.
@@ -70,25 +70,25 @@  discard block
 block discarded – undo
70 70
 			// Get current setting page.
71 71
 			$this->current_setting_page = give_get_current_setting_page();
72 72
 
73
-			add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 );
74
-			add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 );
75
-			add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) );
73
+			add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10);
74
+			add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20);
75
+			add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output'));
76 76
 
77 77
 			// Output section only if exist.
78 78
 			$sections = $this->get_sections();
79
-			if ( ! empty( $sections ) ) {
80
-				add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array(
79
+			if ( ! empty($sections)) {
80
+				add_action("{$this->current_setting_page}_sections_{$this->id}_page", array(
81 81
 					$this,
82 82
 					'output_sections',
83
-				) );
83
+				));
84 84
 			}
85 85
 
86 86
 			// Save hide button by default.
87 87
 			$GLOBALS['give_hide_save_button'] = true;
88 88
 
89 89
 			// Enable saving feature.
90
-			if ( $this->enable_save ) {
91
-				add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) );
90
+			if ($this->enable_save) {
91
+				add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save'));
92 92
 			}
93 93
 		}
94 94
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		 *
114 114
 		 * @return string
115 115
 		 */
116
-		function set_default_setting_tab( $setting_tab ) {
116
+		function set_default_setting_tab($setting_tab) {
117 117
 			return $this->default_tab;
118 118
 		}
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return array
128 128
 		 */
129
-		public function add_settings_page( $pages ) {
130
-			$pages[ $this->id ] = $this->label;
129
+		public function add_settings_page($pages) {
130
+			$pages[$this->id] = $this->label;
131 131
 
132 132
 			return $pages;
133 133
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			 *
147 147
 			 * @param  array $settings
148 148
 			 */
149
-			$settings = apply_filters( 'give_get_settings_' . $this->id, array() );
149
+			$settings = apply_filters('give_get_settings_'.$this->id, array());
150 150
 
151 151
 			// Output.
152 152
 			return $settings;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		 * @return array
160 160
 		 */
161 161
 		public function get_sections() {
162
-			return apply_filters( 'give_get_sections_' . $this->id, array() );
162
+			return apply_filters('give_get_sections_'.$this->id, array());
163 163
 		}
164 164
 
165 165
 		/**
@@ -176,40 +176,40 @@  discard block
 block discarded – undo
176 176
 			$sections = $this->get_sections();
177 177
 
178 178
 			// Bailout.
179
-			if ( empty( $sections ) ) {
179
+			if (empty($sections)) {
180 180
 				return;
181 181
 			}
182 182
 
183 183
 			// Show section settings only if setting section exist.
184
-			if ( $current_section && ! in_array( $current_section, array_keys( $sections ), true ) ) {
185
-				echo wp_kses_post( '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>' );
184
+			if ($current_section && ! in_array($current_section, array_keys($sections), true)) {
185
+				echo wp_kses_post('<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>');
186 186
 				$GLOBALS['give_hide_save_button'] = true;
187 187
 
188 188
 				return;
189 189
 			}
190 190
 
191
-			if ( is_null( $this->current_setting_page ) ) {
191
+			if (is_null($this->current_setting_page)) {
192 192
 				$this->current_setting_page = give_get_current_setting_page();
193 193
 			}
194 194
 
195 195
 			$section_list = array();
196
-			foreach ( $sections as $id => $label ) {
196
+			foreach ($sections as $id => $label) {
197 197
 				/**
198 198
 				 * Fire the filter to hide particular section on tab.
199 199
 				 *
200 200
 				 * @since 2.0
201 201
 				 */
202
-				if ( apply_filters( "give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id ) ) {
202
+				if (apply_filters("give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id)) {
203 203
 					continue;
204 204
 				}
205 205
 
206
-				$section_list[] = '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $current_section === $id ? 'current' : '' ) . '">' . $label . '</a>';
206
+				$section_list[] = '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'&section='.sanitize_title($id)).'" class="'.($current_section === $id ? 'current' : '').'">'.$label.'</a>';
207 207
 			}
208 208
 
209
-			echo wp_kses_post( sprintf(
209
+			echo wp_kses_post(sprintf(
210 210
 				'<ul class="subsubsub">%s</ul><br class="clear" /><hr>',
211
-				implode( ' | </li>', $section_list )
212
-			) );
211
+				implode(' | </li>', $section_list)
212
+			));
213 213
 		}
214 214
 
215 215
 		/**
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		 * @return void
222 222
 		 */
223 223
 		public function output() {
224
-			if ( $this->enable_save ) {
224
+			if ($this->enable_save) {
225 225
 				$GLOBALS['give_hide_save_button'] = false;
226 226
 			}
227 227
 
228 228
 			$settings = $this->get_settings();
229 229
 
230
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
230
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
231 231
 		}
232 232
 
233 233
 		/**
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 			 *
246 246
 			 * @since 2.1
247 247
 			 */
248
-			if ( apply_filters( "give_save_options_{$this->id}_{$current_section}", true ) ) {
249
-				Give_Admin_Settings::save_fields( $settings, 'give_settings' );
248
+			if (apply_filters("give_save_options_{$this->id}_{$current_section}", true)) {
249
+				Give_Admin_Settings::save_fields($settings, 'give_settings');
250 250
 			}
251 251
 
252 252
 			/**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			 *
255 255
 			 * @since 1.8
256 256
 			 */
257
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
257
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
258 258
 		}
259 259
 
260 260
 		/**
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 			$section         = $this->get_sections();
272 272
 			$current_section = give_get_current_setting_section();
273 273
 
274
-			if ( array_key_exists( $current_section, $section ) ) {
275
-				$heading[] = $section[ $current_section ];
274
+			if (array_key_exists($current_section, $section)) {
275
+				$heading[] = $section[$current_section];
276 276
 			}
277 277
 
278
-			return array_unique( $heading );
278
+			return array_unique($heading);
279 279
 		}
280 280
 
281 281
 		/**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		public function get_heading_html() {
290 290
 			return sprintf(
291 291
 				'<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">',
292
-				implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() )
292
+				implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading())
293 293
 			);
294 294
 		}
295 295
 	}
Please login to merge, or discard this patch.
includes/admin/upgrades/class-give-updates.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -618,8 +618,11 @@
 block discarded – undo
618 618
 				<a href="<?php echo esc_url( add_query_arg( array( 'give-restart-db-upgrades' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-restart-updater-btn">
619 619
 					<?php _e( 'Restart the updater', 'give' ); ?>
620 620
 				</a>
621
-			<?php else: ?>
622
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
621
+			<?php else {
622
+	: ?>
623
+				<strong><?php _e( 'Database Update', 'give' );
624
+}
625
+?></strong>
623 626
 				&nbsp;&#8211;&nbsp;<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
624 627
 			<?php
625 628
 			endif;
Please login to merge, or discard this patch.
Spacing   +247 added lines, -254 removed lines patch added patch discarded remove patch
@@ -80,34 +80,34 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param array $args
82 82
 	 */
83
-	public function register( $args ) {
83
+	public function register($args) {
84 84
 		$args_default = array(
85 85
 			'id'       => '',
86 86
 			'version'  => '',
87 87
 			'callback' => '',
88 88
 		);
89 89
 
90
-		$args = wp_parse_args( $args, $args_default );
90
+		$args = wp_parse_args($args, $args_default);
91 91
 
92 92
 		// You can only register database upgrade.
93 93
 		$args['type'] = 'database';
94 94
 
95 95
 		// Bailout.
96 96
 		if (
97
-			empty( $args['id'] ) ||
98
-			empty( $args['version'] ) ||
99
-			empty( $args['callback'] ) ||
100
-			! is_callable( $args['callback'] )
97
+			empty($args['id']) ||
98
+			empty($args['version']) ||
99
+			empty($args['callback']) ||
100
+			! is_callable($args['callback'])
101 101
 		) {
102 102
 			return;
103 103
 		}
104 104
 
105 105
 		// Change depend param to array.
106
-		if ( isset( $args['depend'] ) && is_string( $args['depend'] ) ) {
107
-			$args['depend'] = array( $args['depend'] );
106
+		if (isset($args['depend']) && is_string($args['depend'])) {
107
+			$args['depend'] = array($args['depend']);
108 108
 		}
109 109
 
110
-		$this->updates[ $args['type'] ][] = $args;
110
+		$this->updates[$args['type']][] = $args;
111 111
 	}
112 112
 
113 113
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @return static
119 119
 	 */
120 120
 	static function get_instance() {
121
-		if ( is_null( self::$instance ) ) {
121
+		if (is_null(self::$instance)) {
122 122
 			self::$instance = new self();
123 123
 		}
124 124
 
@@ -136,27 +136,27 @@  discard block
 block discarded – undo
136 136
 		/**
137 137
 		 * Load file
138 138
 		 */
139
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-background-updater.php';
140
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
139
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-background-updater.php';
140
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
141 141
 
142 142
 		self::$background_updater = new Give_Background_Updater();
143 143
 
144 144
 		/**
145 145
 		 * Setup hooks.
146 146
 		 */
147
-		add_action( 'init', array( $this, '__register_upgrade' ), 9999 );
148
-		add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 );
149
-		add_action( 'wp_ajax_give_db_updates_info', array( $this, '__give_db_updates_info' ) );
150
-		add_action( 'wp_ajax_give_run_db_updates', array( $this, '__give_start_updating' ) );
151
-		add_action( 'admin_init', array( $this, '__redirect_admin' ) );
152
-		add_action( 'admin_init', array( $this, '__pause_db_update' ), - 1 );
153
-		add_action( 'admin_init', array( $this, '__restart_db_update' ), - 1 );
154
-		add_action( 'admin_notices', array( $this, '__show_notice' ) );
155
-		add_action( 'give_restart_db_upgrade', array( $this, '__health_background_update' ) );
156
-
157
-		if ( is_admin() ) {
158
-			add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 );
159
-			add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
147
+		add_action('init', array($this, '__register_upgrade'), 9999);
148
+		add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999);
149
+		add_action('wp_ajax_give_db_updates_info', array($this, '__give_db_updates_info'));
150
+		add_action('wp_ajax_give_run_db_updates', array($this, '__give_start_updating'));
151
+		add_action('admin_init', array($this, '__redirect_admin'));
152
+		add_action('admin_init', array($this, '__pause_db_update'), - 1);
153
+		add_action('admin_init', array($this, '__restart_db_update'), - 1);
154
+		add_action('admin_notices', array($this, '__show_notice'));
155
+		add_action('give_restart_db_upgrade', array($this, '__health_background_update'));
156
+
157
+		if (is_admin()) {
158
+			add_action('admin_init', array($this, '__change_donations_label'), 9999);
159
+			add_action('admin_menu', array($this, '__register_menu'), 9999);
160 160
 		}
161 161
 	}
162 162
 
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 		$addons         = give_get_plugins();
171 171
 		$plugin_updates = get_plugin_updates();
172 172
 
173
-		foreach ( $addons as $key => $info ) {
174
-			if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) {
173
+		foreach ($addons as $key => $info) {
174
+			if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) {
175 175
 				continue;
176 176
 			}
177 177
 
178
-			$this->updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] );
178
+			$this->updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]);
179 179
 		}
180 180
 	}
181 181
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @access public
188 188
 	 */
189 189
 	public function __register_upgrade() {
190
-		if ( ! is_admin() ) {
190
+		if ( ! is_admin()) {
191 191
 			return;
192 192
 		}
193 193
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		 *
197 197
 		 * @since 1.8.12
198 198
 		 */
199
-		do_action( 'give_register_updates', $this );
199
+		do_action('give_register_updates', $this);
200 200
 	}
201 201
 
202 202
 	/**
@@ -209,23 +209,22 @@  discard block
 block discarded – undo
209 209
 		global $menu;
210 210
 
211 211
 		// Bailout.
212
-		if ( empty( $menu ) || ! $this->get_total_update_count() ) {
212
+		if (empty($menu) || ! $this->get_total_update_count()) {
213 213
 			return;
214 214
 		}
215 215
 
216
-		$is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() );
216
+		$is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process());
217 217
 
218
-		foreach ( $menu as $index => $menu_item ) {
219
-			if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) {
218
+		foreach ($menu as $index => $menu_item) {
219
+			if ('edit.php?post_type=give_forms' !== $menu_item[2]) {
220 220
 				continue;
221 221
 			}
222 222
 
223
-			$menu[ $index ][0] = sprintf(
223
+			$menu[$index][0] = sprintf(
224 224
 				'%1$s <span class="update-plugins"><span class="plugin-count give-update-progress-count">%2$s%3$s</span></span>',
225
-				__( 'Donations', 'give' ),
225
+				__('Donations', 'give'),
226 226
 				$is_update ?
227
-					$this->get_db_update_processing_percentage() :
228
-					$this->get_total_update_count(),
227
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
229 228
 				$is_update ? '%' : ''
230 229
 			);
231 230
 
@@ -244,41 +243,40 @@  discard block
 block discarded – undo
244 243
 		$this->__register_plugin_addon_updates();
245 244
 
246 245
 		// Bailout.
247
-		if ( ! $this->get_total_update_count() ) {
246
+		if ( ! $this->get_total_update_count()) {
248 247
 			// Show complete update message if still on update setting page.
249
-			if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) {
248
+			if (isset($_GET['page']) && 'give-updates' === $_GET['page']) {
250 249
 				// Upgrades
251 250
 				add_submenu_page(
252 251
 					'edit.php?post_type=give_forms',
253
-					esc_html__( 'Give Updates Complete', 'give' ),
254
-					__( 'Updates', 'give' ),
252
+					esc_html__('Give Updates Complete', 'give'),
253
+					__('Updates', 'give'),
255 254
 					'manage_give_settings',
256 255
 					'give-updates',
257
-					array( $this, 'render_complete_page' )
256
+					array($this, 'render_complete_page')
258 257
 				);
259 258
 			}
260 259
 
261 260
 			return;
262 261
 		}
263 262
 
264
-		$is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() );
263
+		$is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process());
265 264
 
266 265
 		// Upgrades
267 266
 		add_submenu_page(
268 267
 			'edit.php?post_type=give_forms',
269
-			esc_html__( 'Give Updates', 'give' ),
268
+			esc_html__('Give Updates', 'give'),
270 269
 			sprintf(
271 270
 				'%1$s <span class="update-plugins"%2$s><span class="plugin-count give-update-progress-count">%3$s%4$s</span></span>',
272
-				__( 'Updates', 'give' ),
273
-				isset( $_GET['give-pause-db-upgrades'] ) ? ' style="display:none;"' : '',
271
+				__('Updates', 'give'),
272
+				isset($_GET['give-pause-db-upgrades']) ? ' style="display:none;"' : '',
274 273
 				$is_update ?
275
-					$this->get_db_update_processing_percentage() :
276
-					$this->get_total_update_count(),
274
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
277 275
 				$is_update ? '%' : ''
278 276
 			),
279 277
 			'manage_give_settings',
280 278
 			'give-updates',
281
-			array( $this, 'render_page' )
279
+			array($this, 'render_page')
282 280
 		);
283 281
 	}
284 282
 
@@ -293,13 +291,13 @@  discard block
 block discarded – undo
293 291
 		// Show db upgrade completed notice.
294 292
 		if (
295 293
 			! wp_doing_ajax() &&
296
-			current_user_can( 'manage_give_settings' ) &&
297
-			get_option( 'give_show_db_upgrade_complete_notice' ) &&
298
-			! isset( $_GET['give-db-update-completed'] )
294
+			current_user_can('manage_give_settings') &&
295
+			get_option('give_show_db_upgrade_complete_notice') &&
296
+			! isset($_GET['give-db-update-completed'])
299 297
 		) {
300
-			delete_option( 'give_show_db_upgrade_complete_notice' );
298
+			delete_option('give_show_db_upgrade_complete_notice');
301 299
 
302
-			wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-updates&give-db-update-completed=give_db_upgrade_completed' ) );
300
+			wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-updates&give-db-update-completed=give_db_upgrade_completed'));
303 301
 			exit();
304 302
 		}
305 303
 	}
@@ -315,15 +313,15 @@  discard block
 block discarded – undo
315 313
 	 *
316 314
 	 * @return bool
317 315
 	 */
318
-	public function __pause_db_update( $force = false ) {
316
+	public function __pause_db_update($force = false) {
319 317
 		// Bailout.
320 318
 		if (
321 319
 			! $force &&
322 320
 			(
323 321
 				wp_doing_ajax() ||
324
-				! isset( $_GET['page'] ) ||
322
+				! isset($_GET['page']) ||
325 323
 				'give-updates' !== $_GET['page'] ||
326
-				! isset( $_GET['give-pause-db-upgrades'] ) ||
324
+				! isset($_GET['give-pause-db-upgrades']) ||
327 325
 				self::$background_updater->is_paused_process()
328 326
 			)
329 327
 
@@ -331,13 +329,13 @@  discard block
 block discarded – undo
331 329
 			return false;
332 330
 		}
333 331
 
334
-		delete_option( 'give_upgrade_error' );
332
+		delete_option('give_upgrade_error');
335 333
 
336
-		$this->__health_background_update( $this );
334
+		$this->__health_background_update($this);
337 335
 		$batch = self::$background_updater->get_all_batch();
338 336
 
339 337
 		// Bailout: if batch is empty
340
-		if ( empty( $batch->data ) ) {
338
+		if (empty($batch->data)) {
341 339
 			return false;
342 340
 		}
343 341
 
@@ -346,25 +344,25 @@  discard block
 block discarded – undo
346 344
 
347 345
 		// Do not stop background process immediately if task running.
348 346
 		// @see Give_Background_Updater::lock_process
349
-		if ( ! $force && self::$background_updater->is_process_running() ) {
350
-			update_option( 'give_pause_upgrade', 1 );
347
+		if ( ! $force && self::$background_updater->is_process_running()) {
348
+			update_option('give_pause_upgrade', 1);
351 349
 
352 350
 			return true;
353 351
 		}
354 352
 
355
-		update_option( 'give_paused_batches', $batch, 'no' );
356
-		delete_option( $batch->key );
357
-		delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' );
358
-		wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() );
353
+		update_option('give_paused_batches', $batch, 'no');
354
+		delete_option($batch->key);
355
+		delete_site_transient(self::$background_updater->get_identifier().'_process_lock');
356
+		wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier());
359 357
 
360
-		Give()->logs->add( 'Update Pause', print_r( $batch, true ), 0, 'update' );
358
+		Give()->logs->add('Update Pause', print_r($batch, true), 0, 'update');
361 359
 
362 360
 		/**
363 361
 		 * Fire action when pause db updates
364 362
 		 *
365 363
 		 * @since 2.0.1
366 364
 		 */
367
-		do_action( 'give_pause_db_upgrade', $this );
365
+		do_action('give_pause_db_upgrade', $this);
368 366
 
369 367
 		return true;
370 368
 	}
@@ -381,31 +379,31 @@  discard block
 block discarded – undo
381 379
 		// Bailout.
382 380
 		if (
383 381
 			wp_doing_ajax() ||
384
-			! isset( $_GET['page'] ) ||
382
+			! isset($_GET['page']) ||
385 383
 			'give-updates' !== $_GET['page'] ||
386
-			! isset( $_GET['give-restart-db-upgrades'] ) ||
384
+			! isset($_GET['give-restart-db-upgrades']) ||
387 385
 			! self::$background_updater->is_paused_process()
388 386
 		) {
389 387
 			return false;
390 388
 		}
391 389
 
392 390
 		Give_Background_Updater::flush_cache();
393
-		$batch = get_option( 'give_paused_batches' );
391
+		$batch = get_option('give_paused_batches');
394 392
 
395
-		if ( ! empty( $batch ) ) {
396
-			wp_cache_delete( $batch->key, 'options' );
397
-			update_option( $batch->key, $batch->data );
393
+		if ( ! empty($batch)) {
394
+			wp_cache_delete($batch->key, 'options');
395
+			update_option($batch->key, $batch->data);
398 396
 
399
-			delete_option( 'give_paused_batches' );
397
+			delete_option('give_paused_batches');
400 398
 
401
-			Give()->logs->add( 'Update Restart', print_r( $batch, true ), 0, 'update' );
399
+			Give()->logs->add('Update Restart', print_r($batch, true), 0, 'update');
402 400
 
403 401
 
404 402
 			/** Fire action when restart db updates
405 403
 			 *
406 404
 			 * @since 2.0.1
407 405
 			 */
408
-			do_action( 'give_restart_db_upgrade', $this );
406
+			do_action('give_restart_db_upgrade', $this);
409 407
 
410 408
 			self::$background_updater->dispatch();
411 409
 		}
@@ -421,53 +419,53 @@  discard block
 block discarded – undo
421 419
 	 *
422 420
 	 * @param Give_Updates $give_updates
423 421
 	 */
424
-	public function __health_background_update( $give_updates ) {
425
-		if ( ! $this->is_doing_updates() ) {
422
+	public function __health_background_update($give_updates) {
423
+		if ( ! $this->is_doing_updates()) {
426 424
 			return;
427 425
 		}
428 426
 
429 427
 		Give_Background_Updater::flush_cache();
430 428
 
431 429
 		$batch                = Give_Updates::$background_updater->get_all_batch();
432
-		$batch_data_count     = count( $batch->data );
433
-		$all_updates          = $give_updates->get_updates( 'database', 'all' );
434
-		$all_update_ids       = wp_list_pluck( $all_updates, 'id' );
435
-		$all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array();
430
+		$batch_data_count     = count($batch->data);
431
+		$all_updates          = $give_updates->get_updates('database', 'all');
432
+		$all_update_ids       = wp_list_pluck($all_updates, 'id');
433
+		$all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array();
436 434
 		$log_data             = '';
437
-		$doing_upgrade_args   = get_option( 'give_doing_upgrade' );
435
+		$doing_upgrade_args   = get_option('give_doing_upgrade');
438 436
 
439
-		if ( ! empty( $doing_upgrade_args ) ) {
440
-			$log_data .= 'Doing update:' . "\n";
441
-			$log_data .= print_r( $doing_upgrade_args, true ) . "\n";
437
+		if ( ! empty($doing_upgrade_args)) {
438
+			$log_data .= 'Doing update:'."\n";
439
+			$log_data .= print_r($doing_upgrade_args, true)."\n";
442 440
 		}
443 441
 
444 442
 		/**
445 443
 		 * Add remove upgrade from batch
446 444
 		 */
447
-		if ( ! empty( $batch->data ) ) {
445
+		if ( ! empty($batch->data)) {
448 446
 
449
-			foreach ( $batch->data as $index => $update ) {
450
-				$log_data = print_r( $update, true ) . "\n";
447
+			foreach ($batch->data as $index => $update) {
448
+				$log_data = print_r($update, true)."\n";
451 449
 
452
-				if ( ! is_callable( $update['callback'] ) ) {
453
-					$log_data .= 'Removing missing callback update: ' . "{$update['id']}\n";
454
-					unset( $batch->data[ $index ] );
455
-				} elseif ( give_has_upgrade_completed( $update['id'] ) ) {
456
-					$log_data .= 'Removing already completed update: ' . "{$update['id']}\n";
457
-					unset( $batch->data[ $index ] );
450
+				if ( ! is_callable($update['callback'])) {
451
+					$log_data .= 'Removing missing callback update: '."{$update['id']}\n";
452
+					unset($batch->data[$index]);
453
+				} elseif (give_has_upgrade_completed($update['id'])) {
454
+					$log_data .= 'Removing already completed update: '."{$update['id']}\n";
455
+					unset($batch->data[$index]);
458 456
 				}
459 457
 
460
-				if ( ! empty( $update['depend'] ) ) {
458
+				if ( ! empty($update['depend'])) {
461 459
 
462
-					foreach ( $update['depend'] as $depend ) {
463
-						if ( give_has_upgrade_completed( $depend ) ) {
464
-							$log_data .= 'Completed update: ' . "{$depend}\n";
460
+					foreach ($update['depend'] as $depend) {
461
+						if (give_has_upgrade_completed($depend)) {
462
+							$log_data .= 'Completed update: '."{$depend}\n";
465 463
 							continue;
466 464
 						}
467 465
 
468
-						if ( in_array( $depend, $all_update_ids ) && ! in_array( $depend, $all_batch_update_ids ) ) {
469
-							$log_data .= 'Adding missing update: ' . "{$depend}\n";
470
-							array_unshift( $batch->data, $all_updates[ array_search( $depend, $all_update_ids ) ] );
466
+						if (in_array($depend, $all_update_ids) && ! in_array($depend, $all_batch_update_ids)) {
467
+							$log_data .= 'Adding missing update: '."{$depend}\n";
468
+							array_unshift($batch->data, $all_updates[array_search($depend, $all_update_ids)]);
471 469
 						}
472 470
 					}
473 471
 				}
@@ -477,52 +475,52 @@  discard block
 block discarded – undo
477 475
 		/**
478 476
 		 * Add new upgrade to batch
479 477
 		 */
480
-		if ( $new_updates = $this->get_updates( 'database', 'new' ) ) {
481
-			$all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array();
478
+		if ($new_updates = $this->get_updates('database', 'new')) {
479
+			$all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array();
482 480
 
483
-			foreach ( $new_updates as $index => $new_update ) {
484
-				if ( give_has_upgrade_completed( $new_update['id'] ) || in_array( $new_update['id'], $all_batch_update_ids ) ) {
485
-					unset( $new_updates[ $index ] );
481
+			foreach ($new_updates as $index => $new_update) {
482
+				if (give_has_upgrade_completed($new_update['id']) || in_array($new_update['id'], $all_batch_update_ids)) {
483
+					unset($new_updates[$index]);
486 484
 				}
487 485
 			}
488 486
 
489
-			if ( ! empty( $new_updates ) ) {
490
-				$log_data .= 'Adding new update: ' . "\n";
491
-				$log_data .= print_r( $new_updates, true ) . "\n";
487
+			if ( ! empty($new_updates)) {
488
+				$log_data .= 'Adding new update: '."\n";
489
+				$log_data .= print_r($new_updates, true)."\n";
492 490
 
493
-				$batch->data = array_merge( (array) $batch->data, $new_updates );
494
-				update_option( 'give_db_update_count', ( absint( get_option( 'give_db_update_count' ) ) + count( $new_updates ) ) );
491
+				$batch->data = array_merge((array) $batch->data, $new_updates);
492
+				update_option('give_db_update_count', (absint(get_option('give_db_update_count')) + count($new_updates)));
495 493
 			}
496 494
 		}
497 495
 
498 496
 		/**
499 497
 		 * Fix batch
500 498
 		 */
501
-		if ( empty( $batch->data ) ) {
499
+		if (empty($batch->data)) {
502 500
 			// Complete batch if do not have any data to process.
503
-			self::$background_updater->delete( $batch->key );
501
+			self::$background_updater->delete($batch->key);
504 502
 
505
-			if ( self::$background_updater->has_queue() ) {
506
-				$this->__health_background_update( $this );
503
+			if (self::$background_updater->has_queue()) {
504
+				$this->__health_background_update($this);
507 505
 			} else {
508
-				delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' );
509
-				wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() );
506
+				delete_site_transient(self::$background_updater->get_identifier().'_process_lock');
507
+				wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier());
510 508
 
511 509
 				self::$background_updater->complete();
512 510
 			}
513 511
 
514
-		} elseif ( $batch_data_count !== count( $batch->data ) ) {
512
+		} elseif ($batch_data_count !== count($batch->data)) {
515 513
 
516
-			$log_data .= 'Updating batch' . "\n";
517
-			$log_data .= print_r( $batch, true );
514
+			$log_data .= 'Updating batch'."\n";
515
+			$log_data .= print_r($batch, true);
518 516
 
519
-			if ( ! empty( $batch->key ) ) {
520
-				wp_cache_delete( $batch->key, 'options' );
521
-				update_option( $batch->key, $batch->data );
517
+			if ( ! empty($batch->key)) {
518
+				wp_cache_delete($batch->key, 'options');
519
+				update_option($batch->key, $batch->data);
522 520
 			} else {
523 521
 
524
-				foreach ( $batch->data as $data ) {
525
-					Give_Updates::$background_updater->push_to_queue( $data );
522
+				foreach ($batch->data as $data) {
523
+					Give_Updates::$background_updater->push_to_queue($data);
526 524
 				}
527 525
 
528 526
 				Give_Updates::$background_updater->save();
@@ -533,31 +531,31 @@  discard block
 block discarded – undo
533 531
 		/**
534 532
 		 * Fix give_doing_upgrade option
535 533
 		 */
536
-		if( $fresh_new_db_count = $this->get_total_new_db_update_count( true ) ) {
537
-			update_option( 'give_db_update_count', $fresh_new_db_count );
534
+		if ($fresh_new_db_count = $this->get_total_new_db_update_count(true)) {
535
+			update_option('give_db_update_count', $fresh_new_db_count);
538 536
 		}
539 537
 
540 538
 		$doing_upgrade_args['update']           = 1;
541
-		$doing_upgrade_args['heading']          = sprintf( 'Update %s of %s', 1, $fresh_new_db_count );
542
-		$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage( true );
539
+		$doing_upgrade_args['heading']          = sprintf('Update %s of %s', 1, $fresh_new_db_count);
540
+		$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage(true);
543 541
 
544 542
 		// Remove already completed update from info.
545 543
 		if (
546
-			empty( $doing_upgrade_args['update_info'] )
547
-			|| give_has_upgrade_completed( $doing_upgrade_args['update_info']['id'] )
544
+			empty($doing_upgrade_args['update_info'])
545
+			|| give_has_upgrade_completed($doing_upgrade_args['update_info']['id'])
548 546
 		) {
549
-			$doing_upgrade_args['update_info'] = current( array_values( $batch->data ) );
547
+			$doing_upgrade_args['update_info'] = current(array_values($batch->data));
550 548
 			$doing_upgrade_args['step']        = 1;
551 549
 		}
552 550
 
553 551
 		// Check if dependency completed or not.
554
-		if ( isset( $doing_upgrade_args['update_info']['depend'] ) ) {
555
-			foreach ( $doing_upgrade_args['update_info']['depend'] as $depend ) {
556
-				if ( give_has_upgrade_completed( $depend ) ) {
552
+		if (isset($doing_upgrade_args['update_info']['depend'])) {
553
+			foreach ($doing_upgrade_args['update_info']['depend'] as $depend) {
554
+				if (give_has_upgrade_completed($depend)) {
557 555
 					continue;
558 556
 				}
559 557
 
560
-				$doing_upgrade_args['update_info']      = $all_updates[ array_search( $depend, $all_update_ids ) ];
558
+				$doing_upgrade_args['update_info']      = $all_updates[array_search($depend, $all_update_ids)];
561 559
 				$doing_upgrade_args['step']             = 1;
562 560
 				$doing_upgrade_args['percentage']       = 0;
563 561
 				$doing_upgrade_args['total_percentage'] = 0;
@@ -566,14 +564,14 @@  discard block
 block discarded – undo
566 564
 			}
567 565
 		}
568 566
 
569
-		if( ! empty( $doing_upgrade_args['update_info'] ) ) {
570
-			update_option( 'give_doing_upgrade', $doing_upgrade_args );
567
+		if ( ! empty($doing_upgrade_args['update_info'])) {
568
+			update_option('give_doing_upgrade', $doing_upgrade_args);
571 569
 
572
-			$log_data .= 'Updated doing update:' . "\n";
573
-			$log_data .= print_r( $doing_upgrade_args, true ) . "\n";
570
+			$log_data .= 'Updated doing update:'."\n";
571
+			$log_data .= print_r($doing_upgrade_args, true)."\n";
574 572
 		}
575 573
 
576
-		Give()->logs->add( 'Update Health Check', $log_data, 0, 'update' );
574
+		Give()->logs->add('Update Health Check', $log_data, 0, 'update');
577 575
 	}
578 576
 
579 577
 
@@ -587,61 +585,61 @@  discard block
 block discarded – undo
587 585
 		$current_screen = get_current_screen();
588 586
 
589 587
 		// Bailout.
590
-		if ( ! current_user_can( 'manage_give_settings' ) ) {
588
+		if ( ! current_user_can('manage_give_settings')) {
591 589
 			return;
592 590
 		}
593 591
 
594 592
 		// Run DB updates.
595
-		if ( ! empty( $_GET['give-run-db-update'] ) ) {
593
+		if ( ! empty($_GET['give-run-db-update'])) {
596 594
 			$this->run_db_update();
597 595
 		}
598 596
 
599 597
 
600 598
 		// Bailout.
601
-		if ( in_array( $current_screen->base, array( 'give_forms_page_give-updates', 'update-core' ) ) ) {
599
+		if (in_array($current_screen->base, array('give_forms_page_give-updates', 'update-core'))) {
602 600
 			return;
603 601
 		}
604 602
 
605 603
 		// Show notice if upgrade paused.
606
-		if ( self::$background_updater->is_paused_process() ) {
604
+		if (self::$background_updater->is_paused_process()) {
607 605
 			ob_start();
608 606
 
609
-			$upgrade_error = get_option( 'give_upgrade_error' );
610
-			if ( ! $upgrade_error ) : ?>
611
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
612
-				&nbsp;&#8211;&nbsp;<?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give' ); ?>
607
+			$upgrade_error = get_option('give_upgrade_error');
608
+			if ( ! $upgrade_error) : ?>
609
+				<strong><?php _e('Database Update', 'give'); ?></strong>
610
+				&nbsp;&#8211;&nbsp;<?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give'); ?>
613 611
 				<br>
614 612
 				<br>
615
-				<a href="<?php echo esc_url( add_query_arg( array( 'give-restart-db-upgrades' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-restart-updater-btn">
616
-					<?php _e( 'Restart the updater', 'give' ); ?>
613
+				<a href="<?php echo esc_url(add_query_arg(array('give-restart-db-upgrades' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-restart-updater-btn">
614
+					<?php _e('Restart the updater', 'give'); ?>
617 615
 				</a>
618 616
 			<?php else: ?>
619
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
620
-				&nbsp;&#8211;&nbsp;<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
617
+				<strong><?php _e('Database Update', 'give'); ?></strong>
618
+				&nbsp;&#8211;&nbsp;<?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?>
621 619
 			<?php
622 620
 			endif;
623 621
 			$desc_html = ob_get_clean();
624 622
 
625
-			Give()->notices->register_notice( array(
623
+			Give()->notices->register_notice(array(
626 624
 				'id'          => 'give_upgrade_db',
627 625
 				'type'        => 'error',
628 626
 				'dismissible' => false,
629 627
 				'description' => $desc_html,
630
-			) );
628
+			));
631 629
 		}
632 630
 
633 631
 		// Bailout if doing upgrades.
634
-		if ( $this->is_doing_updates() ) {
632
+		if ($this->is_doing_updates()) {
635 633
 			return;
636 634
 		}
637 635
 
638 636
 		// Show notice if ajax is not working.
639
-		if ( ! give_test_ajax_works() ) {
637
+		if ( ! give_test_ajax_works()) {
640 638
 			Give()->notices->register_notice(
641 639
 				array(
642 640
 					'id'          => 'give_db_upgrade_ajax_inaccessible',
643 641
 					'type'        => 'error',
644
-					'description' => sprintf( '%1$s <a href="%2$s" target="_blank">%3$s</a>', __( 'Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give' ), 'http://docs.givewp.com/admin-ajax-error', __( 'Read More', 'give' ) . ' &raquo;' ),
642
+					'description' => sprintf('%1$s <a href="%2$s" target="_blank">%3$s</a>', __('Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give'), 'http://docs.givewp.com/admin-ajax-error', __('Read More', 'give').' &raquo;'),
645 643
 					'show'        => true,
646 644
 				)
647 645
 			);
@@ -650,40 +648,40 @@  discard block
 block discarded – undo
650 648
 		}
651 649
 
652 650
 		// Show db upgrade completed notice.
653
-		if ( ! empty( $_GET['give-db-update-completed'] ) ) {
654
-			Give()->notices->register_notice( array(
651
+		if ( ! empty($_GET['give-db-update-completed'])) {
652
+			Give()->notices->register_notice(array(
655 653
 				'id'          => 'give_db_upgrade_completed',
656 654
 				'type'        => 'updated',
657
-				'description' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
655
+				'description' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
658 656
 				'show'        => true,
659
-			) );
657
+			));
660 658
 
661 659
 			// Start update.
662
-		} elseif ( ! empty( $_GET['give-run-db-update'] ) ) {
660
+		} elseif ( ! empty($_GET['give-run-db-update'])) {
663 661
 			$this->run_db_update();
664 662
 
665 663
 			// Show run the update notice.
666
-		} elseif ( $this->get_total_new_db_update_count() ) {
664
+		} elseif ($this->get_total_new_db_update_count()) {
667 665
 			ob_start();
668 666
 			?>
669 667
 			<p>
670
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
671
-				&nbsp;&#8211;&nbsp;<?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give' ); ?>
668
+				<strong><?php _e('Database Update', 'give'); ?></strong>
669
+				&nbsp;&#8211;&nbsp;<?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give'); ?>
672 670
 			</p>
673 671
 			<p class="submit">
674
-				<a href="<?php echo esc_url( add_query_arg( array( 'give-run-db-update' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-run-update-now">
675
-					<?php _e( 'Run the updater', 'give' ); ?>
672
+				<a href="<?php echo esc_url(add_query_arg(array('give-run-db-update' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-run-update-now">
673
+					<?php _e('Run the updater', 'give'); ?>
676 674
 				</a>
677 675
 			</p>
678 676
 			<?php
679 677
 			$desc_html = ob_get_clean();
680 678
 
681
-			Give()->notices->register_notice( array(
679
+			Give()->notices->register_notice(array(
682 680
 				'id'          => 'give_upgrade_db',
683 681
 				'type'        => 'updated',
684 682
 				'dismissible' => false,
685 683
 				'description' => $desc_html,
686
-			) );
684
+			));
687 685
 		}
688 686
 	}
689 687
 
@@ -694,7 +692,7 @@  discard block
 block discarded – undo
694 692
 	 * @access public
695 693
 	 */
696 694
 	public function render_complete_page() {
697
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php';
695
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php';
698 696
 	}
699 697
 
700 698
 	/**
@@ -704,7 +702,7 @@  discard block
 block discarded – undo
704 702
 	 * @access public
705 703
 	 */
706 704
 	public function render_page() {
707
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php';
705
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php';
708 706
 	}
709 707
 
710 708
 	/**
@@ -715,26 +713,26 @@  discard block
 block discarded – undo
715 713
 	 */
716 714
 	private function run_db_update() {
717 715
 		// Bailout.
718
-		if ( $this->is_doing_updates() || ! $this->get_total_new_db_update_count() ) {
716
+		if ($this->is_doing_updates() || ! $this->get_total_new_db_update_count()) {
719 717
 			return;
720 718
 		}
721 719
 
722
-		$updates = $this->get_updates( 'database', 'new' );
720
+		$updates = $this->get_updates('database', 'new');
723 721
 
724
-		foreach ( $updates as $update ) {
725
-			self::$background_updater->push_to_queue( $update );
722
+		foreach ($updates as $update) {
723
+			self::$background_updater->push_to_queue($update);
726 724
 		}
727 725
 
728
-		add_option( 'give_db_update_count', count( $updates ), '', 'no' );
726
+		add_option('give_db_update_count', count($updates), '', 'no');
729 727
 
730
-		add_option( 'give_doing_upgrade', array(
728
+		add_option('give_doing_upgrade', array(
731 729
 			'update_info'      => $updates[0],
732 730
 			'step'             => 1,
733 731
 			'update'           => 1,
734
-			'heading'          => sprintf( 'Update %s of %s', 1, count( $updates ) ),
732
+			'heading'          => sprintf('Update %s of %s', 1, count($updates)),
735 733
 			'percentage'       => 0,
736 734
 			'total_percentage' => 0,
737
-		), '', 'no' );
735
+		), '', 'no');
738 736
 
739 737
 		self::$background_updater->save()->dispatch();
740 738
 	}
@@ -748,14 +746,13 @@  discard block
 block discarded – undo
748 746
 	 */
749 747
 	public function __flush_resume_updates() {
750 748
 		//delete_option( 'give_doing_upgrade' );
751
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
749
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
752 750
 
753 751
 		// Reset counter.
754 752
 		$this->step = $this->percentage = 0;
755 753
 
756
-		$this->update = ( $this->get_total_db_update_count() > $this->update ) ?
757
-			( $this->update + 1 ) :
758
-			$this->update;
754
+		$this->update = ($this->get_total_db_update_count() > $this->update) ?
755
+			($this->update + 1) : $this->update;
759 756
 	}
760 757
 
761 758
 
@@ -770,7 +767,7 @@  discard block
 block discarded – undo
770 767
 	public function __give_start_updating() {
771 768
 		// Check permission.
772 769
 		if (
773
-			! current_user_can( 'manage_give_settings' ) ||
770
+			! current_user_can('manage_give_settings') ||
774 771
 			$this->is_doing_updates()
775 772
 		) {
776 773
 			wp_send_json_error();
@@ -778,7 +775,7 @@  discard block
 block discarded – undo
778 775
 
779 776
 		// @todo: validate nonce
780 777
 		// @todo: set http method to post
781
-		if ( empty( $_POST['run_db_update'] ) ) {
778
+		if (empty($_POST['run_db_update'])) {
782 779
 			wp_send_json_error();
783 780
 		}
784 781
 
@@ -797,34 +794,34 @@  discard block
 block discarded – undo
797 794
 	 * @return string
798 795
 	 */
799 796
 	public function __give_db_updates_info() {
800
-		$update_info   = get_option( 'give_doing_upgrade' );
797
+		$update_info   = get_option('give_doing_upgrade');
801 798
 		$response_type = '';
802 799
 
803
-		if ( self::$background_updater->is_paused_process() ) {
800
+		if (self::$background_updater->is_paused_process()) {
804 801
 			$update_info = array(
805
-				'message'    => __( 'The updates have been paused.', 'give' ),
802
+				'message'    => __('The updates have been paused.', 'give'),
806 803
 				'heading'    => '',
807 804
 				'percentage' => 0,
808 805
 			);
809 806
 
810
-			if ( get_option( 'give_upgrade_error' ) ) {
811
-				$update_info['message'] = __( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' );
807
+			if (get_option('give_upgrade_error')) {
808
+				$update_info['message'] = __('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give');
812 809
 			}
813 810
 
814 811
 			$response_type = 'error';
815 812
 
816
-		} elseif ( empty( $update_info ) || ! $this->get_total_new_db_update_count( true ) ) {
813
+		} elseif (empty($update_info) || ! $this->get_total_new_db_update_count(true)) {
817 814
 			$update_info   = array(
818
-				'message'    => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
819
-				'heading'    => __( 'Updates Completed.', 'give' ),
815
+				'message'    => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
816
+				'heading'    => __('Updates Completed.', 'give'),
820 817
 				'percentage' => 0,
821 818
 			);
822 819
 			$response_type = 'success';
823 820
 
824
-			delete_option( 'give_show_db_upgrade_complete_notice' );
821
+			delete_option('give_show_db_upgrade_complete_notice');
825 822
 		}
826 823
 
827
-		$this->send_ajax_response( $update_info, $response_type );
824
+		$this->send_ajax_response($update_info, $response_type);
828 825
 	}
829 826
 
830 827
 	/**
@@ -836,7 +833,7 @@  discard block
 block discarded – undo
836 833
 	 * @param        $data
837 834
 	 * @param string $type
838 835
 	 */
839
-	public function send_ajax_response( $data, $type = '' ) {
836
+	public function send_ajax_response($data, $type = '') {
840 837
 		$default = array(
841 838
 			'message'    => '',
842 839
 			'heading'    => '',
@@ -846,24 +843,24 @@  discard block
 block discarded – undo
846 843
 		);
847 844
 
848 845
 		// Set data.
849
-		$data = wp_parse_args( $data, $default );
846
+		$data = wp_parse_args($data, $default);
850 847
 
851 848
 		// Enable cache.
852 849
 		Give_Cache::enable();
853 850
 
854
-		switch ( $type ) {
851
+		switch ($type) {
855 852
 			case 'success':
856
-				wp_send_json_success( $data );
853
+				wp_send_json_success($data);
857 854
 				break;
858 855
 
859 856
 			case 'error':
860
-				wp_send_json_error( $data );
857
+				wp_send_json_error($data);
861 858
 				break;
862 859
 
863 860
 			default:
864
-				wp_send_json( array(
861
+				wp_send_json(array(
865 862
 					'data' => $data,
866
-				) );
863
+				));
867 864
 				break;
868 865
 		}
869 866
 	}
@@ -877,12 +874,12 @@  discard block
 block discarded – undo
877 874
 	 * @param $total
878 875
 	 * @param $current_total
879 876
 	 */
880
-	public function set_percentage( $total, $current_total ) {
877
+	public function set_percentage($total, $current_total) {
881 878
 		// Set percentage.
882
-		$this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0;
879
+		$this->percentage = $total ? (($current_total) / $total) * 100 : 0;
883 880
 
884 881
 		// Verify percentage.
885
-		$this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage;
882
+		$this->percentage = (100 < $this->percentage) ? 100 : $this->percentage;
886 883
 	}
887 884
 
888 885
 	/**
@@ -895,22 +892,22 @@  discard block
 block discarded – undo
895 892
 	 *
896 893
 	 * @return bool|null
897 894
 	 */
898
-	public function is_parent_updates_completed( $update ) {
895
+	public function is_parent_updates_completed($update) {
899 896
 		// Bailout.
900
-		if ( empty( $update['depend'] ) ) {
897
+		if (empty($update['depend'])) {
901 898
 			return true;
902 899
 		}
903 900
 
904 901
 		// Check if dependency is valid or not.
905
-		if ( ! $this->has_valid_dependency( $update ) ) {
902
+		if ( ! $this->has_valid_dependency($update)) {
906 903
 			return null;
907 904
 		}
908 905
 
909 906
 		$is_dependency_completed = true;
910 907
 
911
-		foreach ( $update['depend'] as $depend ) {
908
+		foreach ($update['depend'] as $depend) {
912 909
 
913
-			if ( ! give_has_upgrade_completed( $depend ) ) {
910
+			if ( ! give_has_upgrade_completed($depend)) {
914 911
 				$is_dependency_completed = false;
915 912
 				break;
916 913
 			}
@@ -927,7 +924,7 @@  discard block
 block discarded – undo
927 924
 	 * @return bool
928 925
 	 */
929 926
 	public function is_doing_updates() {
930
-		return (bool) get_option( 'give_doing_upgrade' );
927
+		return (bool) get_option('give_doing_upgrade');
931 928
 	}
932 929
 
933 930
 
@@ -941,7 +938,7 @@  discard block
 block discarded – undo
941 938
 	 *
942 939
 	 * @return bool
943 940
 	 */
944
-	public function has_valid_dependency( $update ) {
941
+	public function has_valid_dependency($update) {
945 942
 		$is_valid_dependency = true;
946 943
 		// $update_ids          = wp_list_pluck( $this->get_updates( 'database', 'all' ), 'id' );
947 944
 		//
@@ -967,33 +964,33 @@  discard block
 block discarded – undo
967 964
 	 *
968 965
 	 * @return array
969 966
 	 */
970
-	public function get_updates( $update_type = '', $status = 'all' ) {
967
+	public function get_updates($update_type = '', $status = 'all') {
971 968
 		// return all updates.
972
-		if ( empty( $update_type ) ) {
969
+		if (empty($update_type)) {
973 970
 			return $this->updates;
974 971
 		}
975 972
 
976 973
 		// Get specific update.
977
-		$updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array();
974
+		$updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array();
978 975
 
979 976
 		// Bailout.
980
-		if ( empty( $updates ) ) {
977
+		if (empty($updates)) {
981 978
 			return $updates;
982 979
 		}
983 980
 
984
-		switch ( $status ) {
981
+		switch ($status) {
985 982
 			case 'new':
986 983
 				// Remove already completed updates.
987
-				wp_cache_delete( 'give_completed_upgrades', 'options' );
984
+				wp_cache_delete('give_completed_upgrades', 'options');
988 985
 				$completed_updates = give_get_completed_upgrades();
989 986
 
990
-				if ( ! empty( $completed_updates ) ) {
991
-					foreach ( $updates as $index => $update ) {
992
-						if ( in_array( $update['id'], $completed_updates ) ) {
993
-							unset( $updates[ $index ] );
987
+				if ( ! empty($completed_updates)) {
988
+					foreach ($updates as $index => $update) {
989
+						if (in_array($update['id'], $completed_updates)) {
990
+							unset($updates[$index]);
994 991
 						}
995 992
 					}
996
-					$updates = array_values( $updates );
993
+					$updates = array_values($updates);
997 994
 				}
998 995
 
999 996
 				break;
@@ -1010,7 +1007,7 @@  discard block
 block discarded – undo
1010 1007
 	 * @return int
1011 1008
 	 */
1012 1009
 	public function get_total_plugin_update_count() {
1013
-		return count( $this->get_updates( 'plugin' ) );
1010
+		return count($this->get_updates('plugin'));
1014 1011
 	}
1015 1012
 
1016 1013
 	/**
@@ -1025,7 +1022,7 @@  discard block
 block discarded – undo
1025 1022
 		$db_update_count     = $this->get_pending_db_update_count();
1026 1023
 		$plugin_update_count = $this->get_total_plugin_update_count();
1027 1024
 
1028
-		return ( $db_update_count + $plugin_update_count );
1025
+		return ($db_update_count + $plugin_update_count);
1029 1026
 	}
1030 1027
 
1031 1028
 	/**
@@ -1037,7 +1034,7 @@  discard block
 block discarded – undo
1037 1034
 	 * @return int
1038 1035
 	 */
1039 1036
 	public function get_pending_db_update_count() {
1040
-		return count( $this->get_updates( 'database', 'new' ) );
1037
+		return count($this->get_updates('database', 'new'));
1041 1038
 	}
1042 1039
 
1043 1040
 	/**
@@ -1049,7 +1046,7 @@  discard block
 block discarded – undo
1049 1046
 	 * @return int
1050 1047
 	 */
1051 1048
 	public function get_total_db_update_count() {
1052
-		return count( $this->get_updates( 'database', 'all' ) );
1049
+		return count($this->get_updates('database', 'all'));
1053 1050
 	}
1054 1051
 
1055 1052
 	/**
@@ -1062,10 +1059,9 @@  discard block
 block discarded – undo
1062 1059
 	 *
1063 1060
 	 * @return int
1064 1061
 	 */
1065
-	public function get_total_new_db_update_count( $refresh = false ) {
1062
+	public function get_total_new_db_update_count($refresh = false) {
1066 1063
 		$update_count = $this->is_doing_updates() && ! $refresh ?
1067
-			get_option( 'give_db_update_count' ) :
1068
-			$this->get_pending_db_update_count();
1064
+			get_option('give_db_update_count') : $this->get_pending_db_update_count();
1069 1065
 
1070 1066
 		return $update_count;
1071 1067
 	}
@@ -1080,11 +1076,11 @@  discard block
 block discarded – undo
1080 1076
 	 *
1081 1077
 	 * @return int
1082 1078
 	 */
1083
-	public function get_running_db_update( $refresh = false ) {
1079
+	public function get_running_db_update($refresh = false) {
1084 1080
 		$current_update = 1;
1085 1081
 
1086
-		if ( $this->is_doing_updates() && ! $refresh ) {
1087
-			$current_update = get_option( 'give_doing_upgrade' );
1082
+		if ($this->is_doing_updates() && ! $refresh) {
1083
+			$current_update = get_option('give_doing_upgrade');
1088 1084
 			$current_update = $current_update['update'];
1089 1085
 		}
1090 1086
 
@@ -1101,25 +1097,23 @@  discard block
 block discarded – undo
1101 1097
 	 *
1102 1098
 	 * @return float|int
1103 1099
 	 */
1104
-	public function get_db_update_processing_percentage( $refresh = false ) {
1100
+	public function get_db_update_processing_percentage($refresh = false) {
1105 1101
 		// Bailout.
1106
-		if ( ! $this->get_total_new_db_update_count( $refresh ) ) {
1102
+		if ( ! $this->get_total_new_db_update_count($refresh)) {
1107 1103
 			return 0;
1108 1104
 		}
1109 1105
 
1110
-		$resume_update            = get_option( 'give_doing_upgrade' );
1111
-		$update_count_percentages = ( ( $this->get_running_db_update( $refresh ) - 1 ) / $this->get_total_new_db_update_count( $refresh ) ) * 100;
1112
-		$update_percentage_share  = ( 1 / $this->get_total_new_db_update_count() ) * 100;
1113
-		$upgrade_percentage       = ( ( $resume_update['percentage'] * $update_percentage_share ) / 100 );
1106
+		$resume_update            = get_option('give_doing_upgrade');
1107
+		$update_count_percentages = (($this->get_running_db_update($refresh) - 1) / $this->get_total_new_db_update_count($refresh)) * 100;
1108
+		$update_percentage_share  = (1 / $this->get_total_new_db_update_count()) * 100;
1109
+		$upgrade_percentage       = (($resume_update['percentage'] * $update_percentage_share) / 100);
1114 1110
 
1115 1111
 		$final_percentage = $update_count_percentages + $upgrade_percentage;
1116 1112
 
1117 1113
 		return $this->is_doing_updates() ?
1118
-			( absint( $final_percentage ) ?
1119
-				absint( $final_percentage ) :
1120
-				round( $final_percentage, 2 )
1121
-			) :
1122
-			0;
1114
+			(absint($final_percentage) ?
1115
+				absint($final_percentage) : round($final_percentage, 2)
1116
+			) : 0;
1123 1117
 	}
1124 1118
 
1125 1119
 
@@ -1131,8 +1125,8 @@  discard block
 block discarded – undo
1131 1125
 	 * @return array
1132 1126
 	 */
1133 1127
 	public function get_update_ids() {
1134
-		$all_updates    = $this->get_updates( 'database', 'all' );
1135
-		$all_update_ids = wp_list_pluck( $all_updates, 'id' );
1128
+		$all_updates    = $this->get_updates('database', 'all');
1129
+		$all_update_ids = wp_list_pluck($all_updates, 'id');
1136 1130
 
1137 1131
 		return $all_update_ids;
1138 1132
 	}
@@ -1147,10 +1141,9 @@  discard block
 block discarded – undo
1147 1141
 	 *
1148 1142
 	 * @return float|int
1149 1143
 	 */
1150
-	public function get_offset( $process_item_count ) {
1151
-		return ( 1 === $this->step ) ?
1152
-			0 :
1153
-			( $this->step - 1 ) * $process_item_count;
1144
+	public function get_offset($process_item_count) {
1145
+		return (1 === $this->step) ?
1146
+			0 : ($this->step - 1) * $process_item_count;
1154 1147
 	}
1155 1148
 }
1156 1149
 
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( 'give_forms' === $typenow ) {
30
+	if ('give_forms' === $typenow) {
31 31
 		$rate_text = sprintf(
32 32
 			/* translators: %s: Link to 5 star rating */
33
-			__( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
34
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
33
+			__('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
34
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
35 35
 		);
36 36
 
37 37
 		return $rate_text;
@@ -40,4 +40,4 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 }
42 42
 
43
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
43
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/admin/admin-pages.php 1 patch
Spacing   +81 added lines, -81 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
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page;
33 33
 
34 34
 	//Payments
35
-	$give_payment       = get_post_type_object( 'give_payment' );
35
+	$give_payment       = get_post_type_object('give_payment');
36 36
 	$give_payments_page = add_submenu_page(
37 37
 		'edit.php?post_type=give_forms',
38 38
 		$give_payment->labels->name,
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	//Donors
46 46
 	$give_donors_page = add_submenu_page(
47 47
 		'edit.php?post_type=give_forms',
48
-		esc_html__( 'Donors', 'give' ),
49
-		esc_html__( 'Donors', 'give' ),
48
+		esc_html__('Donors', 'give'),
49
+		esc_html__('Donors', 'give'),
50 50
 		'view_give_reports',
51 51
 		'give-donors',
52 52
 		'give_donors_page'
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	//Reports`
56 56
 	$give_reports_page = add_submenu_page(
57 57
 		'edit.php?post_type=give_forms',
58
-		esc_html__( 'Donation Reports', 'give' ),
59
-		esc_html__( 'Reports', 'give' ),
58
+		esc_html__('Donation Reports', 'give'),
59
+		esc_html__('Reports', 'give'),
60 60
 		'view_give_reports',
61 61
 		'give-reports',
62 62
 		array(
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	//Settings
69 69
 	$give_settings_page = add_submenu_page(
70 70
 		'edit.php?post_type=give_forms',
71
-		esc_html__( 'Give Settings', 'give' ),
72
-		esc_html__( 'Settings', 'give' ),
71
+		esc_html__('Give Settings', 'give'),
72
+		esc_html__('Settings', 'give'),
73 73
 		'manage_give_settings',
74 74
 		'give-settings',
75 75
 		array(
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	//Tools.
82 82
 	$give_tools_page = add_submenu_page(
83 83
 		'edit.php?post_type=give_forms',
84
-		esc_html__( 'Give Tools', 'give' ),
85
-		esc_html__( 'Tools', 'give' ),
84
+		esc_html__('Give Tools', 'give'),
85
+		esc_html__('Tools', 'give'),
86 86
 		'manage_give_settings',
87 87
 		'give-tools',
88 88
 		array(
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 	//Add-ons
95 95
 	$give_add_ons_page = add_submenu_page(
96 96
 		'edit.php?post_type=give_forms',
97
-		esc_html__( 'Give Add-ons', 'give' ),
98
-		esc_html__( 'Add-ons', 'give' ),
97
+		esc_html__('Give Add-ons', 'give'),
98
+		esc_html__('Add-ons', 'give'),
99 99
 		'install_plugins',
100 100
 		'give-addons',
101 101
 		'give_add_ons_page'
102 102
 	);
103 103
 }
104 104
 
105
-add_action( 'admin_menu', 'give_add_options_links', 10 );
105
+add_action('admin_menu', 'give_add_options_links', 10);
106 106
 
107 107
 /**
108 108
  *  Determines whether the current admin page is a Give admin page.
@@ -118,28 +118,28 @@  discard block
 block discarded – undo
118 118
  *
119 119
  * @return bool True if Give admin page.
120 120
  */
121
-function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
121
+function give_is_admin_page($passed_page = '', $passed_view = '') {
122 122
 	global $pagenow, $typenow;
123 123
 
124 124
 	$found          = true;
125
-	$get_query_args = ! empty( $_GET ) ? @array_map( 'strtolower', $_GET ) : array();
125
+	$get_query_args = ! empty($_GET) ? @array_map('strtolower', $_GET) : array();
126 126
 
127 127
 	// Set default argument, if not passed.
128
-	$query_args = wp_parse_args( $get_query_args, array_fill_keys( array( 'post_type', 'action', 'taxonomy', 'page', 'view', 'tab' ), false ) );
128
+	$query_args = wp_parse_args($get_query_args, array_fill_keys(array('post_type', 'action', 'taxonomy', 'page', 'view', 'tab'), false));
129 129
 
130
-	switch ( $passed_page ) {
130
+	switch ($passed_page) {
131 131
 		case 'categories':
132 132
 		case 'tags':
133
-			$has_view = in_array( $passed_view, array( 'list-table', 'edit', 'new' ), true );
133
+			$has_view = in_array($passed_view, array('list-table', 'edit', 'new'), true);
134 134
 
135 135
 			if (
136
-				! in_array( $query_args['taxonomy'], array( 'give_forms_category', 'give_forms_tag' ), true ) &&
136
+				! in_array($query_args['taxonomy'], array('give_forms_category', 'give_forms_tag'), true) &&
137 137
 				'edit-tags.php' !== $pagenow &&
138 138
 				(
139 139
 					$has_view ||
140 140
 					(
141
-						( in_array( $passed_view, array( 'list-table', 'new' ), true ) && 'edit' === $query_args['action'] ) ||
142
-						( 'edit' !== $passed_view && 'edit' !== $query_args['action'] ) &&
141
+						(in_array($passed_view, array('list-table', 'new'), true) && 'edit' === $query_args['action']) ||
142
+						('edit' !== $passed_view && 'edit' !== $query_args['action']) &&
143 143
 						! $has_view
144 144
 					)
145 145
 				)
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 			break;
150 150
 		// Give Donation form page.
151 151
 		case 'give_forms':
152
-			$has_view = in_array( $passed_view, array( 'new', 'list-table', 'edit' ), true );
152
+			$has_view = in_array($passed_view, array('new', 'list-table', 'edit'), true);
153 153
 
154 154
 			if (
155 155
 				'give_forms' !== $typenow &&
156 156
 				(
157
-					( 'list-table' !== $passed_view && 'edit.php' !== $pagenow ) &&
158
-					( 'edit' !== $passed_view && 'post.php' !== $pagenow ) &&
159
-					( 'new' !== $passed_view && 'post-new.php' !== $pagenow )
157
+					('list-table' !== $passed_view && 'edit.php' !== $pagenow) &&
158
+					('edit' !== $passed_view && 'post.php' !== $pagenow) &&
159
+					('new' !== $passed_view && 'post-new.php' !== $pagenow)
160 160
 				) ||
161 161
 				(
162 162
 					! $has_view &&
163
-					( 'post-new.php' !== $pagenow && 'give_forms' !== $query_args['post_type'] )
163
+					('post-new.php' !== $pagenow && 'give_forms' !== $query_args['post_type'])
164 164
 				)
165 165
 			) {
166 166
 				$found = false;
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 			break;
169 169
 		// Give Donors page.
170 170
 		case 'donors':
171
-			$has_view = array_intersect( array( $passed_view, $query_args['view'] ), array( 'list-table', 'overview', 'notes' ) );
171
+			$has_view = array_intersect(array($passed_view, $query_args['view']), array('list-table', 'overview', 'notes'));
172 172
 
173 173
 			if (
174
-				( 'give-donors' !== $query_args['page'] || 'edit.php' !== $pagenow ) &&
174
+				('give-donors' !== $query_args['page'] || 'edit.php' !== $pagenow) &&
175 175
 				(
176
-					( $passed_view !== $query_args['view'] || ! empty( $has_view ) ) ||
177
-					( false !== $query_args['view'] && 'list-table' !== $passed_view )
176
+					($passed_view !== $query_args['view'] || ! empty($has_view)) ||
177
+					(false !== $query_args['view'] && 'list-table' !== $passed_view)
178 178
 				)
179 179
 			) {
180 180
 				$found = false;
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
 		// Give Donations page.
184 184
 		case 'payments':
185 185
 			if (
186
-				( 'give-payment-history' !== $query_args['page'] || 'edit.php' !== $pagenow ) &&
186
+				('give-payment-history' !== $query_args['page'] || 'edit.php' !== $pagenow) &&
187 187
 				(
188
-					! in_array( $passed_view, array( 'list-table', 'edit' ), true ) ||
188
+					! in_array($passed_view, array('list-table', 'edit'), true) ||
189 189
 					(
190
-						( 'list-table' !== $passed_view && false !== $query_args['view'] ) ||
191
-						( 'edit' !== $passed_view && 'view-payment-details' !== $query_args['view'] )
190
+						('list-table' !== $passed_view && false !== $query_args['view']) ||
191
+						('edit' !== $passed_view && 'view-payment-details' !== $query_args['view'])
192 192
 					)
193 193
 				)
194 194
 			) {
@@ -199,20 +199,20 @@  discard block
 block discarded – undo
199 199
 		case 'settings':
200 200
 		case 'addons':
201 201
 			// Get current tab.
202
-			$current_tab       = empty( $passed_view ) ? $query_args['tab'] : $passed_view;
203
-			$give_setting_page = in_array( $query_args['page'], array( 'give-reports', 'give-settings', 'give-addons' ), true );
202
+			$current_tab       = empty($passed_view) ? $query_args['tab'] : $passed_view;
203
+			$give_setting_page = in_array($query_args['page'], array('give-reports', 'give-settings', 'give-addons'), true);
204 204
 
205 205
 			// Check if it's Give Setting page or not.
206 206
 			if (
207
-				( 'edit.php' !== $pagenow || ! $give_setting_page ) &&
208
-				! Give_Admin_Settings::is_setting_page( $current_tab )
207
+				('edit.php' !== $pagenow || ! $give_setting_page) &&
208
+				! Give_Admin_Settings::is_setting_page($current_tab)
209 209
 			) {
210 210
 				$found = false;
211 211
 			}
212 212
 			break;
213 213
 		default:
214 214
 			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page;
215
-			$admin_pages = apply_filters( 'give_admin_pages', array(
215
+			$admin_pages = apply_filters('give_admin_pages', array(
216 216
 				$give_payments_page,
217 217
 				$give_settings_page,
218 218
 				$give_reports_page,
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 				$give_donors_page,
223 223
 				$give_tools_page,
224 224
 				'widgets.php',
225
-			) );
225
+			));
226 226
 
227
-			$found = ( 'give_forms' === $typenow || in_array( $pagenow, array_merge( $admin_pages, array( 'index.php', 'post-new.php', 'post.php' ) ), true ) ) ? true : false;
227
+			$found = ('give_forms' === $typenow || in_array($pagenow, array_merge($admin_pages, array('index.php', 'post-new.php', 'post.php')), true)) ? true : false;
228 228
 	}
229
-	return (bool) apply_filters( 'give_is_admin_page', $found, $query_args['page'], $query_args['view'], $passed_page, $passed_view );
229
+	return (bool) apply_filters('give_is_admin_page', $found, $query_args['page'], $query_args['view'], $passed_page, $passed_view);
230 230
 }
231 231
 
232 232
 /**
@@ -236,37 +236,37 @@  discard block
 block discarded – undo
236 236
  * @param  array $settings
237 237
  * @return array
238 238
  */
239
-function give_settings_page_pages( $settings ) {
240
-	include( 'abstract-admin-settings-page.php' );
241
-	include( 'settings/class-settings-cmb2-backward-compatibility.php' );
239
+function give_settings_page_pages($settings) {
240
+	include('abstract-admin-settings-page.php');
241
+	include('settings/class-settings-cmb2-backward-compatibility.php');
242 242
 
243 243
 	$settings = array(
244 244
 		// General settings.
245
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-general.php' ),
245
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-general.php'),
246 246
 
247 247
 		// Payment Gateways Settings.
248
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-gateways.php' ),
248
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-gateways.php'),
249 249
 
250 250
 		// Display settings.
251
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-display.php' ),
251
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-display.php'),
252 252
 
253 253
 		// Emails settings.
254
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-email.php' ),
254
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-email.php'),
255 255
 
256 256
 		// Addons settings.
257
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-addon.php' ),
257
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-addon.php'),
258 258
 
259 259
 		// License settings.
260
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-license.php' ),
260
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-license.php'),
261 261
 
262 262
 		// Advanced settings.
263
-		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-advanced.php' ),
263
+		include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-advanced.php'),
264 264
 	);
265 265
 
266 266
 	// Output.
267 267
 	return $settings;
268 268
 }
269
-add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 );
269
+add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1);
270 270
 
271 271
 
272 272
 /**
@@ -276,25 +276,25 @@  discard block
 block discarded – undo
276 276
  * @param  array $settings
277 277
  * @return array
278 278
  */
279
-function give_reports_page_pages( $settings ) {
280
-	include( 'abstract-admin-settings-page.php' );
279
+function give_reports_page_pages($settings) {
280
+	include('abstract-admin-settings-page.php');
281 281
 
282 282
 	$settings = array(
283 283
 		// Earnings.
284
-		include( 'reports/class-earnings-report.php' ),
284
+		include('reports/class-earnings-report.php'),
285 285
 
286 286
 		// Forms.
287
-		include( 'reports/class-forms-report.php' ),
287
+		include('reports/class-forms-report.php'),
288 288
 
289 289
 		// Gateways.
290
-		include( 'reports/class-gateways-report.php' ),
290
+		include('reports/class-gateways-report.php'),
291 291
 
292 292
 	);
293 293
 
294 294
 	// Output.
295 295
 	return $settings;
296 296
 }
297
-add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 );
297
+add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1);
298 298
 
299 299
 /**
300 300
  * Add setting tab to give-settings page
@@ -303,34 +303,34 @@  discard block
 block discarded – undo
303 303
  * @param  array $settings
304 304
  * @return array
305 305
  */
306
-function give_tools_page_pages( $settings ) {
307
-	include( 'abstract-admin-settings-page.php' );
306
+function give_tools_page_pages($settings) {
307
+	include('abstract-admin-settings-page.php');
308 308
 
309 309
 	$settings = array(
310 310
 
311 311
 		// Export.
312
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-export.php' ),
312
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-export.php'),
313 313
 
314 314
 		// Import
315
-		include_once( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-import.php' ),
315
+		include_once(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-import.php'),
316 316
 
317 317
 		// Logs.
318
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-logs.php' ),
318
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-logs.php'),
319 319
 
320 320
 		// API.
321
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-api.php' ),
321
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-api.php'),
322 322
 
323 323
 		// Data.
324
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-data.php' ),
324
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-data.php'),
325 325
 
326 326
 		// System Info.
327
-		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-system-info.php' ),
327
+		include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-system-info.php'),
328 328
 	);
329 329
 
330 330
 	// Output.
331 331
 	return $settings;
332 332
 }
333
-add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 );
333
+add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1);
334 334
 
335 335
 /**
336 336
  * Set default tools page tab.
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
  * @param  string $default_tab Default tab name.
340 340
  * @return string
341 341
  */
342
-function give_set_default_tab_form_tools_page( $default_tab ) {
342
+function give_set_default_tab_form_tools_page($default_tab) {
343 343
 	return 'export';
344 344
 }
345
-add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 );
345
+add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1);
346 346
 
347 347
 
348 348
 /**
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
  * @param  string $default_tab Default tab name.
353 353
  * @return string
354 354
  */
355
-function give_set_default_tab_form_reports_page( $default_tab ) {
355
+function give_set_default_tab_form_reports_page($default_tab) {
356 356
 	return 'earnings';
357 357
 }
358
-add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 );
358
+add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1);
359 359
 
360 360
 
361 361
 /**
@@ -368,19 +368,19 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return array
370 370
  */
371
-function give_add_display_page_states( $post_states, $post ) {
371
+function give_add_display_page_states($post_states, $post) {
372 372
 
373
-	switch ( $post->ID ) {
374
-		case give_get_option( 'success_page' ):
375
-			$post_states['give_successfully_page'] = __( 'Donation Success Page', 'give' );
373
+	switch ($post->ID) {
374
+		case give_get_option('success_page'):
375
+			$post_states['give_successfully_page'] = __('Donation Success Page', 'give');
376 376
 			break;
377 377
 
378
-		case give_get_option( 'failure_page' ):
379
-			$post_states['give_failure_page'] = __( 'Donation Failed Page', 'give' );
378
+		case give_get_option('failure_page'):
379
+			$post_states['give_failure_page'] = __('Donation Failed Page', 'give');
380 380
 			break;
381 381
 
382
-		case give_get_option( 'history_page' ):
383
-			$post_states['give_history_page'] = __( 'Donation History Page', 'give' );
382
+		case give_get_option('history_page'):
383
+			$post_states['give_history_page'] = __('Donation History Page', 'give');
384 384
 			break;
385 385
 	}
386 386
 
@@ -388,4 +388,4 @@  discard block
 block discarded – undo
388 388
 }
389 389
 
390 390
 // Add a post display state for special Give pages.
391
-add_filter( 'display_post_states', 'give_add_display_page_states', 10, 2 );
391
+add_filter('display_post_states', 'give_add_display_page_states', 10, 2);
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 1 patch
Spacing   +66 added lines, -66 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
 /**
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 		global $status, $page;
54 54
 
55 55
 		// Set parent defaults
56
-		parent::__construct( array(
57
-			'singular' => esc_html__( 'API Key', 'give' ),     // Singular name of the listed records
58
-			'plural'   => esc_html__( 'API Keys', 'give' ),    // Plural name of the listed records
56
+		parent::__construct(array(
57
+			'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records
58
+			'plural'   => esc_html__('API Keys', 'give'), // Plural name of the listed records
59 59
 			'ajax'     => false, // Does this table support ajax?
60
-		) );
60
+		));
61 61
 
62 62
 		$this->query();
63 63
 	}
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string Column Name
75 75
 	 */
76
-	public function column_default( $item, $column_name ) {
77
-		return $item[ $column_name ];
76
+	public function column_default($item, $column_name) {
77
+		return $item[$column_name];
78 78
 	}
79 79
 
80 80
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string Column Name
89 89
 	 */
90
-	public function column_key( $item ) {
91
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>';
90
+	public function column_key($item) {
91
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>';
92 92
 	}
93 93
 
94 94
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string Column Name
103 103
 	 */
104
-	public function column_token( $item ) {
105
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>';
104
+	public function column_token($item) {
105
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>';
106 106
 	}
107 107
 
108 108
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return string Column Name
117 117
 	 */
118
-	public function column_secret( $item ) {
119
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>';
118
+	public function column_secret($item) {
119
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>';
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,46 +126,46 @@  discard block
 block discarded – undo
126 126
 	 * @since  1.1
127 127
 	 * @return string
128 128
 	 */
129
-	public function column_user( $item ) {
129
+	public function column_user($item) {
130 130
 
131 131
 		$actions = array();
132 132
 
133
-		if ( apply_filters( 'give_api_log_requests', true ) ) {
133
+		if (apply_filters('give_api_log_requests', true)) {
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136
-				esc_url( add_query_arg( array(
136
+				esc_url(add_query_arg(array(
137 137
 					'section'   => 'api_requests',
138 138
 					'post_type' => 'give_forms',
139 139
 					'page'      => 'give-tools',
140 140
 					'tab'       => 'logs',
141 141
 					's'         => $item['email'],
142
-				), 'edit.php' ) ),
143
-				esc_html__( 'View API Log', 'give' )
142
+				), 'edit.php')),
143
+				esc_html__('View API Log', 'give')
144 144
 			);
145 145
 		}
146 146
 
147 147
 		$actions['reissue'] = sprintf(
148 148
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
149
-			esc_url( wp_nonce_url( add_query_arg( array(
149
+			esc_url(wp_nonce_url(add_query_arg(array(
150 150
 				'user_id'          => $item['id'],
151 151
 				'give_action'      => 'process_api_key',
152 152
 				'give_api_process' => 'regenerate',
153
-			) ), 'give-api-nonce' ) ),
154
-			esc_html__( 'Reissue', 'give' )
153
+			)), 'give-api-nonce')),
154
+			esc_html__('Reissue', 'give')
155 155
 		);
156
-		$actions['revoke']  = sprintf(
156
+		$actions['revoke'] = sprintf(
157 157
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
158
-			esc_url( wp_nonce_url( add_query_arg( array(
158
+			esc_url(wp_nonce_url(add_query_arg(array(
159 159
 				'user_id'          => $item['id'],
160 160
 				'give_action'      => 'process_api_key',
161 161
 				'give_api_process' => 'revoke',
162
-			) ), 'give-api-nonce' ) ),
163
-			esc_html__( 'Revoke', 'give' )
162
+			)), 'give-api-nonce')),
163
+			esc_html__('Revoke', 'give')
164 164
 		);
165 165
 
166
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
166
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
167 167
 
168
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
168
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
169 169
 	}
170 170
 
171 171
 	/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function get_columns() {
191 191
 		$columns = array(
192
-			'user'   => esc_html__( 'Username', 'give' ),
193
-			'key'    => esc_html__( 'Public Key', 'give' ),
194
-			'token'  => esc_html__( 'Token', 'give' ),
195
-			'secret' => esc_html__( 'Secret Key', 'give' ),
192
+			'user'   => esc_html__('Username', 'give'),
193
+			'key'    => esc_html__('Public Key', 'give'),
194
+			'token'  => esc_html__('Token', 'give'),
195
+			'secret' => esc_html__('Secret Key', 'give'),
196 196
 		);
197 197
 
198 198
 		return $columns;
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param string $which
208 208
 	 */
209
-	protected function display_tablenav( $which ) {
210
-		if ( 'top' === $which ) {
211
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
209
+	protected function display_tablenav($which) {
210
+		if ('top' === $which) {
211
+			wp_nonce_field('bulk-'.$this->_args['plural']);
212 212
 		}
213 213
 		?>
214
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
214
+		<div class="tablenav <?php echo esc_attr($which); ?>">
215 215
 
216 216
 			<div class="alignleft actions bulkactions">
217
-				<?php $this->bulk_actions( $which ); ?>
217
+				<?php $this->bulk_actions($which); ?>
218 218
 			</div>
219 219
 
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -237,18 +237,18 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	function bulk_actions( $which = '' ) {
240
+	function bulk_actions($which = '') {
241 241
 		// These aren't really bulk actions but this outputs the markup in the right place.
242 242
 		static $give_api_is_bottom;
243 243
 
244
-		if ( $give_api_is_bottom ) {
244
+		if ($give_api_is_bottom) {
245 245
 			return;
246 246
 		}
247 247
 		?>
248 248
 		<input type="hidden" name="give_action" value="process_api_key"/>
249 249
 		<input type="hidden" name="give_api_process" value="generate"/>
250 250
 		<?php
251
-		wp_nonce_field( 'give-api-nonce' );
251
+		wp_nonce_field('give-api-nonce');
252 252
 		/**
253 253
 		 * API Key user search.
254 254
 		 */
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 			'name' => 'user_id',
258 258
 		);
259 259
 
260
-		echo Give()->html->ajax_user_search( $args );
260
+		echo Give()->html->ajax_user_search($args);
261 261
 
262
-		submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false );
262
+		submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false);
263 263
 
264 264
 		$give_api_is_bottom = true;
265 265
 	}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 * @return int Current page number
273 273
 	 */
274 274
 	public function get_paged() {
275
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
275
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
276 276
 	}
277 277
 
278 278
 	/**
@@ -283,21 +283,21 @@  discard block
 block discarded – undo
283 283
 	 * @return array
284 284
 	 */
285 285
 	public function query() {
286
-		$users = get_users( array(
286
+		$users = get_users(array(
287 287
 			'meta_value' => 'give_user_secret_key',
288 288
 			'number'     => $this->per_page,
289
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 ),
290
-		) );
291
-		$keys  = array();
292
-
293
-		foreach ( $users as $user ) {
294
-			$keys[ $user->ID ]['id']    = $user->ID;
295
-			$keys[ $user->ID ]['email'] = $user->user_email;
296
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
297
-
298
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
299
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
300
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
289
+			'offset'     => $this->per_page * ($this->get_paged() - 1),
290
+		));
291
+		$keys = array();
292
+
293
+		foreach ($users as $user) {
294
+			$keys[$user->ID]['id']    = $user->ID;
295
+			$keys[$user->ID]['email'] = $user->user_email;
296
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
297
+
298
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
299
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
300
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
301 301
 		}
302 302
 
303 303
 		return $keys;
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	public function total_items() {
315 315
 		global $wpdb;
316 316
 
317
-		$total_items = Give_Cache::get( 'give_total_api_keys', true );
317
+		$total_items = Give_Cache::get('give_total_api_keys', true);
318 318
 
319
-		if ( ! $total_items ) {
319
+		if ( ! $total_items) {
320 320
 			$total_items = $wpdb->get_var(
321 321
 				$wpdb->prepare(
322 322
 					"SELECT count(user_id)
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 				)
326 326
 			);
327 327
 
328
-			Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true );
328
+			Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true);
329 329
 		}
330 330
 
331 331
 		return $total_items;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 		$hidden   = array(); // No hidden columns
345 345
 		$sortable = array(); // Not sortable... for now
346 346
 
347
-		$this->_column_headers = array( $columns, $hidden, $sortable );
347
+		$this->_column_headers = array($columns, $hidden, $sortable);
348 348
 
349 349
 		$data = $this->query();
350 350
 
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 
353 353
 		$this->items = $data;
354 354
 
355
-		$this->set_pagination_args( array(
355
+		$this->set_pagination_args(array(
356 356
 			'total_items' => $total_items,
357 357
 			'per_page'    => $this->per_page,
358
-			'total_pages' => ceil( $total_items / $this->per_page ),
359
-		) );
358
+			'total_pages' => ceil($total_items / $this->per_page),
359
+		));
360 360
 	}
361 361
 }
Please login to merge, or discard this patch.
includes/admin/donors/donors.php 2 patches
Spacing   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return string
27 27
  */
28
-function __give_get_format_address( $address, $address_args = array() ) {
28
+function __give_get_format_address($address, $address_args = array()) {
29 29
 	$address_html = '';
30 30
 	$address_args = wp_parse_args(
31 31
 		$address_args,
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	$address_id = $address_args['type'];
41 41
 
42 42
 	// Bailout.
43
-	if ( empty( $address ) || ! is_array( $address ) ) {
43
+	if (empty($address) || ! is_array($address)) {
44 44
 		return $address_html;
45 45
 	}
46 46
 
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 	$address_html .= sprintf(
50 50
 		'<span data-address-type="line1">%1$s</span>%2$s',
51 51
 		$address['line1'],
52
-		( ! empty( $address['line2'] ) ? '<br>' : '' )
52
+		( ! empty($address['line2']) ? '<br>' : '')
53 53
 	);
54 54
 	$address_html .= sprintf(
55 55
 		'<span data-address-type="line2">%1$s</span>%2$s',
56 56
 		$address['line2'],
57
-		( ! empty( $address['city'] ) ? '<br>' : '' )
57
+		( ! empty($address['city']) ? '<br>' : '')
58 58
 	);
59 59
 	$address_html .= sprintf(
60 60
 		'<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s',
61 61
 		$address['city'],
62
-		( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ),
63
-		( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ),
64
-		( ! empty( $address['country'] ) ? '<br>' : '' )
62
+		( ! empty($address['state']) ? ", {$address['state']}" : ''),
63
+		( ! empty($address['zip']) ? " {$address['zip']}" : ''),
64
+		( ! empty($address['country']) ? '<br>' : '')
65 65
 	);
66 66
 	$address_html .= sprintf(
67 67
 		'<span data-address-type="country">%s</span><br>',
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	// Address action.
72 72
 	$address_html .= sprintf(
73 73
 		'<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>',
74
-		__( 'Edit', 'give' ),
75
-		__( 'Remove', 'give' )
74
+		__('Edit', 'give'),
75
+		__('Remove', 'give')
76 76
 	);
77 77
 
78 78
 	/**
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @since 2.0
82 82
 	 */
83
-	$address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args );
83
+	$address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args);
84 84
 
85 85
 	// Set unique id and index for multi type address.
86
-	if ( isset( $address_args['index'] ) ) {
86
+	if (isset($address_args['index'])) {
87 87
 		$address_label = "{$address_label} #{$address_args['index']}";
88 88
 	}
89 89
 
90
-	if ( isset( $address_args['id'] ) ) {
90
+	if (isset($address_args['id'])) {
91 91
 		$address_id = "{$address_id}_{$address_args['id']}";
92 92
 	}
93 93
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function give_donors_page() {
114 114
 	$default_views  = give_donor_views();
115
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors';
116
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
117
-		give_render_donor_view( $requested_view, $default_views );
115
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors';
116
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
117
+		give_render_donor_view($requested_view, $default_views);
118 118
 	} else {
119 119
 		give_donors_list();
120 120
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 	$views = array();
132 132
 
133
-	return apply_filters( 'give_donor_views', $views );
133
+	return apply_filters('give_donor_views', $views);
134 134
 
135 135
 }
136 136
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 	$tabs = array();
146 146
 
147
-	return apply_filters( 'give_donor_tabs', $tabs );
147
+	return apply_filters('give_donor_tabs', $tabs);
148 148
 
149 149
 }
150 150
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function give_donors_list() {
158 158
 
159
-	include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php';
159
+	include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php';
160 160
 
161 161
 	$donors_table = new Give_Donor_List_Table();
162 162
 	$donors_table->prepare_items();
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 		 *
170 170
 		 * @since 1.0
171 171
 		 */
172
-		do_action( 'give_donors_table_top' );
172
+		do_action('give_donors_table_top');
173 173
 		?>
174 174
 
175 175
 		<hr class="wp-header-end">
176
-		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
177
-			<?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?>
176
+		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
177
+			<?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?>
178 178
 			<input type="hidden" name="post_type" value="give_forms" />
179 179
 			<input type="hidden" name="page" value="give-donors" />
180 180
 			<input type="hidden" name="view" value="donors" />
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		 *
192 192
 		 * @since 1.0
193 193
 		 */
194
-		do_action( 'give_donors_table_bottom' );
194
+		do_action('give_donors_table_bottom');
195 195
 		?>
196 196
 	</div>
197 197
 	<?php
@@ -207,33 +207,33 @@  discard block
 block discarded – undo
207 207
  *
208 208
  * @return void
209 209
  */
210
-function give_render_donor_view( $view, $callbacks ) {
210
+function give_render_donor_view($view, $callbacks) {
211 211
 
212 212
 	$render = true;
213 213
 
214
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
214
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
215 215
 
216
-	if ( ! current_user_can( $donor_view_role ) ) {
217
-		give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) );
216
+	if ( ! current_user_can($donor_view_role)) {
217
+		give_set_error('give-no-access', __('You are not permitted to view this data.', 'give'));
218 218
 		$render = false;
219 219
 	}
220 220
 
221
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
222
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
221
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
222
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
223 223
 		$render = false;
224 224
 	}
225 225
 
226 226
 	$donor_id          = (int) $_GET['id'];
227
-	$reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : '';
228
-	$donor             = new Give_Donor( $donor_id );
227
+	$reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : '';
228
+	$donor             = new Give_Donor($donor_id);
229 229
 
230 230
 	// Reconnect User with Donor profile.
231
-	if ( $reconnect_user_id ) {
232
-		give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() );
231
+	if ($reconnect_user_id) {
232
+		give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array());
233 233
 	}
234 234
 
235
-	if ( empty( $donor->id ) ) {
236
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
235
+	if (empty($donor->id)) {
236
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
237 237
 		$render = false;
238 238
 	}
239 239
 
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 
243 243
 	<div class='wrap'>
244 244
 
245
-		<?php if ( give_get_errors() ) : ?>
245
+		<?php if (give_get_errors()) : ?>
246 246
 			<div class="error settings-error">
247
-				<?php Give()->notices->render_frontend_notices( 0 ); ?>
247
+				<?php Give()->notices->render_frontend_notices(0); ?>
248 248
 			</div>
249 249
 		<?php endif; ?>
250 250
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			<?php
253 253
 			printf(
254 254
 			/* translators: %s: donor first name */
255
-				__( 'Edit Donor: %s %s', 'give' ),
255
+				__('Edit Donor: %s %s', 'give'),
256 256
 				$donor->get_first_name(),
257 257
 				$donor->get_last_name()
258 258
 			);
@@ -261,26 +261,26 @@  discard block
 block discarded – undo
261 261
 
262 262
 		<hr class="wp-header-end">
263 263
 
264
-		<?php if ( $donor && $render ) : ?>
264
+		<?php if ($donor && $render) : ?>
265 265
 
266 266
 			<h2 class="nav-tab-wrapper">
267 267
 				<?php
268
-				foreach ( $donor_tabs as $key => $tab ) :
268
+				foreach ($donor_tabs as $key => $tab) :
269 269
 					$active = $key === $view ? true : false;
270 270
 					$class  = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
271 271
 					printf(
272
-						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n",
273
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ),
274
-						esc_attr( $class ),
275
-						sanitize_html_class( $tab['dashicon'] ),
276
-						esc_html( $tab['title'] )
272
+						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n",
273
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)),
274
+						esc_attr($class),
275
+						sanitize_html_class($tab['dashicon']),
276
+						esc_html($tab['title'])
277 277
 					);
278 278
 				endforeach;
279 279
 				?>
280 280
 			</h2>
281 281
 
282 282
 			<div id="give-donor-card-wrapper">
283
-				<?php $callbacks[ $view ]( $donor ) ?>
283
+				<?php $callbacks[$view]($donor) ?>
284 284
 			</div>
285 285
 
286 286
 		<?php endif; ?>
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
  *
301 301
  * @return void
302 302
  */
303
-function give_donor_view( $donor ) {
303
+function give_donor_view($donor) {
304 304
 
305
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
305
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
306 306
 
307 307
 	/**
308 308
 	 * Fires in donor profile screen, above the donor card.
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @param object $donor The donor object being displayed.
313 313
 	 */
314
-	do_action( 'give_donor_card_top', $donor );
314
+	do_action('give_donor_card_top', $donor);
315 315
 
316 316
 	// Set Read only to the fields which needs to be locked.
317 317
 	$read_only = '';
318
-	if ( $donor->user_id ) {
318
+	if ($donor->user_id) {
319 319
 		$read_only = 'readonly="readonly"';
320 320
 	}
321 321
 	?>
@@ -323,32 +323,32 @@  discard block
 block discarded – undo
323 323
 	<div id="donor-summary" class="info-wrapper donor-section postbox">
324 324
 
325 325
 		<form id="edit-donor-info" method="post"
326
-		      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>">
326
+		      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>">
327 327
 
328 328
 			<div class="donor-info">
329 329
 
330 330
 				<div class="donor-bio-header clearfix">
331 331
 
332 332
 					<div class="avatar-wrap left" id="donor-avatar">
333
-						<?php echo get_avatar( $donor->email ); ?>
333
+						<?php echo get_avatar($donor->email); ?>
334 334
 					</div>
335 335
 
336 336
 					<div id="donor-name-wrap" class="left">
337 337
 						<span class="donor-name info-item edit-item">
338 338
 							<input <?php echo $read_only; ?> size="15" data-key="first_name"
339 339
 							                                 name="customerinfo[first_name]" type="text"
340
-							                                 value="<?php esc_attr_e( $donor->get_first_name() ); ?>"
341
-							                                 placeholder="<?php _e( 'First Name', 'give' ); ?>"/>
342
-							<?php if ( $donor->user_id ) : ?>
340
+							                                 value="<?php esc_attr_e($donor->get_first_name()); ?>"
341
+							                                 placeholder="<?php _e('First Name', 'give'); ?>"/>
342
+							<?php if ($donor->user_id) : ?>
343 343
 								<a href="#" class="give-lock-block">
344 344
 									<i class="give-icon give-icon-locked"></i>
345 345
 								</a>
346 346
 							<?php endif; ?>
347 347
 							<input <?php echo $read_only; ?> size="15" data-key="last_name"
348 348
 							                                 name="customerinfo[last_name]" type="text"
349
-							                                 value="<?php esc_attr_e( $donor->get_last_name() ); ?>"
350
-							                                 placeholder="<?php _e( 'Last Name', 'give' ); ?>"/>
351
-							<?php if ( $donor->user_id ) : ?>
349
+							                                 value="<?php esc_attr_e($donor->get_last_name()); ?>"
350
+							                                 placeholder="<?php _e('Last Name', 'give'); ?>"/>
351
+							<?php if ($donor->user_id) : ?>
352 352
 								<a href="#" class="give-lock-block">
353 353
 									<i class="give-icon give-icon-locked"></i>
354 354
 								</a>
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 									data-key="name"><?php echo $donor->name; ?></span></span>
359 359
 					</div>
360 360
 					<p class="donor-since info-item">
361
-						<?php _e( 'Donor since', 'give' ); ?>
362
-						<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
361
+						<?php _e('Donor since', 'give'); ?>
362
+						<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
363 363
 					</p>
364
-					<?php if ( current_user_can( $donor_edit_role ) ) : ?>
364
+					<?php if (current_user_can($donor_edit_role)) : ?>
365 365
 						<a href="#" id="edit-donor"
366
-						   class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a>
366
+						   class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a>
367 367
 					<?php endif; ?>
368 368
 				</div>
369 369
 				<!-- /donor-bio-header -->
@@ -373,11 +373,11 @@  discard block
 block discarded – undo
373 373
 					<table class="widefat striped">
374 374
 						<tbody>
375 375
 						<tr>
376
-							<th scope="col"><label for="tablecell"><?php _e( 'Donor ID:', 'give' ); ?></label></th>
376
+							<th scope="col"><label for="tablecell"><?php _e('Donor ID:', 'give'); ?></label></th>
377 377
 							<td><?php echo $donor->id; ?></td>
378 378
 						</tr>
379 379
 						<tr>
380
-							<th scope="col"><label for="tablecell"><?php _e( 'User ID:', 'give' ); ?></label></th>
380
+							<th scope="col"><label for="tablecell"><?php _e('User ID:', 'give'); ?></label></th>
381 381
 							<td>
382 382
 									<span class="donor-user-id info-item edit-item">
383 383
 										<?php
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
 											'data'  => $data_atts,
395 395
 										);
396 396
 
397
-										if ( ! empty( $user_id ) ) {
398
-											$userdata              = get_userdata( $user_id );
397
+										if ( ! empty($user_id)) {
398
+											$userdata              = get_userdata($user_id);
399 399
 											$user_args['selected'] = $user_id;
400 400
 										}
401 401
 
402
-										echo Give()->html->ajax_user_search( $user_args );
402
+										echo Give()->html->ajax_user_search($user_args);
403 403
 										?>
404 404
 									</span>
405 405
 
406 406
 								<span class="donor-user-id info-item editable">
407
-										<?php if ( ! empty( $userdata ) ) : ?>
408
-											<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
407
+										<?php if ( ! empty($userdata)) : ?>
408
+											<span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span>
409 409
 										<?php else: ?>
410
-											<span data-key="user_id"><?php _e( 'Unregistered', 'give' ); ?></span>
410
+											<span data-key="user_id"><?php _e('Unregistered', 'give'); ?></span>
411 411
 										<?php endif; ?>
412
-									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ):
412
+									<?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0):
413 413
 
414 414
 										echo sprintf(
415 415
 											'- <span class="disconnect-user">
@@ -418,11 +418,11 @@  discard block
 block discarded – undo
418 418
 				                                       | <span class="view-user-profile">
419 419
  											                <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a>
420 420
  										               </span>',
421
-											__( 'Disconnects the current user ID from this donor record.', 'give' ),
422
-											__( 'Disconnect User', 'give' ),
423
-											'user-edit.php?user_id=' . $donor->user_id,
424
-											__( 'View User Profile of current user ID.', 'give' ),
425
-											__( 'View User Profile', 'give' )
421
+											__('Disconnects the current user ID from this donor record.', 'give'),
422
+											__('Disconnect User', 'give'),
423
+											'user-edit.php?user_id='.$donor->user_id,
424
+											__('View User Profile of current user ID.', 'give'),
425
+											__('View User Profile', 'give')
426 426
 										);
427 427
 
428 428
 										endif; ?>
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
 						</tr>
432 432
 
433 433
 						<?php
434
-						$donor_company = $donor->get_meta( '_give_donor_company', true );
434
+						$donor_company = $donor->get_meta('_give_donor_company', true);
435 435
 
436
-						if ( ! empty( $donor_company ) ) {
436
+						if ( ! empty($donor_company)) {
437 437
 							?>
438 438
 							<tr class="alternate">
439 439
 								<th scope="col">
440
-									<label for="tablecell"><?php _e( 'Company Name:', 'give' ); ?></label>
440
+									<label for="tablecell"><?php _e('Company Name:', 'give'); ?></label>
441 441
 								</th>
442 442
 								<td><?php echo $donor_company; ?></td>
443 443
 							</tr>
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 
454 454
 			<span id="donor-edit-actions" class="edit-item">
455 455
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>"/>
456
-				<?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?>
456
+				<?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?>
457 457
 				<input type="hidden" name="give_action" value="edit-donor"/>
458 458
 				<input type="submit" id="give-edit-donor-save" class="button-secondary"
459
-				       value="<?php _e( 'Update Donor', 'give' ); ?>"/>
460
-				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
459
+				       value="<?php _e('Update Donor', 'give'); ?>"/>
460
+				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a>
461 461
 			</span>
462 462
 
463 463
 		</form>
@@ -472,24 +472,24 @@  discard block
 block discarded – undo
472 472
 	 *
473 473
 	 * @param Give_Donor $donor The donor object being displayed.
474 474
 	 */
475
-	do_action( 'give_donor_before_stats', $donor );
475
+	do_action('give_donor_before_stats', $donor);
476 476
 	?>
477 477
 
478 478
 	<div id="donor-stats-wrapper" class="donor-section postbox clear">
479 479
 		<ul>
480 480
 			<li>
481
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>">
481
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>">
482 482
 					<span class="dashicons dashicons-heart"></span>
483 483
 					<?php
484 484
 					// Completed Donations.
485
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count );
486
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor );
485
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count);
486
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor);
487 487
 					?>
488 488
 				</a>
489 489
 			</li>
490 490
 			<li>
491 491
 				<span class="dashicons dashicons-chart-area"></span>
492
-				<?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?>
492
+				<?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?>
493 493
 			</li>
494 494
 			<?php
495 495
 			/**
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 			 *
502 502
 			 * @param object $donor The donor object being displayed.
503 503
 			 */
504
-			do_action( 'give_donor_stats_list', $donor );
504
+			do_action('give_donor_stats_list', $donor);
505 505
 			?>
506 506
 		</ul>
507 507
 	</div>
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @param Give_Donor $donor The donor object being displayed.
516 516
 	 */
517
-	do_action( 'give_donor_before_address', $donor );
517
+	do_action('give_donor_before_address', $donor);
518 518
 	?>
519 519
 
520 520
 	<div id="donor-address-wrapper" class="donor-section clear">
521
-		<h3><?php _e( 'Addresses', 'give' ); ?></h3>
521
+		<h3><?php _e('Addresses', 'give'); ?></h3>
522 522
 
523 523
 		<div class="postbox">
524 524
 			<div class="give-spinner-wrapper">
@@ -528,16 +528,16 @@  discard block
 block discarded – undo
528 528
 				<div class="all-address">
529 529
 					<div class="give-grid-row">
530 530
 						<?php
531
-						if ( ! empty( $donor->address ) ) :
531
+						if ( ! empty($donor->address)) :
532 532
 							// Default address always will be at zero array index.
533 533
 							$is_set_as_default = null;
534 534
 
535
-							foreach ( $donor->address as $address_type => $addresses ) {
535
+							foreach ($donor->address as $address_type => $addresses) {
536 536
 
537
-								switch ( true ) {
538
-									case is_array( end( $addresses ) ):
537
+								switch (true) {
538
+									case is_array(end($addresses)):
539 539
 										$index = 1;
540
-										foreach ( $addresses as $id => $address ) {
540
+										foreach ($addresses as $id => $address) {
541 541
 											echo __give_get_format_address(
542 542
 												$address,
543 543
 												array(
@@ -547,11 +547,11 @@  discard block
 block discarded – undo
547 547
 												)
548 548
 											);
549 549
 
550
-											$index ++;
550
+											$index++;
551 551
 										}
552 552
 										break;
553 553
 
554
-									case is_string( end( $addresses ) ):
554
+									case is_string(end($addresses)):
555 555
 										echo __give_get_format_address(
556 556
 											$addresses,
557 557
 											array(
@@ -564,13 +564,13 @@  discard block
 block discarded – undo
564 564
 						endif;
565 565
 						?>
566 566
 					</div>
567
-					<span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) {
567
+					<span class="give-no-address-message<?php if ( ! empty($donor->address)) {
568 568
 						echo ' give-hidden';
569 569
 					} ?>">
570
-						<?php _e( 'This donor does not have any addresses saved.', 'give' ); ?>
570
+						<?php _e('This donor does not have any addresses saved.', 'give'); ?>
571 571
 					</span>
572 572
 					<button class="button add-new-address">
573
-						<?php _e( 'Add Address', 'give' ); ?>
573
+						<?php _e('Add Address', 'give'); ?>
574 574
 					</button>
575 575
 				</div>
576 576
 
@@ -580,26 +580,26 @@  discard block
 block discarded – undo
580 580
 							<tbody>
581 581
 							<tr>
582 582
 								<th class="col">
583
-									<label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label>
583
+									<label class="country"><?php esc_html_e('Country:', 'give'); ?></label>
584 584
 								</th>
585 585
 								<td>
586 586
 									<?php
587
-									echo Give()->html->select( array(
587
+									echo Give()->html->select(array(
588 588
 										'options'          => give_get_country_list(),
589 589
 										'name'             => 'country',
590
-										'selected'         => give_get_option( 'base_country' ),
590
+										'selected'         => give_get_option('base_country'),
591 591
 										'show_option_all'  => false,
592 592
 										'show_option_none' => false,
593 593
 										'chosen'           => true,
594
-										'placeholder'      => esc_attr__( 'Select a country', 'give' ),
595
-										'data'             => array( 'search-type' => 'no_ajax' ),
596
-									) );
594
+										'placeholder'      => esc_attr__('Select a country', 'give'),
595
+										'data'             => array('search-type' => 'no_ajax'),
596
+									));
597 597
 									?>
598 598
 								</td>
599 599
 							</tr>
600 600
 							<tr>
601 601
 								<th class="col">
602
-									<label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
602
+									<label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label>
603 603
 								</th>
604 604
 								<td>
605 605
 									<input id="line1" name="line1" type="text" class="medium-text"/>
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 							</tr>
608 608
 							<tr>
609 609
 								<th class="col">
610
-									<label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
610
+									<label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label>
611 611
 								</th>
612 612
 								<td>
613 613
 									<input id="line2" type="text" name="line2" value="" class="medium-text"/>
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 							</tr>
617 617
 							<tr>
618 618
 								<th class="col">
619
-									<label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label>
619
+									<label for="city"><?php esc_html_e('City:', 'give'); ?></label>
620 620
 								</th>
621 621
 								<td>
622 622
 									<input id="city" type="text" name="city" value="" class="medium-text"/>
@@ -624,41 +624,41 @@  discard block
 block discarded – undo
624 624
 							</tr>
625 625
 							<?php
626 626
 							$no_states_country = give_no_states_country_list();
627
-							$base_country      = give_get_option( 'base_country' );
628
-							if ( ! array_key_exists( $base_country, $no_states_country ) ) {
627
+							$base_country      = give_get_option('base_country');
628
+							if ( ! array_key_exists($base_country, $no_states_country)) {
629 629
 								?>
630 630
 								<tr class="give-field-wrap">
631 631
 									<th class="col">
632
-										<label for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
632
+										<label for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
633 633
 									</th>
634 634
 									<td>
635 635
 										<?php
636
-										$states     = give_get_states( $base_country );
636
+										$states     = give_get_states($base_country);
637 637
 										$state_args = array(
638 638
 											'name'  => 'state',
639 639
 											'class' => 'regular-text',
640 640
 										);
641 641
 
642
-										if ( empty( $states ) ) {
642
+										if (empty($states)) {
643 643
 
644 644
 											// Show Text field, if empty states.
645
-											$state_args = wp_parse_args( $state_args, array(
646
-												'value' => give_get_option( 'base_state' ),
647
-											) );
648
-											echo Give()->html->text( $state_args );
645
+											$state_args = wp_parse_args($state_args, array(
646
+												'value' => give_get_option('base_state'),
647
+											));
648
+											echo Give()->html->text($state_args);
649 649
 										} else {
650 650
 
651 651
 											// Show Chosen DropDown, if states are not empty.
652
-											$state_args = wp_parse_args( $state_args, array(
652
+											$state_args = wp_parse_args($state_args, array(
653 653
 												'options'          => $states,
654
-												'selected'         => give_get_option( 'base_state' ),
654
+												'selected'         => give_get_option('base_state'),
655 655
 												'show_option_all'  => false,
656 656
 												'show_option_none' => false,
657 657
 												'chosen'           => true,
658
-												'placeholder'      => __( 'Select a state', 'give' ),
659
-												'data'             => array( 'search-type' => 'no_ajax' ),
660
-											) );
661
-											echo Give()->html->select( $state_args );
658
+												'placeholder'      => __('Select a state', 'give'),
659
+												'data'             => array('search-type' => 'no_ajax'),
660
+											));
661
+											echo Give()->html->select($state_args);
662 662
 										}
663 663
 										?>
664 664
 									</td>
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 							?>
669 669
 							<tr>
670 670
 								<th class="col">
671
-									<label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
671
+									<label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
672 672
 								</th>
673 673
 								<td>
674 674
 									<input id="zip" type="text" name="zip" value="" class="medium-text"/>
@@ -676,12 +676,12 @@  discard block
 block discarded – undo
676 676
 							</tr>
677 677
 							<tr>
678 678
 								<td colspan="2">
679
-									<?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?>
679
+									<?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?>
680 680
 									<input type="hidden" name="address-action" value="add">
681 681
 									<input type="hidden" name="address-id" value="">
682 682
 									<input type="submit" class="button button-primary js-save"
683
-									       value="<?php _e( 'Save', 'give' ); ?>">&nbsp;&nbsp;<button
684
-											class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button>
683
+									       value="<?php _e('Save', 'give'); ?>">&nbsp;&nbsp;<button
684
+											class="button js-cancel"><?php _e('Cancel', 'give'); ?></button>
685 685
 								</td>
686 686
 							</tr>
687 687
 							</tbody>
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 *
701 701
 	 * @param Give_Donor $donor The donor object being displayed.
702 702
 	 */
703
-	do_action( 'give_donor_before_tables_wrapper', $donor );
703
+	do_action('give_donor_before_tables_wrapper', $donor);
704 704
 	?>
705 705
 
706 706
 	<div id="donor-tables-wrapper" class="donor-section">
@@ -713,46 +713,46 @@  discard block
 block discarded – undo
713 713
 		 *
714 714
 		 * @param object $donor The donor object being displayed.
715 715
 		 */
716
-		do_action( 'give_donor_before_tables', $donor );
716
+		do_action('give_donor_before_tables', $donor);
717 717
 		?>
718 718
 
719
-		<h3><?php _e( 'Donor Emails', 'give' ); ?></h3>
719
+		<h3><?php _e('Donor Emails', 'give'); ?></h3>
720 720
 
721 721
 		<table class="wp-list-table widefat striped emails">
722 722
 			<thead>
723 723
 			<tr>
724
-				<th><?php _e( 'Email', 'give' ); ?></th>
725
-				<th><?php _e( 'Actions', 'give' ); ?></th>
724
+				<th><?php _e('Email', 'give'); ?></th>
725
+				<th><?php _e('Actions', 'give'); ?></th>
726 726
 			</tr>
727 727
 			</thead>
728 728
 
729 729
 			<tbody>
730
-			<?php if ( ! empty( $donor->emails ) ) { ?>
730
+			<?php if ( ! empty($donor->emails)) { ?>
731 731
 
732
-				<?php foreach ( $donor->emails as $key => $email ) : ?>
732
+				<?php foreach ($donor->emails as $key => $email) : ?>
733 733
 					<tr data-key="<?php echo $key; ?>">
734 734
 						<td>
735 735
 							<?php echo $email; ?>
736
-							<?php if ( 'primary' === $key ) : ?>
736
+							<?php if ('primary' === $key) : ?>
737 737
 								<span class="dashicons dashicons-star-filled primary-email-icon"></span>
738 738
 							<?php endif; ?>
739 739
 						</td>
740 740
 						<td>
741
-							<?php if ( 'primary' !== $key ) : ?>
741
+							<?php if ('primary' !== $key) : ?>
742 742
 								<?php
743
-								$base_url    = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id );
744
-								$promote_url = wp_nonce_url( add_query_arg( array(
745
-									'email'       => rawurlencode( $email ),
743
+								$base_url    = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id);
744
+								$promote_url = wp_nonce_url(add_query_arg(array(
745
+									'email'       => rawurlencode($email),
746 746
 									'give_action' => 'set_donor_primary_email',
747
-								), $base_url ), 'give-set-donor-primary-email' );
748
-								$remove_url  = wp_nonce_url( add_query_arg( array(
749
-									'email'       => rawurlencode( $email ),
747
+								), $base_url), 'give-set-donor-primary-email');
748
+								$remove_url = wp_nonce_url(add_query_arg(array(
749
+									'email'       => rawurlencode($email),
750 750
 									'give_action' => 'remove_donor_email',
751
-								), $base_url ), 'give-remove-donor-email' );
751
+								), $base_url), 'give-remove-donor-email');
752 752
 								?>
753
-								<a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a>
753
+								<a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a>
754 754
 								&nbsp;|&nbsp;
755
-								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a>
755
+								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a>
756 756
 							<?php endif; ?>
757 757
 						</td>
758 758
 					</tr>
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
 					<td colspan="2" class="add-donor-email-td">
763 763
 						<div class="add-donor-email-wrapper">
764 764
 							<input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/>
765
-							<?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?>
765
+							<?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?>
766 766
 							<input type="email" name="additional-email" value=""
767
-							       placeholder="<?php _e( 'Email Address', 'give' ); ?>"/>&nbsp;
767
+							       placeholder="<?php _e('Email Address', 'give'); ?>"/>&nbsp;
768 768
 							<input type="checkbox" name="make-additional-primary" value="1"
769 769
 							       id="make-additional-primary"/>&nbsp;<label
770
-									for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label>
770
+									for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label>
771 771
 							<button class="button-secondary give-add-donor-email"
772
-							        id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button>
772
+							        id="add-donor-email"><?php _e('Add Email', 'give'); ?></button>
773 773
 							<span class="spinner"></span>
774 774
 						</div>
775 775
 						<div class="notice-wrap"></div>
@@ -777,50 +777,50 @@  discard block
 block discarded – undo
777 777
 				</tr>
778 778
 			<?php } else { ?>
779 779
 				<tr>
780
-					<td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td>
780
+					<td colspan="2"><?php _e('No Emails Found', 'give'); ?></td>
781 781
 				</tr>
782 782
 			<?php }// End if().
783 783
 			?>
784 784
 			</tbody>
785 785
 		</table>
786 786
 
787
-		<h3><?php _e( 'Recent Donations', 'give' ); ?></h3>
787
+		<h3><?php _e('Recent Donations', 'give'); ?></h3>
788 788
 		<?php
789
-		$payment_ids = explode( ',', $donor->payment_ids );
790
-		$payments    = give_get_payments( array(
789
+		$payment_ids = explode(',', $donor->payment_ids);
790
+		$payments    = give_get_payments(array(
791 791
 			'post__in' => $payment_ids,
792
-		) );
793
-		$payments    = array_slice( $payments, 0, 10 );
792
+		));
793
+		$payments    = array_slice($payments, 0, 10);
794 794
 		?>
795 795
 		<table class="wp-list-table widefat striped payments">
796 796
 			<thead>
797 797
 			<tr>
798
-				<th scope="col"><?php _e( 'ID', 'give' ); ?></th>
799
-				<th scope="col"><?php _e( 'Amount', 'give' ); ?></th>
800
-				<th scope="col"><?php _e( 'Date', 'give' ); ?></th>
801
-				<th scope="col"><?php _e( 'Status', 'give' ); ?></th>
802
-				<th scope="col"><?php _e( 'Actions', 'give' ); ?></th>
798
+				<th scope="col"><?php _e('ID', 'give'); ?></th>
799
+				<th scope="col"><?php _e('Amount', 'give'); ?></th>
800
+				<th scope="col"><?php _e('Date', 'give'); ?></th>
801
+				<th scope="col"><?php _e('Status', 'give'); ?></th>
802
+				<th scope="col"><?php _e('Actions', 'give'); ?></th>
803 803
 			</tr>
804 804
 			</thead>
805 805
 			<tbody>
806
-			<?php if ( ! empty( $payments ) ) { ?>
807
-				<?php foreach ( $payments as $payment ) : ?>
806
+			<?php if ( ! empty($payments)) { ?>
807
+				<?php foreach ($payments as $payment) : ?>
808 808
 					<tr>
809
-						<td><?php echo Give()->seq_donation_number->get_serial_code( $payment->ID ); ?></td>
810
-						<td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td>
811
-						<td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td>
812
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
809
+						<td><?php echo Give()->seq_donation_number->get_serial_code($payment->ID); ?></td>
810
+						<td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td>
811
+						<td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td>
812
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
813 813
 						<td>
814 814
 							<?php
815 815
 							printf(
816 816
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
817
-								admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ),
817
+								admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID),
818 818
 								sprintf(
819 819
 								/* translators: %s: Donation ID */
820
-									esc_attr__( 'View Donation %s.', 'give' ),
820
+									esc_attr__('View Donation %s.', 'give'),
821 821
 									$payment->ID
822 822
 								),
823
-								__( 'View Donation', 'give' )
823
+								__('View Donation', 'give')
824 824
 							);
825 825
 							?>
826 826
 
@@ -835,47 +835,47 @@  discard block
 block discarded – undo
835 835
 							 * @param object $donor   The donor object being displayed.
836 836
 							 * @param object $payment The payment object being displayed.
837 837
 							 */
838
-							do_action( 'give_donor_recent_purchases_actions', $donor, $payment );
838
+							do_action('give_donor_recent_purchases_actions', $donor, $payment);
839 839
 							?>
840 840
 						</td>
841 841
 					</tr>
842 842
 				<?php endforeach; ?>
843 843
 			<?php } else { ?>
844 844
 				<tr>
845
-					<td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td>
845
+					<td colspan="5"><?php _e('No donations found.', 'give'); ?></td>
846 846
 				</tr>
847 847
 			<?php }// End if().
848 848
 			?>
849 849
 			</tbody>
850 850
 		</table>
851 851
 
852
-		<h3><?php _e( 'Completed Forms', 'give' ); ?></h3>
852
+		<h3><?php _e('Completed Forms', 'give'); ?></h3>
853 853
 		<?php
854
-		$donations = give_get_users_completed_donations( $donor->email );
854
+		$donations = give_get_users_completed_donations($donor->email);
855 855
 		?>
856 856
 		<table class="wp-list-table widefat striped donations">
857 857
 			<thead>
858 858
 			<tr>
859
-				<th scope="col"><?php _e( 'Form', 'give' ); ?></th>
860
-				<th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th>
859
+				<th scope="col"><?php _e('Form', 'give'); ?></th>
860
+				<th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th>
861 861
 			</tr>
862 862
 			</thead>
863 863
 			<tbody>
864
-			<?php if ( ! empty( $donations ) ) { ?>
865
-				<?php foreach ( $donations as $donation ) : ?>
864
+			<?php if ( ! empty($donations)) { ?>
865
+				<?php foreach ($donations as $donation) : ?>
866 866
 					<tr>
867 867
 						<td><?php echo $donation->post_title; ?></td>
868 868
 						<td>
869 869
 							<?php
870 870
 							printf(
871 871
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
872
-								esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ),
872
+								esc_url(admin_url('post.php?action=edit&post='.$donation->ID)),
873 873
 								sprintf(
874 874
 								/* translators: %s: form name */
875
-									esc_attr__( 'View Form %s.', 'give' ),
875
+									esc_attr__('View Form %s.', 'give'),
876 876
 									$donation->post_title
877 877
 								),
878
-								__( 'View Form', 'give' )
878
+								__('View Form', 'give')
879 879
 							);
880 880
 							?>
881 881
 						</td>
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 				<?php endforeach; ?>
884 884
 			<?php } else { ?>
885 885
 				<tr>
886
-					<td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td>
886
+					<td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td>
887 887
 				</tr>
888 888
 			<?php } ?>
889 889
 			</tbody>
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 		 *
898 898
 		 * @param object $donor The donor object being displayed.
899 899
 		 */
900
-		do_action( 'give_donor_after_tables', $donor );
900
+		do_action('give_donor_after_tables', $donor);
901 901
 		?>
902 902
 
903 903
 	</div>
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 	 *
911 911
 	 * @param object $donor The donor object being displayed.
912 912
 	 */
913
-	do_action( 'give_donor_card_bottom', $donor );
913
+	do_action('give_donor_card_bottom', $donor);
914 914
 
915 915
 }
916 916
 
@@ -923,31 +923,31 @@  discard block
 block discarded – undo
923 923
  *
924 924
  * @return void
925 925
  */
926
-function give_donor_notes_view( $donor ) {
926
+function give_donor_notes_view($donor) {
927 927
 
928
-	$paged       = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
929
-	$paged       = absint( $paged );
928
+	$paged       = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
929
+	$paged       = absint($paged);
930 930
 	$note_count  = $donor->get_notes_count();
931
-	$per_page    = apply_filters( 'give_donor_notes_per_page', 20 );
932
-	$total_pages = ceil( $note_count / $per_page );
933
-	$donor_notes = $donor->get_notes( $per_page, $paged );
931
+	$per_page    = apply_filters('give_donor_notes_per_page', 20);
932
+	$total_pages = ceil($note_count / $per_page);
933
+	$donor_notes = $donor->get_notes($per_page, $paged);
934 934
 	?>
935 935
 
936 936
 	<div id="donor-notes-wrapper">
937 937
 		<div class="donor-notes-header">
938
-			<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
938
+			<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
939 939
 		</div>
940
-		<h3><?php _e( 'Notes', 'give' ); ?></h3>
940
+		<h3><?php _e('Notes', 'give'); ?></h3>
941 941
 
942
-		<?php if ( 1 == $paged ) : ?>
942
+		<?php if (1 == $paged) : ?>
943 943
 			<div style="display: block; margin-bottom: 55px;">
944 944
 				<form id="give-add-donor-note" method="post"
945
-				      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>">
945
+				      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>">
946 946
 					<textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea>
947 947
 					<br/>
948 948
 					<input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/>
949 949
 					<input type="hidden" name="give_action" value="add-donor-note"/>
950
-					<?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?>
950
+					<?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?>
951 951
 					<input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/>
952 952
 				</form>
953 953
 			</div>
@@ -962,26 +962,26 @@  discard block
 block discarded – undo
962 962
 			'show_all' => true,
963 963
 		);
964 964
 
965
-		echo paginate_links( $pagination_args );
965
+		echo paginate_links($pagination_args);
966 966
 		?>
967 967
 
968 968
 		<div id="give-donor-notes" class="postbox">
969
-			<?php if ( count( $donor_notes ) > 0 ) { ?>
970
-				<?php foreach ( $donor_notes as $key => $note ) : ?>
969
+			<?php if (count($donor_notes) > 0) { ?>
970
+				<?php foreach ($donor_notes as $key => $note) : ?>
971 971
 					<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
972 972
 					<span class="note-content-wrap">
973
-						<?php echo stripslashes( $note ); ?>
973
+						<?php echo stripslashes($note); ?>
974 974
 					</span>
975 975
 					</div>
976 976
 				<?php endforeach; ?>
977 977
 			<?php } else { ?>
978 978
 				<div class="give-no-donor-notes">
979
-					<?php _e( 'No donor notes found.', 'give' ); ?>
979
+					<?php _e('No donor notes found.', 'give'); ?>
980 980
 				</div>
981 981
 			<?php } ?>
982 982
 		</div>
983 983
 
984
-		<?php echo paginate_links( $pagination_args ); ?>
984
+		<?php echo paginate_links($pagination_args); ?>
985 985
 
986 986
 	</div>
987 987
 
@@ -997,9 +997,9 @@  discard block
 block discarded – undo
997 997
  *
998 998
  * @return void
999 999
  */
1000
-function give_donor_delete_view( $donor ) {
1000
+function give_donor_delete_view($donor) {
1001 1001
 
1002
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
1002
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
1003 1003
 
1004 1004
 	/**
1005 1005
 	 * Fires in donor delete screen, above the content.
@@ -1008,16 +1008,16 @@  discard block
 block discarded – undo
1008 1008
 	 *
1009 1009
 	 * @param object $donor The donor object being displayed.
1010 1010
 	 */
1011
-	do_action( 'give_donor_delete_top', $donor );
1011
+	do_action('give_donor_delete_top', $donor);
1012 1012
 	?>
1013 1013
 
1014 1014
 	<div class="info-wrapper donor-section">
1015 1015
 
1016 1016
 		<form id="delete-donor" method="post"
1017
-		      action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>">
1017
+		      action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>">
1018 1018
 
1019 1019
 			<div class="donor-notes-header">
1020
-				<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
1020
+				<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
1021 1021
 			</div>
1022 1022
 
1023 1023
 
@@ -1025,20 +1025,20 @@  discard block
 block discarded – undo
1025 1025
 
1026 1026
 				<span class="delete-donor-options">
1027 1027
 					<p>
1028
-						<?php echo Give()->html->checkbox( array(
1028
+						<?php echo Give()->html->checkbox(array(
1029 1029
 							'name' => 'give-donor-delete-confirm',
1030
-						) ); ?>
1031
-						<label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
1030
+						)); ?>
1031
+						<label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label>
1032 1032
 					</p>
1033 1033
 
1034 1034
 					<p>
1035
-						<?php echo Give()->html->checkbox( array(
1035
+						<?php echo Give()->html->checkbox(array(
1036 1036
 							'name'    => 'give-donor-delete-records',
1037 1037
 							'options' => array(
1038 1038
 								'disabled' => true,
1039 1039
 							),
1040
-						) ); ?>
1041
-						<label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label>
1040
+						)); ?>
1041
+						<label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label>
1042 1042
 					</p>
1043 1043
 
1044 1044
 					<?php
@@ -1051,19 +1051,19 @@  discard block
 block discarded – undo
1051 1051
 					 *
1052 1052
 					 * @param object $donor The donor object being displayed.
1053 1053
 					 */
1054
-					do_action( 'give_donor_delete_inputs', $donor );
1054
+					do_action('give_donor_delete_inputs', $donor);
1055 1055
 					?>
1056 1056
 				</span>
1057 1057
 
1058 1058
 				<span id="donor-edit-actions">
1059 1059
 					<input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>"/>
1060
-					<?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?>
1060
+					<?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?>
1061 1061
 					<input type="hidden" name="give_action" value="delete-donor"/>
1062 1062
 					<input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary"
1063
-					       value="<?php _e( 'Delete Donor', 'give' ); ?>"/>
1063
+					       value="<?php _e('Delete Donor', 'give'); ?>"/>
1064 1064
 					<a id="give-delete-donor-cancel"
1065
-					   href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"
1066
-					   class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
1065
+					   href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"
1066
+					   class="delete"><?php _e('Cancel', 'give'); ?></a>
1067 1067
 				</span>
1068 1068
 
1069 1069
 			</div>
@@ -1079,5 +1079,5 @@  discard block
 block discarded – undo
1079 1079
 	 *
1080 1080
 	 * @param object $donor The donor object being displayed.
1081 1081
 	 */
1082
-	do_action( 'give_donor_delete_bottom', $donor );
1082
+	do_action('give_donor_delete_bottom', $donor);
1083 1083
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -406,8 +406,11 @@
 block discarded – undo
406 406
 								<span class="donor-user-id info-item editable">
407 407
 										<?php if ( ! empty( $userdata ) ) : ?>
408 408
 											<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
409
-										<?php else: ?>
410
-											<span data-key="user_id"><?php _e( 'Unregistered', 'give' ); ?></span>
409
+										<?php else {
410
+	: ?>
411
+											<span data-key="user_id"><?php _e( 'Unregistered', 'give' );
412
+}
413
+?></span>
411 414
 										<?php endif; ?>
412 415
 									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ):
413 416
 
Please login to merge, or discard this patch.
includes/admin/add-ons.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 function give_add_ons_page() {
26 26
 	?>
27 27
 	<div class="wrap" id="give-add-ons">
28
-		<h1><?php echo esc_html( get_admin_page_title() ); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
28
+		<h1><?php echo esc_html(get_admin_page_title()); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33 33
 		<hr class="wp-header-end">
34 34
 
35
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
35
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
36 36
 		<?php give_add_ons_feed(); ?>
37 37
 	</div>
38 38
 	<?php
@@ -49,27 +49,27 @@  discard block
 block discarded – undo
49 49
 function give_add_ons_feed() {
50 50
 
51 51
 	$addons_debug = false; //set to true to debug
52
-	$cache        = Give_Cache::get( 'give_add_ons_feed', true );
52
+	$cache        = Give_Cache::get('give_add_ons_feed', true);
53 53
 
54
-	if ( false === $cache || ( true === $addons_debug && true === WP_DEBUG ) ) {
55
-		if ( function_exists( 'vip_safe_wp_remote_get' ) ) {
56
-			$feed = vip_safe_wp_remote_get( 'https://givewp.com/downloads/feed/', false, 3, 1, 20, array( 'sslverify' => false ) );
54
+	if (false === $cache || (true === $addons_debug && true === WP_DEBUG)) {
55
+		if (function_exists('vip_safe_wp_remote_get')) {
56
+			$feed = vip_safe_wp_remote_get('https://givewp.com/downloads/feed/', false, 3, 1, 20, array('sslverify' => false));
57 57
 		} else {
58
-			$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
58
+			$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
59 59
 		}
60 60
 
61
-		if ( ! is_wp_error( $feed ) && ! empty( $feed ) ) {
62
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
63
-				$cache = wp_remote_retrieve_body( $feed );
64
-				Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true );
61
+		if ( ! is_wp_error($feed) && ! empty($feed)) {
62
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
63
+				$cache = wp_remote_retrieve_body($feed);
64
+				Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true);
65 65
 			}
66 66
 		} else {
67 67
 			$cache = sprintf(
68 68
 				'<div class="error"><p>%s</p></div>',
69
-				esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' )
69
+				esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give')
70 70
 			);
71 71
 		}
72 72
 	}
73 73
 
74
-	echo wp_kses_post( $cache );
74
+	echo wp_kses_post($cache);
75 75
 }
Please login to merge, or discard this patch.
includes/admin/class-blank-slate.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.8.13
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -75,63 +75,63 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function init() {
77 77
 		// Bail early if screen cannot be detected.
78
-		if ( empty( $this->screen ) ) {
78
+		if (empty($this->screen)) {
79 79
 			return null;
80 80
 		}
81 81
 
82 82
 		$content = array();
83 83
 
84 84
 		// Define content and hook into the appropriate action.
85
-		switch ( $this->screen ) {
85
+		switch ($this->screen) {
86 86
 			// Forms screen.
87 87
 			case 'edit-give_forms':
88
-				$this->form = $this->post_exists( 'give_forms' );
88
+				$this->form = $this->post_exists('give_forms');
89 89
 
90
-				if ( $this->form ) {
90
+				if ($this->form) {
91 91
 					// Form exists. Bail out.
92 92
 					return false;
93 93
 				} else {
94 94
 					// No forms exist.
95
-					$content = $this->get_content( 'no_forms' );
95
+					$content = $this->get_content('no_forms');
96 96
 				}
97 97
 
98
-				add_action( 'manage_posts_extra_tablenav', array( $this, 'render' ) );
98
+				add_action('manage_posts_extra_tablenav', array($this, 'render'));
99 99
 				break;
100 100
 			// Donations screen.
101 101
 			case 'give_forms_page_give-payment-history':
102
-				$this->form     = $this->post_exists( 'give_forms' );
103
-				$this->donation = $this->post_exists( 'give_payment' );
102
+				$this->form     = $this->post_exists('give_forms');
103
+				$this->donation = $this->post_exists('give_payment');
104 104
 
105
-				if ( $this->donation ) {
105
+				if ($this->donation) {
106 106
 					// Donation exists. Bail out.
107 107
 					return false;
108
-				} elseif ( ! $this->form ) {
108
+				} elseif ( ! $this->form) {
109 109
 					// No forms and no donations exist.
110
-					$content = $this->get_content( 'no_donations_or_forms' );
110
+					$content = $this->get_content('no_donations_or_forms');
111 111
 				} else {
112 112
 					// No donations exist but a form does exist.
113
-					$content = $this->get_content( 'no_donations' );
113
+					$content = $this->get_content('no_donations');
114 114
 				}
115 115
 
116
-				add_action( 'give_payments_page_bottom', array( $this, 'render' ) );
116
+				add_action('give_payments_page_bottom', array($this, 'render'));
117 117
 				break;
118 118
 			// Donors screen.
119 119
 			case 'give_forms_page_give-donors':
120
-				$this->form  = $this->post_exists( 'give_forms' );
120
+				$this->form  = $this->post_exists('give_forms');
121 121
 				$this->donor = $this->donor_exists();
122 122
 
123
-				if ( $this->donor ) {
123
+				if ($this->donor) {
124 124
 					// Donor exists. Bail out.
125 125
 					return false;
126
-				} elseif ( ! $this->form ) {
126
+				} elseif ( ! $this->form) {
127 127
 					// No forms and no donors exist.
128
-					$content = $this->get_content( 'no_donors_or_forms' );
128
+					$content = $this->get_content('no_donors_or_forms');
129 129
 				} else {
130 130
 					// No donors exist but a form does exist.
131
-					$content = $this->get_content( 'no_donors' );
131
+					$content = $this->get_content('no_donors');
132 132
 				}
133 133
 
134
-				add_action( 'give_donors_table_bottom', array( $this, 'render' ) );
134
+				add_action('give_donors_table_bottom', array($this, 'render'));
135 135
 				break;
136 136
 			default:
137 137
 				return null;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$this->content = $content;
141 141
 
142 142
 		// Hide non-essential UI elements.
143
-		add_action( 'admin_head', array( $this, 'hide_ui' ) );
143
+		add_action('admin_head', array($this, 'hide_ui'));
144 144
 	}
145 145
 
146 146
 	/**
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @param string $which The location of the list table hook: 'top' or 'bottom'.
152 152
 	 */
153
-	public function render( $which = 'bottom' ) {
153
+	public function render($which = 'bottom') {
154 154
 		// Bail out to prevent content from rendering twice.
155
-		if ( 'top' === $which ) {
155
+		if ('top' === $which) {
156 156
 			return null;
157 157
 		}
158 158
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 		 *
178 178
 		 * @param string $screen The current screen ID.
179 179
 		 */
180
-		$content = apply_filters( 'give_blank_slate_content', $this->content, $screen );
180
+		$content = apply_filters('give_blank_slate_content', $this->content, $screen);
181 181
 
182
-		$template_path = GIVE_PLUGIN_DIR . 'includes/admin/views/blank-slate.php';
182
+		$template_path = GIVE_PLUGIN_DIR.'includes/admin/views/blank-slate.php';
183 183
 
184 184
 		include $template_path;
185 185
 	}
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
 	 * @param string $post_type Post type used in the query.
215 215
 	 * @return bool True if post exists, otherwise false.
216 216
 	 */
217
-	private function post_exists( $post_type ) {
217
+	private function post_exists($post_type) {
218 218
 		// Attempt to get a single post of the post type.
219
-		$query = new WP_Query( array(
219
+		$query = new WP_Query(array(
220 220
 			'post_type'              => $post_type,
221 221
 			'posts_per_page'         => 1,
222 222
 			'no_found_rows'          => false,
223 223
 			'update_post_meta_cache' => false,
224 224
 			'update_post_term_cache' => false,
225 225
 			'fields'                 => 'ids',
226
-			'post_status'            => array( 'any', 'trash' ),
227
-		) );
226
+			'post_status'            => array('any', 'trash'),
227
+		));
228 228
 
229 229
 		return $query->have_posts();
230 230
 	}
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 	 * @return bool True if donor exists, otherwise false.
238 238
 	 */
239 239
 	private function donor_exists() {
240
-		$donors = Give()->donors->get_donors( array( 'number' => 1 ) );
240
+		$donors = Give()->donors->get_donors(array('number' => 1));
241 241
 
242
-		return ! empty( $donors );
242
+		return ! empty($donors);
243 243
 	}
244 244
 
245 245
 	/**
@@ -250,18 +250,18 @@  discard block
 block discarded – undo
250 250
 	 * @param string $context The key used to determine which content is returned.
251 251
 	 * @return array Blank slate content.
252 252
 	 */
253
-	private function get_content( $context ) {
253
+	private function get_content($context) {
254 254
 		// Define default content.
255 255
 		$defaults = array(
256
-			'image_url' => GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg',
257
-			'image_alt' => __( 'Give Icon', 'give' ),
258
-			'heading'   => __( 'No donation forms  found.', 'give' ),
259
-			'message'   => __( 'The first step towards accepting online donations is to create a form.', 'give' ),
260
-			'cta_text'  => __( 'Create Donation Form', 'give' ),
261
-			'cta_link'  => admin_url( 'post-new.php?post_type=give_forms' ),
256
+			'image_url' => GIVE_PLUGIN_URL.'assets/dist/images/give-icon-full-circle.svg',
257
+			'image_alt' => __('Give Icon', 'give'),
258
+			'heading'   => __('No donation forms  found.', 'give'),
259
+			'message'   => __('The first step towards accepting online donations is to create a form.', 'give'),
260
+			'cta_text'  => __('Create Donation Form', 'give'),
261
+			'cta_link'  => admin_url('post-new.php?post_type=give_forms'),
262 262
 			'help'      => sprintf(
263 263
 				/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
264
-				__( 'Need help? Get started with %1$sGive 101%2$s.', 'give' ),
264
+				__('Need help? Get started with %1$sGive 101%2$s.', 'give'),
265 265
 				'<a href="http://docs.givewp.com/give101/" target="_blank">',
266 266
 				'</a>'
267 267
 			),
@@ -270,42 +270,42 @@  discard block
 block discarded – undo
270 270
 		// Define contextual content.
271 271
 		$content = array(
272 272
 			'no_donations_or_forms' => array(
273
-				'heading' => __( 'No donations found.', 'give' ),
274
-				'message' => __( 'Your donation history will appear here, but first, you need a donation form!', 'give' ),
273
+				'heading' => __('No donations found.', 'give'),
274
+				'message' => __('Your donation history will appear here, but first, you need a donation form!', 'give'),
275 275
 			),
276 276
 			'no_donations'          => array(
277
-				'heading'  => __( 'No donations found.', 'give' ),
278
-				'message'  => __( 'When your first donation arrives, a record of the donation will appear here.', 'give' ),
279
-				'cta_text' => __( 'View All Forms', 'give' ),
280
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
277
+				'heading'  => __('No donations found.', 'give'),
278
+				'message'  => __('When your first donation arrives, a record of the donation will appear here.', 'give'),
279
+				'cta_text' => __('View All Forms', 'give'),
280
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
281 281
 				'help'     => sprintf(
282 282
 					/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
283
-					__( 'Need help? Learn more about %1$sDonations%2$s.', 'give' ),
283
+					__('Need help? Learn more about %1$sDonations%2$s.', 'give'),
284 284
 					'<a href="http://docs.givewp.com/core-donations/">',
285 285
 					'</a>'
286 286
 				),
287 287
 			),
288 288
 			'no_donors_or_forms'    => array(
289
-				'heading' => __( 'No donors  found.', 'give' ),
290
-				'message' => __( 'Your donor history will appear here, but first, you need a donation form!', 'give' ),
289
+				'heading' => __('No donors  found.', 'give'),
290
+				'message' => __('Your donor history will appear here, but first, you need a donation form!', 'give'),
291 291
 			),
292 292
 			'no_donors'             => array(
293
-				'heading'  => __( 'No donors found.', 'give' ),
294
-				'message'  => __( 'When your first donation arrives, the donor will appear here.', 'give' ),
295
-				'cta_text' => __( 'View All Forms', 'give' ),
296
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
293
+				'heading'  => __('No donors found.', 'give'),
294
+				'message'  => __('When your first donation arrives, the donor will appear here.', 'give'),
295
+				'cta_text' => __('View All Forms', 'give'),
296
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
297 297
 				'help'     => sprintf(
298 298
 					/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
299
-					__( 'Need help? Learn more about %1$sDonors%2$s.', 'give' ),
299
+					__('Need help? Learn more about %1$sDonors%2$s.', 'give'),
300 300
 					'<a href="http://docs.givewp.com/core-donors/">',
301 301
 					'</a>'
302 302
 				),
303 303
 			),
304 304
 		);
305 305
 
306
-		if ( isset( $content[ $context ] ) ) {
306
+		if (isset($content[$context])) {
307 307
 			// Merge contextual content with defaults.
308
-			return wp_parse_args( $content[ $context ], $defaults );
308
+			return wp_parse_args($content[$context], $defaults);
309 309
 		} else {
310 310
 			// Return defaults if context is undefined.
311 311
 			return $defaults;
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-form-stats.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * Constructor.
55 55
 	 */
56
-	public function __construct( $_step = 1 ) {
57
-		parent::__construct( $_step );
56
+	public function __construct($_step = 1) {
57
+		parent::__construct($_step);
58 58
 
59 59
 		$this->is_writable = true;
60 60
 	}
@@ -69,43 +69,43 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function get_data() {
71 71
 
72
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
72
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
73 73
 
74
-		if ( $this->step == 1 ) {
75
-			$this->delete_data( 'give_temp_recount_form_stats' );
74
+		if ($this->step == 1) {
75
+			$this->delete_data('give_temp_recount_form_stats');
76 76
 		}
77 77
 
78
-		$totals = $this->get_stored_data( 'give_temp_recount_form_stats' );
78
+		$totals = $this->get_stored_data('give_temp_recount_form_stats');
79 79
 
80
-		if ( false === $totals ) {
80
+		if (false === $totals) {
81 81
 			$totals = array(
82 82
 				'earnings' => (float) 0,
83 83
 				'sales'    => 0,
84 84
 			);
85
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
85
+			$this->store_data('give_temp_recount_form_stats', $totals);
86 86
 		}
87 87
 
88
-		$args = apply_filters( 'give_recount_form_stats_args', array(
88
+		$args = apply_filters('give_recount_form_stats_args', array(
89 89
 			'give_forms' => $this->form_id,
90 90
 			'number'     => $this->per_step,
91 91
 			'status'     => $accepted_statuses,
92 92
 			'paged'      => $this->step,
93 93
 			'fields'     => 'ids',
94
-		) );
94
+		));
95 95
 
96
-		$payments = new Give_Payments_Query( $args );
96
+		$payments = new Give_Payments_Query($args);
97 97
 		$payments = $payments->get_payments();
98 98
 
99
-		if ( $payments ) {
100
-			foreach ( $payments as $payment ) {
99
+		if ($payments) {
100
+			foreach ($payments as $payment) {
101 101
 
102 102
 				// Ensure acceptable status only.
103
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
103
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
104 104
 					continue;
105 105
 				}
106 106
 
107 107
 				// Ensure only payments for this form are counted.
108
-				if ( $payment->form_id != $this->form_id ) {
108
+				if ($payment->form_id != $this->form_id) {
109 109
 					continue;
110 110
 				}
111 111
 
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
 				 */
117 117
 				$earning_amount = apply_filters(
118 118
 					'give_donation_amount',
119
-					give_format_amount( $payment->total, array( 'donation_id' => $payment->ID ) ),
119
+					give_format_amount($payment->total, array('donation_id' => $payment->ID)),
120 120
 					$payment->total,
121 121
 					$payment->ID,
122
-					array( 'type' => 'stats', 'currency' => false, 'amount' => false )
122
+					array('type' => 'stats', 'currency' => false, 'amount' => false)
123 123
 				);
124 124
 
125
-				$totals['sales'] ++;
126
-				$totals['earnings'] += (float) give_maybe_sanitize_amount( $earning_amount );
125
+				$totals['sales']++;
126
+				$totals['earnings'] += (float) give_maybe_sanitize_amount($earning_amount);
127 127
 
128 128
 			}
129 129
 
130
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
130
+			$this->store_data('give_temp_recount_form_stats', $totals);
131 131
 
132 132
 			return true;
133 133
 		}
134 134
 
135 135
 
136
-		give_update_meta( $this->form_id, '_give_form_sales', $totals['sales'] );
137
-		give_update_meta( $this->form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
136
+		give_update_meta($this->form_id, '_give_form_sales', $totals['sales']);
137
+		give_update_meta($this->form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
138 138
 
139 139
 		return false;
140 140
 	}
@@ -146,35 +146,35 @@  discard block
 block discarded – undo
146 146
 	 * @return int
147 147
 	 */
148 148
 	public function get_percentage_complete() {
149
-		if ( $this->step == 1 ) {
150
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
149
+		if ($this->step == 1) {
150
+			$this->delete_data('give_recount_total_'.$this->form_id);
151 151
 		}
152 152
 
153
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
154
-		$total             = $this->get_stored_data( 'give_recount_total_' . $this->form_id );
153
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
154
+		$total             = $this->get_stored_data('give_recount_total_'.$this->form_id);
155 155
 
156
-		if ( false === $total ) {
156
+		if (false === $total) {
157 157
 			$total = 0;
158
-			$args  = apply_filters( 'give_recount_form_stats_total_args', array(
158
+			$args  = apply_filters('give_recount_form_stats_total_args', array(
159 159
 				'give_forms' => $this->form_id,
160
-				'number'     => - 1,
160
+				'number'     => -1,
161 161
 				'status'     => $accepted_statuses,
162 162
 				'fields'     => 'ids',
163
-			) );
163
+			));
164 164
 
165
-			$payments = new Give_Payments_Query( $args );
166
-			$total    = count( $payments->get_payments() );
167
-			$this->store_data( 'give_recount_total_' . $this->form_id, $total );
165
+			$payments = new Give_Payments_Query($args);
166
+			$total    = count($payments->get_payments());
167
+			$this->store_data('give_recount_total_'.$this->form_id, $total);
168 168
 
169 169
 		}
170 170
 
171 171
 		$percentage = 100;
172 172
 
173
-		if ( $total > 0 ) {
174
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
173
+		if ($total > 0) {
174
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
175 175
 		}
176 176
 
177
-		if ( $percentage > 100 ) {
177
+		if ($percentage > 100) {
178 178
 			$percentage = 100;
179 179
 		}
180 180
 
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @param array $request The Form Data passed into the batch processing
190 190
 	 */
191
-	public function set_properties( $request ) {
192
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
191
+	public function set_properties($request) {
192
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
193 193
 	}
194 194
 
195 195
 	/**
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function process_step() {
202 202
 
203
-		if ( ! $this->can_export() ) {
204
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
203
+		if ( ! $this->can_export()) {
204
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
205 205
 		}
206 206
 
207 207
 		$had_data = $this->get_data();
208 208
 
209
-		if ( $had_data ) {
209
+		if ($had_data) {
210 210
 			$this->done = false;
211 211
 
212 212
 			return true;
213 213
 		} else {
214
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
215
-			$this->delete_data( 'give_temp_recount_form_stats' );
214
+			$this->delete_data('give_recount_total_'.$this->form_id);
215
+			$this->delete_data('give_temp_recount_form_stats');
216 216
 			$this->done    = true;
217
-			$this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) );
217
+			$this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id));
218 218
 
219 219
 			return false;
220 220
 		}
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return mixed       Returns the data from the database
250 250
 	 */
251
-	private function get_stored_data( $key ) {
251
+	private function get_stored_data($key) {
252 252
 		global $wpdb;
253
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
253
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
254 254
 
255
-		if ( empty( $value ) ) {
255
+		if (empty($value)) {
256 256
 			return false;
257 257
 		}
258 258
 
259
-		$maybe_json = json_decode( $value );
260
-		if ( ! is_null( $maybe_json ) ) {
261
-			$value = json_decode( $value, true );
259
+		$maybe_json = json_decode($value);
260
+		if ( ! is_null($maybe_json)) {
261
+			$value = json_decode($value, true);
262 262
 		}
263 263
 
264 264
 		return $value;
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 	 *
275 275
 	 * @return void
276 276
 	 */
277
-	private function store_data( $key, $value ) {
277
+	private function store_data($key, $value) {
278 278
 		global $wpdb;
279 279
 
280
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
280
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
281 281
 
282 282
 		$data = array(
283 283
 			'option_name'  => $key,
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 			'%s',
292 292
 		);
293 293
 
294
-		$wpdb->replace( $wpdb->options, $data, $formats );
294
+		$wpdb->replace($wpdb->options, $data, $formats);
295 295
 	}
296 296
 
297 297
 	/**
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @return void
305 305
 	 */
306
-	private function delete_data( $key ) {
306
+	private function delete_data($key) {
307 307
 		global $wpdb;
308
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
308
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
309 309
 	}
310 310
 
311 311
 }
312 312
\ No newline at end of file
Please login to merge, or discard this patch.