Test Failed
Pull Request — master (#2854)
by Devin
05:38
created
includes/class-give-db.php 1 patch
Spacing   +61 added lines, -61 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
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @access public
73 73
 	 */
74 74
 	public function __construct() {
75
-		if( is_multisite() ) {
76
-			add_action( 'switch_blog', array( $this, 'handle_switch_blog' ), 10, 2 );
75
+		if (is_multisite()) {
76
+			add_action('switch_blog', array($this, 'handle_switch_blog'), 10, 2);
77 77
 		}
78 78
 	}
79 79
 
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return object
113 113
 	 */
114
-	public function get( $row_id ) {
114
+	public function get($row_id) {
115 115
 		/* @var WPDB $wpdb */
116 116
 		global $wpdb;
117 117
 
118 118
 		// Bailout.
119
-		if ( empty( $row_id ) ) {
119
+		if (empty($row_id)) {
120 120
 			return null;
121 121
 		}
122 122
 
123
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
123
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
124 124
 	}
125 125
 
126 126
 	/**
@@ -134,18 +134,18 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @return object
136 136
 	 */
137
-	public function get_by( $column, $row_id ) {
137
+	public function get_by($column, $row_id) {
138 138
 		/* @var WPDB $wpdb */
139 139
 		global $wpdb;
140 140
 
141 141
 		// Bailout.
142
-		if ( empty( $column ) || empty( $row_id ) ) {
142
+		if (empty($column) || empty($row_id)) {
143 143
 			return null;
144 144
 		}
145 145
 
146
-		$column = esc_sql( $column );
146
+		$column = esc_sql($column);
147 147
 
148
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
148
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
149 149
 	}
150 150
 
151 151
 	/**
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @return string      Column value.
161 161
 	 */
162
-	public function get_column( $column, $row_id ) {
162
+	public function get_column($column, $row_id) {
163 163
 		/* @var WPDB $wpdb */
164 164
 		global $wpdb;
165 165
 
166 166
 		// Bailout.
167
-		if ( empty( $column ) || empty( $row_id ) ) {
167
+		if (empty($column) || empty($row_id)) {
168 168
 			return null;
169 169
 		}
170 170
 
171
-		$column = esc_sql( $column );
171
+		$column = esc_sql($column);
172 172
 
173
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
173
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
174 174
 	}
175 175
 
176 176
 	/**
@@ -185,19 +185,19 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return string
187 187
 	 */
188
-	public function get_column_by( $column, $column_where, $column_value ) {
188
+	public function get_column_by($column, $column_where, $column_value) {
189 189
 		/* @var WPDB $wpdb */
190 190
 		global $wpdb;
191 191
 
192 192
 		// Bailout.
193
-		if ( empty( $column ) || empty( $column_where ) || empty( $column_value ) ) {
193
+		if (empty($column) || empty($column_where) || empty($column_value)) {
194 194
 			return null;
195 195
 		}
196 196
 
197
-		$column_where = esc_sql( $column_where );
198
-		$column       = esc_sql( $column );
197
+		$column_where = esc_sql($column_where);
198
+		$column       = esc_sql($column);
199 199
 
200
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
200
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
201 201
 	}
202 202
 
203 203
 	/**
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 	 *
212 212
 	 * @return int
213 213
 	 */
214
-	public function insert( $data, $type = '' ) {
214
+	public function insert($data, $type = '') {
215 215
 		/* @var WPDB $wpdb */
216 216
 		global $wpdb;
217 217
 
218 218
 		// Set default values.
219
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
219
+		$data = wp_parse_args($data, $this->get_column_defaults());
220 220
 
221 221
 		/**
222 222
 		 * Fires before inserting data to the database.
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		 *
226 226
 		 * @param array $data
227 227
 		 */
228
-		do_action( "give_pre_insert_{$type}", $data );
228
+		do_action("give_pre_insert_{$type}", $data);
229 229
 
230 230
 		// Initialise column format array
231 231
 		$column_formats = $this->get_columns();
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
 		// $data = array_change_key_case( $data );
235 235
 
236 236
 		// White list columns
237
-		$data = array_intersect_key( $data, $column_formats );
237
+		$data = array_intersect_key($data, $column_formats);
238 238
 
239 239
 		// Reorder $column_formats to match the order of columns given in $data
240
-		$data_keys      = array_keys( $data );
241
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
240
+		$data_keys      = array_keys($data);
241
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
242 242
 
243
-		$wpdb->insert( $this->table_name, $data, $column_formats );
243
+		$wpdb->insert($this->table_name, $data, $column_formats);
244 244
 
245 245
 		/**
246 246
 		 * Fires after inserting data to the database.
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		 * @param int   $insert_id
251 251
 		 * @param array $data
252 252
 		 */
253
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
253
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
254 254
 
255 255
 		return $wpdb->insert_id;
256 256
 	}
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return bool
269 269
 	 */
270
-	public function update( $row_id, $data = array(), $where = '' ) {
270
+	public function update($row_id, $data = array(), $where = '') {
271 271
 		/* @var WPDB $wpdb */
272 272
 		global $wpdb;
273 273
 
274 274
 		// Row ID must be positive integer
275
-		$row_id = absint( $row_id );
275
+		$row_id = absint($row_id);
276 276
 
277
-		if ( empty( $row_id ) ) {
277
+		if (empty($row_id)) {
278 278
 			return false;
279 279
 		}
280 280
 
281
-		if ( empty( $where ) ) {
281
+		if (empty($where)) {
282 282
 			$where = $this->primary_key;
283 283
 		}
284 284
 
@@ -286,16 +286,16 @@  discard block
 block discarded – undo
286 286
 		$column_formats = $this->get_columns();
287 287
 
288 288
 		// Force fields to lower case
289
-		$data = array_change_key_case( $data );
289
+		$data = array_change_key_case($data);
290 290
 
291 291
 		// White list columns
292
-		$data = array_intersect_key( $data, $column_formats );
292
+		$data = array_intersect_key($data, $column_formats);
293 293
 
294 294
 		// Reorder $column_formats to match the order of columns given in $data
295
-		$data_keys      = array_keys( $data );
296
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
295
+		$data_keys      = array_keys($data);
296
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
297 297
 
298
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
298
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
299 299
 			return false;
300 300
 		}
301 301
 
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return bool
314 314
 	 */
315
-	public function delete( $row_id = 0 ) {
315
+	public function delete($row_id = 0) {
316 316
 		/* @var WPDB $wpdb */
317 317
 		global $wpdb;
318 318
 
319 319
 		// Row ID must be positive integer
320
-		$row_id = absint( $row_id );
320
+		$row_id = absint($row_id);
321 321
 
322
-		if ( empty( $row_id ) ) {
322
+		if (empty($row_id)) {
323 323
 			return false;
324 324
 		}
325 325
 
326
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
326
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
327 327
 			return false;
328 328
 		}
329 329
 
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @return bool          If the table name exists.
342 342
 	 */
343
-	public function table_exists( $table ) {
343
+	public function table_exists($table) {
344 344
 		/* @var WPDB $wpdb */
345 345
 		global $wpdb;
346 346
 
347
-		$table = sanitize_text_field( $table );
347
+		$table = sanitize_text_field($table);
348 348
 
349
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
349
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
350 350
 	}
351 351
 
352 352
 	/**
@@ -360,16 +360,16 @@  discard block
 block discarded – undo
360 360
 	 *
361 361
 	 * @return bool
362 362
 	 */
363
-	public function does_column_exist( $column_name ) {
363
+	public function does_column_exist($column_name) {
364 364
 
365 365
 		global $wpdb;
366 366
 
367
-		$column = $wpdb->get_results( $wpdb->prepare(
367
+		$column = $wpdb->get_results($wpdb->prepare(
368 368
 			"SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ",
369 369
 			DB_NAME, $this->table_name, $column_name
370
-		) );
370
+		));
371 371
 
372
-		if ( ! empty( $column ) ) {
372
+		if ( ! empty($column)) {
373 373
 			return true;
374 374
 		}
375 375
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
386 386
 	 */
387 387
 	public function installed() {
388
-		return $this->table_exists( $this->table_name );
388
+		return $this->table_exists($this->table_name);
389 389
 	}
390 390
 
391 391
 	/**
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 	 * @access public
396 396
 	 */
397 397
 	public function register_table() {
398
-		$current_version = get_option( $this->table_name . '_db_version' );
399
-		if ( ! $current_version || version_compare( $current_version, $this->version, '<' ) ) {
398
+		$current_version = get_option($this->table_name.'_db_version');
399
+		if ( ! $current_version || version_compare($current_version, $this->version, '<')) {
400 400
 			$this->create_table();
401 401
 		}
402 402
 	}
@@ -421,23 +421,23 @@  discard block
 block discarded – undo
421 421
 	 *
422 422
 	 * @return int|bool                The normalized log ID or false if it's found to not be valid.
423 423
 	 */
424
-	public function sanitize_id( $id ) {
425
-		if ( ! is_numeric( $id ) ) {
424
+	public function sanitize_id($id) {
425
+		if ( ! is_numeric($id)) {
426 426
 			return false;
427 427
 		}
428 428
 
429 429
 		$id = (int) $id;
430 430
 
431 431
 		// We were given a non positive number.
432
-		if ( absint( $id ) !== $id ) {
432
+		if (absint($id) !== $id) {
433 433
 			return false;
434 434
 		}
435 435
 
436
-		if ( empty( $id ) ) {
436
+		if (empty($id)) {
437 437
 			return false;
438 438
 		}
439 439
 
440
-		return absint( $id );
440
+		return absint($id);
441 441
 
442 442
 	}
443 443
 
@@ -451,23 +451,23 @@  discard block
 block discarded – undo
451 451
 	 * @param $new_blog_id
452 452
 	 * @param $prev_blog_id
453 453
 	 */
454
-	public function handle_switch_blog( $new_blog_id, $prev_blog_id ) {
454
+	public function handle_switch_blog($new_blog_id, $prev_blog_id) {
455 455
 		global $wpdb;
456 456
 
457 457
 		// Bailout.
458
-		if ( $new_blog_id === $prev_blog_id ) {
458
+		if ($new_blog_id === $prev_blog_id) {
459 459
 			return;
460 460
 		}
461 461
 
462 462
 
463 463
 		$this->table_name = str_replace(
464
-			1 != $prev_blog_id ? $wpdb->get_blog_prefix( $prev_blog_id ) : $wpdb->base_prefix,
465
-			1 != $new_blog_id ? $wpdb->get_blog_prefix( $new_blog_id ) : $wpdb->base_prefix,
464
+			1 != $prev_blog_id ? $wpdb->get_blog_prefix($prev_blog_id) : $wpdb->base_prefix,
465
+			1 != $new_blog_id ? $wpdb->get_blog_prefix($new_blog_id) : $wpdb->base_prefix,
466 466
 			$this->table_name
467 467
 		);
468 468
 
469
-		if ( $this instanceof Give_DB_Meta ) {
470
-			$wpdb->{$this->get_meta_type() . 'meta'} = $this->table_name;
469
+		if ($this instanceof Give_DB_Meta) {
470
+			$wpdb->{$this->get_meta_type().'meta'} = $this->table_name;
471 471
 		}
472 472
 
473 473
 	}
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,17 +250,17 @@  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/images/svg/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/images/svg/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
-				__( 'Need help? Get started with %sGive 101%s.', 'give' ),
263
+				__('Need help? Get started with %sGive 101%s.', 'give'),
264 264
 				'<a href="http://docs.givewp.com/give101/" target="_blank">',
265 265
 				'</a>'
266 266
 			),
@@ -269,40 +269,40 @@  discard block
 block discarded – undo
269 269
 		// Define contextual content.
270 270
 		$content = array(
271 271
 			'no_donations_or_forms' => array(
272
-				'heading' => __( 'No donations found.', 'give' ),
273
-				'message' => __( 'Your donation history will appear here, but first, you need a donation form!', 'give' ),
272
+				'heading' => __('No donations found.', 'give'),
273
+				'message' => __('Your donation history will appear here, but first, you need a donation form!', 'give'),
274 274
 			),
275 275
 			'no_donations'          => array(
276
-				'heading'  => __( 'No donations found.', 'give' ),
277
-				'message'  => __( 'When your first donation arrives, a record of the donation will appear here.', 'give' ),
278
-				'cta_text' => __( 'View All Forms', 'give' ),
279
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
276
+				'heading'  => __('No donations found.', 'give'),
277
+				'message'  => __('When your first donation arrives, a record of the donation will appear here.', 'give'),
278
+				'cta_text' => __('View All Forms', 'give'),
279
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
280 280
 				'help'     => sprintf(
281
-					__( 'Need help? Learn more about %sDonations%s.', 'give' ),
281
+					__('Need help? Learn more about %sDonations%s.', 'give'),
282 282
 					'<a href="http://docs.givewp.com/core-donations/">',
283 283
 					'</a>'
284 284
 				),
285 285
 			),
286 286
 			'no_donors_or_forms'    => array(
287
-				'heading' => __( 'No donors  found.', 'give' ),
288
-				'message' => __( 'Your donor history will appear here, but first, you need a donation form!', 'give' ),
287
+				'heading' => __('No donors  found.', 'give'),
288
+				'message' => __('Your donor history will appear here, but first, you need a donation form!', 'give'),
289 289
 			),
290 290
 			'no_donors'             => array(
291
-				'heading'  => __( 'No donors found.', 'give' ),
292
-				'message'  => __( 'When your first donation arrives, the donor will appear here.', 'give' ),
293
-				'cta_text' => __( 'View All Forms', 'give' ),
294
-				'cta_link' => admin_url( 'edit.php?post_type=give_forms' ),
291
+				'heading'  => __('No donors found.', 'give'),
292
+				'message'  => __('When your first donation arrives, the donor will appear here.', 'give'),
293
+				'cta_text' => __('View All Forms', 'give'),
294
+				'cta_link' => admin_url('edit.php?post_type=give_forms'),
295 295
 				'help'     => sprintf(
296
-					__( 'Need help? Learn more about %sDonors%s.', 'give' ),
296
+					__('Need help? Learn more about %sDonors%s.', 'give'),
297 297
 					'<a href="http://docs.givewp.com/core-donors/">',
298 298
 					'</a>'
299 299
 				),
300 300
 			),
301 301
 		);
302 302
 
303
-		if ( isset( $content[ $context ] ) ) {
303
+		if (isset($content[$context])) {
304 304
 			// Merge contextual content with defaults.
305
-			return wp_parse_args( $content[ $context ], $defaults );
305
+			return wp_parse_args($content[$context], $defaults);
306 306
 		} else {
307 307
 			// Return defaults if context is undefined.
308 308
 			return $defaults;
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +472 added lines, -472 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,70 +25,70 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ) :
49
+		case version_compare($give_version, '1.8.7', '<') :
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 
53
-		case version_compare( $give_version, '1.8.8', '<' ) :
53
+		case version_compare($give_version, '1.8.8', '<') :
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ) :
57
+		case version_compare($give_version, '1.8.9', '<') :
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61
-		case version_compare( $give_version, '1.8.12', '<' ) :
61
+		case version_compare($give_version, '1.8.12', '<') :
62 62
 			give_v1812_upgrades();
63 63
 			$did_upgrade = true;
64 64
 
65
-		case version_compare( $give_version, '1.8.13', '<' ) :
65
+		case version_compare($give_version, '1.8.13', '<') :
66 66
 			give_v1813_upgrades();
67 67
 			$did_upgrade = true;
68 68
 
69
-		case version_compare( $give_version, '1.8.17', '<' ) :
69
+		case version_compare($give_version, '1.8.17', '<') :
70 70
 			give_v1817_upgrades();
71 71
 			$did_upgrade = true;
72 72
 
73
-		case version_compare( $give_version, '1.8.18', '<' ) :
73
+		case version_compare($give_version, '1.8.18', '<') :
74 74
 			give_v1818_upgrades();
75 75
 			$did_upgrade = true;
76 76
 
77
-		case version_compare( $give_version, '2.0', '<' ) :
77
+		case version_compare($give_version, '2.0', '<') :
78 78
 			give_v20_upgrades();
79 79
 			$did_upgrade = true;
80 80
 
81
-		case version_compare( $give_version, '2.0.1', '<' ) :
81
+		case version_compare($give_version, '2.0.1', '<') :
82 82
 			// Do nothing on fresh install.
83
-			if ( ! doing_action( 'give_upgrades' ) ) {
83
+			if ( ! doing_action('give_upgrades')) {
84 84
 				give_v201_create_tables();
85
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
85
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
86 86
 				Give_Updates::$background_updater->dispatch();
87 87
 			}
88 88
 
89 89
 			$did_upgrade = true;
90 90
 
91
-		case version_compare( $give_version, '2.0.2', '<' ) :
91
+		case version_compare($give_version, '2.0.2', '<') :
92 92
 			// Remove 2.0.1 update to rerun on 2.0.2
93 93
 			$completed_upgrades = give_get_completed_upgrades();
94 94
 			$v201_updates       = array(
@@ -98,35 +98,35 @@  discard block
 block discarded – undo
98 98
 				'v201_logs_upgrades',
99 99
 			);
100 100
 
101
-			foreach ( $v201_updates as $v201_update ) {
102
-				if ( in_array( $v201_update, $completed_upgrades ) ) {
103
-					unset( $completed_upgrades[ array_search( $v201_update, $completed_upgrades ) ] );
101
+			foreach ($v201_updates as $v201_update) {
102
+				if (in_array($v201_update, $completed_upgrades)) {
103
+					unset($completed_upgrades[array_search($v201_update, $completed_upgrades)]);
104 104
 				}
105 105
 			}
106 106
 
107
-			update_option( 'give_completed_upgrades', $completed_upgrades );
107
+			update_option('give_completed_upgrades', $completed_upgrades);
108 108
 
109 109
 			// Do nothing on fresh install.
110
-			if ( ! doing_action( 'give_upgrades' ) ) {
110
+			if ( ! doing_action('give_upgrades')) {
111 111
 				give_v201_create_tables();
112
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
112
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
113 113
 				Give_Updates::$background_updater->dispatch();
114 114
 			}
115 115
 
116 116
 			$did_upgrade = true;
117 117
 
118
-		case version_compare( $give_version, '2.0.3', '<' ) :
118
+		case version_compare($give_version, '2.0.3', '<') :
119 119
 			give_v203_upgrades();
120 120
 			$did_upgrade = true;
121 121
 	}
122 122
 
123
-	if ( $did_upgrade ) {
124
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
123
+	if ($did_upgrade) {
124
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
125 125
 	}
126 126
 }
127 127
 
128
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
129
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
128
+add_action('admin_init', 'give_do_automatic_upgrades');
129
+add_action('give_upgrades', 'give_do_automatic_upgrades');
130 130
 
131 131
 /**
132 132
  * Display Upgrade Notices.
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return void
142 142
  */
143
-function give_show_upgrade_notices( $give_updates ) {
143
+function give_show_upgrade_notices($give_updates) {
144 144
 	// v1.3.2 Upgrades
145 145
 	$give_updates->register(
146 146
 		array(
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 	);
207 207
 
208 208
 	// v1.8.17 Upgrades for donations.
209
-	$give_updates->register( array(
209
+	$give_updates->register(array(
210 210
 		'id'       => 'v1817_update_donation_iranian_currency_code',
211 211
 		'version'  => '1.8.17',
212 212
 		'callback' => 'give_v1817_update_donation_iranian_currency_code',
213
-	) );
213
+	));
214 214
 
215 215
 	// v1.8.17 Upgrades for cleanup of user roles.
216
-	$give_updates->register( array(
216
+	$give_updates->register(array(
217 217
 		'id'       => 'v1817_cleanup_user_roles',
218 218
 		'version'  => '1.8.17',
219 219
 		'callback' => 'give_v1817_cleanup_user_roles',
220
-	) );
220
+	));
221 221
 
222 222
 	// v1.8.18 Upgrades for assigning custom amount to existing set donations.
223
-	$give_updates->register( array(
223
+	$give_updates->register(array(
224 224
 		'id'       => 'v1818_assign_custom_amount_set_donation',
225 225
 		'version'  => '1.8.18',
226 226
 		'callback' => 'give_v1818_assign_custom_amount_set_donation',
227
-	) );
227
+	));
228 228
 
229 229
 	// v1.8.18 Cleanup the Give Worker Role Caps.
230
-	$give_updates->register( array(
230
+	$give_updates->register(array(
231 231
 		'id'       => 'v1818_give_worker_role_cleanup',
232 232
 		'version'  => '1.8.18',
233 233
 		'callback' => 'give_v1818_give_worker_role_cleanup',
234
-	) );
234
+	));
235 235
 
236 236
 	// v2.0.0 Upgrades
237 237
 	$give_updates->register(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			'id'       => 'v20_move_metadata_into_new_table',
286 286
 			'version'  => '2.0.0',
287 287
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
288
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
288
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
289 289
 		)
290 290
 	);
291 291
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 			'id'       => 'v201_move_metadata_into_new_table',
332 332
 			'version'  => '2.0.1',
333 333
 			'callback' => 'give_v201_move_metadata_into_new_table_callback',
334
-			'depend'   => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ),
334
+			'depend'   => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'),
335 335
 		)
336 336
 	);
337 337
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	);
347 347
 }
348 348
 
349
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
349
+add_action('give_register_updates', 'give_show_upgrade_notices');
350 350
 
351 351
 /**
352 352
  * Triggers all upgrade functions
@@ -358,29 +358,29 @@  discard block
 block discarded – undo
358 358
  */
359 359
 function give_trigger_upgrades() {
360 360
 
361
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
362
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
361
+	if ( ! current_user_can('manage_give_settings')) {
362
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
363 363
 			'response' => 403,
364
-		) );
364
+		));
365 365
 	}
366 366
 
367
-	$give_version = get_option( 'give_version' );
367
+	$give_version = get_option('give_version');
368 368
 
369
-	if ( ! $give_version ) {
369
+	if ( ! $give_version) {
370 370
 		// 1.0 is the first version to use this option so we must add it.
371 371
 		$give_version = '1.0';
372
-		add_option( 'give_version', $give_version );
372
+		add_option('give_version', $give_version);
373 373
 	}
374 374
 
375
-	update_option( 'give_version', GIVE_VERSION );
376
-	delete_option( 'give_doing_upgrade' );
375
+	update_option('give_version', GIVE_VERSION);
376
+	delete_option('give_doing_upgrade');
377 377
 
378
-	if ( DOING_AJAX ) {
379
-		die( 'complete' );
378
+	if (DOING_AJAX) {
379
+		die('complete');
380 380
 	} // End if().
381 381
 }
382 382
 
383
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
383
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
384 384
 
385 385
 
386 386
 /**
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
 
399 399
 	// UPDATE DB METAKEYS.
400 400
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
401
-	$query = $wpdb->query( $sql );
401
+	$query = $wpdb->query($sql);
402 402
 
403 403
 	$give_updates->percentage = 100;
404
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
404
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
405 405
 }
406 406
 
407 407
 
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
 	$where  .= "AND ( p.post_status = 'abandoned' )";
426 426
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
427 427
 
428
-	$sql            = $select . $join . $where;
429
-	$found_payments = $wpdb->get_col( $sql );
428
+	$sql            = $select.$join.$where;
429
+	$found_payments = $wpdb->get_col($sql);
430 430
 
431
-	foreach ( $found_payments as $payment ) {
431
+	foreach ($found_payments as $payment) {
432 432
 
433 433
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
434
-		$modified_time = get_post_modified_time( 'U', false, $payment );
434
+		$modified_time = get_post_modified_time('U', false, $payment);
435 435
 
436 436
 		// 1450124863 =  12/10/2015 20:42:25.
437
-		if ( $modified_time >= 1450124863 ) {
437
+		if ($modified_time >= 1450124863) {
438 438
 
439
-			give_update_payment_status( $payment, 'pending' );
439
+			give_update_payment_status($payment, 'pending');
440 440
 
441 441
 		}
442 442
 	}
443 443
 
444 444
 	$give_updates->percentage = 100;
445
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
445
+	give_set_upgrade_complete('upgrade_give_offline_status');
446 446
 }
447 447
 
448 448
 
@@ -455,17 +455,17 @@  discard block
 block discarded – undo
455 455
  */
456 456
 function give_v152_cleanup_users() {
457 457
 
458
-	$give_version = get_option( 'give_version' );
458
+	$give_version = get_option('give_version');
459 459
 
460
-	if ( ! $give_version ) {
460
+	if ( ! $give_version) {
461 461
 		// 1.0 is the first version to use this option so we must add it.
462 462
 		$give_version = '1.0';
463 463
 	}
464 464
 
465
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
465
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
466 466
 
467 467
 	// v1.5.2 Upgrades
468
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
468
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
469 469
 
470 470
 		// Delete all caps with "ss".
471 471
 		// Also delete all unused "campaign" roles.
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 		);
513 513
 
514 514
 		global $wp_roles;
515
-		foreach ( $delete_caps as $cap ) {
516
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
517
-				$wp_roles->remove_cap( $role, $cap );
515
+		foreach ($delete_caps as $cap) {
516
+			foreach (array_keys($wp_roles->roles) as $role) {
517
+				$wp_roles->remove_cap($role, $cap);
518 518
 			}
519 519
 		}
520 520
 
@@ -524,15 +524,15 @@  discard block
 block discarded – undo
524 524
 		$roles->add_caps();
525 525
 
526 526
 		// The Update Ran.
527
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
528
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
529
-		delete_option( 'give_doing_upgrade' );
527
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
528
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
529
+		delete_option('give_doing_upgrade');
530 530
 
531 531
 	}// End if().
532 532
 
533 533
 }
534 534
 
535
-add_action( 'admin_init', 'give_v152_cleanup_users' );
535
+add_action('admin_init', 'give_v152_cleanup_users');
536 536
 
537 537
 /**
538 538
  * 1.6 Upgrade routine to create the customer meta table.
@@ -575,53 +575,53 @@  discard block
 block discarded – undo
575 575
 
576 576
 	// Get addons license key.
577 577
 	$addons = array();
578
-	foreach ( $give_options as $key => $value ) {
579
-		if ( false !== strpos( $key, '_license_key' ) ) {
580
-			$addons[ $key ] = $value;
578
+	foreach ($give_options as $key => $value) {
579
+		if (false !== strpos($key, '_license_key')) {
580
+			$addons[$key] = $value;
581 581
 		}
582 582
 	}
583 583
 
584 584
 	// Bailout: We do not have any addon license data to upgrade.
585
-	if ( empty( $addons ) ) {
585
+	if (empty($addons)) {
586 586
 		return false;
587 587
 	}
588 588
 
589
-	foreach ( $addons as $key => $addon_license ) {
589
+	foreach ($addons as $key => $addon_license) {
590 590
 
591 591
 		// Get addon shortname.
592
-		$shortname = str_replace( '_license_key', '', $key );
592
+		$shortname = str_replace('_license_key', '', $key);
593 593
 
594 594
 		// Addon license option name.
595
-		$addon_license_option_name = $shortname . '_license_active';
595
+		$addon_license_option_name = $shortname.'_license_active';
596 596
 
597 597
 		// bailout if license is empty.
598
-		if ( empty( $addon_license ) ) {
599
-			delete_option( $addon_license_option_name );
598
+		if (empty($addon_license)) {
599
+			delete_option($addon_license_option_name);
600 600
 			continue;
601 601
 		}
602 602
 
603 603
 		// Get addon name.
604 604
 		$addon_name       = array();
605
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
606
-		foreach ( $addon_name_parts as $name_part ) {
605
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
606
+		foreach ($addon_name_parts as $name_part) {
607 607
 
608 608
 			// Fix addon name
609
-			switch ( $name_part ) {
609
+			switch ($name_part) {
610 610
 				case 'authorizenet' :
611 611
 					$name_part = 'authorize.net';
612 612
 					break;
613 613
 			}
614 614
 
615
-			$addon_name[] = ucfirst( $name_part );
615
+			$addon_name[] = ucfirst($name_part);
616 616
 		}
617 617
 
618
-		$addon_name = implode( ' ', $addon_name );
618
+		$addon_name = implode(' ', $addon_name);
619 619
 
620 620
 		// Data to send to the API.
621 621
 		$api_params = array(
622 622
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
623 623
 			'license'    => $addon_license,
624
-			'item_name'  => urlencode( $addon_name ),
624
+			'item_name'  => urlencode($addon_name),
625 625
 			'url'        => home_url(),
626 626
 		);
627 627
 
@@ -636,17 +636,17 @@  discard block
 block discarded – undo
636 636
 		);
637 637
 
638 638
 		// Make sure there are no errors.
639
-		if ( is_wp_error( $response ) ) {
640
-			delete_option( $addon_license_option_name );
639
+		if (is_wp_error($response)) {
640
+			delete_option($addon_license_option_name);
641 641
 			continue;
642 642
 		}
643 643
 
644 644
 		// Tell WordPress to look for updates.
645
-		set_site_transient( 'update_plugins', null );
645
+		set_site_transient('update_plugins', null);
646 646
 
647 647
 		// Decode license data.
648
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
649
-		update_option( $addon_license_option_name, $license_data );
648
+		$license_data = json_decode(wp_remote_retrieve_body($response));
649
+		update_option($addon_license_option_name, $license_data);
650 650
 	}// End foreach().
651 651
 }
652 652
 
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
 	);
677 677
 
678 678
 	global $wp_roles;
679
-	foreach ( $delete_caps as $cap ) {
680
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
681
-			$wp_roles->remove_cap( $role, $cap );
679
+	foreach ($delete_caps as $cap) {
680
+		foreach (array_keys($wp_roles->roles) as $role) {
681
+			$wp_roles->remove_cap($role, $cap);
682 682
 		}
683 683
 	}
684 684
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 function give_v18_upgrades_core_setting() {
713 713
 	// Core settings which changes from checkbox to radio.
714 714
 	$core_setting_names = array_merge(
715
-		array_keys( give_v18_renamed_core_settings() ),
715
+		array_keys(give_v18_renamed_core_settings()),
716 716
 		array(
717 717
 			'uninstall_on_delete',
718 718
 			'scripts_footer',
@@ -724,48 +724,48 @@  discard block
 block discarded – undo
724 724
 	);
725 725
 
726 726
 	// Bailout: If not any setting define.
727
-	if ( $give_settings = get_option( 'give_settings' ) ) {
727
+	if ($give_settings = get_option('give_settings')) {
728 728
 
729 729
 		$setting_changed = false;
730 730
 
731 731
 		// Loop: check each setting field.
732
-		foreach ( $core_setting_names as $setting_name ) {
732
+		foreach ($core_setting_names as $setting_name) {
733 733
 			// New setting name.
734
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
734
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
735 735
 
736 736
 			// Continue: If setting already set.
737 737
 			if (
738
-				array_key_exists( $new_setting_name, $give_settings )
739
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
738
+				array_key_exists($new_setting_name, $give_settings)
739
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
740 740
 			) {
741 741
 				continue;
742 742
 			}
743 743
 
744 744
 			// Set checkbox value to radio value.
745
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
745
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
746 746
 
747 747
 			// @see https://github.com/WordImpress/Give/issues/1063.
748
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
748
+			if (false !== strpos($setting_name, 'disable_')) {
749 749
 
750
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
751
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
750
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
751
+			} elseif (false !== strpos($setting_name, 'enable_')) {
752 752
 
753
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
753
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
754 754
 			}
755 755
 
756 756
 			// Tell bot to update core setting to db.
757
-			if ( ! $setting_changed ) {
757
+			if ( ! $setting_changed) {
758 758
 				$setting_changed = true;
759 759
 			}
760 760
 		}
761 761
 
762 762
 		// Update setting only if they changed.
763
-		if ( $setting_changed ) {
764
-			update_option( 'give_settings', $give_settings );
763
+		if ($setting_changed) {
764
+			update_option('give_settings', $give_settings);
765 765
 		}
766 766
 	}// End if().
767 767
 
768
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
768
+	give_set_upgrade_complete('v18_upgrades_core_setting');
769 769
 }
770 770
 
771 771
 /**
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 	$give_updates = Give_Updates::get_instance();
780 780
 
781 781
 	// form query
782
-	$forms = new WP_Query( array(
782
+	$forms = new WP_Query(array(
783 783
 			'paged'          => $give_updates->step,
784 784
 			'status'         => 'any',
785 785
 			'order'          => 'ASC',
@@ -788,41 +788,41 @@  discard block
 block discarded – undo
788 788
 		)
789 789
 	);
790 790
 
791
-	if ( $forms->have_posts() ) {
792
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
791
+	if ($forms->have_posts()) {
792
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
793 793
 
794
-		while ( $forms->have_posts() ) {
794
+		while ($forms->have_posts()) {
795 795
 			$forms->the_post();
796 796
 
797 797
 			// Form content.
798 798
 			// Note in version 1.8 display content setting split into display content and content placement setting.
799 799
 			// You can delete _give_content_option in future.
800
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
801
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
802
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
803
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
800
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
801
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
802
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
803
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
804 804
 
805
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
806
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
805
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
806
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
807 807
 			}
808 808
 
809 809
 			// "Disable" Guest Donation. Checkbox.
810 810
 			// See: https://github.com/WordImpress/Give/issues/1470.
811
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
812
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
813
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
811
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
812
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
813
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
814 814
 
815 815
 			// Offline Donations.
816 816
 			// See: https://github.com/WordImpress/Give/issues/1579.
817
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
818
-			if ( 'no' === $offline_donation ) {
817
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
818
+			if ('no' === $offline_donation) {
819 819
 				$offline_donation_newval = 'global';
820
-			} elseif ( 'yes' === $offline_donation ) {
820
+			} elseif ('yes' === $offline_donation) {
821 821
 				$offline_donation_newval = 'enabled';
822 822
 			} else {
823 823
 				$offline_donation_newval = 'disabled';
824 824
 			}
825
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
825
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
826 826
 
827 827
 			// Convert yes/no setting field to enabled/disabled.
828 828
 			$form_radio_settings = array(
@@ -842,15 +842,15 @@  discard block
 block discarded – undo
842 842
 				'_give_offline_donation_enable_billing_fields_single',
843 843
 			);
844 844
 
845
-			foreach ( $form_radio_settings as $meta_key ) {
845
+			foreach ($form_radio_settings as $meta_key) {
846 846
 				// Get value.
847
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
847
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
848 848
 
849 849
 				// Convert meta value only if it is in yes/no/none.
850
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
850
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
851 851
 
852
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
853
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
852
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
853
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
854 854
 				}
855 855
 			}
856 856
 		}// End while().
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 
860 860
 	} else {
861 861
 		// No more forms found, finish up.
862
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
862
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
863 863
 	}
864 864
 }
865 865
 
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 				'%_transient_give_stats_%',
927 927
 				'give_cache%',
928 928
 				'%_transient_give_add_ons_feed%',
929
-				'%_transient__give_ajax_works' .
929
+				'%_transient__give_ajax_works'.
930 930
 				'%_transient_give_total_api_keys%',
931 931
 				'%_transient_give_i18n_give_promo_hide%',
932 932
 				'%_transient_give_contributors%',
@@ -953,24 +953,24 @@  discard block
 block discarded – undo
953 953
 		ARRAY_A
954 954
 	);
955 955
 
956
-	if ( ! empty( $user_apikey_options ) ) {
957
-		foreach ( $user_apikey_options as $user ) {
958
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
959
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
960
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
956
+	if ( ! empty($user_apikey_options)) {
957
+		foreach ($user_apikey_options as $user) {
958
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
959
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
960
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
961 961
 		}
962 962
 	}
963 963
 
964
-	if ( ! empty( $cached_options ) ) {
965
-		foreach ( $cached_options as $option ) {
966
-			switch ( true ) {
967
-				case ( false !== strpos( $option, 'transient' ) ):
968
-					$option = str_replace( '_transient_', '', $option );
969
-					delete_transient( $option );
964
+	if ( ! empty($cached_options)) {
965
+		foreach ($cached_options as $option) {
966
+			switch (true) {
967
+				case (false !== strpos($option, 'transient')):
968
+					$option = str_replace('_transient_', '', $option);
969
+					delete_transient($option);
970 970
 					break;
971 971
 
972 972
 				default:
973
-					delete_option( $option );
973
+					delete_option($option);
974 974
 			}
975 975
 		}
976 976
 	}
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 	global $wp_roles;
989 989
 
990 990
 	// Get the role object.
991
-	$give_worker = get_role( 'give_worker' );
991
+	$give_worker = get_role('give_worker');
992 992
 
993 993
 	// A list of capabilities to add for give workers.
994 994
 	$caps_to_add = array(
@@ -996,9 +996,9 @@  discard block
 block discarded – undo
996 996
 		'edit_pages',
997 997
 	);
998 998
 
999
-	foreach ( $caps_to_add as $cap ) {
999
+	foreach ($caps_to_add as $cap) {
1000 1000
 		// Add the capability.
1001
-		$give_worker->add_cap( $cap );
1001
+		$give_worker->add_cap($cap);
1002 1002
 	}
1003 1003
 
1004 1004
 }
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	$give_updates = Give_Updates::get_instance();
1016 1016
 
1017 1017
 	// form query.
1018
-	$donation_forms = new WP_Query( array(
1018
+	$donation_forms = new WP_Query(array(
1019 1019
 			'paged'          => $give_updates->step,
1020 1020
 			'status'         => 'any',
1021 1021
 			'order'          => 'ASC',
@@ -1024,10 +1024,10 @@  discard block
 block discarded – undo
1024 1024
 		)
1025 1025
 	);
1026 1026
 
1027
-	if ( $donation_forms->have_posts() ) {
1028
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1027
+	if ($donation_forms->have_posts()) {
1028
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1029 1029
 
1030
-		while ( $donation_forms->have_posts() ) {
1030
+		while ($donation_forms->have_posts()) {
1031 1031
 			$donation_forms->the_post();
1032 1032
 			$form_id = get_the_ID();
1033 1033
 
@@ -1035,41 +1035,41 @@  discard block
 block discarded – undo
1035 1035
 			update_post_meta(
1036 1036
 				$form_id,
1037 1037
 				'_give_set_price',
1038
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1038
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1039 1039
 			);
1040 1040
 
1041 1041
 			// Remove formatting from _give_custom_amount_minimum.
1042 1042
 			update_post_meta(
1043 1043
 				$form_id,
1044 1044
 				'_give_custom_amount_minimum',
1045
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1045
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1046 1046
 			);
1047 1047
 
1048 1048
 			// Bailout.
1049
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1049
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1050 1050
 				continue;
1051 1051
 			}
1052 1052
 
1053
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1053
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1054 1054
 
1055
-			if ( ! empty( $donation_levels ) ) {
1055
+			if ( ! empty($donation_levels)) {
1056 1056
 
1057
-				foreach ( $donation_levels as $index => $donation_level ) {
1058
-					if ( isset( $donation_level['_give_amount'] ) ) {
1059
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1057
+				foreach ($donation_levels as $index => $donation_level) {
1058
+					if (isset($donation_level['_give_amount'])) {
1059
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1060 1060
 					}
1061 1061
 				}
1062 1062
 
1063
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1063
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1064 1064
 
1065
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1065
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1066 1066
 
1067
-				$min_amount = min( $donation_levels_amounts );
1068
-				$max_amount = max( $donation_levels_amounts );
1067
+				$min_amount = min($donation_levels_amounts);
1068
+				$max_amount = max($donation_levels_amounts);
1069 1069
 
1070 1070
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1071
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1072
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1071
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1072
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1073 1073
 			}
1074 1074
 
1075 1075
 		}
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 		wp_reset_postdata();
1079 1079
 	} else {
1080 1080
 		// The Update Ran.
1081
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1081
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1082 1082
 	}
1083 1083
 
1084 1084
 }
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
  */
1129 1129
 function give_v20_upgrades() {
1130 1130
 	// Update cache setting.
1131
-	give_update_option( 'cache', 'enabled' );
1131
+	give_update_option('cache', 'enabled');
1132 1132
 
1133 1133
 	// Upgrade email settings.
1134 1134
 	give_v20_upgrades_email_setting();
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 	$all_setting = give_get_settings();
1148 1148
 
1149 1149
 	// Bailout on fresh install.
1150
-	if ( empty( $all_setting ) ) {
1150
+	if (empty($all_setting)) {
1151 1151
 		return;
1152 1152
 	}
1153 1153
 
@@ -1166,19 +1166,19 @@  discard block
 block discarded – undo
1166 1166
 		'admin_notices'                 => 'new-donation_notification',
1167 1167
 	);
1168 1168
 
1169
-	foreach ( $settings as $old_setting => $new_setting ) {
1169
+	foreach ($settings as $old_setting => $new_setting) {
1170 1170
 		// Do not update already modified
1171
-		if ( ! is_array( $new_setting ) ) {
1172
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1171
+		if ( ! is_array($new_setting)) {
1172
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1173 1173
 				continue;
1174 1174
 			}
1175 1175
 		}
1176 1176
 
1177
-		switch ( $old_setting ) {
1177
+		switch ($old_setting) {
1178 1178
 			case 'admin_notices':
1179
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1179
+				$notification_status = give_get_option($old_setting, 'enabled');
1180 1180
 
1181
-				give_update_option( $new_setting, $notification_status );
1181
+				give_update_option($new_setting, $notification_status);
1182 1182
 
1183 1183
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1184 1184
 				// give_delete_option( $old_setting );
@@ -1189,19 +1189,19 @@  discard block
 block discarded – undo
1189 1189
 			case 'admin_notice_emails':
1190 1190
 				$recipients = give_get_admin_notice_emails();
1191 1191
 
1192
-				foreach ( $new_setting as $setting ) {
1192
+				foreach ($new_setting as $setting) {
1193 1193
 					// bailout if setting already exist.
1194
-					if ( array_key_exists( $setting, $all_setting ) ) {
1194
+					if (array_key_exists($setting, $all_setting)) {
1195 1195
 						continue;
1196 1196
 					}
1197 1197
 
1198
-					give_update_option( $setting, $recipients );
1198
+					give_update_option($setting, $recipients);
1199 1199
 				}
1200 1200
 				break;
1201 1201
 
1202 1202
 			default:
1203
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1204
-				give_delete_option( $old_setting );
1203
+				give_update_option($new_setting, give_get_option($old_setting));
1204
+				give_delete_option($old_setting);
1205 1205
 		}
1206 1206
 	}
1207 1207
 }
@@ -1218,22 +1218,22 @@  discard block
 block discarded – undo
1218 1218
 	$give_settings        = give_get_settings();
1219 1219
 	$give_setting_updated = false;
1220 1220
 
1221
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1221
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1222 1222
 		$give_settings['number_decimals']   = 0;
1223 1223
 		$give_settings['decimal_separator'] = '';
1224 1224
 		$give_setting_updated               = true;
1225 1225
 
1226
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1226
+	} elseif (empty($give_settings['decimal_separator'])) {
1227 1227
 		$give_settings['number_decimals'] = 0;
1228 1228
 		$give_setting_updated             = true;
1229 1229
 
1230
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1230
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1231 1231
 		$give_settings['number_decimals'] = 5;
1232 1232
 		$give_setting_updated             = true;
1233 1233
 	}
1234 1234
 
1235
-	if ( $give_setting_updated ) {
1236
-		update_option( 'give_settings', $give_settings );
1235
+	if ($give_setting_updated) {
1236
+		update_option('give_settings', $give_settings);
1237 1237
 	}
1238 1238
 }
1239 1239
 
@@ -1252,69 +1252,69 @@  discard block
 block discarded – undo
1252 1252
 	$give_updates = Give_Updates::get_instance();
1253 1253
 
1254 1254
 	// form query.
1255
-	$donation_forms = new WP_Query( array(
1255
+	$donation_forms = new WP_Query(array(
1256 1256
 			'paged'          => $give_updates->step,
1257 1257
 			'status'         => 'any',
1258 1258
 			'order'          => 'ASC',
1259
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1259
+			'post_type'      => array('give_forms', 'give_payment'),
1260 1260
 			'posts_per_page' => 20,
1261 1261
 		)
1262 1262
 	);
1263
-	if ( $donation_forms->have_posts() ) {
1264
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1263
+	if ($donation_forms->have_posts()) {
1264
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1265 1265
 
1266
-		while ( $donation_forms->have_posts() ) {
1266
+		while ($donation_forms->have_posts()) {
1267 1267
 			$donation_forms->the_post();
1268 1268
 			global $post;
1269 1269
 
1270
-			$meta = get_post_meta( $post->ID );
1270
+			$meta = get_post_meta($post->ID);
1271 1271
 
1272
-			switch ( $post->post_type ) {
1272
+			switch ($post->post_type) {
1273 1273
 				case 'give_forms':
1274 1274
 					// _give_set_price.
1275
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1276
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1275
+					if ( ! empty($meta['_give_set_price'][0])) {
1276
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1277 1277
 					}
1278 1278
 
1279 1279
 					// _give_custom_amount_minimum.
1280
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1281
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1280
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1281
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1282 1282
 					}
1283 1283
 
1284 1284
 					// _give_levels_minimum_amount.
1285
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1286
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1285
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1286
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1287 1287
 					}
1288 1288
 
1289 1289
 					// _give_levels_maximum_amount.
1290
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1291
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1290
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1291
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1292 1292
 					}
1293 1293
 
1294 1294
 					// _give_set_goal.
1295
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1296
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1295
+					if ( ! empty($meta['_give_set_goal'][0])) {
1296
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1297 1297
 					}
1298 1298
 
1299 1299
 					// _give_form_earnings.
1300
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1301
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1300
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1301
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1302 1302
 					}
1303 1303
 
1304 1304
 					// _give_custom_amount_minimum.
1305
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1306
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1305
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1306
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1307 1307
 
1308
-						foreach ( $donation_levels as $index => $level ) {
1309
-							if ( empty( $level['_give_amount'] ) ) {
1308
+						foreach ($donation_levels as $index => $level) {
1309
+							if (empty($level['_give_amount'])) {
1310 1310
 								continue;
1311 1311
 							}
1312 1312
 
1313
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1313
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1314 1314
 						}
1315 1315
 
1316 1316
 						$meta['_give_donation_levels'] = $donation_levels;
1317
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1317
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1318 1318
 					}
1319 1319
 
1320 1320
 
@@ -1322,8 +1322,8 @@  discard block
 block discarded – undo
1322 1322
 
1323 1323
 				case 'give_payment':
1324 1324
 					// _give_payment_total.
1325
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1326
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1325
+					if ( ! empty($meta['_give_payment_total'][0])) {
1326
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1327 1327
 					}
1328 1328
 
1329 1329
 					break;
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		wp_reset_postdata();
1335 1335
 	} else {
1336 1336
 		// The Update Ran.
1337
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1337
+		give_set_upgrade_complete('v1812_update_amount_values');
1338 1338
 	}
1339 1339
 }
1340 1340
 
@@ -1353,22 +1353,22 @@  discard block
 block discarded – undo
1353 1353
 	$give_updates = Give_Updates::get_instance();
1354 1354
 
1355 1355
 	// form query.
1356
-	$donors = Give()->donors->get_donors( array(
1356
+	$donors = Give()->donors->get_donors(array(
1357 1357
 			'number' => 20,
1358
-			'offset' => $give_updates->get_offset( 20 ),
1358
+			'offset' => $give_updates->get_offset(20),
1359 1359
 		)
1360 1360
 	);
1361 1361
 
1362
-	if ( ! empty( $donors ) ) {
1363
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1362
+	if ( ! empty($donors)) {
1363
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1364 1364
 
1365 1365
 		/* @var Object $donor */
1366
-		foreach ( $donors as $donor ) {
1367
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1366
+		foreach ($donors as $donor) {
1367
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1368 1368
 		}
1369 1369
 	} else {
1370 1370
 		// The Update Ran.
1371
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1371
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1372 1372
 	}
1373 1373
 }
1374 1374
 
@@ -1382,25 +1382,25 @@  discard block
 block discarded – undo
1382 1382
 	$give_updates = Give_Updates::get_instance();
1383 1383
 
1384 1384
 	// Fetch all the existing donors.
1385
-	$donors = Give()->donors->get_donors( array(
1385
+	$donors = Give()->donors->get_donors(array(
1386 1386
 			'number' => 20,
1387
-			'offset' => $give_updates->get_offset( 20 ),
1387
+			'offset' => $give_updates->get_offset(20),
1388 1388
 		)
1389 1389
 	);
1390 1390
 
1391
-	if ( ! empty( $donors ) ) {
1392
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1391
+	if ( ! empty($donors)) {
1392
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1393 1393
 
1394 1394
 		/* @var Object $donor */
1395
-		foreach ( $donors as $donor ) {
1395
+		foreach ($donors as $donor) {
1396 1396
 			$user_id = $donor->user_id;
1397 1397
 
1398 1398
 			// Proceed, if donor is attached with user.
1399
-			if ( $user_id ) {
1400
-				$user = get_userdata( $user_id );
1399
+			if ($user_id) {
1400
+				$user = get_userdata($user_id);
1401 1401
 
1402 1402
 				// Update user role, if user has subscriber role.
1403
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1403
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1404 1404
 					wp_update_user(
1405 1405
 						array(
1406 1406
 							'ID'   => $user_id,
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 		}
1413 1413
 	} else {
1414 1414
 		// The Update Ran.
1415
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1415
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1416 1416
 	}
1417 1417
 }
1418 1418
 
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
  */
1425 1425
 function give_v1813_upgrades() {
1426 1426
 	// Update admin setting.
1427
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1427
+	give_update_option('donor_default_user_role', 'give_donor');
1428 1428
 
1429 1429
 	// Update Give roles.
1430 1430
 	$roles = new Give_Roles();
@@ -1442,33 +1442,33 @@  discard block
 block discarded – undo
1442 1442
 	$give_updates = Give_Updates::get_instance();
1443 1443
 
1444 1444
 	// form query.
1445
-	$payments = new WP_Query( array(
1445
+	$payments = new WP_Query(array(
1446 1446
 			'paged'          => $give_updates->step,
1447 1447
 			'status'         => 'any',
1448 1448
 			'order'          => 'ASC',
1449
-			'post_type'      => array( 'give_payment' ),
1449
+			'post_type'      => array('give_payment'),
1450 1450
 			'posts_per_page' => 100,
1451 1451
 		)
1452 1452
 	);
1453 1453
 
1454
-	if ( $payments->have_posts() ) {
1455
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1454
+	if ($payments->have_posts()) {
1455
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1456 1456
 
1457
-		while ( $payments->have_posts() ) {
1457
+		while ($payments->have_posts()) {
1458 1458
 			$payments->the_post();
1459 1459
 
1460
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1460
+			$payment_meta = give_get_payment_meta(get_the_ID());
1461 1461
 
1462
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1462
+			if ('RIAL' === $payment_meta['currency']) {
1463 1463
 				$payment_meta['currency'] = 'IRR';
1464
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1464
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1465 1465
 			}
1466 1466
 
1467 1467
 		}
1468 1468
 
1469 1469
 	} else {
1470 1470
 		// The Update Ran.
1471
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1471
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1472 1472
 	}
1473 1473
 }
1474 1474
 
@@ -1481,9 +1481,9 @@  discard block
 block discarded – undo
1481 1481
 function give_v1817_upgrades() {
1482 1482
 	$give_settings = give_get_settings();
1483 1483
 
1484
-	if ( 'RIAL' === $give_settings['currency'] ) {
1484
+	if ('RIAL' === $give_settings['currency']) {
1485 1485
 		$give_settings['currency'] = 'IRR';
1486
-		update_option( 'give_settings', $give_settings );
1486
+		update_option('give_settings', $give_settings);
1487 1487
 	}
1488 1488
 }
1489 1489
 
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
 
1497 1497
 	global $wp_roles;
1498 1498
 
1499
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1499
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1500 1500
 		return;
1501 1501
 	}
1502 1502
 
@@ -1520,15 +1520,15 @@  discard block
 block discarded – undo
1520 1520
 		),
1521 1521
 	);
1522 1522
 
1523
-	foreach ( $add_caps as $role => $caps ) {
1524
-		foreach ( $caps as $cap ) {
1525
-			$wp_roles->add_cap( $role, $cap );
1523
+	foreach ($add_caps as $role => $caps) {
1524
+		foreach ($caps as $cap) {
1525
+			$wp_roles->add_cap($role, $cap);
1526 1526
 		}
1527 1527
 	}
1528 1528
 
1529
-	foreach ( $remove_caps as $role => $caps ) {
1530
-		foreach ( $caps as $cap ) {
1531
-			$wp_roles->remove_cap( $role, $cap );
1529
+	foreach ($remove_caps as $role => $caps) {
1530
+		foreach ($caps as $cap) {
1531
+			$wp_roles->remove_cap($role, $cap);
1532 1532
 		}
1533 1533
 	}
1534 1534
 
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
 	$roles->add_roles();
1553 1553
 	$roles->add_caps();
1554 1554
 
1555
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1555
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1556 1556
 }
1557 1557
 
1558 1558
 /**
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
 function give_v1818_upgrades() {
1564 1564
 
1565 1565
 	// Remove email_access_installed from give_settings.
1566
-	give_delete_option( 'email_access_installed' );
1566
+	give_delete_option('email_access_installed');
1567 1567
 }
1568 1568
 
1569 1569
 /**
@@ -1576,23 +1576,23 @@  discard block
 block discarded – undo
1576 1576
 	/* @var Give_Updates $give_updates */
1577 1577
 	$give_updates = Give_Updates::get_instance();
1578 1578
 
1579
-	$donations = new WP_Query( array(
1579
+	$donations = new WP_Query(array(
1580 1580
 			'paged'          => $give_updates->step,
1581 1581
 			'status'         => 'any',
1582 1582
 			'order'          => 'ASC',
1583
-			'post_type'      => array( 'give_payment' ),
1583
+			'post_type'      => array('give_payment'),
1584 1584
 			'posts_per_page' => 100,
1585 1585
 		)
1586 1586
 	);
1587 1587
 
1588
-	if ( $donations->have_posts() ) {
1589
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1588
+	if ($donations->have_posts()) {
1589
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1590 1590
 
1591
-		while ( $donations->have_posts() ) {
1591
+		while ($donations->have_posts()) {
1592 1592
 			$donations->the_post();
1593 1593
 
1594
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1595
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1594
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1595
+			$donation_meta = give_get_payment_meta(get_the_ID());
1596 1596
 
1597 1597
 			// Update Donation meta with price_id set as custom, only if it is:
1598 1598
 			// 1. Donation Type = Set Donation.
@@ -1601,19 +1601,19 @@  discard block
 block discarded – undo
1601 1601
 			if (
1602 1602
 				$form->ID &&
1603 1603
 				$form->is_set_type_donation_form() &&
1604
-				( 'custom' !== $donation_meta['price_id'] ) &&
1605
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1604
+				('custom' !== $donation_meta['price_id']) &&
1605
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1606 1606
 			) {
1607 1607
 				$donation_meta['price_id'] = 'custom';
1608
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1609
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1608
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1609
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1610 1610
 			}
1611 1611
 		}
1612 1612
 
1613 1613
 		wp_reset_postdata();
1614 1614
 	} else {
1615 1615
 		// Update Ran Successfully.
1616
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1616
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1617 1617
 	}
1618 1618
 }
1619 1619
 
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
 
1632 1632
 	global $wp_roles;
1633 1633
 
1634
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1634
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1635 1635
 		return;
1636 1636
 	}
1637 1637
 
@@ -1649,9 +1649,9 @@  discard block
 block discarded – undo
1649 1649
 		),
1650 1650
 	);
1651 1651
 
1652
-	foreach ( $remove_caps as $role => $caps ) {
1653
-		foreach ( $caps as $cap ) {
1654
-			$wp_roles->remove_cap( $role, $cap );
1652
+	foreach ($remove_caps as $role => $caps) {
1653
+		foreach ($caps as $cap) {
1654
+			$wp_roles->remove_cap($role, $cap);
1655 1655
 		}
1656 1656
 	}
1657 1657
 
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
 	$roles->add_roles();
1663 1663
 	$roles->add_caps();
1664 1664
 
1665
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1665
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1666 1666
 }
1667 1667
 
1668 1668
 /**
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 	$give_updates = Give_Updates::get_instance();
1677 1677
 
1678 1678
 	// form query
1679
-	$forms = new WP_Query( array(
1679
+	$forms = new WP_Query(array(
1680 1680
 			'paged'          => $give_updates->step,
1681 1681
 			'status'         => 'any',
1682 1682
 			'order'          => 'ASC',
@@ -1685,22 +1685,22 @@  discard block
 block discarded – undo
1685 1685
 		)
1686 1686
 	);
1687 1687
 
1688
-	if ( $forms->have_posts() ) {
1689
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1688
+	if ($forms->have_posts()) {
1689
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1690 1690
 
1691
-		while ( $forms->have_posts() ) {
1691
+		while ($forms->have_posts()) {
1692 1692
 			$forms->the_post();
1693 1693
 			global $post;
1694 1694
 
1695 1695
 			// Update offline instruction email notification status.
1696
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1697
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1696
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1697
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1698 1698
 				'enabled',
1699 1699
 				'global',
1700
-			) )
1700
+			))
1701 1701
 				? $offline_instruction_notification_status
1702 1702
 				: 'global';
1703
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1703
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1704 1704
 
1705 1705
 			// Update offline instruction email message.
1706 1706
 			update_post_meta(
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
 		wp_reset_postdata();
1733 1733
 	} else {
1734 1734
 		// No more forms found, finish up.
1735
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1735
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1736 1736
 	}
1737 1737
 }
1738 1738
 
@@ -1749,7 +1749,7 @@  discard block
 block discarded – undo
1749 1749
 	$give_updates = Give_Updates::get_instance();
1750 1750
 
1751 1751
 	// form query
1752
-	$forms = new WP_Query( array(
1752
+	$forms = new WP_Query(array(
1753 1753
 			'paged'          => $give_updates->step,
1754 1754
 			'status'         => 'any',
1755 1755
 			'order'          => 'ASC',
@@ -1758,19 +1758,19 @@  discard block
 block discarded – undo
1758 1758
 		)
1759 1759
 	);
1760 1760
 
1761
-	if ( $forms->have_posts() ) {
1762
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1761
+	if ($forms->have_posts()) {
1762
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1763 1763
 
1764
-		while ( $forms->have_posts() ) {
1764
+		while ($forms->have_posts()) {
1765 1765
 			$forms->the_post();
1766 1766
 			global $post;
1767 1767
 
1768 1768
 			// Split _give_payment_meta meta.
1769 1769
 			// @todo Remove _give_payment_meta after releases 2.0
1770
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1770
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1771 1771
 
1772
-			if ( ! empty( $payment_meta ) ) {
1773
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1772
+			if ( ! empty($payment_meta)) {
1773
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1774 1774
 			}
1775 1775
 
1776 1776
 			$deprecated_meta_keys = array(
@@ -1779,9 +1779,9 @@  discard block
 block discarded – undo
1779 1779
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1780 1780
 			);
1781 1781
 
1782
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1782
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1783 1783
 				// Do not add new meta key if already exist.
1784
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
1784
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
1785 1785
 					continue;
1786 1786
 				}
1787 1787
 
@@ -1790,25 +1790,25 @@  discard block
 block discarded – undo
1790 1790
 					array(
1791 1791
 						'post_id'    => $post->ID,
1792 1792
 						'meta_key'   => $new_meta_key,
1793
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
1793
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
1794 1794
 					)
1795 1795
 				);
1796 1796
 			}
1797 1797
 
1798 1798
 			// Bailout
1799
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1799
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1800 1800
 				/* @var Give_Donor $donor */
1801
-				$donor = new Give_Donor( $donor_id );
1801
+				$donor = new Give_Donor($donor_id);
1802 1802
 
1803
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1804
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1805
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1806
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1807
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1808
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1803
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1804
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1805
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1806
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1807
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1808
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1809 1809
 
1810 1810
 				// Save address.
1811
-				$donor->add_address( 'billing[]', $address );
1811
+				$donor->add_address('billing[]', $address);
1812 1812
 			}
1813 1813
 
1814 1814
 		}// End while().
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1820 1820
 
1821 1821
 		// No more forms found, finish up.
1822
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1822
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1823 1823
 	}
1824 1824
 }
1825 1825
 
@@ -1835,7 +1835,7 @@  discard block
 block discarded – undo
1835 1835
 	$give_updates = Give_Updates::get_instance();
1836 1836
 
1837 1837
 	// form query
1838
-	$forms = new WP_Query( array(
1838
+	$forms = new WP_Query(array(
1839 1839
 			'paged'          => $give_updates->step,
1840 1840
 			'order'          => 'DESC',
1841 1841
 			'post_type'      => 'give_log',
@@ -1844,20 +1844,20 @@  discard block
 block discarded – undo
1844 1844
 		)
1845 1845
 	);
1846 1846
 
1847
-	if ( $forms->have_posts() ) {
1848
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1847
+	if ($forms->have_posts()) {
1848
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1849 1849
 
1850
-		while ( $forms->have_posts() ) {
1850
+		while ($forms->have_posts()) {
1851 1851
 			$forms->the_post();
1852 1852
 			global $post;
1853 1853
 
1854
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1854
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1855 1855
 				continue;
1856 1856
 			}
1857 1857
 
1858
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1859
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1860
-			$term_name = ! empty( $term ) ? $term->slug : '';
1858
+			$term      = get_the_terms($post->ID, 'give_log_type');
1859
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1860
+			$term_name = ! empty($term) ? $term->slug : '';
1861 1861
 
1862 1862
 			$log_data = array(
1863 1863
 				'ID'           => $post->ID,
@@ -1870,29 +1870,29 @@  discard block
 block discarded – undo
1870 1870
 			);
1871 1871
 			$log_meta = array();
1872 1872
 
1873
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1874
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1875
-					switch ( $meta_key ) {
1873
+			if ($old_log_meta = get_post_meta($post->ID)) {
1874
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1875
+					switch ($meta_key) {
1876 1876
 						case '_give_log_payment_id':
1877
-							$log_data['log_parent']        = current( $meta_value );
1877
+							$log_data['log_parent']        = current($meta_value);
1878 1878
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1879 1879
 							break;
1880 1880
 
1881 1881
 						default:
1882
-							$log_meta[ $meta_key ] = current( $meta_value );
1882
+							$log_meta[$meta_key] = current($meta_value);
1883 1883
 					}
1884 1884
 				}
1885 1885
 			}
1886 1886
 
1887
-			if ( 'api_request' === $term_name ) {
1887
+			if ('api_request' === $term_name) {
1888 1888
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1889 1889
 			}
1890 1890
 
1891
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1891
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1892 1892
 
1893
-			if ( ! empty( $log_meta ) ) {
1894
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1895
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1893
+			if ( ! empty($log_meta)) {
1894
+				foreach ($log_meta as $meta_key => $meta_value) {
1895
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1896 1896
 				}
1897 1897
 			}
1898 1898
 
@@ -1934,7 +1934,7 @@  discard block
 block discarded – undo
1934 1934
 		Give()->logs->delete_cache();
1935 1935
 
1936 1936
 		// No more forms found, finish up.
1937
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1937
+		give_set_upgrade_complete('v20_logs_upgrades');
1938 1938
 	}
1939 1939
 }
1940 1940
 
@@ -1950,19 +1950,19 @@  discard block
 block discarded – undo
1950 1950
 	$give_updates = Give_Updates::get_instance();
1951 1951
 
1952 1952
 	// form query
1953
-	$payments = new WP_Query( array(
1953
+	$payments = new WP_Query(array(
1954 1954
 			'paged'          => $give_updates->step,
1955 1955
 			'status'         => 'any',
1956 1956
 			'order'          => 'ASC',
1957
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1957
+			'post_type'      => array('give_forms', 'give_payment'),
1958 1958
 			'posts_per_page' => 100,
1959 1959
 		)
1960 1960
 	);
1961 1961
 
1962
-	if ( $payments->have_posts() ) {
1963
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
1962
+	if ($payments->have_posts()) {
1963
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
1964 1964
 
1965
-		while ( $payments->have_posts() ) {
1965
+		while ($payments->have_posts()) {
1966 1966
 			$payments->the_post();
1967 1967
 			global $post;
1968 1968
 
@@ -1974,19 +1974,19 @@  discard block
 block discarded – undo
1974 1974
 				ARRAY_A
1975 1975
 			);
1976 1976
 
1977
-			if ( ! empty( $meta_data ) ) {
1978
-				foreach ( $meta_data as $index => $data ) {
1977
+			if ( ! empty($meta_data)) {
1978
+				foreach ($meta_data as $index => $data) {
1979 1979
 					// Check for duplicate meta values.
1980
-					if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
1980
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
1981 1981
 						continue;
1982 1982
 					}
1983 1983
 
1984
-					switch ( $post->post_type ) {
1984
+					switch ($post->post_type) {
1985 1985
 						case 'give_forms':
1986 1986
 							$data['form_id'] = $data['post_id'];
1987
-							unset( $data['post_id'] );
1987
+							unset($data['post_id']);
1988 1988
 
1989
-							Give()->form_meta->insert( $data );
1989
+							Give()->form_meta->insert($data);
1990 1990
 							// @todo: delete form meta from post meta table after releases 2.0.
1991 1991
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
1992 1992
 
@@ -1994,9 +1994,9 @@  discard block
 block discarded – undo
1994 1994
 
1995 1995
 						case 'give_payment':
1996 1996
 							$data['payment_id'] = $data['post_id'];
1997
-							unset( $data['post_id'] );
1997
+							unset($data['post_id']);
1998 1998
 
1999
-							Give()->payment_meta->insert( $data );
1999
+							Give()->payment_meta->insert($data);
2000 2000
 
2001 2001
 							// @todo: delete donation meta from post meta table after releases 2.0.
2002 2002
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
 		wp_reset_postdata();
2012 2012
 	} else {
2013 2013
 		// No more forms found, finish up.
2014
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
2014
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
2015 2015
 	}
2016 2016
 
2017 2017
 }
@@ -2027,44 +2027,44 @@  discard block
 block discarded – undo
2027 2027
 	/* @var Give_Updates $give_updates */
2028 2028
 	$give_updates = Give_Updates::get_instance();
2029 2029
 
2030
-	$donors = Give()->donors->get_donors( array(
2030
+	$donors = Give()->donors->get_donors(array(
2031 2031
 		'paged'  => $give_updates->step,
2032 2032
 		'number' => 100,
2033
-	) );
2033
+	));
2034 2034
 
2035
-	if ( $donors ) {
2036
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2035
+	if ($donors) {
2036
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2037 2037
 		// Loop through Donors
2038
-		foreach ( $donors as $donor ) {
2038
+		foreach ($donors as $donor) {
2039 2039
 
2040
-			$donor_name       = explode( ' ', $donor->name, 2 );
2041
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2042
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2040
+			$donor_name       = explode(' ', $donor->name, 2);
2041
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2042
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2043 2043
 
2044 2044
 			// If first name meta of donor is not created, then create it.
2045
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2046
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2045
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2046
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2047 2047
 			}
2048 2048
 
2049 2049
 			// If last name meta of donor is not created, then create it.
2050
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2051
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2050
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2051
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2052 2052
 			}
2053 2053
 
2054 2054
 			// If Donor is connected with WP User then update user meta.
2055
-			if ( $donor->user_id ) {
2056
-				if ( isset( $donor_name[0] ) ) {
2057
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2055
+			if ($donor->user_id) {
2056
+				if (isset($donor_name[0])) {
2057
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2058 2058
 				}
2059
-				if ( isset( $donor_name[1] ) ) {
2060
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2059
+				if (isset($donor_name[1])) {
2060
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2061 2061
 				}
2062 2062
 			}
2063 2063
 		}
2064 2064
 
2065 2065
 	} else {
2066 2066
 		// The Update Ran.
2067
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2067
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2068 2068
 	}
2069 2069
 
2070 2070
 }
@@ -2093,15 +2093,15 @@  discard block
 block discarded – undo
2093 2093
 
2094 2094
 	$users = $user_query->get_results();
2095 2095
 
2096
-	if ( $users ) {
2097
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2096
+	if ($users) {
2097
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2098 2098
 
2099 2099
 		// Loop through Donors
2100
-		foreach ( $users as $user ) {
2100
+		foreach ($users as $user) {
2101 2101
 			/* @var Give_Donor $donor */
2102
-			$donor = new Give_Donor( $user->ID, true );
2102
+			$donor = new Give_Donor($user->ID, true);
2103 2103
 
2104
-			if ( ! $donor->id ) {
2104
+			if ( ! $donor->id) {
2105 2105
 				continue;
2106 2106
 			}
2107 2107
 
@@ -2117,10 +2117,10 @@  discard block
 block discarded – undo
2117 2117
 				)
2118 2118
 			);
2119 2119
 
2120
-			if ( ! empty( $address ) ) {
2121
-				$address = maybe_unserialize( $address );
2122
-				$donor->add_address( 'personal', $address );
2123
-				$donor->add_address( 'billing[]', $address );
2120
+			if ( ! empty($address)) {
2121
+				$address = maybe_unserialize($address);
2122
+				$donor->add_address('personal', $address);
2123
+				$donor->add_address('billing[]', $address);
2124 2124
 
2125 2125
 
2126 2126
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2130,7 +2130,7 @@  discard block
 block discarded – undo
2130 2130
 
2131 2131
 	} else {
2132 2132
 		// The Update Ran.
2133
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2133
+		give_set_upgrade_complete('v20_upgrades_user_address');
2134 2134
 	}
2135 2135
 
2136 2136
 }
@@ -2154,15 +2154,15 @@  discard block
 block discarded – undo
2154 2154
 	);
2155 2155
 
2156 2156
 	// Alter customer table
2157
-	foreach ( $tables as $old_table => $new_table ) {
2157
+	foreach ($tables as $old_table => $new_table) {
2158 2158
 		if (
2159
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2160
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2159
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2160
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2161 2161
 		) {
2162
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2162
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2163 2163
 
2164
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2165
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2164
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2165
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2166 2166
 			}
2167 2167
 		}
2168 2168
 	}
@@ -2170,7 +2170,7 @@  discard block
 block discarded – undo
2170 2170
 	$give_updates->percentage = 100;
2171 2171
 
2172 2172
 	// No more forms found, finish up.
2173
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2173
+	give_set_upgrade_complete('v20_rename_donor_tables');
2174 2174
 
2175 2175
 	// Re initiate donor classes.
2176 2176
 	Give()->donors     = new Give_DB_Donors();
@@ -2188,19 +2188,19 @@  discard block
 block discarded – undo
2188 2188
 function give_v201_create_tables() {
2189 2189
 	global $wpdb;
2190 2190
 
2191
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2191
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) {
2192 2192
 		Give()->payment_meta->create_table();
2193 2193
 	}
2194 2194
 
2195
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) {
2195
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) {
2196 2196
 		Give()->form_meta->create_table();
2197 2197
 	}
2198 2198
 
2199
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) {
2199
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) {
2200 2200
 		Give()->logs->log_db->create_table();
2201 2201
 	}
2202 2202
 
2203
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) {
2203
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) {
2204 2204
 		Give()->logs->logmeta_db->create_table();
2205 2205
 	}
2206 2206
 }
@@ -2225,31 +2225,31 @@  discard block
 block discarded – undo
2225 2225
   				$wpdb->posts.post_date >= '2018-01-08 00:00:00'
2226 2226
 			)
2227 2227
 			AND $wpdb->posts.post_type = 'give_payment'
2228
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2228
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2229 2229
 			ORDER BY $wpdb->posts.post_date ASC 
2230 2230
 			LIMIT 100
2231
-			OFFSET " . $give_updates->get_offset( 100 )
2231
+			OFFSET ".$give_updates->get_offset(100)
2232 2232
 	);
2233 2233
 
2234
-	if ( ! empty( $payments ) ) {
2235
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) );
2234
+	if ( ! empty($payments)) {
2235
+		$give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100));
2236 2236
 
2237
-		foreach ( $payments as $payment_id ) {
2238
-			$post = get_post( $payment_id );
2239
-			setup_postdata( $post );
2237
+		foreach ($payments as $payment_id) {
2238
+			$post = get_post($payment_id);
2239
+			setup_postdata($post);
2240 2240
 
2241 2241
 			// Do not add new meta keys if already refactored.
2242
-			if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) {
2242
+			if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) {
2243 2243
 				continue;
2244 2244
 			}
2245 2245
 
2246 2246
 
2247 2247
 			// Split _give_payment_meta meta.
2248 2248
 			// @todo Remove _give_payment_meta after releases 2.0
2249
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2249
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2250 2250
 
2251
-			if ( ! empty( $payment_meta ) ) {
2252
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2251
+			if ( ! empty($payment_meta)) {
2252
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2253 2253
 			}
2254 2254
 
2255 2255
 			$deprecated_meta_keys = array(
@@ -2258,9 +2258,9 @@  discard block
 block discarded – undo
2258 2258
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2259 2259
 			);
2260 2260
 
2261
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2261
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2262 2262
 				// Do not add new meta key if already exist.
2263
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
2263
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
2264 2264
 					continue;
2265 2265
 				}
2266 2266
 
@@ -2269,25 +2269,25 @@  discard block
 block discarded – undo
2269 2269
 					array(
2270 2270
 						'post_id'    => $post->ID,
2271 2271
 						'meta_key'   => $new_meta_key,
2272
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
2272
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
2273 2273
 					)
2274 2274
 				);
2275 2275
 			}
2276 2276
 
2277 2277
 			// Bailout
2278
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2278
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2279 2279
 				/* @var Give_Donor $donor */
2280
-				$donor = new Give_Donor( $donor_id );
2280
+				$donor = new Give_Donor($donor_id);
2281 2281
 
2282
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2283
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2284
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2285
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2286
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2287
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2282
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2283
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2284
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2285
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2286
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2287
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2288 2288
 
2289 2289
 				// Save address.
2290
-				$donor->add_address( 'billing[]', $address );
2290
+				$donor->add_address('billing[]', $address);
2291 2291
 			}
2292 2292
 
2293 2293
 		}// End while().
@@ -2298,7 +2298,7 @@  discard block
 block discarded – undo
2298 2298
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2299 2299
 
2300 2300
 		// No more forms found, finish up.
2301
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2301
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2302 2302
 	}
2303 2303
 }
2304 2304
 
@@ -2318,21 +2318,21 @@  discard block
 block discarded – undo
2318 2318
 			SELECT ID FROM $wpdb->posts 
2319 2319
 			WHERE 1=1
2320 2320
 			AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' )
2321
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2321
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2322 2322
 			ORDER BY $wpdb->posts.post_date ASC 
2323 2323
 			LIMIT 100
2324
-			OFFSET " . $give_updates->get_offset( 100 )
2324
+			OFFSET ".$give_updates->get_offset(100)
2325 2325
 	);
2326 2326
 
2327
-	if ( ! empty( $payments ) ) {
2328
-		$give_updates->set_percentage( give_get_total_post_type_count( array(
2327
+	if ( ! empty($payments)) {
2328
+		$give_updates->set_percentage(give_get_total_post_type_count(array(
2329 2329
 			'give_forms',
2330 2330
 			'give_payment',
2331
-		) ), $give_updates->step * 100 );
2331
+		)), $give_updates->step * 100);
2332 2332
 
2333
-		foreach ( $payments as $payment_id ) {
2334
-			$post = get_post( $payment_id );
2335
-			setup_postdata( $post );
2333
+		foreach ($payments as $payment_id) {
2334
+			$post = get_post($payment_id);
2335
+			setup_postdata($post);
2336 2336
 
2337 2337
 			$meta_data = $wpdb->get_results(
2338 2338
 				$wpdb->prepare(
@@ -2342,19 +2342,19 @@  discard block
 block discarded – undo
2342 2342
 				ARRAY_A
2343 2343
 			);
2344 2344
 
2345
-			if ( ! empty( $meta_data ) ) {
2346
-				foreach ( $meta_data as $index => $data ) {
2345
+			if ( ! empty($meta_data)) {
2346
+				foreach ($meta_data as $index => $data) {
2347 2347
 					// Check for duplicate meta values.
2348
-					if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
2348
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
2349 2349
 						continue;
2350 2350
 					}
2351 2351
 
2352
-					switch ( $post->post_type ) {
2352
+					switch ($post->post_type) {
2353 2353
 						case 'give_forms':
2354 2354
 							$data['form_id'] = $data['post_id'];
2355
-							unset( $data['post_id'] );
2355
+							unset($data['post_id']);
2356 2356
 
2357
-							Give()->form_meta->insert( $data );
2357
+							Give()->form_meta->insert($data);
2358 2358
 							// @todo: delete form meta from post meta table after releases 2.0.
2359 2359
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2360 2360
 
@@ -2362,9 +2362,9 @@  discard block
 block discarded – undo
2362 2362
 
2363 2363
 						case 'give_payment':
2364 2364
 							$data['payment_id'] = $data['post_id'];
2365
-							unset( $data['post_id'] );
2365
+							unset($data['post_id']);
2366 2366
 
2367
-							Give()->payment_meta->insert( $data );
2367
+							Give()->payment_meta->insert($data);
2368 2368
 
2369 2369
 							// @todo: delete donation meta from post meta table after releases 2.0.
2370 2370
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
 		wp_reset_postdata();
2380 2380
 	} else {
2381 2381
 		// No more forms found, finish up.
2382
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2382
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2383 2383
 	}
2384 2384
 
2385 2385
 }
@@ -2400,26 +2400,26 @@  discard block
 block discarded – undo
2400 2400
 			SELECT ID FROM $wpdb->posts 
2401 2401
 			WHERE 1=1
2402 2402
 			AND $wpdb->posts.post_type = 'give_log'
2403
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2403
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2404 2404
 			ORDER BY $wpdb->posts.post_date ASC 
2405 2405
 			LIMIT 100
2406
-			OFFSET " . $give_updates->get_offset( 100 )
2406
+			OFFSET ".$give_updates->get_offset(100)
2407 2407
 	);
2408 2408
 
2409
-	if ( ! empty( $logs ) ) {
2410
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 );
2409
+	if ( ! empty($logs)) {
2410
+		$give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100);
2411 2411
 
2412
-		foreach ( $logs as $log_id ) {
2413
-			$post = get_post( $log_id );
2414
-			setup_postdata( $post );
2412
+		foreach ($logs as $log_id) {
2413
+			$post = get_post($log_id);
2414
+			setup_postdata($post);
2415 2415
 
2416
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2416
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2417 2417
 				continue;
2418 2418
 			}
2419 2419
 
2420
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2421
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2422
-			$term_name = ! empty( $term ) ? $term->slug : '';
2420
+			$term      = get_the_terms($post->ID, 'give_log_type');
2421
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2422
+			$term_name = ! empty($term) ? $term->slug : '';
2423 2423
 
2424 2424
 			$log_data = array(
2425 2425
 				'ID'           => $post->ID,
@@ -2432,29 +2432,29 @@  discard block
 block discarded – undo
2432 2432
 			);
2433 2433
 			$log_meta = array();
2434 2434
 
2435
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2436
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2437
-					switch ( $meta_key ) {
2435
+			if ($old_log_meta = get_post_meta($post->ID)) {
2436
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2437
+					switch ($meta_key) {
2438 2438
 						case '_give_log_payment_id':
2439
-							$log_data['log_parent']        = current( $meta_value );
2439
+							$log_data['log_parent']        = current($meta_value);
2440 2440
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2441 2441
 							break;
2442 2442
 
2443 2443
 						default:
2444
-							$log_meta[ $meta_key ] = current( $meta_value );
2444
+							$log_meta[$meta_key] = current($meta_value);
2445 2445
 					}
2446 2446
 				}
2447 2447
 			}
2448 2448
 
2449
-			if ( 'api_request' === $term_name ) {
2449
+			if ('api_request' === $term_name) {
2450 2450
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2451 2451
 			}
2452 2452
 
2453
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2453
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2454 2454
 
2455
-			if ( ! empty( $log_meta ) ) {
2456
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2457
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2455
+			if ( ! empty($log_meta)) {
2456
+				foreach ($log_meta as $meta_key => $meta_value) {
2457
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2458 2458
 				}
2459 2459
 			}
2460 2460
 
@@ -2467,7 +2467,7 @@  discard block
 block discarded – undo
2467 2467
 		Give()->logs->delete_cache();
2468 2468
 
2469 2469
 		// No more forms found, finish up.
2470
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2470
+		give_set_upgrade_complete('v201_logs_upgrades');
2471 2471
 	}
2472 2472
 }
2473 2473
 
@@ -2482,51 +2482,51 @@  discard block
 block discarded – undo
2482 2482
 	global $wpdb;
2483 2483
 	give_v201_create_tables();
2484 2484
 
2485
-	if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) {
2486
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2487
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2485
+	if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) {
2486
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2487
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2488 2488
 		$donor_data = array();
2489 2489
 
2490
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2491
-			foreach ( $missing_donors as $donor_id ) {
2490
+		if ($missing_donors = array_diff($customers, $donors)) {
2491
+			foreach ($missing_donors as $donor_id) {
2492 2492
 				$donor_data[] = array(
2493
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2494
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2493
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2494
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2495 2495
 
2496 2496
 				);
2497 2497
 			}
2498 2498
 		}
2499 2499
 
2500
-		if ( ! empty( $donor_data ) ) {
2500
+		if ( ! empty($donor_data)) {
2501 2501
 			$donor_table_name      = Give()->donors->table_name;
2502 2502
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2503 2503
 
2504 2504
 			Give()->donors->table_name     = "{$wpdb->prefix}give_donors";
2505 2505
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2506 2506
 
2507
-			foreach ( $donor_data as $donor ) {
2507
+			foreach ($donor_data as $donor) {
2508 2508
 				$donor['info'][0] = (array) $donor['info'][0];
2509 2509
 
2510 2510
 				// Prevent duplicate meta id issue.
2511
-				if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) {
2511
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2512 2512
 					continue;
2513 2513
 				}
2514 2514
 
2515
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2515
+				$donor_id = Give()->donors->add($donor['info'][0]);
2516 2516
 
2517
-				if ( ! empty( $donor['meta'] ) ) {
2518
-					foreach ( $donor['meta'] as $donor_meta ) {
2517
+				if ( ! empty($donor['meta'])) {
2518
+					foreach ($donor['meta'] as $donor_meta) {
2519 2519
 						$donor_meta = (array) $donor_meta;
2520 2520
 
2521 2521
 						// Prevent duplicate meta id issue.
2522
-						if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) {
2523
-							unset( $donor_meta['meta_id'] );
2522
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2523
+							unset($donor_meta['meta_id']);
2524 2524
 						}
2525 2525
 
2526 2526
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2527
-						unset( $donor_meta['customer_id'] );
2527
+						unset($donor_meta['customer_id']);
2528 2528
 
2529
-						Give()->donor_meta->insert( $donor_meta );
2529
+						Give()->donor_meta->insert($donor_meta);
2530 2530
 					}
2531 2531
 				}
2532 2532
 
@@ -2545,35 +2545,35 @@  discard block
 block discarded – undo
2545 2545
 					)
2546 2546
 				);
2547 2547
 
2548
-				$donor = new Give_Donor( $donor_id );
2548
+				$donor = new Give_Donor($donor_id);
2549 2549
 
2550
-				if ( ! empty( $address ) ) {
2551
-					$address = maybe_unserialize( $address );
2552
-					$donor->add_address( 'personal', $address );
2553
-					$donor->add_address( 'billing[]', $address );
2550
+				if ( ! empty($address)) {
2551
+					$address = maybe_unserialize($address);
2552
+					$donor->add_address('personal', $address);
2553
+					$donor->add_address('billing[]', $address);
2554 2554
 				}
2555 2555
 
2556
-				$donor_name       = explode( ' ', $donor->name, 2 );
2557
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2558
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2556
+				$donor_name       = explode(' ', $donor->name, 2);
2557
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2558
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2559 2559
 
2560 2560
 				// If first name meta of donor is not created, then create it.
2561
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2562
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2561
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2562
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2563 2563
 				}
2564 2564
 
2565 2565
 				// If last name meta of donor is not created, then create it.
2566
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2567
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2566
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2567
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2568 2568
 				}
2569 2569
 
2570 2570
 				// If Donor is connected with WP User then update user meta.
2571
-				if ( $donor->user_id ) {
2572
-					if ( isset( $donor_name[0] ) ) {
2573
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2571
+				if ($donor->user_id) {
2572
+					if (isset($donor_name[0])) {
2573
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2574 2574
 					}
2575
-					if ( isset( $donor_name[1] ) ) {
2576
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2575
+					if (isset($donor_name[1])) {
2576
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2577 2577
 					}
2578 2578
 				}
2579 2579
 			}
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
 	}
2585 2585
 
2586 2586
 	Give_Updates::get_instance()->percentage = 100;
2587
-	give_set_upgrade_complete( 'v201_add_missing_donors' );
2587
+	give_set_upgrade_complete('v201_add_missing_donors');
2588 2588
 }
2589 2589
 
2590 2590
 
@@ -2597,14 +2597,14 @@  discard block
 block discarded – undo
2597 2597
 	global $wpdb;
2598 2598
 
2599 2599
 	// Do not auto load option.
2600
-	$wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) );
2600
+	$wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades'));
2601 2601
 
2602 2602
 	// Remove from cache.
2603 2603
 	$all_options = wp_load_alloptions();
2604 2604
 
2605
-	if ( isset( $all_options['give_completed_upgrades'] ) ) {
2606
-		unset( $all_options['give_completed_upgrades'] );
2607
-		wp_cache_set( 'alloptions', $all_options, 'options' );
2605
+	if (isset($all_options['give_completed_upgrades'])) {
2606
+		unset($all_options['give_completed_upgrades']);
2607
+		wp_cache_set('alloptions', $all_options, 'options');
2608 2608
 	}
2609 2609
 
2610 2610
 }
2611 2611
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-exports.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: Exports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 } ?>
9 9
 
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 				 *
19 19
 				 * @since 1.0
20 20
 				 */
21
-				do_action( 'give_tools_tab_export_content_top' );
21
+				do_action('give_tools_tab_export_content_top');
22 22
 				?>
23 23
 
24 24
 				<table class="widefat export-options-table give-table striped">
25 25
 					<thead>
26 26
 						<tr>
27
-							<th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th>
28
-							<th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th>
27
+							<th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th>
28
+							<th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th>
29 29
 						</tr>
30 30
 					</thead>
31 31
 					<tbody>
@@ -38,42 +38,42 @@  discard block
 block discarded – undo
38 38
 						 *
39 39
 						 * @since 1.0
40 40
 						 */
41
-						do_action( 'give_tools_tab_export_table_top' );
41
+						do_action('give_tools_tab_export_table_top');
42 42
 						?>
43 43
 						<tr class="give-export-pdf-sales-earnings">
44 44
 							<td scope="row" class="row-title">
45 45
 								<h3>
46
-									<span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span>
46
+									<span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span>
47 47
 								</h3>
48
-								<p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
48
+								<p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
49 49
 							</td>
50 50
 							<td>
51
-								<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>">
52
-									<?php esc_html_e( 'Generate PDF', 'give' ); ?>
51
+								<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>">
52
+									<?php esc_html_e('Generate PDF', 'give'); ?>
53 53
 								</a>
54 54
 							</td>
55 55
 						</tr>
56 56
 						<tr class="give-export-sales-earnings">
57 57
 							<td scope="row" class="row-title">
58 58
 								<h3>
59
-									<span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span>
59
+									<span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span>
60 60
 								</h3>
61
-								<p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
61
+								<p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p>
62 62
 							</td>
63 63
 							<td>
64 64
 								<form method="post">
65 65
 									<?php
66 66
 									printf(
67 67
 									/* translators: 1: start date dropdown 2: end date dropdown */
68
-										esc_html__( '%1$s to %2$s', 'give' ),
69
-										Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
70
-										Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' )
68
+										esc_html__('%1$s to %2$s', 'give'),
69
+										Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
70
+										Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
71 71
 									);
72 72
 									?>
73 73
 									<input type="hidden" name="give-action"
74 74
 										   value="earnings_export"/>
75 75
 									<input type="submit"
76
-										   value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>"
76
+										   value="<?php esc_attr_e('Generate CSV', 'give'); ?>"
77 77
 										   class="button-secondary"/>
78 78
 								</form>
79 79
 							</td>
@@ -81,37 +81,37 @@  discard block
 block discarded – undo
81 81
 						<tr class="give-export-payment-history">
82 82
 							<td scope="row" class="row-title">
83 83
 								<h3>
84
-									<span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span>
84
+									<span><?php esc_html_e('Export Donation History', 'give'); ?></span>
85 85
 								</h3>
86
-								<p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
86
+								<p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p>
87 87
 							</td>
88 88
 							<td>
89 89
 								<form id="give-export-payments"
90 90
 									  class="give-export-form" method="post">
91 91
 									<?php
92
-									echo Give()->html->date_field( array(
92
+									echo Give()->html->date_field(array(
93 93
 										'id'          => 'give-payment-export-start',
94 94
 										'name'        => 'start',
95
-										'placeholder' => esc_attr__( 'Start date', 'give' ),
96
-									) );
95
+										'placeholder' => esc_attr__('Start date', 'give'),
96
+									));
97 97
 
98
-									echo Give()->html->date_field( array(
98
+									echo Give()->html->date_field(array(
99 99
 										'id'          => 'give-payment-export-end',
100 100
 										'name'        => 'end',
101
-										'placeholder' => esc_attr__( 'End date', 'give' ),
102
-									) );
101
+										'placeholder' => esc_attr__('End date', 'give'),
102
+									));
103 103
 									?>
104 104
 									<select name="status">
105
-										<option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option>
105
+										<option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option>
106 106
 										<?php
107 107
 										$statuses = give_get_payment_statuses();
108
-										foreach ( $statuses as $status => $label ) {
109
-											echo '<option value="' . $status . '">' . $label . '</option>';
108
+										foreach ($statuses as $status => $label) {
109
+											echo '<option value="'.$status.'">'.$label.'</option>';
110 110
 										}
111 111
 										?>
112 112
 									</select>
113 113
 									<?php
114
-									if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) {
114
+									if (give_is_setting_enabled(give_get_option('categories'))) {
115 115
 										echo Give()->html->category_dropdown(
116 116
 											'give_forms_categories[]',
117 117
 											0,
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 												'multiple'        => true,
122 122
 												'selected'        => array(),
123 123
 												'show_option_all' => false,
124
-												'placeholder'     => __( 'Choose one or more from categories', 'give' ),
124
+												'placeholder'     => __('Choose one or more from categories', 'give'),
125 125
 											)
126 126
 										);
127 127
 									}
128 128
 
129
-									if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) {
129
+									if (give_is_setting_enabled(give_get_option('tags'))) {
130 130
 										echo Give()->html->tags_dropdown(
131 131
 											'give_forms_tags[]',
132 132
 											0,
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
 												'multiple'        => true,
137 137
 												'selected'        => array(),
138 138
 												'show_option_all' => false,
139
-												'placeholder'     => __( 'Choose one or more from tags', 'give' ),
139
+												'placeholder'     => __('Choose one or more from tags', 'give'),
140 140
 											)
141 141
 										);
142 142
 									}
143 143
 
144
-									wp_nonce_field( 'give_ajax_export', 'give_ajax_export' );
144
+									wp_nonce_field('give_ajax_export', 'give_ajax_export');
145 145
 									?>
146 146
 									<input type="hidden" name="give-export-class"
147 147
 										   value="Give_Batch_Payments_Export"/>
148 148
 									<span>
149 149
 									<input type="submit"
150
-										   value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>"
150
+										   value="<?php esc_attr_e('Generate CSV', 'give'); ?>"
151 151
 										   class="button-secondary"/>
152 152
 									<span class="spinner"></span>
153 153
 								</span>
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 						<tr class="give-export-donors">
158 158
 							<td scope="row" class="row-title">
159 159
 								<h3>
160
-									<span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span>
160
+									<span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span>
161 161
 								</h3>
162
-								<p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
162
+								<p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
163 163
 							</td>
164 164
 							<td>
165 165
 								<form method="post" id="give_donor_export"
@@ -167,93 +167,93 @@  discard block
 block discarded – undo
167 167
 
168 168
 									<?php
169 169
 									// Start Date form field for donors
170
-									echo Give()->html->date_field( array(
170
+									echo Give()->html->date_field(array(
171 171
 										'id'          => 'give_donor_export_start_date',
172 172
 										'name'        => 'donor_export_start_date',
173
-										'placeholder' => esc_attr__( 'Start date', 'give' ),
174
-									) );
173
+										'placeholder' => esc_attr__('Start date', 'give'),
174
+									));
175 175
 
176 176
 									// End Date form field for donors
177
-									echo Give()->html->date_field( array(
177
+									echo Give()->html->date_field(array(
178 178
 										'id'          => 'give_donor_export_end_date',
179 179
 										'name'        => 'donor_export_end_date',
180
-										'placeholder' => esc_attr__( 'End date', 'give' ),
181
-									) );
180
+										'placeholder' => esc_attr__('End date', 'give'),
181
+									));
182 182
 
183 183
 									// Donation forms dropdown for donors export
184
-									echo Give()->html->forms_dropdown( array(
184
+									echo Give()->html->forms_dropdown(array(
185 185
 										'name'   => 'forms',
186 186
 										'id'     => 'give_donor_export_form',
187 187
 										'chosen' => true,
188
-									) );
188
+									));
189 189
 									?>
190
-									<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
190
+									<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
191 191
 
192 192
 								<div id="export-donor-options-wrap"
193 193
 								     class="give-clearfix">
194
-									<p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p>
194
+									<p><?php esc_html_e('Export Columns:', 'give'); ?></p>
195 195
 									<ul id="give-export-option-ul">
196 196
 										<li>
197 197
 											<label for="give-export-fullname">
198 198
 												<input type="checkbox" checked
199 199
 												       name="give_export_option[full_name]"
200
-												       id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?>
200
+												       id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?>
201 201
 											</label>
202 202
 										</li>
203 203
 										<li>
204 204
 											<label for="give-export-email">
205 205
 												<input type="checkbox" checked
206 206
 												       name="give_export_option[email]"
207
-												       id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?>
207
+												       id="give-export-email"><?php esc_html_e('Email', 'give'); ?>
208 208
 											</label>
209 209
 										</li>
210 210
 										<li>
211 211
 											<label for="give-export-address">
212 212
 												<input type="checkbox" checked
213 213
 												       name="give_export_option[address]"
214
-												       id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?>
214
+												       id="give-export-address"><?php esc_html_e('Address', 'give'); ?>
215 215
 											</label>
216 216
 										</li>
217 217
 										<li>
218 218
 											<label for="give-export-userid">
219 219
 												<input type="checkbox" checked
220 220
 												       name="give_export_option[userid]"
221
-												       id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?>
221
+												       id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?>
222 222
 											</label>
223 223
 										</li>
224 224
 										<li>
225 225
 											<label for="give-export-donation-form">
226 226
 												<input type="checkbox" checked
227 227
 												       name="give_export_option[donation_form]"
228
-												       id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?>
228
+												       id="give-export-donation-form"><?php esc_html_e('Donation Form', 'give'); ?>
229 229
 											</label>
230 230
 										</li>
231 231
 										<li>
232 232
 											<label for="give-export-first-donation-date">
233 233
 												<input type="checkbox" checked
234 234
 												       name="give_export_option[date_first_donated]"
235
-												       id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?>
235
+												       id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?>
236 236
 											</label>
237 237
 										</li>
238 238
 										<li>
239 239
 											<label for="give-export-donation-number">
240 240
 												<input type="checkbox" checked
241 241
 												       name="give_export_option[donations]"
242
-												       id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?>
242
+												       id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?>
243 243
 											</label>
244 244
 										</li>
245 245
 										<li>
246 246
 											<label for="give-export-donation-sum">
247 247
 												<input type="checkbox" checked
248 248
 												       name="give_export_option[donation_sum]"
249
-												       id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?>
249
+												       id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?>
250 250
 											</label>
251 251
 										</li>
252 252
 									</ul>
253 253
 								</div>
254
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
254
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
255 255
 								<input type="hidden" name="give-export-class" value="Give_Batch_Donors_Export"/>
256
-								<input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/>
256
+								<input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid('give_'); ?>"/>
257 257
 							</form>
258 258
 						</td>
259 259
 					</tr>
@@ -261,26 +261,26 @@  discard block
 block discarded – undo
261 261
 					<tr class="give-export-core-settings">
262 262
 						<td scope="row" class="row-title">
263 263
 							<h3>
264
-								<span><?php esc_html_e( 'Export Give Settings', 'give' ); ?></span>
264
+								<span><?php esc_html_e('Export Give Settings', 'give'); ?></span>
265 265
 							</h3>
266
-							<p><?php esc_html_e( 'Download an export of Give\'s settings and import it in a new WordPress installation.', 'give' ); ?></p>
266
+							<p><?php esc_html_e('Download an export of Give\'s settings and import it in a new WordPress installation.', 'give'); ?></p>
267 267
 						</td>
268 268
 						<td>
269 269
 							<form method="post">
270
-								<p class="settings-excludes-title"><?php echo __( 'Checked options from the list will not be exported', 'give' ); ?></p>
270
+								<p class="settings-excludes-title"><?php echo __('Checked options from the list will not be exported', 'give'); ?></p>
271 271
 								<ul class="settings-excludes-list">
272 272
 								<?php
273
-								$export_excludes = apply_filters( 'settings_export_excludes', array() );
273
+								$export_excludes = apply_filters('settings_export_excludes', array());
274 274
 
275
-								if ( ! empty( $export_excludes ) ) {
276
-									foreach ( $export_excludes as $option_key => $option_label ) {
275
+								if ( ! empty($export_excludes)) {
276
+									foreach ($export_excludes as $option_key => $option_label) {
277 277
 									?>
278 278
 									<li>
279 279
 										<label for="settings_export_excludes[<?php echo $option_key?>]">
280 280
 											<input
281 281
 												type="checkbox" checked
282 282
 												name="settings_export_excludes[<?php echo $option_key?>]"
283
-												id="settings_export_excludes[<?php echo $option_key?>]"><?php echo esc_html( $option_label ); ?>
283
+												id="settings_export_excludes[<?php echo $option_key?>]"><?php echo esc_html($option_label); ?>
284 284
 										</label>
285 285
 									</li>
286 286
 									<?php
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 								?>
290 290
 								</ul>
291 291
 								<input type="hidden" name="give-action" value="core_settings_export"/>
292
-								<input type="submit" value="<?php esc_attr_e( 'Export JSON', 'give' ); ?>" class="button-secondary"/>
292
+								<input type="submit" value="<?php esc_attr_e('Export JSON', 'give'); ?>" class="button-secondary"/>
293 293
 							</form>
294 294
 						</td>
295 295
 					</tr>
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 					 *
303 303
 					 * @since 1.0
304 304
 					 */
305
-					do_action( 'give_tools_tab_export_table_bottom' );
305
+					do_action('give_tools_tab_export_table_bottom');
306 306
 					?>
307 307
 					</tbody>
308 308
 				</table>
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 				 *
314 314
 				 * @since 1.0
315 315
 				 */
316
-				do_action( 'give_tools_tab_export_content_bottom' );
316
+				do_action('give_tools_tab_export_content_bottom');
317 317
 				?>
318 318
 
319 319
 			</div>
Please login to merge, or discard this patch.
includes/admin/tools/export/class-core-settings-export.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 		give_ignore_user_abort();
43 43
 
44 44
 		nocache_headers();
45
-		header( 'Content-Type: application/json; charset=utf-8' );
46
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' );
47
-		header( 'Expires: 0' );
45
+		header('Content-Type: application/json; charset=utf-8');
46
+		header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json');
47
+		header('Expires: 0');
48 48
 	}
49 49
 
50 50
 	/**
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
 	 * @since 1.8.17
55 55
 	 */
56 56
 	public function json_core_settings_export() {
57
-		$settings_excludes = give_clean( $_POST['settings_export_excludes'] );
58
-		$give_settings     = get_option( 'give_settings' );
57
+		$settings_excludes = give_clean($_POST['settings_export_excludes']);
58
+		$give_settings     = get_option('give_settings');
59 59
 
60
-		if ( is_array( $settings_excludes ) && ! empty( $settings_excludes ) ) {
61
-			foreach ( $settings_excludes as $key => $value ) {
62
-				if ( give_is_setting_enabled( $value ) ) {
63
-					unset( $give_settings[ $key ] );
60
+		if (is_array($settings_excludes) && ! empty($settings_excludes)) {
61
+			foreach ($settings_excludes as $key => $value) {
62
+				if (give_is_setting_enabled($value)) {
63
+					unset($give_settings[$key]);
64 64
 				}
65 65
 			}
66 66
 		}
67 67
 
68
-		echo wp_json_encode( $give_settings );
68
+		echo wp_json_encode($give_settings);
69 69
 	}
70 70
 
71 71
 	/**
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 * @since  1.8.17
76 76
 	 */
77 77
 	public function export() {
78
-		if ( ! $this->can_export() ) {
79
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
78
+		if ( ! $this->can_export()) {
79
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
80 80
 		}
81 81
 
82 82
 		// Set headers.
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +32 added lines, -32 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
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats(); ?>
@@ -46,27 +46,27 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date_i18n( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date_i18n(_x('F j, Y', 'dashboard widget', 'give')); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 				/* translators: %s: day of the week */
54
-					__( 'Happy %s!', 'give' ),
55
-					date_i18n( 'l', current_time( 'timestamp' ) )
54
+					__('Happy %s!', 'give'),
55
+					date_i18n('l', current_time('timestamp'))
56 56
 				);
57 57
 			?></p>
58 58
 
59 59
 			<p class="give-dashboard-today-earnings"><?php
60
-				$earnings_today = $stats->get_earnings( 0, 'today', false );
61
-				echo give_currency_filter( give_format_amount( $earnings_today, array( 'sanitize' => false ) ) );
60
+				$earnings_today = $stats->get_earnings(0, 'today', false);
61
+				echo give_currency_filter(give_format_amount($earnings_today, array('sanitize' => false)));
62 62
 			?></p>
63 63
 
64 64
 			<p class="give-donations-today"><?php
65
-				$donations_today = $stats->get_sales( 0, 'today', false );
65
+				$donations_today = $stats->get_sales(0, 'today', false);
66 66
 				printf(
67 67
 					/* translators: %s: daily donation count */
68
-					__( '%s donations today', 'give' ),
69
-					give_format_amount( $donations_today, array( 'decimal' => false, 'sanitize' => false ) )
68
+					__('%s donations today', 'give'),
69
+					give_format_amount($donations_today, array('decimal' => false, 'sanitize' => false))
70 70
 				);
71 71
 			?></p>
72 72
 
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 		<table class="give-table-stats">
77 77
 			<thead style="display: none;">
78 78
 			<tr>
79
-				<th><?php _e( 'This Week', 'give' ); ?></th>
80
-				<th><?php _e( 'This Month', 'give' ); ?></th>
81
-				<th><?php _e( 'Past 30 Days', 'give' ); ?></th>
79
+				<th><?php _e('This Week', 'give'); ?></th>
80
+				<th><?php _e('This Month', 'give'); ?></th>
81
+				<th><?php _e('Past 30 Days', 'give'); ?></th>
82 82
 			</tr>
83 83
 			</thead>
84 84
 			<tbody>
85 85
 			<tr id="give-table-stats-tr-1">
86 86
 				<td>
87
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ), array( 'sanitize' => false ) ) ); ?></p>
87
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'), array('sanitize' => false))); ?></p>
88 88
 
89
-					<p class="give-dashboard-stat-total-label"><?php _e( 'This Week', 'give' ); ?></p>
89
+					<p class="give-dashboard-stat-total-label"><?php _e('This Week', 'give'); ?></p>
90 90
 				</td>
91 91
 				<td>
92
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ), array( 'sanitize' => false ) ) ); ?></p>
92
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'), array('sanitize' => false))); ?></p>
93 93
 
94
-					<p class="give-dashboard-stat-total-label"><?php _e( 'This Month', 'give' ); ?></p>
94
+					<p class="give-dashboard-stat-total-label"><?php _e('This Month', 'give'); ?></p>
95 95
 				</td>
96 96
 			</tr>
97 97
 			<tr id="give-table-stats-tr-2">
98 98
 				<td>
99
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ), array( 'sanitize' => false ) ) ) ?></p>
99
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'), array('sanitize' => false))) ?></p>
100 100
 
101
-					<p class="give-dashboard-stat-total-label"><?php _e( 'Last Month', 'give' ); ?></p>
101
+					<p class="give-dashboard-stat-total-label"><?php _e('Last Month', 'give'); ?></p>
102 102
 				</td>
103 103
 				<td>
104
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year' ), array( 'sanitize' => false ) ) ) ?></p>
104
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year'), array('sanitize' => false))) ?></p>
105 105
 
106
-					<p class="give-dashboard-stat-total-label"><?php _e( 'This Year', 'give' ); ?></p>
106
+					<p class="give-dashboard-stat-total-label"><?php _e('This Year', 'give'); ?></p>
107 107
 				</td>
108 108
 			</tr>
109 109
 			</tbody>
@@ -123,24 +123,24 @@  discard block
 block discarded – undo
123 123
  *
124 124
  * @return array
125 125
  */
126
-function give_dashboard_at_a_glance_widget( $items ) {
126
+function give_dashboard_at_a_glance_widget($items) {
127 127
 
128
-	$num_posts = wp_count_posts( 'give_forms' );
128
+	$num_posts = wp_count_posts('give_forms');
129 129
 
130
-	if ( $num_posts && $num_posts->publish ) {
130
+	if ($num_posts && $num_posts->publish) {
131 131
 
132 132
 		$text = sprintf(
133 133
 			/* translators: %s: number of posts published */
134
-			_n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ),
134
+			_n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'),
135 135
 			$num_posts->publish
136 136
 		);
137 137
 
138
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
138
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
139 139
 
140
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
140
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
141 141
 			$text = sprintf(
142 142
 				'<a class="give-forms-count" href="%1$s">%2$s</a>',
143
-				admin_url( 'edit.php?post_type=give_forms' ),
143
+				admin_url('edit.php?post_type=give_forms'),
144 144
 				$text
145 145
 			);
146 146
 		} else {
@@ -156,4 +156,4 @@  discard block
 block discarded – undo
156 156
 	return $items;
157 157
 }
158 158
 
159
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 );
159
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Exit if accessed directly.
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if ( ! defined('ABSPATH')) {
43 43
 	exit;
44 44
 }
45 45
 
46
-if ( ! class_exists( 'Give' ) ) :
46
+if ( ! class_exists('Give')) :
47 47
 
48 48
 	/**
49 49
 	 * Main Give Class
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		 * @return    Give
238 238
 		 */
239 239
 		public static function instance() {
240
-			if ( is_null( self::$_instance ) ) {
240
+			if (is_null(self::$_instance)) {
241 241
 				self::$_instance = new self();
242 242
 			}
243 243
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 		 */
250 250
 		public function __construct() {
251 251
 			// PHP version
252
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
253
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
252
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
253
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
254 254
 			}
255 255
 
256 256
 			// Bailout: Need minimum php version to load plugin.
257
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
258
-				add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) );
257
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
258
+				add_action('admin_notices', array($this, 'minmum_phpversion_notice'));
259 259
 
260 260
 				return;
261 261
 			}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->includes();
266 266
 			$this->init_hooks();
267 267
 
268
-			do_action( 'give_loaded' );
268
+			do_action('give_loaded');
269 269
 		}
270 270
 
271 271
 		/**
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 		 * @since  1.8.9
275 275
 		 */
276 276
 		private function init_hooks() {
277
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
277
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
278 278
 
279
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
279
+			add_action('plugins_loaded', array($this, 'init'), 0);
280 280
 
281 281
 			// Set up localization on init Hook.
282
-			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
282
+			add_action('init', array($this, 'load_textdomain'), 0);
283 283
 		}
284 284
 
285 285
 		/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 			 *
295 295
 			 * @since 1.8.9
296 296
 			 */
297
-			do_action( 'before_give_init' );
297
+			do_action('before_give_init');
298 298
 
299 299
 			$this->roles              = new Give_Roles();
300 300
 			$this->api                = new Give_API();
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			 *
322 322
 			 * @since 1.8.7
323 323
 			 */
324
-			do_action( 'give_init', $this );
324
+			do_action('give_init', $this);
325 325
 
326 326
 		}
327 327
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		 */
339 339
 		public function __clone() {
340 340
 			// Cloning instances of the class is forbidden.
341
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
341
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
342 342
 		}
343 343
 
344 344
 		/**
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		 */
352 352
 		public function __wakeup() {
353 353
 			// Unserializing instances of the class is forbidden.
354
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
354
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
355 355
 		}
356 356
 
357 357
 		/**
@@ -365,33 +365,33 @@  discard block
 block discarded – undo
365 365
 		private function setup_constants() {
366 366
 
367 367
 			// Plugin version
368
-			if ( ! defined( 'GIVE_VERSION' ) ) {
369
-				define( 'GIVE_VERSION', '2.0.5' );
368
+			if ( ! defined('GIVE_VERSION')) {
369
+				define('GIVE_VERSION', '2.0.5');
370 370
 			}
371 371
 
372 372
 			// Plugin Root File
373
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
374
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
373
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
374
+				define('GIVE_PLUGIN_FILE', __FILE__);
375 375
 			}
376 376
 
377 377
 			// Plugin Folder Path
378
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
379
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
378
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
379
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
380 380
 			}
381 381
 
382 382
 			// Plugin Folder URL
383
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
384
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
383
+			if ( ! defined('GIVE_PLUGIN_URL')) {
384
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
385 385
 			}
386 386
 
387 387
 			// Plugin Basename aka: "give/give.php"
388
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
389
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
388
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
389
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
390 390
 			}
391 391
 
392 392
 			// Make sure CAL_GREGORIAN is defined
393
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
394
-				define( 'CAL_GREGORIAN', 1 );
393
+			if ( ! defined('CAL_GREGORIAN')) {
394
+				define('CAL_GREGORIAN', 1);
395 395
 			}
396 396
 		}
397 397
 
@@ -409,152 +409,152 @@  discard block
 block discarded – undo
409 409
 			/**
410 410
 			 * Load libraries.
411 411
 			 */
412
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
413
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
412
+			if ( ! class_exists('WP_Async_Request')) {
413
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
414 414
 			}
415 415
 
416
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
417
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
416
+			if ( ! class_exists('WP_Background_Process')) {
417
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
418 418
 			}
419 419
 
420 420
 			/**
421 421
 			 * Load plugin files
422 422
 			 */
423
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
424
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
423
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
424
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
425 425
 			$give_options = give_get_settings();
426 426
 
427
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
428
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
429
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
430
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
431
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
432
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
433
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
434
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
435
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
436
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
437
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
438
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
439
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
440
-
441
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
442
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
443
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
444
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
445
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
446
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
447
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
448
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
449
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
450
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
451
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
452
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
453
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
454
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
455
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
456
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
457
-
458
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
459
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
460
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
461
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
462
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
463
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
464
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
465
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
466
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
467
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
468
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
469
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
470
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
471
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
472
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
475
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
476
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
477
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
478
-
479
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
484
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
485
-
486
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
489
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
490
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
491
-
492
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
497
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
498
-
499
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
500
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
501
-
502
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
503
-
504
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
505
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
427
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
428
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
429
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
430
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
431
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
432
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
433
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
434
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
435
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
436
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
437
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
438
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
439
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
440
+
441
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
442
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
443
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
444
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
445
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
446
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
447
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
448
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
449
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
450
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
451
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
452
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
453
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
454
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
455
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
456
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
457
+
458
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
459
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
460
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
461
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
462
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
463
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
464
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
465
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
466
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
467
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
468
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
469
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
470
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
471
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
475
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
477
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
478
+
479
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
484
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
485
+
486
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
489
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
490
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
491
+
492
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
497
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
498
+
499
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
500
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
501
+
502
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
503
+
504
+			if (defined('WP_CLI') && WP_CLI) {
505
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
506 506
 			}
507 507
 
508
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
509
-
510
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
511
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
512
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
513
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
514
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
515
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
516
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
517
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
518
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
519
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
520
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
521
-
522
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
523
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
524
-
525
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
526
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
527
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
528
-
529
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
530
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
531
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
532
-
533
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
534
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
535
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
536
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
537
-
538
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
539
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
540
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
541
-
542
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
543
-
544
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
545
-
546
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
547
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
548
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
549
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
550
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
551
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
552
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
553
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
554
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
508
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
509
+
510
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
511
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
512
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
513
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
514
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
515
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
516
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
517
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
518
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
519
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
520
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
521
+
522
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
523
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
524
+
525
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
526
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
527
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
528
+
529
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
530
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
531
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
532
+
533
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
534
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
535
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
536
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
537
+
538
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
539
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
540
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
541
+
542
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
543
+
544
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
545
+
546
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
547
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
548
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
549
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
550
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
551
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
552
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
553
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
554
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
555 555
 			}// End if().
556 556
 
557
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
557
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
558 558
 
559 559
 		}
560 560
 
@@ -569,16 +569,16 @@  discard block
 block discarded – undo
569 569
 		public function load_textdomain() {
570 570
 
571 571
 			// Set filter for Give's languages directory
572
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
573
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
572
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
573
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
574 574
 
575 575
 			// Traditional WordPress plugin locale filter.
576
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
577
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
576
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
577
+			$locale = apply_filters('plugin_locale', $locale, 'give');
578 578
 
579
-			unload_textdomain( 'give' );
580
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
581
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
579
+			unload_textdomain('give');
580
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
581
+			load_plugin_textdomain('give', false, $give_lang_dir);
582 582
 
583 583
 		}
584 584
 
@@ -591,17 +591,17 @@  discard block
 block discarded – undo
591 591
 		 */
592 592
 		public function minmum_phpversion_notice() {
593 593
 			// Bailout.
594
-			if ( ! is_admin() ) {
594
+			if ( ! is_admin()) {
595 595
 				return;
596 596
 			}
597 597
 
598
-			$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
599
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
600
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
601
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
602
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
603
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
604
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
598
+			$notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
599
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
600
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
601
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
602
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
603
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
604
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
605 605
 
606 606
 			echo sprintf(
607 607
 				'<div class="notice notice-error">%1$s</div>',
Please login to merge, or discard this patch.