Test Failed
Push — master ( f5256c...25a383 )
by Devin
07:02
created
includes/admin/tools/data/class-give-tools-recount-income.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * Constructor.
48 48
 	 */
49
-	public function __construct( $_step = 1 ) {
50
-		parent::__construct( $_step );
49
+	public function __construct($_step = 1) {
50
+		parent::__construct($_step);
51 51
 
52 52
 		$this->is_writable = true;
53 53
 	}
@@ -61,33 +61,33 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function get_data() {
63 63
 
64
-		if ( $this->step == 1 ) {
65
-			$this->delete_data( 'give_temp_recount_earnings' );
64
+		if ($this->step == 1) {
65
+			$this->delete_data('give_temp_recount_earnings');
66 66
 		}
67 67
 
68
-		$total = get_option( 'give_temp_recount_earnings', false );
68
+		$total = get_option('give_temp_recount_earnings', false);
69 69
 
70
-		if ( false === $total ) {
70
+		if (false === $total) {
71 71
 			$total = (float) 0;
72
-			$this->store_data( 'give_temp_recount_earnings', $total );
72
+			$this->store_data('give_temp_recount_earnings', $total);
73 73
 		}
74 74
 
75
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
75
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
76 76
 
77
-		$args = apply_filters( 'give_recount_earnings_args', array(
77
+		$args = apply_filters('give_recount_earnings_args', array(
78 78
 			'number' => $this->per_step,
79 79
 			'page'   => $this->step,
80 80
 			'status' => $accepted_statuses,
81 81
 			'fields' => 'ids'
82
-		) );
82
+		));
83 83
 
84
-		$payments = give_get_payments( $args );
84
+		$payments = give_get_payments($args);
85 85
 
86
-		if ( ! empty( $payments ) ) {
86
+		if ( ! empty($payments)) {
87 87
 
88
-			foreach ( $payments as $payment ) {
88
+			foreach ($payments as $payment) {
89 89
 				// Get the payment amount.
90
-				$payment_amount = give_get_meta( $payment->ID, '_give_payment_total', true );
90
+				$payment_amount = give_get_meta($payment->ID, '_give_payment_total', true);
91 91
 
92 92
 				/**
93 93
 				 * Filter the payment amount.
@@ -96,28 +96,28 @@  discard block
 block discarded – undo
96 96
 				 */
97 97
 				$donation_amount = apply_filters(
98 98
 					'give_donation_amount',
99
-					give_format_amount( $payment_amount, array( 'donation_id' => $payment->ID ) ),
99
+					give_format_amount($payment_amount, array('donation_id' => $payment->ID)),
100 100
 					$payment->total,
101 101
 					$payment->ID,
102
-					array( 'type' => 'stats', 'currency' => false, 'amount' => false )
102
+					array('type' => 'stats', 'currency' => false, 'amount' => false)
103 103
 				);
104 104
 
105
-				$total += (float) give_maybe_sanitize_amount( $donation_amount );
105
+				$total += (float) give_maybe_sanitize_amount($donation_amount);
106 106
 			}
107 107
 
108
-			if ( $total < 0 ) {
108
+			if ($total < 0) {
109 109
 				$totals = 0;
110 110
 			}
111 111
 
112
-			$total = round( $total, give_get_price_decimals() );
112
+			$total = round($total, give_get_price_decimals());
113 113
 
114
-			$this->store_data( 'give_temp_recount_earnings', $total );
114
+			$this->store_data('give_temp_recount_earnings', $total);
115 115
 
116 116
 			return true;
117 117
 
118 118
 		}
119 119
 
120
-		update_option( 'give_earnings_total', $total, false );
120
+		update_option('give_earnings_total', $total, false);
121 121
 
122 122
 		return false;
123 123
 
@@ -131,25 +131,25 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	public function get_percentage_complete() {
133 133
 
134
-		$total = $this->get_stored_data( 'give_recount_earnings_total' );
134
+		$total = $this->get_stored_data('give_recount_earnings_total');
135 135
 
136
-		if ( false === $total ) {
137
-			$args = apply_filters( 'give_recount_earnings_total_args', array() );
136
+		if (false === $total) {
137
+			$args = apply_filters('give_recount_earnings_total_args', array());
138 138
 
139
-			$counts = give_count_payments( $args );
140
-			$total  = absint( $counts->publish );
141
-			$total  = apply_filters( 'give_recount_store_earnings_total', $total );
139
+			$counts = give_count_payments($args);
140
+			$total  = absint($counts->publish);
141
+			$total  = apply_filters('give_recount_store_earnings_total', $total);
142 142
 
143
-			$this->store_data( 'give_recount_earnings_total', $total );
143
+			$this->store_data('give_recount_earnings_total', $total);
144 144
 		}
145 145
 
146 146
 		$percentage = 100;
147 147
 
148
-		if ( $total > 0 ) {
149
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
148
+		if ($total > 0) {
149
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
150 150
 		}
151 151
 
152
-		if ( $percentage > 100 ) {
152
+		if ($percentage > 100) {
153 153
 			$percentage = 100;
154 154
 		}
155 155
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @param array $request The Form Data passed into the batch processing
165 165
 	 */
166
-	public function set_properties( $request ) {
166
+	public function set_properties($request) {
167 167
 	}
168 168
 
169 169
 	/**
@@ -174,21 +174,21 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function process_step() {
176 176
 
177
-		if ( ! $this->can_export() ) {
178
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
177
+		if ( ! $this->can_export()) {
178
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
179 179
 		}
180 180
 
181 181
 		$had_data = $this->get_data();
182 182
 
183
-		if ( $had_data ) {
183
+		if ($had_data) {
184 184
 			$this->done = false;
185 185
 
186 186
 			return true;
187 187
 		} else {
188
-			$this->delete_data( 'give_recount_earnings_total' );
189
-			$this->delete_data( 'give_temp_recount_earnings' );
188
+			$this->delete_data('give_recount_earnings_total');
189
+			$this->delete_data('give_temp_recount_earnings');
190 190
 			$this->done    = true;
191
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
191
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
192 192
 
193 193
 			return false;
194 194
 		}
@@ -225,17 +225,17 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @return mixed       Returns the data from the database
227 227
 	 */
228
-	private function get_stored_data( $key ) {
228
+	private function get_stored_data($key) {
229 229
 		global $wpdb;
230
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
230
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
231 231
 
232
-		if ( empty( $value ) ) {
232
+		if (empty($value)) {
233 233
 			return false;
234 234
 		}
235 235
 
236
-		$maybe_json = json_decode( $value );
237
-		if ( ! is_null( $maybe_json ) ) {
238
-			$value = json_decode( $value, true );
236
+		$maybe_json = json_decode($value);
237
+		if ( ! is_null($maybe_json)) {
238
+			$value = json_decode($value, true);
239 239
 		}
240 240
 
241 241
 		return $value;
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @return void
253 253
 	 */
254
-	private function store_data( $key, $value ) {
254
+	private function store_data($key, $value) {
255 255
 		global $wpdb;
256 256
 
257
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
257
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
258 258
 
259 259
 		$data = array(
260 260
 			'option_name'  => $key,
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 			'%s',
269 269
 		);
270 270
 
271
-		$wpdb->replace( $wpdb->options, $data, $formats );
271
+		$wpdb->replace($wpdb->options, $data, $formats);
272 272
 	}
273 273
 
274 274
 	/**
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @return void
282 282
 	 */
283
-	private function delete_data( $key ) {
283
+	private function delete_data($key) {
284 284
 		global $wpdb;
285
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
285
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
286 286
 	}
287 287
 
288 288
 }
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-delete-test-transactions.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * Constructor.
48 48
 	 */
49
-	public function __construct( $_step = 1 ) {
50
-		parent::__construct( $_step );
49
+	public function __construct($_step = 1) {
50
+		parent::__construct($_step);
51 51
 
52 52
 		$this->is_writable = true;
53 53
 	}
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 	 * @return array|bool $data The data for the CSV file
63 63
 	 */
64 64
 	public function get_data() {
65
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids' );
65
+		$items = $this->get_stored_data('give_temp_delete_test_ids');
66 66
 
67
-		if ( ! is_array( $items ) ) {
67
+		if ( ! is_array($items)) {
68 68
 			return false;
69 69
 		}
70 70
 
71
-		$offset     = ( $this->step - 1 ) * $this->per_step;
72
-		$step_items = array_slice( $items, $offset, $this->per_step );
73
-		$meta_table = __give_v20_bc_table_details( 'payment' );
71
+		$offset     = ($this->step - 1) * $this->per_step;
72
+		$step_items = array_slice($items, $offset, $this->per_step);
73
+		$meta_table = __give_v20_bc_table_details('payment');
74 74
 
75
-		if ( $step_items ) {
76
-			foreach ( $step_items as $item ) {
75
+		if ($step_items) {
76
+			foreach ($step_items as $item) {
77 77
 				// Delete the main payment.
78
-				give_delete_donation( absint( $item['id'] ) );
78
+				give_delete_donation(absint($item['id']));
79 79
 			}
80 80
 			return true;
81 81
 		}
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_percentage_complete() {
93 93
 
94
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids', false );
95
-		$total = count( $items );
94
+		$items = $this->get_stored_data('give_temp_delete_test_ids', false);
95
+		$total = count($items);
96 96
 
97 97
 		$percentage = 100;
98 98
 
99
-		if ( $total > 0 ) {
100
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
99
+		if ($total > 0) {
100
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
101 101
 		}
102 102
 
103
-		if ( $percentage > 100 ) {
103
+		if ($percentage > 100) {
104 104
 			$percentage = 100;
105 105
 		}
106 106
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param array $request The Form Data passed into the batch processing
116 116
 	 */
117
-	public function set_properties( $request ) {
117
+	public function set_properties($request) {
118 118
 	}
119 119
 
120 120
 	/**
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function process_step() {
127 127
 
128
-		if ( ! $this->can_export() ) {
129
-			wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
128
+		if ( ! $this->can_export()) {
129
+			wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403));
130 130
 		}
131 131
 
132 132
 		$had_data = $this->get_data();
133 133
 
134
-		if ( $had_data ) {
134
+		if ($had_data) {
135 135
 			$this->done = false;
136 136
 
137 137
 			return true;
138 138
 		} else {
139
-			update_option( 'give_earnings_total', give_get_total_earnings( true ), false );
140
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
139
+			update_option('give_earnings_total', give_get_total_earnings(true), false);
140
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
141 141
 
142
-			$this->delete_data( 'give_temp_delete_test_ids' );
142
+			$this->delete_data('give_temp_delete_test_ids');
143 143
 
144 144
 			$this->done    = true;
145
-			$this->message = __( 'Test transactions successfully deleted.', 'give' );
145
+			$this->message = __('Test transactions successfully deleted.', 'give');
146 146
 
147 147
 			return false;
148 148
 		}
@@ -175,27 +175,27 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function pre_fetch() {
177 177
 
178
-		if ( $this->step == 1 ) {
179
-			$this->delete_data( 'give_temp_delete_test_ids' );
178
+		if ($this->step == 1) {
179
+			$this->delete_data('give_temp_delete_test_ids');
180 180
 		}
181 181
 
182
-		$items = get_option( 'give_temp_delete_test_ids', false );
182
+		$items = get_option('give_temp_delete_test_ids', false);
183 183
 
184
-		if ( false === $items ) {
184
+		if (false === $items) {
185 185
 			$items = array();
186 186
 
187
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
187
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
188 188
 				'post_status' => 'any',
189
-				'number'      => - 1,
189
+				'number'      => -1,
190 190
 				'meta_key'    => '_give_payment_mode',
191 191
 				'meta_value'  => 'test'
192
-			) );
192
+			));
193 193
 
194
-			$posts    = new Give_Payments_Query( $args );
194
+			$posts    = new Give_Payments_Query($args);
195 195
 			$payments = $posts->get_payments();
196 196
 
197 197
 			/* @var Give_Payment $payment */
198
-			foreach ( $payments as $payment ) {
198
+			foreach ($payments as $payment) {
199 199
 				$items[] = array(
200 200
 					'id'   => (int) $payment->ID,
201 201
 					'type' => 'give_payment',
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 			// Allow filtering of items to remove with an unassociative array for each item.
206 206
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method.
207
-			$items = apply_filters( 'give_delete_test_items', $items );
207
+			$items = apply_filters('give_delete_test_items', $items);
208 208
 
209
-			$this->store_data( 'give_temp_delete_test_ids', $items );
209
+			$this->store_data('give_temp_delete_test_ids', $items);
210 210
 		}
211 211
 
212 212
 	}
@@ -220,17 +220,17 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return mixed       Returns the data from the database
222 222
 	 */
223
-	private function get_stored_data( $key ) {
223
+	private function get_stored_data($key) {
224 224
 		global $wpdb;
225
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
225
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
226 226
 
227
-		if ( empty( $value ) ) {
227
+		if (empty($value)) {
228 228
 			return false;
229 229
 		}
230 230
 
231
-		$maybe_json = json_decode( $value );
232
-		if ( ! is_null( $maybe_json ) ) {
233
-			$value = json_decode( $value, true );
231
+		$maybe_json = json_decode($value);
232
+		if ( ! is_null($maybe_json)) {
233
+			$value = json_decode($value, true);
234 234
 		}
235 235
 
236 236
 		return $value;
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @return void
248 248
 	 */
249
-	private function store_data( $key, $value ) {
249
+	private function store_data($key, $value) {
250 250
 		global $wpdb;
251 251
 
252
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
252
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
253 253
 
254 254
 		$data = array(
255 255
 			'option_name'  => $key,
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			'%s',
264 264
 		);
265 265
 
266
-		$wpdb->replace( $wpdb->options, $data, $formats );
266
+		$wpdb->replace($wpdb->options, $data, $formats);
267 267
 	}
268 268
 
269 269
 	/**
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return void
277 277
 	 */
278
-	private function delete_data( $key ) {
278
+	private function delete_data($key) {
279 279
 		global $wpdb;
280
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
280
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
281 281
 	}
282 282
 
283 283
 }
Please login to merge, or discard this patch.
includes/admin/tools/import/class-give-import-core-settings.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  * @since       1.8.17
12 12
  */
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit; // Exit if accessed directly
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Import_Core_Settings' ) ) {
18
+if ( ! class_exists('Give_Import_Core_Settings')) {
19 19
 
20 20
 	/**
21 21
 	 * Give_Import_Core_Settings.
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		 * @return static
78 78
 		 */
79 79
 		public static function get_instance() {
80
-			if ( null === static::$instance ) {
80
+			if (null === static::$instance) {
81 81
 				self::$instance = new static();
82 82
 			}
83 83
 
@@ -104,26 +104,26 @@  discard block
 block discarded – undo
104 104
 		 * @return void
105 105
 		 */
106 106
 		private function setup_hooks() {
107
-			if ( ! $this->is_donations_import_page() ) {
107
+			if ( ! $this->is_donations_import_page()) {
108 108
 				return;
109 109
 			}
110 110
 
111 111
 			// Do not render main import tools page.
112
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
112
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
113 113
 
114 114
 			// Render donation import page
115
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
115
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
116 116
 
117 117
 			// Print the HTML.
118
-			add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 );
118
+			add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10);
119 119
 
120 120
 			// Run when form submit.
121
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
121
+			add_action('give-tools_save_import', array($this, 'save'));
122 122
 
123
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
123
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
124 124
 
125 125
 			// Used to add submit button.
126
-			add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 );
126
+			add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10);
127 127
 		}
128 128
 
129 129
 		/**
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 		 *
136 136
 		 * @return mixed
137 137
 		 */
138
-		public function update_notices( $messages ) {
139
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
140
-				unset( $messages['give-setting-updated'] );
138
+		public function update_notices($messages) {
139
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
140
+				unset($messages['give-setting-updated']);
141 141
 			}
142 142
 
143 143
 			return $messages;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		 * @since 1.8.17
150 150
 		 */
151 151
 		public function submit() {
152
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
152
+			wp_nonce_field('give-save-settings', '_give-save-settings');
153 153
 			?>
154 154
 			<input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/>
155 155
 			<input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/>
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 			?>
170 170
 			<section>
171 171
 				<table
172
-					class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo( 1 === $step && ! empty( $this->is_json_valid ) ? 'give-hidden' : '' ); ?> "
172
+					class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo(1 === $step && ! empty($this->is_json_valid) ? 'give-hidden' : ''); ?> "
173 173
 					id="<?php echo "step-{$step}"; ?>">
174 174
 					<tbody>
175 175
 					<?php
176
-					switch ( $step ) {
176
+					switch ($step) {
177 177
 						case 1:
178 178
 							$this->render_upload_html();
179 179
 							break;
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 		public function import_success() {
201 201
 			// Imported successfully
202 202
 
203
-			$success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false );
204
-			$undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false );
203
+			$success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false);
204
+			$undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false);
205 205
 			$query_arg_setting = array(
206 206
 				'post_type' => 'give_forms',
207 207
 				'page'      => 'give-settings',
208 208
 			);
209 209
 
210
-			if ( $undo ) {
210
+			if ($undo) {
211 211
 				$success = false;
212 212
 			}
213 213
 
@@ -220,30 +220,30 @@  discard block
 block discarded – undo
220 220
 				'undo'      => 'true',
221 221
 			);
222 222
 
223
-			$title = __( 'Settings Importing Completed!', 'give' );
224
-			if ( $success ) {
223
+			$title = __('Settings Importing Completed!', 'give');
224
+			if ($success) {
225 225
 				$query_arg_success['undo'] = '1';
226 226
 				$query_arg_success['step'] = '3';
227 227
 				$query_arg_success['success'] = '1';
228
-				$text = __( 'Undo Importing', 'give' );
228
+				$text = __('Undo Importing', 'give');
229 229
 			} else {
230
-				if ( $undo ) {
231
-					$host_give_options = get_option( 'give_settings_old', array() );
232
-					update_option( 'give_settings', $host_give_options, false );
233
-					$title = __( 'Undo of Setting Imported Completed!', 'give' );
230
+				if ($undo) {
231
+					$host_give_options = get_option('give_settings_old', array());
232
+					update_option('give_settings', $host_give_options, false);
233
+					$title = __('Undo of Setting Imported Completed!', 'give');
234 234
 				} else {
235
-					$title = __( 'Failed to import', 'give' );
235
+					$title = __('Failed to import', 'give');
236 236
 				}
237 237
 
238
-				$text = __( 'Importing Again', 'give' );
238
+				$text = __('Importing Again', 'give');
239 239
 			}
240 240
 			?>
241 241
 			<tr valign="top" class="give-import-dropdown">
242 242
 				<th colspan="2">
243 243
 					<h2><?php echo $title; ?></h2>
244 244
 					<p>
245
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
246
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_setting, admin_url( 'edit.php' ) ); ?>"><?php echo __( 'View Settings', 'give' ); ?></a>
245
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
246
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_setting, admin_url('edit.php')); ?>"><?php echo __('View Settings', 'give'); ?></a>
247 247
 					</p>
248 248
 				</th>
249 249
 			</tr>
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 		 * @since 1.8.17
257 257
 		 */
258 258
 		public function start_import() {
259
-			$type      = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' );
260
-			$file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' );
259
+			$type      = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace');
260
+			$file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : '');
261 261
 
262 262
 			?>
263 263
 			<tr valign="top" class="give-import-dropdown">
264 264
 				<th colspan="2">
265
-					<h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2>
266
-					<p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p>
265
+					<h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2>
266
+					<p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p>
267 267
 				</th>
268 268
 			</tr>
269 269
 
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 			$step = $this->get_step();
291 291
 			?>
292 292
 			<ol class="give-progress-steps">
293
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
294
-					<?php esc_html_e( 'Upload JSON file', 'give' ); ?>
293
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
294
+					<?php esc_html_e('Upload JSON file', 'give'); ?>
295 295
 				</li>
296
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
297
-					<?php esc_html_e( 'Import', 'give' ); ?>
296
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
297
+					<?php esc_html_e('Import', 'give'); ?>
298 298
 				</li>
299
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
300
-					<?php esc_html_e( 'Done!', 'give' ); ?>
299
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
300
+					<?php esc_html_e('Done!', 'give'); ?>
301 301
 				</li>
302 302
 			</ol>
303 303
 			<?php
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 		 * @return int $step on which step doest the import is on.
312 312
 		 */
313 313
 		public function get_step() {
314
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
314
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
315 315
 			$on_step = 1;
316 316
 
317
-			if ( empty( $step ) || 1 === $step ) {
317
+			if (empty($step) || 1 === $step) {
318 318
 				$on_step = 1;
319
-			} elseif ( 2 === $step ) {
319
+			} elseif (2 === $step) {
320 320
 				$on_step = 2;
321
-			} elseif ( 3 === $step ) {
321
+			} elseif (3 === $step) {
322 322
 				$on_step = 3;
323 323
 			}
324 324
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		 * @since 1.8.17
332 332
 		 */
333 333
 		public function render_page() {
334
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php';
334
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php';
335 335
 		}
336 336
 
337 337
 		/**
@@ -343,28 +343,28 @@  discard block
 block discarded – undo
343 343
 		 * @return void
344 344
 		 */
345 345
 		public function render_upload_html() {
346
-			$json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' );
347
-			$type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' );
346
+			$json = (isset($_POST['json']) ? give_clean($_POST['json']) : '');
347
+			$type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge');
348 348
 			$step = $this->get_step();
349 349
 
350 350
 			?>
351 351
 			<tr valign="top">
352 352
 				<th colspan="2">
353
-					<h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2>
354
-					<p class="give-field-description"><?php esc_html_e( 'This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give' ) ?></p>
353
+					<h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2>
354
+					<p class="give-field-description"><?php esc_html_e('This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give') ?></p>
355 355
 				</th>
356 356
 			</tr>
357 357
 
358 358
 			<tr valign="top">
359 359
 				<th scope="row" class="titledesc">
360
-					<label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label>
360
+					<label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label>
361 361
 				</th>
362 362
 				<td class="give-forminp">
363 363
 					<div class="give-field-wrap">
364 364
 						<label for="json">
365 365
 							<input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>"
366 366
 							       accept=".json">
367
-							<p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p>
367
+							<p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p>
368 368
 						</label>
369 369
 					</div>
370 370
 				</td>
@@ -373,21 +373,21 @@  discard block
 block discarded – undo
373 373
 			$settings = array(
374 374
 				array(
375 375
 					'id'          => 'type',
376
-					'name'        => __( 'Merge Type:', 'give' ),
377
-					'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ),
376
+					'name'        => __('Merge Type:', 'give'),
377
+					'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'),
378 378
 					'default'     => $type,
379 379
 					'type'        => 'radio_inline',
380 380
 					'options'     => array(
381
-						'merge'   => __( 'Merge', 'give' ),
382
-						'replace' => __( 'Replace', 'give' ),
381
+						'merge'   => __('Merge', 'give'),
382
+						'replace' => __('Replace', 'give'),
383 383
 					),
384 384
 				),
385 385
 			);
386 386
 
387
-			$settings = apply_filters( 'give_import_core_setting_html', $settings );
387
+			$settings = apply_filters('give_import_core_setting_html', $settings);
388 388
 
389
-			if ( empty( $this->is_json_valid ) ) {
390
-				Give_Admin_Settings::output_fields( $settings, 'give_settings' );
389
+			if (empty($this->is_json_valid)) {
390
+				Give_Admin_Settings::output_fields($settings, 'give_settings');
391 391
 				?>
392 392
 				<tr valign="top">
393 393
 					<th></th>
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						<input type="submit"
396 396
 						       class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>"
397 397
 						       id="recount-stats-submit"
398
-						       value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/>
398
+						       value="<?php esc_attr_e('Submit', 'give'); ?>"/>
399 399
 					</th>
400 400
 				</tr>
401 401
 				<?php
@@ -417,20 +417,20 @@  discard block
 block discarded – undo
417 417
 			$step = $this->get_step();
418 418
 
419 419
 			// Validation for first step.
420
-			if ( 1 === $step ) {
421
-				$type          = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' );
420
+			if (1 === $step) {
421
+				$type          = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace');
422 422
 				$core_settings = self::upload_widget_settings_file();
423
-				if ( ! empty( $core_settings['error'] ) ) {
424
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) );
423
+				if ( ! empty($core_settings['error'])) {
424
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give'));
425 425
 				} else {
426
-					$file_path = explode( '/', $core_settings['file'] );
427
-					$count     = ( count( $file_path ) - 1 );
428
-					$url       = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array(
426
+					$file_path = explode('/', $core_settings['file']);
427
+					$count     = (count($file_path) - 1);
428
+					$url       = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array(
429 429
 						'step'          => '2',
430 430
 						'importer-type' => $this->importer_type,
431 431
 						'type'          => $type,
432
-						'file_name'     => $file_path[ $count ],
433
-					) ) );
432
+						'file_name'     => $file_path[$count],
433
+					)));
434 434
 
435 435
 
436 436
 					$this->is_json_valid = $url;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		 * @return bool
446 446
 		 */
447 447
 		private function is_donations_import_page() {
448
-			return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] );
448
+			return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']);
449 449
 		}
450 450
 
451 451
 		/**
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 		 */
455 455
 		public static function upload_widget_settings_file() {
456 456
 			$upload = false;
457
-			if ( isset( $_FILES['json'] ) ) {
458
-				add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
457
+			if (isset($_FILES['json'])) {
458
+				add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
459 459
 
460
-				$upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) );
460
+				$upload = wp_handle_upload($_FILES['json'], array('test_form' => false));
461 461
 
462
-				remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) );
462
+				remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes'));
463 463
 			} else {
464
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
464
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
465 465
 			}
466 466
 
467 467
 			return $upload;
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		 *
473 473
 		 * @param array $existing_mimes
474 474
 		 */
475
-		public static function json_upload_mimes( $existing_mimes = array() ) {
475
+		public static function json_upload_mimes($existing_mimes = array()) {
476 476
 			$existing_mimes['json'] = 'application/json';
477 477
 
478 478
 			return $existing_mimes;
Please login to merge, or discard this patch.
includes/admin/tools/export/give-export-donations-exporter.php 1 patch
Spacing   +159 added lines, -159 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
 
@@ -85,28 +85,28 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param array $request The Form Data passed into the batch processing.
87 87
 	 */
88
-	public function set_properties( $request ) {
88
+	public function set_properties($request) {
89 89
 
90 90
 		// Set data from form submission
91
-		if ( isset( $_POST['form'] ) ) {
92
-			$this->data = give_clean( wp_parse_args( $_POST['form'] ) );
91
+		if (isset($_POST['form'])) {
92
+			$this->data = give_clean(wp_parse_args($_POST['form']));
93 93
 		}
94 94
 
95 95
 		$this->form       = $this->data['forms'];
96
-		$this->categories = ! empty( $request['give_forms_categories'] ) ? (array) $request['give_forms_categories'] : array();
97
-		$this->tags       = ! empty( $request['give_forms_tags'] ) ? (array) $request['give_forms_tags'] : array();
98
-		$this->form_id    = $this->get_form_ids( $request );
99
-		$this->price_id   = isset( $request['give_price_option'] ) && ( 'all' !== $request['give_price_option'] && '' !== $request['give_price_option'] ) ? absint( $request['give_price_option'] ) : null;
100
-		$this->start      = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
101
-		$this->end        = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
102
-		$this->status     = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
96
+		$this->categories = ! empty($request['give_forms_categories']) ? (array) $request['give_forms_categories'] : array();
97
+		$this->tags       = ! empty($request['give_forms_tags']) ? (array) $request['give_forms_tags'] : array();
98
+		$this->form_id    = $this->get_form_ids($request);
99
+		$this->price_id   = isset($request['give_price_option']) && ('all' !== $request['give_price_option'] && '' !== $request['give_price_option']) ? absint($request['give_price_option']) : null;
100
+		$this->start      = isset($request['start']) ? sanitize_text_field($request['start']) : '';
101
+		$this->end        = isset($request['end']) ? sanitize_text_field($request['end']) : '';
102
+		$this->status     = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
103 103
 
104 104
 		/**
105 105
 		 * Hook to use after setting properties.
106 106
 		 *
107 107
 		 * @since 2.1.3
108 108
 		 */
109
-		do_action( 'give_export_donations_form_data', $this->data );
109
+		do_action('give_export_donations_form_data', $this->data);
110 110
 	}
111 111
 
112 112
 	/**
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return array|boolean|null $form get all the donation id that need to be exported
120 120
 	 */
121
-	public function get_form_ids( $request = array() ) {
122
-		$form = ! empty( $request['forms'] ) && 0 !== $request['forms'] ? absint( $request['forms'] ) : null;
121
+	public function get_form_ids($request = array()) {
122
+		$form = ! empty($request['forms']) && 0 !== $request['forms'] ? absint($request['forms']) : null;
123 123
 
124
-		$form_ids = ! empty( $request['form_ids'] ) ? sanitize_text_field( $request['form_ids'] ) : null;
124
+		$form_ids = ! empty($request['form_ids']) ? sanitize_text_field($request['form_ids']) : null;
125 125
 
126
-		if ( empty( $form ) && ! empty( $form_ids ) && ( ! empty( $this->categories ) || ! empty( $this->tags ) ) ) {
127
-			$form = explode( ',', $form_ids );
126
+		if (empty($form) && ! empty($form_ids) && ( ! empty($this->categories) || ! empty($this->tags))) {
127
+			$form = explode(',', $form_ids);
128 128
 		}
129 129
 
130 130
 		return $form;
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function csv_cols() {
143 143
 
144
-		$columns = isset( $this->data['give_give_donations_export_option'] ) ? $this->data['give_give_donations_export_option'] : array();
144
+		$columns = isset($this->data['give_give_donations_export_option']) ? $this->data['give_give_donations_export_option'] : array();
145 145
 
146 146
 		// We need columns.
147
-		if ( empty( $columns ) ) {
147
+		if (empty($columns)) {
148 148
 			return false;
149 149
 		}
150 150
 
151
-		$this->cols = $this->get_cols( $columns );
151
+		$this->cols = $this->get_cols($columns);
152 152
 
153 153
 		return $this->cols;
154 154
 	}
@@ -163,88 +163,88 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return array
165 165
 	 */
166
-	private function get_cols( $columns ) {
166
+	private function get_cols($columns) {
167 167
 
168 168
 		$cols = array();
169 169
 
170
-		foreach ( $columns as $key => $value ) {
170
+		foreach ($columns as $key => $value) {
171 171
 
172
-			switch ( $key ) {
172
+			switch ($key) {
173 173
 				case 'donation_id':
174
-					$cols['donation_id'] = __( 'Donation ID', 'give' );
174
+					$cols['donation_id'] = __('Donation ID', 'give');
175 175
 					break;
176 176
 				case 'seq_id':
177
-					$cols['seq_id'] = __( 'Donation Number', 'give' );
177
+					$cols['seq_id'] = __('Donation Number', 'give');
178 178
 					break;
179 179
 				case 'title_prefix':
180
-					$cols['title_prefix'] = __( 'Title Prefix', 'give' );
180
+					$cols['title_prefix'] = __('Title Prefix', 'give');
181 181
 					break;
182 182
 				case 'first_name':
183
-					$cols['first_name'] = __( 'First Name', 'give' );
183
+					$cols['first_name'] = __('First Name', 'give');
184 184
 					break;
185 185
 				case 'last_name':
186
-					$cols['last_name'] = __( 'Last Name', 'give' );
186
+					$cols['last_name'] = __('Last Name', 'give');
187 187
 					break;
188 188
 				case 'email':
189
-					$cols['email'] = __( 'Email Address', 'give' );
189
+					$cols['email'] = __('Email Address', 'give');
190 190
 					break;
191 191
 				case 'company':
192
-					$cols['company'] = __( 'Company Name', 'give' );
192
+					$cols['company'] = __('Company Name', 'give');
193 193
 					break;
194 194
 				case 'address':
195
-					$cols['address_line1']   = __( 'Address 1', 'give' );
196
-					$cols['address_line2']   = __( 'Address 2', 'give' );
197
-					$cols['address_city']    = __( 'City', 'give' );
198
-					$cols['address_state']   = __( 'State', 'give' );
199
-					$cols['address_zip']     = __( 'Zip', 'give' );
200
-					$cols['address_country'] = __( 'Country', 'give' );
195
+					$cols['address_line1']   = __('Address 1', 'give');
196
+					$cols['address_line2']   = __('Address 2', 'give');
197
+					$cols['address_city']    = __('City', 'give');
198
+					$cols['address_state']   = __('State', 'give');
199
+					$cols['address_zip']     = __('Zip', 'give');
200
+					$cols['address_country'] = __('Country', 'give');
201 201
 					break;
202 202
 				case 'donation_total':
203
-					$cols['donation_total'] = __( 'Donation Total', 'give' );
203
+					$cols['donation_total'] = __('Donation Total', 'give');
204 204
 					break;
205 205
 				case 'currency_code':
206
-					$cols['currency_code'] = __( 'Currency Code', 'give' );
206
+					$cols['currency_code'] = __('Currency Code', 'give');
207 207
 					break;
208 208
 				case 'currency_symbol':
209
-					$cols['currency_symbol'] = __( 'Currency Symbol', 'give' );
209
+					$cols['currency_symbol'] = __('Currency Symbol', 'give');
210 210
 					break;
211 211
 				case 'donation_status':
212
-					$cols['donation_status'] = __( 'Donation Status', 'give' );
212
+					$cols['donation_status'] = __('Donation Status', 'give');
213 213
 					break;
214 214
 				case 'payment_gateway':
215
-					$cols['payment_gateway'] = __( 'Payment Gateway', 'give' );
215
+					$cols['payment_gateway'] = __('Payment Gateway', 'give');
216 216
 				case 'payment_mode':
217
-					$cols['payment_mode'] = __( 'Payment Mode', 'give' );
217
+					$cols['payment_mode'] = __('Payment Mode', 'give');
218 218
 					break;
219 219
 				case 'form_id':
220
-					$cols['form_id'] = __( 'Form ID', 'give' );
220
+					$cols['form_id'] = __('Form ID', 'give');
221 221
 					break;
222 222
 				case 'form_title':
223
-					$cols['form_title'] = __( 'Form Title', 'give' );
223
+					$cols['form_title'] = __('Form Title', 'give');
224 224
 					break;
225 225
 				case 'form_level_id':
226
-					$cols['form_level_id'] = __( 'Level ID', 'give' );
226
+					$cols['form_level_id'] = __('Level ID', 'give');
227 227
 					break;
228 228
 				case 'form_level_title':
229
-					$cols['form_level_title'] = __( 'Level Title', 'give' );
229
+					$cols['form_level_title'] = __('Level Title', 'give');
230 230
 					break;
231 231
 				case 'donation_date':
232
-					$cols['donation_date'] = __( 'Donation Date', 'give' );
232
+					$cols['donation_date'] = __('Donation Date', 'give');
233 233
 					break;
234 234
 				case 'donation_time':
235
-					$cols['donation_time'] = __( 'Donation Time', 'give' );
235
+					$cols['donation_time'] = __('Donation Time', 'give');
236 236
 					break;
237 237
 				case 'userid':
238
-					$cols['userid'] = __( 'User ID', 'give' );
238
+					$cols['userid'] = __('User ID', 'give');
239 239
 					break;
240 240
 				case 'donorid':
241
-					$cols['donorid'] = __( 'Donor ID', 'give' );
241
+					$cols['donorid'] = __('Donor ID', 'give');
242 242
 					break;
243 243
 				case 'donor_ip':
244
-					$cols['donor_ip'] = __( 'Donor IP Address', 'give' );
244
+					$cols['donor_ip'] = __('Donor IP Address', 'give');
245 245
 					break;
246 246
 				default:
247
-					$cols[ $key ] = $key;
247
+					$cols[$key] = $key;
248 248
 
249 249
 			}
250 250
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		 * @param array $cols columns name for CSV
258 258
 		 * @param array $columns columns select by admin to export
259 259
 		 */
260
-		return (array) apply_filters( 'give_export_donation_get_columns_name', $cols, $columns );
260
+		return (array) apply_filters('give_export_donation_get_columns_name', $cols, $columns);
261 261
 	}
262 262
 
263 263
 	/**
@@ -269,24 +269,24 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return array $args donation argument
271 271
 	 */
272
-	public function get_donation_argument( $args = array() ) {
272
+	public function get_donation_argument($args = array()) {
273 273
 		$defaults = array(
274 274
 			'number' => 30,
275 275
 			'page'   => $this->step,
276 276
 			'status' => $this->status,
277 277
 		);
278 278
 		// Date query.
279
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
280
-			if ( ! empty( $this->start ) ) {
281
-				$defaults['date_query'][0]['after'] = date( 'Y-n-d 00:00:00', strtotime( $this->start ) );
279
+		if ( ! empty($this->start) || ! empty($this->end)) {
280
+			if ( ! empty($this->start)) {
281
+				$defaults['date_query'][0]['after'] = date('Y-n-d 00:00:00', strtotime($this->start));
282 282
 			}
283
-			if ( ! empty( $this->end ) ) {
284
-				$defaults['date_query'][0]['before'] = date( 'Y-n-d 00:00:00', strtotime( $this->end ) );
283
+			if ( ! empty($this->end)) {
284
+				$defaults['date_query'][0]['before'] = date('Y-n-d 00:00:00', strtotime($this->end));
285 285
 			}
286 286
 		}
287 287
 
288
-		if ( ! empty( $this->form_id ) ) {
289
-			$defaults['give_forms'] = is_array( $this->form_id ) ? $this->form_id : array( $this->form_id );
288
+		if ( ! empty($this->form_id)) {
289
+			$defaults['give_forms'] = is_array($this->form_id) ? $this->form_id : array($this->form_id);
290 290
 		}
291 291
 
292 292
 		/**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		 *
296 296
 		 * @since 2.1.3
297 297
 		 */
298
-		return apply_filters( 'give_export_donations_donation_query_args', wp_parse_args( $args, $defaults ) );
298
+		return apply_filters('give_export_donations_donation_query_args', wp_parse_args($args, $defaults));
299 299
 	}
300 300
 
301 301
 	/**
@@ -314,130 +314,130 @@  discard block
 block discarded – undo
314 314
 		$data = array();
315 315
 		$i    = 0;
316 316
 		// Payment query.
317
-		$payments = give_get_payments( $this->get_donation_argument() );
317
+		$payments = give_get_payments($this->get_donation_argument());
318 318
 
319
-		if ( $payments ) {
319
+		if ($payments) {
320 320
 
321
-			foreach ( $payments as $payment ) {
321
+			foreach ($payments as $payment) {
322 322
 
323 323
 				$columns      = $this->csv_cols();
324
-				$payment      = new Give_Payment( $payment->ID );
324
+				$payment      = new Give_Payment($payment->ID);
325 325
 				$payment_meta = $payment->payment_meta;
326 326
 				$address      = $payment->address;
327 327
 
328 328
 				// Set columns.
329
-				if ( ! empty( $columns['donation_id'] ) ) {
330
-					$data[ $i ]['donation_id'] = $payment->ID;
329
+				if ( ! empty($columns['donation_id'])) {
330
+					$data[$i]['donation_id'] = $payment->ID;
331 331
 				}
332 332
 
333
-				if ( ! empty( $columns['seq_id'] ) ) {
334
-					$data[ $i ]['seq_id'] = Give()->seq_donation_number->get_serial_code( $payment->ID );
333
+				if ( ! empty($columns['seq_id'])) {
334
+					$data[$i]['seq_id'] = Give()->seq_donation_number->get_serial_code($payment->ID);
335 335
 				}
336 336
 
337
-				if ( ! empty( $columns['title_prefix'] ) ) {
338
-					$data[ $i ]['title_prefix'] = ! empty( $payment->title_prefix ) ? $payment->title_prefix : '';
337
+				if ( ! empty($columns['title_prefix'])) {
338
+					$data[$i]['title_prefix'] = ! empty($payment->title_prefix) ? $payment->title_prefix : '';
339 339
 				}
340 340
 
341
-				if ( ! empty( $columns['first_name'] ) ) {
342
-					$data[ $i ]['first_name'] = isset( $payment->first_name ) ? $payment->first_name : '';
341
+				if ( ! empty($columns['first_name'])) {
342
+					$data[$i]['first_name'] = isset($payment->first_name) ? $payment->first_name : '';
343 343
 				}
344 344
 
345
-				if ( ! empty( $columns['last_name'] ) ) {
346
-					$data[ $i ]['last_name'] = isset( $payment->last_name ) ? $payment->last_name : '';
345
+				if ( ! empty($columns['last_name'])) {
346
+					$data[$i]['last_name'] = isset($payment->last_name) ? $payment->last_name : '';
347 347
 				}
348 348
 
349
-				if ( ! empty( $columns['email'] ) ) {
350
-					$data[ $i ]['email'] = $payment->email;
349
+				if ( ! empty($columns['email'])) {
350
+					$data[$i]['email'] = $payment->email;
351 351
 				}
352 352
 
353
-				if ( ! empty( $columns['company'] ) ) {
354
-					$data[ $i ]['company'] = empty( $payment_meta['_give_donation_company'] ) ? '' : str_replace( "\'", "'", $payment_meta['_give_donation_company'] );
353
+				if ( ! empty($columns['company'])) {
354
+					$data[$i]['company'] = empty($payment_meta['_give_donation_company']) ? '' : str_replace("\'", "'", $payment_meta['_give_donation_company']);
355 355
 				}
356 356
 
357
-				if ( ! empty( $columns['address_line1'] ) ) {
358
-					$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
359
-					$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
360
-					$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
361
-					$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
362
-					$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
363
-					$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
357
+				if ( ! empty($columns['address_line1'])) {
358
+					$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
359
+					$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
360
+					$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
361
+					$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
362
+					$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
363
+					$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
364 364
 				}
365 365
 
366
-				if ( ! empty( $columns['donation_total'] ) ) {
367
-					$data[ $i ]['donation_total'] = give_format_amount( give_donation_amount( $payment->ID ) );
366
+				if ( ! empty($columns['donation_total'])) {
367
+					$data[$i]['donation_total'] = give_format_amount(give_donation_amount($payment->ID));
368 368
 				}
369 369
 
370
-				if ( ! empty( $columns['currency_code'] ) ) {
371
-					$data[ $i ]['currency_code'] = empty( $payment_meta['_give_payment_currency'] ) ? give_get_currency() : $payment_meta['_give_payment_currency'];
370
+				if ( ! empty($columns['currency_code'])) {
371
+					$data[$i]['currency_code'] = empty($payment_meta['_give_payment_currency']) ? give_get_currency() : $payment_meta['_give_payment_currency'];
372 372
 				}
373 373
 
374
-				if ( ! empty( $columns['currency_symbol'] ) ) {
375
-					$currency_code                 = $data[ $i ]['currency_code'];
376
-					$data[ $i ]['currency_symbol'] = give_currency_symbol( $currency_code, true );
374
+				if ( ! empty($columns['currency_symbol'])) {
375
+					$currency_code                 = $data[$i]['currency_code'];
376
+					$data[$i]['currency_symbol'] = give_currency_symbol($currency_code, true);
377 377
 				}
378 378
 
379
-				if ( ! empty( $columns['donation_status'] ) ) {
380
-					$data[ $i ]['donation_status'] = give_get_payment_status( $payment, true );
379
+				if ( ! empty($columns['donation_status'])) {
380
+					$data[$i]['donation_status'] = give_get_payment_status($payment, true);
381 381
 				}
382 382
 
383
-				if ( ! empty( $columns['payment_gateway'] ) ) {
384
-					$data[ $i ]['payment_gateway'] = $payment->gateway;
383
+				if ( ! empty($columns['payment_gateway'])) {
384
+					$data[$i]['payment_gateway'] = $payment->gateway;
385 385
 				}
386 386
 
387
-				if ( ! empty( $columns['payment_mode'] ) ) {
388
-					$data[ $i ]['payment_mode'] = $payment->mode;
387
+				if ( ! empty($columns['payment_mode'])) {
388
+					$data[$i]['payment_mode'] = $payment->mode;
389 389
 				}
390 390
 
391
-				if ( ! empty( $columns['form_id'] ) ) {
392
-					$data[ $i ]['form_id'] = $payment->form_id;
391
+				if ( ! empty($columns['form_id'])) {
392
+					$data[$i]['form_id'] = $payment->form_id;
393 393
 				}
394 394
 
395
-				if ( ! empty( $columns['form_title'] ) ) {
396
-					$data[ $i ]['form_title'] = get_the_title( $payment->form_id );
395
+				if ( ! empty($columns['form_title'])) {
396
+					$data[$i]['form_title'] = get_the_title($payment->form_id);
397 397
 				}
398 398
 
399
-				if ( ! empty( $columns['form_level_id'] ) ) {
400
-					$data[ $i ]['form_level_id'] = $payment->price_id;
399
+				if ( ! empty($columns['form_level_id'])) {
400
+					$data[$i]['form_level_id'] = $payment->price_id;
401 401
 				}
402 402
 
403
-				if ( ! empty( $columns['form_level_title'] ) ) {
404
-					$var_prices = give_has_variable_prices( $payment->form_id );
405
-					if ( empty( $var_prices ) ) {
406
-						$data[ $i ]['form_level_title'] = '';
403
+				if ( ! empty($columns['form_level_title'])) {
404
+					$var_prices = give_has_variable_prices($payment->form_id);
405
+					if (empty($var_prices)) {
406
+						$data[$i]['form_level_title'] = '';
407 407
 					} else {
408
-						if ( 'custom' === $payment->price_id ) {
409
-							$custom_amount_text = give_get_meta( $payment->form_id, '_give_custom_amount_text', true );
408
+						if ('custom' === $payment->price_id) {
409
+							$custom_amount_text = give_get_meta($payment->form_id, '_give_custom_amount_text', true);
410 410
 
411
-							if ( empty( $custom_amount_text ) ) {
412
-								$custom_amount_text = esc_html__( 'Custom', 'give' );
411
+							if (empty($custom_amount_text)) {
412
+								$custom_amount_text = esc_html__('Custom', 'give');
413 413
 							}
414
-							$data[ $i ]['form_level_title'] = $custom_amount_text;
414
+							$data[$i]['form_level_title'] = $custom_amount_text;
415 415
 						} else {
416
-							$data[ $i ]['form_level_title'] = give_get_price_option_name( $payment->form_id, $payment->price_id );
416
+							$data[$i]['form_level_title'] = give_get_price_option_name($payment->form_id, $payment->price_id);
417 417
 						}
418 418
 					}
419 419
 				}
420 420
 
421
-				if ( ! empty( $columns['donation_date'] ) ) {
422
-					$payment_date                = strtotime( $payment->date );
423
-					$data[ $i ]['donation_date'] = date( give_date_format(), $payment_date );
421
+				if ( ! empty($columns['donation_date'])) {
422
+					$payment_date                = strtotime($payment->date);
423
+					$data[$i]['donation_date'] = date(give_date_format(), $payment_date);
424 424
 				}
425 425
 
426
-				if ( ! empty( $columns['donation_time'] ) ) {
427
-					$payment_date                = strtotime( $payment->date );
428
-					$data[ $i ]['donation_time'] = date_i18n( 'H', $payment_date ) . ':' . date( 'i', $payment_date );
426
+				if ( ! empty($columns['donation_time'])) {
427
+					$payment_date                = strtotime($payment->date);
428
+					$data[$i]['donation_time'] = date_i18n('H', $payment_date).':'.date('i', $payment_date);
429 429
 				}
430 430
 
431
-				if ( ! empty( $columns['userid'] ) ) {
432
-					$data[ $i ]['userid'] = $payment->user_id;
431
+				if ( ! empty($columns['userid'])) {
432
+					$data[$i]['userid'] = $payment->user_id;
433 433
 				}
434 434
 
435
-				if ( ! empty( $columns['donorid'] ) ) {
436
-					$data[ $i ]['donorid'] = $payment->customer_id;
435
+				if ( ! empty($columns['donorid'])) {
436
+					$data[$i]['donorid'] = $payment->customer_id;
437 437
 				}
438 438
 
439
-				if ( ! empty( $columns['donor_ip'] ) ) {
440
-					$data[ $i ]['donor_ip'] = give_get_payment_user_ip( $payment->ID );
439
+				if ( ! empty($columns['donor_ip'])) {
440
+					$data[$i]['donor_ip'] = give_get_payment_user_ip($payment->ID);
441 441
 				}
442 442
 
443 443
 				// Add custom field data.
@@ -469,15 +469,15 @@  discard block
 block discarded – undo
469 469
 				);
470 470
 
471 471
 				// Removing above keys...
472
-				foreach ( $remove_keys as $key ) {
473
-					unset( $columns[ $key ] );
472
+				foreach ($remove_keys as $key) {
473
+					unset($columns[$key]);
474 474
 				}
475 475
 
476 476
 				// Now loop through remaining meta fields.
477
-				foreach ( $columns as $col ) {
478
-					$field_data         = get_post_meta( $payment->ID, $col, true );
479
-					$data[ $i ][ $col ] = $field_data;
480
-					unset( $columns[ $col ] );
477
+				foreach ($columns as $col) {
478
+					$field_data         = get_post_meta($payment->ID, $col, true);
479
+					$data[$i][$col] = $field_data;
480
+					unset($columns[$col]);
481 481
 				}
482 482
 
483 483
 				/**
@@ -492,27 +492,27 @@  discard block
 block discarded – undo
492 492
 				 *
493 493
 				 * @return array Donation data
494 494
 				 */
495
-				$data[ $i ] = apply_filters( 'give_export_donation_data', $data[ $i ], $payment, $columns, $this );
495
+				$data[$i] = apply_filters('give_export_donation_data', $data[$i], $payment, $columns, $this);
496 496
 
497 497
 				$new_data = array();
498
-				$old_data = $data[ $i ];
498
+				$old_data = $data[$i];
499 499
 
500 500
 				// sorting the columns bas on row
501
-				foreach ( $this->csv_cols() as $key => $value ) {
502
-					if ( array_key_exists( $key, $old_data ) ) {
503
-						$new_data[ $key ] = $old_data[ $key ];
501
+				foreach ($this->csv_cols() as $key => $value) {
502
+					if (array_key_exists($key, $old_data)) {
503
+						$new_data[$key] = $old_data[$key];
504 504
 					}
505 505
 				}
506 506
 
507
-				$data[ $i ] = $new_data;
507
+				$data[$i] = $new_data;
508 508
 
509 509
 				// Increment iterator.
510
-				$i ++;
510
+				$i++;
511 511
 
512 512
 			}
513 513
 
514
-			$data = apply_filters( 'give_export_get_data', $data );
515
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
514
+			$data = apply_filters('give_export_get_data', $data);
515
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
516 516
 
517 517
 			return $data;
518 518
 
@@ -530,17 +530,17 @@  discard block
 block discarded – undo
530 530
 	 * @return int
531 531
 	 */
532 532
 	public function get_percentage_complete() {
533
-		$args = $this->get_donation_argument( array( 'number' => - 1 ) );
534
-		if ( isset( $args['page'] ) ) {
535
-			unset( $args['page'] );
533
+		$args = $this->get_donation_argument(array('number' => -1));
534
+		if (isset($args['page'])) {
535
+			unset($args['page']);
536 536
 		}
537
-		$query      = give_get_payments( $args );
538
-		$total      = count( $query );
537
+		$query      = give_get_payments($args);
538
+		$total      = count($query);
539 539
 		$percentage = 100;
540
-		if ( $total > 0 ) {
541
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
540
+		if ($total > 0) {
541
+			$percentage = ((30 * $this->step) / $total) * 100;
542 542
 		}
543
-		if ( $percentage > 100 ) {
543
+		if ($percentage > 100) {
544 544
 			$percentage = 100;
545 545
 		}
546 546
 
@@ -562,23 +562,23 @@  discard block
 block discarded – undo
562 562
 		$data     = $this->get_data();
563 563
 		$cols     = $this->get_csv_cols();
564 564
 
565
-		if ( $data ) {
565
+		if ($data) {
566 566
 
567 567
 			// Output each row
568
-			foreach ( $data as $row ) {
568
+			foreach ($data as $row) {
569 569
 				$i = 1;
570
-				foreach ( $row as $col_id => $column ) {
570
+				foreach ($row as $col_id => $column) {
571 571
 					// Make sure the column is valid
572
-					if ( array_key_exists( $col_id, $cols ) ) {
573
-						$row_data .= '"' . preg_replace( '/"/', "'", $column ) . '"';
574
-						$row_data .= $i == count( $cols ) ? '' : ',';
575
-						$i ++;
572
+					if (array_key_exists($col_id, $cols)) {
573
+						$row_data .= '"'.preg_replace('/"/', "'", $column).'"';
574
+						$row_data .= $i == count($cols) ? '' : ',';
575
+						$i++;
576 576
 					}
577 577
 				}
578 578
 				$row_data .= "\r\n";
579 579
 			}
580 580
 
581
-			$this->stash_step_data( $row_data );
581
+			$this->stash_step_data($row_data);
582 582
 
583 583
 			return $row_data;
584 584
 		}
Please login to merge, or discard this patch.
includes/admin/tools/export/pdf-reports.php 1 patch
Spacing   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly..
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,136 +25,136 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @uses   give_pdf
27 27
  */
28
-function give_generate_pdf( $data ) {
28
+function give_generate_pdf($data) {
29 29
 
30
-	if ( ! current_user_can( 'view_give_reports' ) ) {
31
-		wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) {
39
-		wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
38
+	if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) {
39
+		wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403));
40 40
 	}
41 41
 
42
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php';
42
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php';
43 43
 
44 44
 	$daterange = utf8_decode(
45 45
 		sprintf(
46 46
 		/* translators: 1: start date 2: end date */
47
-			__( '%1$s to %2$s', 'give' ),
48
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
49
-			date_i18n( give_date_format() )
47
+			__('%1$s to %2$s', 'give'),
48
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
49
+			date_i18n(give_date_format())
50 50
 		)
51 51
 	);
52 52
 
53
-	$categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
54
-	$tags_enabled       = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
53
+	$categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled'));
54
+	$tags_enabled       = give_is_setting_enabled(give_get_option('tags', 'disabled'));
55 55
 
56
-	$pdf          = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false );
57
-	$default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' );
56
+	$pdf          = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false);
57
+	$default_font = apply_filters('give_pdf_default_font', 'Helvetica');
58 58
 	$custom_font  = 'dejavusans';
59 59
 	$font_style   = '';
60 60
 
61 61
 	if (
62
-		file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF' ) &&
62
+		file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF') &&
63 63
 
64 64
 		// RIAL exist for backward compatibility.
65
-		in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) )
65
+		in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR'))
66 66
 	) {
67
-		TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' );
67
+		TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', '');
68 68
 		$custom_font = 'CODE2000';
69 69
 		$font_style  = 'B';
70 70
 	}
71 71
 
72
-	$pdf->AddPage( 'L', 'A4' );
73
-	$pdf->setImageScale( 1.5 );
74
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
75
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
76
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
72
+	$pdf->AddPage('L', 'A4');
73
+	$pdf->setImageScale(1.5);
74
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
75
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
76
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
77 77
 
78 78
 	// Image URL should have absolute path. @see https://tcpdf.org/examples/example_009/.
79
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_DIR . 'assets/dist/images/give-logo-small.png' ), 247, 8 );
79
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_DIR.'assets/dist/images/give-logo-small.png'), 247, 8);
80 80
 
81
-	$pdf->SetMargins( 8, 8, 8 );
82
-	$pdf->SetX( 8 );
81
+	$pdf->SetMargins(8, 8, 8);
82
+	$pdf->SetX(8);
83 83
 
84
-	$pdf->SetFont( $default_font, '', 16 );
85
-	$pdf->SetTextColor( 50, 50, 50 );
86
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
84
+	$pdf->SetFont($default_font, '', 16);
85
+	$pdf->SetTextColor(50, 50, 50);
86
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
87 87
 
88
-	$pdf->SetFont( $default_font, '', 13 );
89
-	$pdf->SetTextColor( 150, 150, 150 );
90
-	$pdf->Ln( 1 );
91
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
88
+	$pdf->SetFont($default_font, '', 13);
89
+	$pdf->SetTextColor(150, 150, 150);
90
+	$pdf->Ln(1);
91
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
92 92
 	$pdf->Ln();
93
-	$pdf->SetTextColor( 50, 50, 50 );
94
-	$pdf->SetFont( $default_font, '', 14 );
95
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
96
-	$pdf->SetFont( $default_font, '', 12 );
93
+	$pdf->SetTextColor(50, 50, 50);
94
+	$pdf->SetFont($default_font, '', 14);
95
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
96
+	$pdf->SetFont($default_font, '', 12);
97 97
 
98
-	$pdf->SetFillColor( 238, 238, 238 );
99
-	$pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color.
100
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
101
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
98
+	$pdf->SetFillColor(238, 238, 238);
99
+	$pdf->SetTextColor(0, 0, 0, 100); // Set Black color.
100
+	$pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
101
+	$pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
102 102
 
103 103
 	// Display Categories Heading only, if user has opted for it.
104
-	if ( $categories_enabled ) {
105
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
104
+	if ($categories_enabled) {
105
+		$pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
106 106
 	}
107 107
 
108 108
 	// Display Tags Heading only, if user has opted for it.
109
-	if ( $tags_enabled ) {
110
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
109
+	if ($tags_enabled) {
110
+		$pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
111 111
 	}
112 112
 
113
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
114
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
113
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
114
+	$pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
115 115
 
116 116
 	// Set Custom Font to support various currencies.
117
-	$pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 );
117
+	$pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12);
118 118
 
119 119
 	// Object for getting stats.
120 120
 	$donation_stats = new Give_Payment_Stats();
121 121
 
122
-	$give_forms = get_posts( array(
122
+	$give_forms = get_posts(array(
123 123
 		'post_type'        => 'give_forms',
124
-		'posts_per_page'   => - 1,
124
+		'posts_per_page'   => -1,
125 125
 		'suppress_filters' => false,
126
-	) );
126
+	));
127 127
 
128
-	if ( $give_forms ) {
129
-		$pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) );
128
+	if ($give_forms) {
129
+		$pdf->SetWidths(array(50, 50, 45, 45, 45, 45));
130 130
 
131
-		foreach ( $give_forms as $form ):
132
-			$pdf->SetFillColor( 255, 255, 255 );
131
+		foreach ($give_forms as $form):
132
+			$pdf->SetFillColor(255, 255, 255);
133 133
 
134 134
 			$title = $form->post_title;
135 135
 
136
-			if ( give_has_variable_prices( $form->ID ) ) {
137
-				$price = html_entity_decode( give_price_range( $form->ID, false ), ENT_COMPAT, 'UTF-8' );
136
+			if (give_has_variable_prices($form->ID)) {
137
+				$price = html_entity_decode(give_price_range($form->ID, false), ENT_COMPAT, 'UTF-8');
138 138
 			} else {
139
-				$price = give_currency_filter( give_get_form_price( $form->ID ), array( 'decode_currency' => true ) );
139
+				$price = give_currency_filter(give_get_form_price($form->ID), array('decode_currency' => true));
140 140
 			}
141 141
 
142 142
 			// Display Categories Data only, if user has opted for it.
143 143
 			$categories = array();
144
-			if ( $categories_enabled ) {
145
-				$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
146
-				$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
144
+			if ($categories_enabled) {
145
+				$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
146
+				$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
147 147
 			}
148 148
 
149 149
 			// Display Tags Data only, if user has opted for it.
150 150
 			$tags = array();
151
-			if ( $tags_enabled ) {
152
-				$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
153
-				$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
151
+			if ($tags_enabled) {
152
+				$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
153
+				$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
154 154
 			}
155 155
 
156
-			$sales    = $donation_stats->get_sales( $form->ID, 'this_year' );
157
-			$earnings = give_currency_filter( give_format_amount( $donation_stats->get_earnings( $form->ID, 'this_year' ), array( 'sanitize' => false, ) ), array( 'decode_currency' => true ) );
156
+			$sales    = $donation_stats->get_sales($form->ID, 'this_year');
157
+			$earnings = give_currency_filter(give_format_amount($donation_stats->get_earnings($form->ID, 'this_year'), array('sanitize' => false,)), array('decode_currency' => true));
158 158
 
159 159
 			// This will help filter data before appending it to PDF Receipt.
160 160
 			$prepare_pdf_data   = array();
@@ -162,54 +162,54 @@  discard block
 block discarded – undo
162 162
 			$prepare_pdf_data[] = $price;
163 163
 
164 164
 			// Append Categories Data only, if user has opted for it.
165
-			if ( $categories_enabled ) {
165
+			if ($categories_enabled) {
166 166
 				$prepare_pdf_data[] = $categories;
167 167
 			}
168 168
 
169 169
 			// Append Tags Data only, if user has opted for it.
170
-			if ( $tags_enabled ) {
170
+			if ($tags_enabled) {
171 171
 				$prepare_pdf_data[] = $tags;
172 172
 			}
173 173
 
174 174
 			$prepare_pdf_data[] = $sales;
175 175
 			$prepare_pdf_data[] = $earnings;
176 176
 
177
-			$pdf->Row( $prepare_pdf_data );
177
+			$pdf->Row($prepare_pdf_data);
178 178
 
179 179
 		endforeach;
180 180
 	} else {
181 181
 
182 182
 		// Fix: Minor Styling Alignment Issue for PDF.
183
-		if ( $categories_enabled && $tags_enabled ) {
183
+		if ($categories_enabled && $tags_enabled) {
184 184
 			$no_found_width = 280;
185
-		} elseif ( $categories_enabled || $tags_enabled ) {
185
+		} elseif ($categories_enabled || $tags_enabled) {
186 186
 			$no_found_width = 235;
187 187
 		} else {
188 188
 			$no_found_width = 190;
189 189
 		}
190
-		$title = utf8_decode( __( 'No forms found.', 'give' ) );
191
-		$pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false );
190
+		$title = utf8_decode(__('No forms found.', 'give'));
191
+		$pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false);
192 192
 	}// End if().
193 193
 	$pdf->Ln();
194
-	$pdf->SetTextColor( 50, 50, 50 );
195
-	$pdf->SetFont( $default_font, '', 14 );
194
+	$pdf->SetTextColor(50, 50, 50);
195
+	$pdf->SetFont($default_font, '', 14);
196 196
 
197 197
 	// Output Graph on a new page.
198
-	$pdf->AddPage( 'L', 'A4' );
199
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
200
-	$pdf->SetFont( $default_font, '', 12 );
198
+	$pdf->AddPage('L', 'A4');
199
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
200
+	$pdf->SetFont($default_font, '', 12);
201 201
 
202
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
203
-	$image = str_replace( ' ', '%20', $image );
202
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
203
+	$image = str_replace(' ', '%20', $image);
204 204
 
205
-	$pdf->SetX( 25 );
206
-	$pdf->Image( $image . '&file=.png' );
207
-	$pdf->Ln( 7 );
208
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
205
+	$pdf->SetX(25);
206
+	$pdf->Image($image.'&file=.png');
207
+	$pdf->Ln(7);
208
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
209 209
 	exit();
210 210
 }
211 211
 
212
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
212
+add_action('give_generate_pdf', 'give_generate_pdf');
213 213
 
214 214
 /**
215 215
  * Draws Chart for PDF Report.
@@ -226,38 +226,38 @@  discard block
 block discarded – undo
226 226
  * @return string $chart->getUrl() URL for the Google Chart
227 227
  */
228 228
 function give_draw_chart_image() {
229
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
230
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
231
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
229
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
230
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
231
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
232 232
 
233
-	$chart = new GoogleChart( 'lc', 900, 330 );
233
+	$chart = new GoogleChart('lc', 900, 330);
234 234
 
235 235
 	$i        = 1;
236 236
 	$earnings = "";
237 237
 	$sales    = "";
238 238
 
239
-	while ( $i <= 12 ) :
240
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
241
-		$sales    .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
242
-		$i ++;
239
+	while ($i <= 12) :
240
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
241
+		$sales    .= give_get_sales_by_date(null, $i, date('Y')).",";
242
+		$i++;
243 243
 	endwhile;
244 244
 
245
-	$earnings_array = explode( ",", $earnings );
246
-	$sales_array    = explode( ",", $sales );
245
+	$earnings_array = explode(",", $earnings);
246
+	$sales_array    = explode(",", $sales);
247 247
 
248 248
 	$i = 0;
249
-	while ( $i <= 11 ) {
250
-		if ( empty( $sales_array[ $i ] ) ) {
251
-			$sales_array[ $i ] = 0;
249
+	while ($i <= 11) {
250
+		if (empty($sales_array[$i])) {
251
+			$sales_array[$i] = 0;
252 252
 		}
253
-		$i ++;
253
+		$i++;
254 254
 	}
255 255
 
256 256
 	$min_earnings   = 0;
257
-	$max_earnings   = max( $earnings_array );
258
-	$earnings_scale = round( $max_earnings, - 1 );
257
+	$max_earnings   = max($earnings_array);
258
+	$earnings_scale = round($max_earnings, - 1);
259 259
 
260
-	$data = new GoogleChartData( array(
260
+	$data = new GoogleChartData(array(
261 261
 		$earnings_array[0],
262 262
 		$earnings_array[1],
263 263
 		$earnings_array[2],
@@ -270,25 +270,25 @@  discard block
 block discarded – undo
270 270
 		$earnings_array[9],
271 271
 		$earnings_array[10],
272 272
 		$earnings_array[11],
273
-	) );
273
+	));
274 274
 
275
-	$data->setLegend( __( 'Income', 'give' ) );
276
-	$data->setColor( '1b58a3' );
277
-	$chart->addData( $data );
275
+	$data->setLegend(__('Income', 'give'));
276
+	$data->setColor('1b58a3');
277
+	$chart->addData($data);
278 278
 
279
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
280
-	$shape_marker->setColor( '000000' );
281
-	$shape_marker->setSize( 7 );
282
-	$shape_marker->setBorder( 2 );
283
-	$shape_marker->setData( $data );
284
-	$chart->addMarker( $shape_marker );
279
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
280
+	$shape_marker->setColor('000000');
281
+	$shape_marker->setSize(7);
282
+	$shape_marker->setBorder(2);
283
+	$shape_marker->setData($data);
284
+	$chart->addMarker($shape_marker);
285 285
 
286
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
287
-	$value_marker->setColor( '000000' );
288
-	$value_marker->setData( $data );
289
-	$chart->addMarker( $value_marker );
286
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
287
+	$value_marker->setColor('000000');
288
+	$value_marker->setData($data);
289
+	$chart->addMarker($value_marker);
290 290
 
291
-	$data = new GoogleChartData( array(
291
+	$data = new GoogleChartData(array(
292 292
 		$sales_array[0],
293 293
 		$sales_array[1],
294 294
 		$sales_array[2],
@@ -301,46 +301,46 @@  discard block
 block discarded – undo
301 301
 		$sales_array[9],
302 302
 		$sales_array[10],
303 303
 		$sales_array[11],
304
-	) );
305
-	$data->setLegend( __( 'Donations', 'give' ) );
306
-	$data->setColor( 'ff6c1c' );
307
-	$chart->addData( $data );
308
-
309
-	$chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
310
-
311
-	$chart->setScale( 0, $max_earnings );
312
-
313
-	$y_axis = new GoogleChartAxis( 'y' );
314
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
315
-	$chart->addAxis( $y_axis );
316
-
317
-	$x_axis = new GoogleChartAxis( 'x' );
318
-	$x_axis->setTickMarks( 5 );
319
-	$x_axis->setLabels( array(
320
-		__( 'Jan', 'give' ),
321
-		__( 'Feb', 'give' ),
322
-		__( 'Mar', 'give' ),
323
-		__( 'Apr', 'give' ),
324
-		__( 'May', 'give' ),
325
-		__( 'June', 'give' ),
326
-		__( 'July', 'give' ),
327
-		__( 'Aug', 'give' ),
328
-		__( 'Sept', 'give' ),
329
-		__( 'Oct', 'give' ),
330
-		__( 'Nov', 'give' ),
331
-		__( 'Dec', 'give' ),
332
-	) );
333
-	$chart->addAxis( $x_axis );
334
-
335
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
336
-	$shape_marker->setSize( 6 );
337
-	$shape_marker->setBorder( 2 );
338
-	$shape_marker->setData( $data );
339
-	$chart->addMarker( $shape_marker );
340
-
341
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
342
-	$value_marker->setData( $data );
343
-	$chart->addMarker( $value_marker );
304
+	));
305
+	$data->setLegend(__('Donations', 'give'));
306
+	$data->setColor('ff6c1c');
307
+	$chart->addData($data);
308
+
309
+	$chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18);
310
+
311
+	$chart->setScale(0, $max_earnings);
312
+
313
+	$y_axis = new GoogleChartAxis('y');
314
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
315
+	$chart->addAxis($y_axis);
316
+
317
+	$x_axis = new GoogleChartAxis('x');
318
+	$x_axis->setTickMarks(5);
319
+	$x_axis->setLabels(array(
320
+		__('Jan', 'give'),
321
+		__('Feb', 'give'),
322
+		__('Mar', 'give'),
323
+		__('Apr', 'give'),
324
+		__('May', 'give'),
325
+		__('June', 'give'),
326
+		__('July', 'give'),
327
+		__('Aug', 'give'),
328
+		__('Sept', 'give'),
329
+		__('Oct', 'give'),
330
+		__('Nov', 'give'),
331
+		__('Dec', 'give'),
332
+	));
333
+	$chart->addAxis($x_axis);
334
+
335
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
336
+	$shape_marker->setSize(6);
337
+	$shape_marker->setBorder(2);
338
+	$shape_marker->setData($data);
339
+	$chart->addMarker($shape_marker);
340
+
341
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
342
+	$value_marker->setData($data);
343
+	$chart->addMarker($value_marker);
344 344
 
345 345
 	return $chart->getUrl();
346 346
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +502 added lines, -502 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,39 +98,39 @@  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, false );
107
+			update_option('give_completed_upgrades', $completed_upgrades, false);
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
-		case version_compare( $give_version, '2.2.0', '<' ) :
122
+		case version_compare($give_version, '2.2.0', '<') :
123 123
 			give_v220_upgrades();
124 124
 			$did_upgrade = true;
125 125
 	}
126 126
 
127
-	if ( $did_upgrade ) {
128
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false );
127
+	if ($did_upgrade) {
128
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false);
129 129
 	}
130 130
 }
131 131
 
132
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
133
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
132
+add_action('admin_init', 'give_do_automatic_upgrades');
133
+add_action('give_upgrades', 'give_do_automatic_upgrades');
134 134
 
135 135
 /**
136 136
  * Display Upgrade Notices.
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
  *
145 145
  * @return void
146 146
  */
147
-function give_show_upgrade_notices( $give_updates ) {
147
+function give_show_upgrade_notices($give_updates) {
148 148
 	// v1.3.2 Upgrades
149 149
 	$give_updates->register(
150 150
 		array(
@@ -210,32 +210,32 @@  discard block
 block discarded – undo
210 210
 	);
211 211
 
212 212
 	// v1.8.17 Upgrades for donations.
213
-	$give_updates->register( array(
213
+	$give_updates->register(array(
214 214
 		'id'       => 'v1817_update_donation_iranian_currency_code',
215 215
 		'version'  => '1.8.17',
216 216
 		'callback' => 'give_v1817_update_donation_iranian_currency_code',
217
-	) );
217
+	));
218 218
 
219 219
 	// v1.8.17 Upgrades for cleanup of user roles.
220
-	$give_updates->register( array(
220
+	$give_updates->register(array(
221 221
 		'id'       => 'v1817_cleanup_user_roles',
222 222
 		'version'  => '1.8.17',
223 223
 		'callback' => 'give_v1817_cleanup_user_roles',
224
-	) );
224
+	));
225 225
 
226 226
 	// v1.8.18 Upgrades for assigning custom amount to existing set donations.
227
-	$give_updates->register( array(
227
+	$give_updates->register(array(
228 228
 		'id'       => 'v1818_assign_custom_amount_set_donation',
229 229
 		'version'  => '1.8.18',
230 230
 		'callback' => 'give_v1818_assign_custom_amount_set_donation',
231
-	) );
231
+	));
232 232
 
233 233
 	// v1.8.18 Cleanup the Give Worker Role Caps.
234
-	$give_updates->register( array(
234
+	$give_updates->register(array(
235 235
 		'id'       => 'v1818_give_worker_role_cleanup',
236 236
 		'version'  => '1.8.18',
237 237
 		'callback' => 'give_v1818_give_worker_role_cleanup',
238
-	) );
238
+	));
239 239
 
240 240
 	// v2.0.0 Upgrades
241 241
 	$give_updates->register(
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			'id'       => 'v20_move_metadata_into_new_table',
290 290
 			'version'  => '2.0.0',
291 291
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
292
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
292
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
293 293
 		)
294 294
 	);
295 295
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			'id'       => 'v201_move_metadata_into_new_table',
336 336
 			'version'  => '2.0.1',
337 337
 			'callback' => 'give_v201_move_metadata_into_new_table_callback',
338
-			'depend'   => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ),
338
+			'depend'   => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'),
339 339
 		)
340 340
 	);
341 341
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 			'id'       => 'v213_delete_donation_meta',
364 364
 			'version'  => '2.1.3',
365 365
 			'callback' => 'give_v213_delete_donation_meta_callback',
366
-			'depends'  => array( 'v201_move_metadata_into_new_table' )
366
+			'depends'  => array('v201_move_metadata_into_new_table')
367 367
 		)
368 368
 	);
369 369
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 			'id'       => 'v213_rename_donation_meta_type',
374 374
 			'version'  => '2.1.3',
375 375
 			'callback' => 'give_v213_rename_donation_meta_type_callback',
376
-			'depend'   => array( 'v20_move_metadata_into_new_table' ),
376
+			'depend'   => array('v20_move_metadata_into_new_table'),
377 377
 		)
378 378
 	);
379 379
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	);
388 388
 }
389 389
 
390
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
390
+add_action('give_register_updates', 'give_show_upgrade_notices');
391 391
 
392 392
 /**
393 393
  * Triggers all upgrade functions
@@ -399,29 +399,29 @@  discard block
 block discarded – undo
399 399
  */
400 400
 function give_trigger_upgrades() {
401 401
 
402
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
403
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
402
+	if ( ! current_user_can('manage_give_settings')) {
403
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
404 404
 			'response' => 403,
405
-		) );
405
+		));
406 406
 	}
407 407
 
408
-	$give_version = get_option( 'give_version' );
408
+	$give_version = get_option('give_version');
409 409
 
410
-	if ( ! $give_version ) {
410
+	if ( ! $give_version) {
411 411
 		// 1.0 is the first version to use this option so we must add it.
412 412
 		$give_version = '1.0';
413
-		add_option( 'give_version', $give_version, '', false );
413
+		add_option('give_version', $give_version, '', false);
414 414
 	}
415 415
 
416
-	update_option( 'give_version', GIVE_VERSION, false );
417
-	delete_option( 'give_doing_upgrade' );
416
+	update_option('give_version', GIVE_VERSION, false);
417
+	delete_option('give_doing_upgrade');
418 418
 
419
-	if ( DOING_AJAX ) {
420
-		die( 'complete' );
419
+	if (DOING_AJAX) {
420
+		die('complete');
421 421
 	} // End if().
422 422
 }
423 423
 
424
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
424
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
425 425
 
426 426
 
427 427
 /**
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
 
440 440
 	// UPDATE DB METAKEYS.
441 441
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
442
-	$query = $wpdb->query( $sql );
442
+	$query = $wpdb->query($sql);
443 443
 
444 444
 	$give_updates->percentage = 100;
445
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
445
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
446 446
 }
447 447
 
448 448
 
@@ -466,24 +466,24 @@  discard block
 block discarded – undo
466 466
 	$where  .= "AND ( p.post_status = 'abandoned' )";
467 467
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
468 468
 
469
-	$sql            = $select . $join . $where;
470
-	$found_payments = $wpdb->get_col( $sql );
469
+	$sql            = $select.$join.$where;
470
+	$found_payments = $wpdb->get_col($sql);
471 471
 
472
-	foreach ( $found_payments as $payment ) {
472
+	foreach ($found_payments as $payment) {
473 473
 
474 474
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
475
-		$modified_time = get_post_modified_time( 'U', false, $payment );
475
+		$modified_time = get_post_modified_time('U', false, $payment);
476 476
 
477 477
 		// 1450124863 =  12/10/2015 20:42:25.
478
-		if ( $modified_time >= 1450124863 ) {
478
+		if ($modified_time >= 1450124863) {
479 479
 
480
-			give_update_payment_status( $payment, 'pending' );
480
+			give_update_payment_status($payment, 'pending');
481 481
 
482 482
 		}
483 483
 	}
484 484
 
485 485
 	$give_updates->percentage = 100;
486
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
486
+	give_set_upgrade_complete('upgrade_give_offline_status');
487 487
 }
488 488
 
489 489
 
@@ -496,17 +496,17 @@  discard block
 block discarded – undo
496 496
  */
497 497
 function give_v152_cleanup_users() {
498 498
 
499
-	$give_version = get_option( 'give_version' );
499
+	$give_version = get_option('give_version');
500 500
 
501
-	if ( ! $give_version ) {
501
+	if ( ! $give_version) {
502 502
 		// 1.0 is the first version to use this option so we must add it.
503 503
 		$give_version = '1.0';
504 504
 	}
505 505
 
506
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
506
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
507 507
 
508 508
 	// v1.5.2 Upgrades
509
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
509
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
510 510
 
511 511
 		// Delete all caps with "ss".
512 512
 		// Also delete all unused "campaign" roles.
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 		);
554 554
 
555 555
 		global $wp_roles;
556
-		foreach ( $delete_caps as $cap ) {
557
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
558
-				$wp_roles->remove_cap( $role, $cap );
556
+		foreach ($delete_caps as $cap) {
557
+			foreach (array_keys($wp_roles->roles) as $role) {
558
+				$wp_roles->remove_cap($role, $cap);
559 559
 			}
560 560
 		}
561 561
 
@@ -565,15 +565,15 @@  discard block
 block discarded – undo
565 565
 		$roles->add_caps();
566 566
 
567 567
 		// The Update Ran.
568
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false );
569
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
570
-		delete_option( 'give_doing_upgrade' );
568
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false);
569
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
570
+		delete_option('give_doing_upgrade');
571 571
 
572 572
 	}// End if().
573 573
 
574 574
 }
575 575
 
576
-add_action( 'admin_init', 'give_v152_cleanup_users' );
576
+add_action('admin_init', 'give_v152_cleanup_users');
577 577
 
578 578
 /**
579 579
  * 1.6 Upgrade routine to create the customer meta table.
@@ -616,53 +616,53 @@  discard block
 block discarded – undo
616 616
 
617 617
 	// Get addons license key.
618 618
 	$addons = array();
619
-	foreach ( $give_options as $key => $value ) {
620
-		if ( false !== strpos( $key, '_license_key' ) ) {
621
-			$addons[ $key ] = $value;
619
+	foreach ($give_options as $key => $value) {
620
+		if (false !== strpos($key, '_license_key')) {
621
+			$addons[$key] = $value;
622 622
 		}
623 623
 	}
624 624
 
625 625
 	// Bailout: We do not have any addon license data to upgrade.
626
-	if ( empty( $addons ) ) {
626
+	if (empty($addons)) {
627 627
 		return false;
628 628
 	}
629 629
 
630
-	foreach ( $addons as $key => $addon_license ) {
630
+	foreach ($addons as $key => $addon_license) {
631 631
 
632 632
 		// Get addon shortname.
633
-		$shortname = str_replace( '_license_key', '', $key );
633
+		$shortname = str_replace('_license_key', '', $key);
634 634
 
635 635
 		// Addon license option name.
636
-		$addon_license_option_name = $shortname . '_license_active';
636
+		$addon_license_option_name = $shortname.'_license_active';
637 637
 
638 638
 		// bailout if license is empty.
639
-		if ( empty( $addon_license ) ) {
640
-			delete_option( $addon_license_option_name );
639
+		if (empty($addon_license)) {
640
+			delete_option($addon_license_option_name);
641 641
 			continue;
642 642
 		}
643 643
 
644 644
 		// Get addon name.
645 645
 		$addon_name       = array();
646
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
647
-		foreach ( $addon_name_parts as $name_part ) {
646
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
647
+		foreach ($addon_name_parts as $name_part) {
648 648
 
649 649
 			// Fix addon name
650
-			switch ( $name_part ) {
650
+			switch ($name_part) {
651 651
 				case 'authorizenet' :
652 652
 					$name_part = 'authorize.net';
653 653
 					break;
654 654
 			}
655 655
 
656
-			$addon_name[] = ucfirst( $name_part );
656
+			$addon_name[] = ucfirst($name_part);
657 657
 		}
658 658
 
659
-		$addon_name = implode( ' ', $addon_name );
659
+		$addon_name = implode(' ', $addon_name);
660 660
 
661 661
 		// Data to send to the API.
662 662
 		$api_params = array(
663 663
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
664 664
 			'license'    => $addon_license,
665
-			'item_name'  => urlencode( $addon_name ),
665
+			'item_name'  => urlencode($addon_name),
666 666
 			'url'        => home_url(),
667 667
 		);
668 668
 
@@ -677,17 +677,17 @@  discard block
 block discarded – undo
677 677
 		);
678 678
 
679 679
 		// Make sure there are no errors.
680
-		if ( is_wp_error( $response ) ) {
681
-			delete_option( $addon_license_option_name );
680
+		if (is_wp_error($response)) {
681
+			delete_option($addon_license_option_name);
682 682
 			continue;
683 683
 		}
684 684
 
685 685
 		// Tell WordPress to look for updates.
686
-		set_site_transient( 'update_plugins', null );
686
+		set_site_transient('update_plugins', null);
687 687
 
688 688
 		// Decode license data.
689
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
690
-		update_option( $addon_license_option_name, $license_data, false );
689
+		$license_data = json_decode(wp_remote_retrieve_body($response));
690
+		update_option($addon_license_option_name, $license_data, false);
691 691
 	}// End foreach().
692 692
 }
693 693
 
@@ -717,9 +717,9 @@  discard block
 block discarded – undo
717 717
 	);
718 718
 
719 719
 	global $wp_roles;
720
-	foreach ( $delete_caps as $cap ) {
721
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
722
-			$wp_roles->remove_cap( $role, $cap );
720
+	foreach ($delete_caps as $cap) {
721
+		foreach (array_keys($wp_roles->roles) as $role) {
722
+			$wp_roles->remove_cap($role, $cap);
723 723
 		}
724 724
 	}
725 725
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 function give_v18_upgrades_core_setting() {
754 754
 	// Core settings which changes from checkbox to radio.
755 755
 	$core_setting_names = array_merge(
756
-		array_keys( give_v18_renamed_core_settings() ),
756
+		array_keys(give_v18_renamed_core_settings()),
757 757
 		array(
758 758
 			'uninstall_on_delete',
759 759
 			'scripts_footer',
@@ -765,48 +765,48 @@  discard block
 block discarded – undo
765 765
 	);
766 766
 
767 767
 	// Bailout: If not any setting define.
768
-	if ( $give_settings = get_option( 'give_settings' ) ) {
768
+	if ($give_settings = get_option('give_settings')) {
769 769
 
770 770
 		$setting_changed = false;
771 771
 
772 772
 		// Loop: check each setting field.
773
-		foreach ( $core_setting_names as $setting_name ) {
773
+		foreach ($core_setting_names as $setting_name) {
774 774
 			// New setting name.
775
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
775
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
776 776
 
777 777
 			// Continue: If setting already set.
778 778
 			if (
779
-				array_key_exists( $new_setting_name, $give_settings )
780
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
779
+				array_key_exists($new_setting_name, $give_settings)
780
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
781 781
 			) {
782 782
 				continue;
783 783
 			}
784 784
 
785 785
 			// Set checkbox value to radio value.
786
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
786
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
787 787
 
788 788
 			// @see https://github.com/WordImpress/Give/issues/1063.
789
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
789
+			if (false !== strpos($setting_name, 'disable_')) {
790 790
 
791
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
792
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
791
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
792
+			} elseif (false !== strpos($setting_name, 'enable_')) {
793 793
 
794
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
794
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
795 795
 			}
796 796
 
797 797
 			// Tell bot to update core setting to db.
798
-			if ( ! $setting_changed ) {
798
+			if ( ! $setting_changed) {
799 799
 				$setting_changed = true;
800 800
 			}
801 801
 		}
802 802
 
803 803
 		// Update setting only if they changed.
804
-		if ( $setting_changed ) {
805
-			update_option( 'give_settings', $give_settings, false );
804
+		if ($setting_changed) {
805
+			update_option('give_settings', $give_settings, false);
806 806
 		}
807 807
 	}// End if().
808 808
 
809
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
809
+	give_set_upgrade_complete('v18_upgrades_core_setting');
810 810
 }
811 811
 
812 812
 /**
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 	$give_updates = Give_Updates::get_instance();
821 821
 
822 822
 	// form query
823
-	$forms = new WP_Query( array(
823
+	$forms = new WP_Query(array(
824 824
 			'paged'          => $give_updates->step,
825 825
 			'status'         => 'any',
826 826
 			'order'          => 'ASC',
@@ -829,41 +829,41 @@  discard block
 block discarded – undo
829 829
 		)
830 830
 	);
831 831
 
832
-	if ( $forms->have_posts() ) {
833
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
832
+	if ($forms->have_posts()) {
833
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
834 834
 
835
-		while ( $forms->have_posts() ) {
835
+		while ($forms->have_posts()) {
836 836
 			$forms->the_post();
837 837
 
838 838
 			// Form content.
839 839
 			// Note in version 1.8 display content setting split into display content and content placement setting.
840 840
 			// You can delete _give_content_option in future.
841
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
842
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
843
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
844
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
841
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
842
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
843
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
844
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
845 845
 
846
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
847
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
846
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
847
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
848 848
 			}
849 849
 
850 850
 			// "Disable" Guest Donation. Checkbox.
851 851
 			// See: https://github.com/WordImpress/Give/issues/1470.
852
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
853
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
854
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
852
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
853
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
854
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
855 855
 
856 856
 			// Offline Donations.
857 857
 			// See: https://github.com/WordImpress/Give/issues/1579.
858
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
859
-			if ( 'no' === $offline_donation ) {
858
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
859
+			if ('no' === $offline_donation) {
860 860
 				$offline_donation_newval = 'global';
861
-			} elseif ( 'yes' === $offline_donation ) {
861
+			} elseif ('yes' === $offline_donation) {
862 862
 				$offline_donation_newval = 'enabled';
863 863
 			} else {
864 864
 				$offline_donation_newval = 'disabled';
865 865
 			}
866
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
866
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
867 867
 
868 868
 			// Convert yes/no setting field to enabled/disabled.
869 869
 			$form_radio_settings = array(
@@ -883,15 +883,15 @@  discard block
 block discarded – undo
883 883
 				'_give_offline_donation_enable_billing_fields_single',
884 884
 			);
885 885
 
886
-			foreach ( $form_radio_settings as $meta_key ) {
886
+			foreach ($form_radio_settings as $meta_key) {
887 887
 				// Get value.
888
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
888
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
889 889
 
890 890
 				// Convert meta value only if it is in yes/no/none.
891
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
891
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
892 892
 
893
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
894
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
893
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
894
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
895 895
 				}
896 896
 			}
897 897
 		}// End while().
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 
901 901
 	} else {
902 902
 		// No more forms found, finish up.
903
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
903
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
904 904
 	}
905 905
 }
906 906
 
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 				'%_transient_give_stats_%',
968 968
 				'give_cache%',
969 969
 				'%_transient_give_add_ons_feed%',
970
-				'%_transient__give_ajax_works' .
970
+				'%_transient__give_ajax_works'.
971 971
 				'%_transient_give_total_api_keys%',
972 972
 				'%_transient_give_i18n_give_promo_hide%',
973 973
 				'%_transient_give_contributors%',
@@ -994,24 +994,24 @@  discard block
 block discarded – undo
994 994
 		ARRAY_A
995 995
 	);
996 996
 
997
-	if ( ! empty( $user_apikey_options ) ) {
998
-		foreach ( $user_apikey_options as $user ) {
999
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
1000
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
1001
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
997
+	if ( ! empty($user_apikey_options)) {
998
+		foreach ($user_apikey_options as $user) {
999
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
1000
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
1001
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
1002 1002
 		}
1003 1003
 	}
1004 1004
 
1005
-	if ( ! empty( $cached_options ) ) {
1006
-		foreach ( $cached_options as $option ) {
1007
-			switch ( true ) {
1008
-				case ( false !== strpos( $option, 'transient' ) ):
1009
-					$option = str_replace( '_transient_', '', $option );
1010
-					delete_transient( $option );
1005
+	if ( ! empty($cached_options)) {
1006
+		foreach ($cached_options as $option) {
1007
+			switch (true) {
1008
+				case (false !== strpos($option, 'transient')):
1009
+					$option = str_replace('_transient_', '', $option);
1010
+					delete_transient($option);
1011 1011
 					break;
1012 1012
 
1013 1013
 				default:
1014
-					delete_option( $option );
1014
+					delete_option($option);
1015 1015
 			}
1016 1016
 		}
1017 1017
 	}
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 	global $wp_roles;
1030 1030
 
1031 1031
 	// Get the role object.
1032
-	$give_worker = get_role( 'give_worker' );
1032
+	$give_worker = get_role('give_worker');
1033 1033
 
1034 1034
 	// A list of capabilities to add for give workers.
1035 1035
 	$caps_to_add = array(
@@ -1037,9 +1037,9 @@  discard block
 block discarded – undo
1037 1037
 		'edit_pages',
1038 1038
 	);
1039 1039
 
1040
-	foreach ( $caps_to_add as $cap ) {
1040
+	foreach ($caps_to_add as $cap) {
1041 1041
 		// Add the capability.
1042
-		$give_worker->add_cap( $cap );
1042
+		$give_worker->add_cap($cap);
1043 1043
 	}
1044 1044
 
1045 1045
 }
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	$give_updates = Give_Updates::get_instance();
1057 1057
 
1058 1058
 	// form query.
1059
-	$donation_forms = new WP_Query( array(
1059
+	$donation_forms = new WP_Query(array(
1060 1060
 			'paged'          => $give_updates->step,
1061 1061
 			'status'         => 'any',
1062 1062
 			'order'          => 'ASC',
@@ -1065,10 +1065,10 @@  discard block
 block discarded – undo
1065 1065
 		)
1066 1066
 	);
1067 1067
 
1068
-	if ( $donation_forms->have_posts() ) {
1069
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1068
+	if ($donation_forms->have_posts()) {
1069
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1070 1070
 
1071
-		while ( $donation_forms->have_posts() ) {
1071
+		while ($donation_forms->have_posts()) {
1072 1072
 			$donation_forms->the_post();
1073 1073
 			$form_id = get_the_ID();
1074 1074
 
@@ -1076,41 +1076,41 @@  discard block
 block discarded – undo
1076 1076
 			update_post_meta(
1077 1077
 				$form_id,
1078 1078
 				'_give_set_price',
1079
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1079
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1080 1080
 			);
1081 1081
 
1082 1082
 			// Remove formatting from _give_custom_amount_minimum.
1083 1083
 			update_post_meta(
1084 1084
 				$form_id,
1085 1085
 				'_give_custom_amount_minimum',
1086
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1086
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1087 1087
 			);
1088 1088
 
1089 1089
 			// Bailout.
1090
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1090
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1091 1091
 				continue;
1092 1092
 			}
1093 1093
 
1094
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1094
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1095 1095
 
1096
-			if ( ! empty( $donation_levels ) ) {
1096
+			if ( ! empty($donation_levels)) {
1097 1097
 
1098
-				foreach ( $donation_levels as $index => $donation_level ) {
1099
-					if ( isset( $donation_level['_give_amount'] ) ) {
1100
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1098
+				foreach ($donation_levels as $index => $donation_level) {
1099
+					if (isset($donation_level['_give_amount'])) {
1100
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1101 1101
 					}
1102 1102
 				}
1103 1103
 
1104
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1104
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1105 1105
 
1106
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1106
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1107 1107
 
1108
-				$min_amount = min( $donation_levels_amounts );
1109
-				$max_amount = max( $donation_levels_amounts );
1108
+				$min_amount = min($donation_levels_amounts);
1109
+				$max_amount = max($donation_levels_amounts);
1110 1110
 
1111 1111
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1112
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1113
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1112
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1113
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1114 1114
 			}
1115 1115
 
1116 1116
 		}
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 		wp_reset_postdata();
1120 1120
 	} else {
1121 1121
 		// The Update Ran.
1122
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1122
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1123 1123
 	}
1124 1124
 
1125 1125
 }
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
  */
1170 1170
 function give_v20_upgrades() {
1171 1171
 	// Update cache setting.
1172
-	give_update_option( 'cache', 'enabled' );
1172
+	give_update_option('cache', 'enabled');
1173 1173
 
1174 1174
 	// Upgrade email settings.
1175 1175
 	give_v20_upgrades_email_setting();
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 	$all_setting = give_get_settings();
1189 1189
 
1190 1190
 	// Bailout on fresh install.
1191
-	if ( empty( $all_setting ) ) {
1191
+	if (empty($all_setting)) {
1192 1192
 		return;
1193 1193
 	}
1194 1194
 
@@ -1207,19 +1207,19 @@  discard block
 block discarded – undo
1207 1207
 		'admin_notices'                 => 'new-donation_notification',
1208 1208
 	);
1209 1209
 
1210
-	foreach ( $settings as $old_setting => $new_setting ) {
1210
+	foreach ($settings as $old_setting => $new_setting) {
1211 1211
 		// Do not update already modified
1212
-		if ( ! is_array( $new_setting ) ) {
1213
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1212
+		if ( ! is_array($new_setting)) {
1213
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1214 1214
 				continue;
1215 1215
 			}
1216 1216
 		}
1217 1217
 
1218
-		switch ( $old_setting ) {
1218
+		switch ($old_setting) {
1219 1219
 			case 'admin_notices':
1220
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1220
+				$notification_status = give_get_option($old_setting, 'enabled');
1221 1221
 
1222
-				give_update_option( $new_setting, $notification_status );
1222
+				give_update_option($new_setting, $notification_status);
1223 1223
 
1224 1224
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1225 1225
 				// give_delete_option( $old_setting );
@@ -1230,19 +1230,19 @@  discard block
 block discarded – undo
1230 1230
 			case 'admin_notice_emails':
1231 1231
 				$recipients = give_get_admin_notice_emails();
1232 1232
 
1233
-				foreach ( $new_setting as $setting ) {
1233
+				foreach ($new_setting as $setting) {
1234 1234
 					// bailout if setting already exist.
1235
-					if ( array_key_exists( $setting, $all_setting ) ) {
1235
+					if (array_key_exists($setting, $all_setting)) {
1236 1236
 						continue;
1237 1237
 					}
1238 1238
 
1239
-					give_update_option( $setting, $recipients );
1239
+					give_update_option($setting, $recipients);
1240 1240
 				}
1241 1241
 				break;
1242 1242
 
1243 1243
 			default:
1244
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1245
-				give_delete_option( $old_setting );
1244
+				give_update_option($new_setting, give_get_option($old_setting));
1245
+				give_delete_option($old_setting);
1246 1246
 		}
1247 1247
 	}
1248 1248
 }
@@ -1259,22 +1259,22 @@  discard block
 block discarded – undo
1259 1259
 	$give_settings        = give_get_settings();
1260 1260
 	$give_setting_updated = false;
1261 1261
 
1262
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1262
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1263 1263
 		$give_settings['number_decimals']   = 0;
1264 1264
 		$give_settings['decimal_separator'] = '';
1265 1265
 		$give_setting_updated               = true;
1266 1266
 
1267
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1267
+	} elseif (empty($give_settings['decimal_separator'])) {
1268 1268
 		$give_settings['number_decimals'] = 0;
1269 1269
 		$give_setting_updated             = true;
1270 1270
 
1271
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1271
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1272 1272
 		$give_settings['number_decimals'] = 5;
1273 1273
 		$give_setting_updated             = true;
1274 1274
 	}
1275 1275
 
1276
-	if ( $give_setting_updated ) {
1277
-		update_option( 'give_settings', $give_settings, false );
1276
+	if ($give_setting_updated) {
1277
+		update_option('give_settings', $give_settings, false);
1278 1278
 	}
1279 1279
 }
1280 1280
 
@@ -1293,69 +1293,69 @@  discard block
 block discarded – undo
1293 1293
 	$give_updates = Give_Updates::get_instance();
1294 1294
 
1295 1295
 	// form query.
1296
-	$donation_forms = new WP_Query( array(
1296
+	$donation_forms = new WP_Query(array(
1297 1297
 			'paged'          => $give_updates->step,
1298 1298
 			'status'         => 'any',
1299 1299
 			'order'          => 'ASC',
1300
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1300
+			'post_type'      => array('give_forms', 'give_payment'),
1301 1301
 			'posts_per_page' => 20,
1302 1302
 		)
1303 1303
 	);
1304
-	if ( $donation_forms->have_posts() ) {
1305
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1304
+	if ($donation_forms->have_posts()) {
1305
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1306 1306
 
1307
-		while ( $donation_forms->have_posts() ) {
1307
+		while ($donation_forms->have_posts()) {
1308 1308
 			$donation_forms->the_post();
1309 1309
 			global $post;
1310 1310
 
1311
-			$meta = get_post_meta( $post->ID );
1311
+			$meta = get_post_meta($post->ID);
1312 1312
 
1313
-			switch ( $post->post_type ) {
1313
+			switch ($post->post_type) {
1314 1314
 				case 'give_forms':
1315 1315
 					// _give_set_price.
1316
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1317
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1316
+					if ( ! empty($meta['_give_set_price'][0])) {
1317
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1318 1318
 					}
1319 1319
 
1320 1320
 					// _give_custom_amount_minimum.
1321
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1322
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1321
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1322
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1323 1323
 					}
1324 1324
 
1325 1325
 					// _give_levels_minimum_amount.
1326
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1327
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1326
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1327
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1328 1328
 					}
1329 1329
 
1330 1330
 					// _give_levels_maximum_amount.
1331
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1332
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1331
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1332
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1333 1333
 					}
1334 1334
 
1335 1335
 					// _give_set_goal.
1336
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1337
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1336
+					if ( ! empty($meta['_give_set_goal'][0])) {
1337
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1338 1338
 					}
1339 1339
 
1340 1340
 					// _give_form_earnings.
1341
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1342
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1341
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1342
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1343 1343
 					}
1344 1344
 
1345 1345
 					// _give_custom_amount_minimum.
1346
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1347
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1346
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1347
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1348 1348
 
1349
-						foreach ( $donation_levels as $index => $level ) {
1350
-							if ( empty( $level['_give_amount'] ) ) {
1349
+						foreach ($donation_levels as $index => $level) {
1350
+							if (empty($level['_give_amount'])) {
1351 1351
 								continue;
1352 1352
 							}
1353 1353
 
1354
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1354
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1355 1355
 						}
1356 1356
 
1357 1357
 						$meta['_give_donation_levels'] = $donation_levels;
1358
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1358
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1359 1359
 					}
1360 1360
 
1361 1361
 
@@ -1363,8 +1363,8 @@  discard block
 block discarded – undo
1363 1363
 
1364 1364
 				case 'give_payment':
1365 1365
 					// _give_payment_total.
1366
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1367
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1366
+					if ( ! empty($meta['_give_payment_total'][0])) {
1367
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1368 1368
 					}
1369 1369
 
1370 1370
 					break;
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 		wp_reset_postdata();
1376 1376
 	} else {
1377 1377
 		// The Update Ran.
1378
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1378
+		give_set_upgrade_complete('v1812_update_amount_values');
1379 1379
 	}
1380 1380
 }
1381 1381
 
@@ -1394,22 +1394,22 @@  discard block
 block discarded – undo
1394 1394
 	$give_updates = Give_Updates::get_instance();
1395 1395
 
1396 1396
 	// form query.
1397
-	$donors = Give()->donors->get_donors( array(
1397
+	$donors = Give()->donors->get_donors(array(
1398 1398
 			'number' => 20,
1399
-			'offset' => $give_updates->get_offset( 20 ),
1399
+			'offset' => $give_updates->get_offset(20),
1400 1400
 		)
1401 1401
 	);
1402 1402
 
1403
-	if ( ! empty( $donors ) ) {
1404
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1403
+	if ( ! empty($donors)) {
1404
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1405 1405
 
1406 1406
 		/* @var Object $donor */
1407
-		foreach ( $donors as $donor ) {
1408
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1407
+		foreach ($donors as $donor) {
1408
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1409 1409
 		}
1410 1410
 	} else {
1411 1411
 		// The Update Ran.
1412
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1412
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1413 1413
 	}
1414 1414
 }
1415 1415
 
@@ -1423,25 +1423,25 @@  discard block
 block discarded – undo
1423 1423
 	$give_updates = Give_Updates::get_instance();
1424 1424
 
1425 1425
 	// Fetch all the existing donors.
1426
-	$donors = Give()->donors->get_donors( array(
1426
+	$donors = Give()->donors->get_donors(array(
1427 1427
 			'number' => 20,
1428
-			'offset' => $give_updates->get_offset( 20 ),
1428
+			'offset' => $give_updates->get_offset(20),
1429 1429
 		)
1430 1430
 	);
1431 1431
 
1432
-	if ( ! empty( $donors ) ) {
1433
-		$give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) );
1432
+	if ( ! empty($donors)) {
1433
+		$give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20));
1434 1434
 
1435 1435
 		/* @var Object $donor */
1436
-		foreach ( $donors as $donor ) {
1436
+		foreach ($donors as $donor) {
1437 1437
 			$user_id = $donor->user_id;
1438 1438
 
1439 1439
 			// Proceed, if donor is attached with user.
1440
-			if ( $user_id ) {
1441
-				$user = get_userdata( $user_id );
1440
+			if ($user_id) {
1441
+				$user = get_userdata($user_id);
1442 1442
 
1443 1443
 				// Update user role, if user has subscriber role.
1444
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1444
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1445 1445
 					wp_update_user(
1446 1446
 						array(
1447 1447
 							'ID'   => $user_id,
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
 		}
1454 1454
 	} else {
1455 1455
 		// The Update Ran.
1456
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1456
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1457 1457
 	}
1458 1458
 }
1459 1459
 
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
  */
1466 1466
 function give_v1813_upgrades() {
1467 1467
 	// Update admin setting.
1468
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1468
+	give_update_option('donor_default_user_role', 'give_donor');
1469 1469
 
1470 1470
 	// Update Give roles.
1471 1471
 	$roles = new Give_Roles();
@@ -1483,33 +1483,33 @@  discard block
 block discarded – undo
1483 1483
 	$give_updates = Give_Updates::get_instance();
1484 1484
 
1485 1485
 	// form query.
1486
-	$payments = new WP_Query( array(
1486
+	$payments = new WP_Query(array(
1487 1487
 			'paged'          => $give_updates->step,
1488 1488
 			'status'         => 'any',
1489 1489
 			'order'          => 'ASC',
1490
-			'post_type'      => array( 'give_payment' ),
1490
+			'post_type'      => array('give_payment'),
1491 1491
 			'posts_per_page' => 100,
1492 1492
 		)
1493 1493
 	);
1494 1494
 
1495
-	if ( $payments->have_posts() ) {
1496
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1495
+	if ($payments->have_posts()) {
1496
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1497 1497
 
1498
-		while ( $payments->have_posts() ) {
1498
+		while ($payments->have_posts()) {
1499 1499
 			$payments->the_post();
1500 1500
 
1501
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1501
+			$payment_meta = give_get_payment_meta(get_the_ID());
1502 1502
 
1503
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1503
+			if ('RIAL' === $payment_meta['currency']) {
1504 1504
 				$payment_meta['currency'] = 'IRR';
1505
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1505
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1506 1506
 			}
1507 1507
 
1508 1508
 		}
1509 1509
 
1510 1510
 	} else {
1511 1511
 		// The Update Ran.
1512
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1512
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1513 1513
 	}
1514 1514
 }
1515 1515
 
@@ -1522,9 +1522,9 @@  discard block
 block discarded – undo
1522 1522
 function give_v1817_upgrades() {
1523 1523
 	$give_settings = give_get_settings();
1524 1524
 
1525
-	if ( 'RIAL' === $give_settings['currency'] ) {
1525
+	if ('RIAL' === $give_settings['currency']) {
1526 1526
 		$give_settings['currency'] = 'IRR';
1527
-		update_option( 'give_settings', $give_settings, false );
1527
+		update_option('give_settings', $give_settings, false);
1528 1528
 	}
1529 1529
 }
1530 1530
 
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 
1538 1538
 	global $wp_roles;
1539 1539
 
1540
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1540
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1541 1541
 		return;
1542 1542
 	}
1543 1543
 
@@ -1561,15 +1561,15 @@  discard block
 block discarded – undo
1561 1561
 		),
1562 1562
 	);
1563 1563
 
1564
-	foreach ( $add_caps as $role => $caps ) {
1565
-		foreach ( $caps as $cap ) {
1566
-			$wp_roles->add_cap( $role, $cap );
1564
+	foreach ($add_caps as $role => $caps) {
1565
+		foreach ($caps as $cap) {
1566
+			$wp_roles->add_cap($role, $cap);
1567 1567
 		}
1568 1568
 	}
1569 1569
 
1570
-	foreach ( $remove_caps as $role => $caps ) {
1571
-		foreach ( $caps as $cap ) {
1572
-			$wp_roles->remove_cap( $role, $cap );
1570
+	foreach ($remove_caps as $role => $caps) {
1571
+		foreach ($caps as $cap) {
1572
+			$wp_roles->remove_cap($role, $cap);
1573 1573
 		}
1574 1574
 	}
1575 1575
 
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 	$roles->add_roles();
1594 1594
 	$roles->add_caps();
1595 1595
 
1596
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1596
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1597 1597
 }
1598 1598
 
1599 1599
 /**
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
 function give_v1818_upgrades() {
1605 1605
 
1606 1606
 	// Remove email_access_installed from give_settings.
1607
-	give_delete_option( 'email_access_installed' );
1607
+	give_delete_option('email_access_installed');
1608 1608
 }
1609 1609
 
1610 1610
 /**
@@ -1617,23 +1617,23 @@  discard block
 block discarded – undo
1617 1617
 	/* @var Give_Updates $give_updates */
1618 1618
 	$give_updates = Give_Updates::get_instance();
1619 1619
 
1620
-	$donations = new WP_Query( array(
1620
+	$donations = new WP_Query(array(
1621 1621
 			'paged'          => $give_updates->step,
1622 1622
 			'status'         => 'any',
1623 1623
 			'order'          => 'ASC',
1624
-			'post_type'      => array( 'give_payment' ),
1624
+			'post_type'      => array('give_payment'),
1625 1625
 			'posts_per_page' => 100,
1626 1626
 		)
1627 1627
 	);
1628 1628
 
1629
-	if ( $donations->have_posts() ) {
1630
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1629
+	if ($donations->have_posts()) {
1630
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1631 1631
 
1632
-		while ( $donations->have_posts() ) {
1632
+		while ($donations->have_posts()) {
1633 1633
 			$donations->the_post();
1634 1634
 
1635
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1636
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1635
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1636
+			$donation_meta = give_get_payment_meta(get_the_ID());
1637 1637
 
1638 1638
 			// Update Donation meta with price_id set as custom, only if it is:
1639 1639
 			// 1. Donation Type = Set Donation.
@@ -1642,19 +1642,19 @@  discard block
 block discarded – undo
1642 1642
 			if (
1643 1643
 				$form->ID &&
1644 1644
 				$form->is_set_type_donation_form() &&
1645
-				( 'custom' !== $donation_meta['price_id'] ) &&
1646
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1645
+				('custom' !== $donation_meta['price_id']) &&
1646
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1647 1647
 			) {
1648 1648
 				$donation_meta['price_id'] = 'custom';
1649
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1650
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1649
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1650
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1651 1651
 			}
1652 1652
 		}
1653 1653
 
1654 1654
 		wp_reset_postdata();
1655 1655
 	} else {
1656 1656
 		// Update Ran Successfully.
1657
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1657
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1658 1658
 	}
1659 1659
 }
1660 1660
 
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 	global $wp_roles;
1674 1674
 
1675
-	if ( ! ( $wp_roles instanceof WP_Roles ) ) {
1675
+	if ( ! ($wp_roles instanceof WP_Roles)) {
1676 1676
 		return;
1677 1677
 	}
1678 1678
 
@@ -1690,9 +1690,9 @@  discard block
 block discarded – undo
1690 1690
 		),
1691 1691
 	);
1692 1692
 
1693
-	foreach ( $remove_caps as $role => $caps ) {
1694
-		foreach ( $caps as $cap ) {
1695
-			$wp_roles->remove_cap( $role, $cap );
1693
+	foreach ($remove_caps as $role => $caps) {
1694
+		foreach ($caps as $cap) {
1695
+			$wp_roles->remove_cap($role, $cap);
1696 1696
 		}
1697 1697
 	}
1698 1698
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 	$roles->add_roles();
1704 1704
 	$roles->add_caps();
1705 1705
 
1706
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1706
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1707 1707
 }
1708 1708
 
1709 1709
 /**
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 	$give_updates = Give_Updates::get_instance();
1718 1718
 
1719 1719
 	// form query
1720
-	$forms = new WP_Query( array(
1720
+	$forms = new WP_Query(array(
1721 1721
 			'paged'          => $give_updates->step,
1722 1722
 			'status'         => 'any',
1723 1723
 			'order'          => 'ASC',
@@ -1726,22 +1726,22 @@  discard block
 block discarded – undo
1726 1726
 		)
1727 1727
 	);
1728 1728
 
1729
-	if ( $forms->have_posts() ) {
1730
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1729
+	if ($forms->have_posts()) {
1730
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1731 1731
 
1732
-		while ( $forms->have_posts() ) {
1732
+		while ($forms->have_posts()) {
1733 1733
 			$forms->the_post();
1734 1734
 			global $post;
1735 1735
 
1736 1736
 			// Update offline instruction email notification status.
1737
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1738
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1737
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1738
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1739 1739
 				'enabled',
1740 1740
 				'global',
1741
-			) )
1741
+			))
1742 1742
 				? $offline_instruction_notification_status
1743 1743
 				: 'global';
1744
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1744
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1745 1745
 
1746 1746
 			// Update offline instruction email message.
1747 1747
 			update_post_meta(
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 		wp_reset_postdata();
1774 1774
 	} else {
1775 1775
 		// No more forms found, finish up.
1776
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1776
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1777 1777
 	}
1778 1778
 }
1779 1779
 
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
 	$give_updates = Give_Updates::get_instance();
1791 1791
 
1792 1792
 	// form query
1793
-	$forms = new WP_Query( array(
1793
+	$forms = new WP_Query(array(
1794 1794
 			'paged'          => $give_updates->step,
1795 1795
 			'status'         => 'any',
1796 1796
 			'order'          => 'ASC',
@@ -1799,19 +1799,19 @@  discard block
 block discarded – undo
1799 1799
 		)
1800 1800
 	);
1801 1801
 
1802
-	if ( $forms->have_posts() ) {
1803
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1802
+	if ($forms->have_posts()) {
1803
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1804 1804
 
1805
-		while ( $forms->have_posts() ) {
1805
+		while ($forms->have_posts()) {
1806 1806
 			$forms->the_post();
1807 1807
 			global $post;
1808 1808
 
1809 1809
 			// Split _give_payment_meta meta.
1810 1810
 			// @todo Remove _give_payment_meta after releases 2.0
1811
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1811
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1812 1812
 
1813
-			if ( ! empty( $payment_meta ) ) {
1814
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1813
+			if ( ! empty($payment_meta)) {
1814
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1815 1815
 			}
1816 1816
 
1817 1817
 			$deprecated_meta_keys = array(
@@ -1820,9 +1820,9 @@  discard block
 block discarded – undo
1820 1820
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1821 1821
 			);
1822 1822
 
1823
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1823
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1824 1824
 				// Do not add new meta key if already exist.
1825
-				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 ) ) ) {
1825
+				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))) {
1826 1826
 					continue;
1827 1827
 				}
1828 1828
 
@@ -1831,25 +1831,25 @@  discard block
 block discarded – undo
1831 1831
 					array(
1832 1832
 						'post_id'    => $post->ID,
1833 1833
 						'meta_key'   => $new_meta_key,
1834
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
1834
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
1835 1835
 					)
1836 1836
 				);
1837 1837
 			}
1838 1838
 
1839 1839
 			// Bailout
1840
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1840
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1841 1841
 				/* @var Give_Donor $donor */
1842
-				$donor = new Give_Donor( $donor_id );
1842
+				$donor = new Give_Donor($donor_id);
1843 1843
 
1844
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1845
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1846
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1847
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1848
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1849
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1844
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1845
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1846
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1847
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1848
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1849
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1850 1850
 
1851 1851
 				// Save address.
1852
-				$donor->add_address( 'billing[]', $address );
1852
+				$donor->add_address('billing[]', $address);
1853 1853
 			}
1854 1854
 
1855 1855
 		}// End while().
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1861 1861
 
1862 1862
 		// No more forms found, finish up.
1863
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1863
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1864 1864
 	}
1865 1865
 }
1866 1866
 
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 	$give_updates = Give_Updates::get_instance();
1877 1877
 
1878 1878
 	// form query
1879
-	$forms = new WP_Query( array(
1879
+	$forms = new WP_Query(array(
1880 1880
 			'paged'          => $give_updates->step,
1881 1881
 			'order'          => 'DESC',
1882 1882
 			'post_type'      => 'give_log',
@@ -1885,20 +1885,20 @@  discard block
 block discarded – undo
1885 1885
 		)
1886 1886
 	);
1887 1887
 
1888
-	if ( $forms->have_posts() ) {
1889
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1888
+	if ($forms->have_posts()) {
1889
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1890 1890
 
1891
-		while ( $forms->have_posts() ) {
1891
+		while ($forms->have_posts()) {
1892 1892
 			$forms->the_post();
1893 1893
 			global $post;
1894 1894
 
1895
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1895
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1896 1896
 				continue;
1897 1897
 			}
1898 1898
 
1899
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1900
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1901
-			$term_name = ! empty( $term ) ? $term->slug : '';
1899
+			$term      = get_the_terms($post->ID, 'give_log_type');
1900
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1901
+			$term_name = ! empty($term) ? $term->slug : '';
1902 1902
 
1903 1903
 			$log_data = array(
1904 1904
 				'ID'           => $post->ID,
@@ -1911,29 +1911,29 @@  discard block
 block discarded – undo
1911 1911
 			);
1912 1912
 			$log_meta = array();
1913 1913
 
1914
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1915
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1916
-					switch ( $meta_key ) {
1914
+			if ($old_log_meta = get_post_meta($post->ID)) {
1915
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1916
+					switch ($meta_key) {
1917 1917
 						case '_give_log_payment_id':
1918
-							$log_data['log_parent']        = current( $meta_value );
1918
+							$log_data['log_parent']        = current($meta_value);
1919 1919
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1920 1920
 							break;
1921 1921
 
1922 1922
 						default:
1923
-							$log_meta[ $meta_key ] = current( $meta_value );
1923
+							$log_meta[$meta_key] = current($meta_value);
1924 1924
 					}
1925 1925
 				}
1926 1926
 			}
1927 1927
 
1928
-			if ( 'api_request' === $term_name ) {
1928
+			if ('api_request' === $term_name) {
1929 1929
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1930 1930
 			}
1931 1931
 
1932
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1932
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1933 1933
 
1934
-			if ( ! empty( $log_meta ) ) {
1935
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1936
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1934
+			if ( ! empty($log_meta)) {
1935
+				foreach ($log_meta as $meta_key => $meta_value) {
1936
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1937 1937
 				}
1938 1938
 			}
1939 1939
 
@@ -1975,7 +1975,7 @@  discard block
 block discarded – undo
1975 1975
 		Give()->logs->delete_cache();
1976 1976
 
1977 1977
 		// No more forms found, finish up.
1978
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1978
+		give_set_upgrade_complete('v20_logs_upgrades');
1979 1979
 	}
1980 1980
 }
1981 1981
 
@@ -1991,19 +1991,19 @@  discard block
 block discarded – undo
1991 1991
 	$give_updates = Give_Updates::get_instance();
1992 1992
 
1993 1993
 	// form query
1994
-	$payments = new WP_Query( array(
1994
+	$payments = new WP_Query(array(
1995 1995
 			'paged'          => $give_updates->step,
1996 1996
 			'status'         => 'any',
1997 1997
 			'order'          => 'ASC',
1998
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1998
+			'post_type'      => array('give_forms', 'give_payment'),
1999 1999
 			'posts_per_page' => 100,
2000 2000
 		)
2001 2001
 	);
2002 2002
 
2003
-	if ( $payments->have_posts() ) {
2004
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
2003
+	if ($payments->have_posts()) {
2004
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
2005 2005
 
2006
-		while ( $payments->have_posts() ) {
2006
+		while ($payments->have_posts()) {
2007 2007
 			$payments->the_post();
2008 2008
 			global $post;
2009 2009
 
@@ -2015,19 +2015,19 @@  discard block
 block discarded – undo
2015 2015
 				ARRAY_A
2016 2016
 			);
2017 2017
 
2018
-			if ( ! empty( $meta_data ) ) {
2019
-				foreach ( $meta_data as $index => $data ) {
2018
+			if ( ! empty($meta_data)) {
2019
+				foreach ($meta_data as $index => $data) {
2020 2020
 					// Check for duplicate meta values.
2021
-					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 ) ) {
2021
+					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)) {
2022 2022
 						continue;
2023 2023
 					}
2024 2024
 
2025
-					switch ( $post->post_type ) {
2025
+					switch ($post->post_type) {
2026 2026
 						case 'give_forms':
2027 2027
 							$data['form_id'] = $data['post_id'];
2028
-							unset( $data['post_id'] );
2028
+							unset($data['post_id']);
2029 2029
 
2030
-							Give()->form_meta->insert( $data );
2030
+							Give()->form_meta->insert($data);
2031 2031
 							// @todo: delete form meta from post meta table after releases 2.0.
2032 2032
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2033 2033
 
@@ -2035,9 +2035,9 @@  discard block
 block discarded – undo
2035 2035
 
2036 2036
 						case 'give_payment':
2037 2037
 							$data['payment_id'] = $data['post_id'];
2038
-							unset( $data['post_id'] );
2038
+							unset($data['post_id']);
2039 2039
 
2040
-							Give()->payment_meta->insert( $data );
2040
+							Give()->payment_meta->insert($data);
2041 2041
 
2042 2042
 							// @todo: delete donation meta from post meta table after releases 2.0.
2043 2043
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2052,7 +2052,7 @@  discard block
 block discarded – undo
2052 2052
 		wp_reset_postdata();
2053 2053
 	} else {
2054 2054
 		// No more forms found, finish up.
2055
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
2055
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
2056 2056
 	}
2057 2057
 
2058 2058
 }
@@ -2068,44 +2068,44 @@  discard block
 block discarded – undo
2068 2068
 	/* @var Give_Updates $give_updates */
2069 2069
 	$give_updates = Give_Updates::get_instance();
2070 2070
 
2071
-	$donors = Give()->donors->get_donors( array(
2071
+	$donors = Give()->donors->get_donors(array(
2072 2072
 		'paged'  => $give_updates->step,
2073 2073
 		'number' => 100,
2074
-	) );
2074
+	));
2075 2075
 
2076
-	if ( $donors ) {
2077
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2076
+	if ($donors) {
2077
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2078 2078
 		// Loop through Donors
2079
-		foreach ( $donors as $donor ) {
2079
+		foreach ($donors as $donor) {
2080 2080
 
2081
-			$donor_name       = explode( ' ', $donor->name, 2 );
2082
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2083
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2081
+			$donor_name       = explode(' ', $donor->name, 2);
2082
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2083
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2084 2084
 
2085 2085
 			// If first name meta of donor is not created, then create it.
2086
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2087
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2086
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2087
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2088 2088
 			}
2089 2089
 
2090 2090
 			// If last name meta of donor is not created, then create it.
2091
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2092
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2091
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2092
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2093 2093
 			}
2094 2094
 
2095 2095
 			// If Donor is connected with WP User then update user meta.
2096
-			if ( $donor->user_id ) {
2097
-				if ( isset( $donor_name[0] ) ) {
2098
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2096
+			if ($donor->user_id) {
2097
+				if (isset($donor_name[0])) {
2098
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2099 2099
 				}
2100
-				if ( isset( $donor_name[1] ) ) {
2101
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2100
+				if (isset($donor_name[1])) {
2101
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2102 2102
 				}
2103 2103
 			}
2104 2104
 		}
2105 2105
 
2106 2106
 	} else {
2107 2107
 		// The Update Ran.
2108
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2108
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2109 2109
 	}
2110 2110
 
2111 2111
 }
@@ -2134,15 +2134,15 @@  discard block
 block discarded – undo
2134 2134
 
2135 2135
 	$users = $user_query->get_results();
2136 2136
 
2137
-	if ( $users ) {
2138
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2137
+	if ($users) {
2138
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2139 2139
 
2140 2140
 		// Loop through Donors
2141
-		foreach ( $users as $user ) {
2141
+		foreach ($users as $user) {
2142 2142
 			/* @var Give_Donor $donor */
2143
-			$donor = new Give_Donor( $user->ID, true );
2143
+			$donor = new Give_Donor($user->ID, true);
2144 2144
 
2145
-			if ( ! $donor->id ) {
2145
+			if ( ! $donor->id) {
2146 2146
 				continue;
2147 2147
 			}
2148 2148
 
@@ -2158,10 +2158,10 @@  discard block
 block discarded – undo
2158 2158
 				)
2159 2159
 			);
2160 2160
 
2161
-			if ( ! empty( $address ) ) {
2162
-				$address = maybe_unserialize( $address );
2163
-				$donor->add_address( 'personal', $address );
2164
-				$donor->add_address( 'billing[]', $address );
2161
+			if ( ! empty($address)) {
2162
+				$address = maybe_unserialize($address);
2163
+				$donor->add_address('personal', $address);
2164
+				$donor->add_address('billing[]', $address);
2165 2165
 
2166 2166
 
2167 2167
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2171,7 +2171,7 @@  discard block
 block discarded – undo
2171 2171
 
2172 2172
 	} else {
2173 2173
 		// The Update Ran.
2174
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2174
+		give_set_upgrade_complete('v20_upgrades_user_address');
2175 2175
 	}
2176 2176
 
2177 2177
 }
@@ -2195,15 +2195,15 @@  discard block
 block discarded – undo
2195 2195
 	);
2196 2196
 
2197 2197
 	// Alter customer table
2198
-	foreach ( $tables as $old_table => $new_table ) {
2198
+	foreach ($tables as $old_table => $new_table) {
2199 2199
 		if (
2200
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2201
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2200
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2201
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2202 2202
 		) {
2203
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2203
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2204 2204
 
2205
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2206
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2205
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2206
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2207 2207
 			}
2208 2208
 		}
2209 2209
 	}
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 	$give_updates->percentage = 100;
2212 2212
 
2213 2213
 	// No more forms found, finish up.
2214
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2214
+	give_set_upgrade_complete('v20_rename_donor_tables');
2215 2215
 
2216 2216
 	// Re initiate donor classes.
2217 2217
 	Give()->donors     = new Give_DB_Donors();
@@ -2229,19 +2229,19 @@  discard block
 block discarded – undo
2229 2229
 function give_v201_create_tables() {
2230 2230
 	global $wpdb;
2231 2231
 
2232
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2232
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) {
2233 2233
 		Give()->payment_meta->create_table();
2234 2234
 	}
2235 2235
 
2236
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) {
2236
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) {
2237 2237
 		Give()->form_meta->create_table();
2238 2238
 	}
2239 2239
 
2240
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) {
2240
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) {
2241 2241
 		Give()->logs->log_db->create_table();
2242 2242
 	}
2243 2243
 
2244
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) {
2244
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) {
2245 2245
 		Give()->logs->logmeta_db->create_table();
2246 2246
 	}
2247 2247
 }
@@ -2266,31 +2266,31 @@  discard block
 block discarded – undo
2266 2266
   				$wpdb->posts.post_date >= '2018-01-08 00:00:00'
2267 2267
 			)
2268 2268
 			AND $wpdb->posts.post_type = 'give_payment'
2269
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2269
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2270 2270
 			ORDER BY $wpdb->posts.post_date ASC 
2271 2271
 			LIMIT 100
2272
-			OFFSET " . $give_updates->get_offset( 100 )
2272
+			OFFSET ".$give_updates->get_offset(100)
2273 2273
 	);
2274 2274
 
2275
-	if ( ! empty( $payments ) ) {
2276
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) );
2275
+	if ( ! empty($payments)) {
2276
+		$give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100));
2277 2277
 
2278
-		foreach ( $payments as $payment_id ) {
2279
-			$post = get_post( $payment_id );
2280
-			setup_postdata( $post );
2278
+		foreach ($payments as $payment_id) {
2279
+			$post = get_post($payment_id);
2280
+			setup_postdata($post);
2281 2281
 
2282 2282
 			// Do not add new meta keys if already refactored.
2283
-			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' ) ) ) {
2283
+			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'))) {
2284 2284
 				continue;
2285 2285
 			}
2286 2286
 
2287 2287
 
2288 2288
 			// Split _give_payment_meta meta.
2289 2289
 			// @todo Remove _give_payment_meta after releases 2.0
2290
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2290
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2291 2291
 
2292
-			if ( ! empty( $payment_meta ) ) {
2293
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2292
+			if ( ! empty($payment_meta)) {
2293
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2294 2294
 			}
2295 2295
 
2296 2296
 			$deprecated_meta_keys = array(
@@ -2299,9 +2299,9 @@  discard block
 block discarded – undo
2299 2299
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2300 2300
 			);
2301 2301
 
2302
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2302
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2303 2303
 				// Do not add new meta key if already exist.
2304
-				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 ) ) ) {
2304
+				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))) {
2305 2305
 					continue;
2306 2306
 				}
2307 2307
 
@@ -2310,25 +2310,25 @@  discard block
 block discarded – undo
2310 2310
 					array(
2311 2311
 						'post_id'    => $post->ID,
2312 2312
 						'meta_key'   => $new_meta_key,
2313
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ),
2313
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true),
2314 2314
 					)
2315 2315
 				);
2316 2316
 			}
2317 2317
 
2318 2318
 			// Bailout
2319
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2319
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2320 2320
 				/* @var Give_Donor $donor */
2321
-				$donor = new Give_Donor( $donor_id );
2321
+				$donor = new Give_Donor($donor_id);
2322 2322
 
2323
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2324
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2325
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2326
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2327
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2328
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2323
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2324
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2325
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2326
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2327
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2328
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2329 2329
 
2330 2330
 				// Save address.
2331
-				$donor->add_address( 'billing[]', $address );
2331
+				$donor->add_address('billing[]', $address);
2332 2332
 			}
2333 2333
 
2334 2334
 		}// End while().
@@ -2339,7 +2339,7 @@  discard block
 block discarded – undo
2339 2339
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2340 2340
 
2341 2341
 		// No more forms found, finish up.
2342
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2342
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2343 2343
 	}
2344 2344
 }
2345 2345
 
@@ -2359,21 +2359,21 @@  discard block
 block discarded – undo
2359 2359
 			SELECT ID FROM $wpdb->posts 
2360 2360
 			WHERE 1=1
2361 2361
 			AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' )
2362
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2362
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2363 2363
 			ORDER BY $wpdb->posts.post_date ASC 
2364 2364
 			LIMIT 100
2365
-			OFFSET " . $give_updates->get_offset( 100 )
2365
+			OFFSET ".$give_updates->get_offset(100)
2366 2366
 	);
2367 2367
 
2368
-	if ( ! empty( $payments ) ) {
2369
-		$give_updates->set_percentage( give_get_total_post_type_count( array(
2368
+	if ( ! empty($payments)) {
2369
+		$give_updates->set_percentage(give_get_total_post_type_count(array(
2370 2370
 			'give_forms',
2371 2371
 			'give_payment',
2372
-		) ), $give_updates->step * 100 );
2372
+		)), $give_updates->step * 100);
2373 2373
 
2374
-		foreach ( $payments as $payment_id ) {
2375
-			$post = get_post( $payment_id );
2376
-			setup_postdata( $post );
2374
+		foreach ($payments as $payment_id) {
2375
+			$post = get_post($payment_id);
2376
+			setup_postdata($post);
2377 2377
 
2378 2378
 			$meta_data = $wpdb->get_results(
2379 2379
 				$wpdb->prepare(
@@ -2383,19 +2383,19 @@  discard block
 block discarded – undo
2383 2383
 				ARRAY_A
2384 2384
 			);
2385 2385
 
2386
-			if ( ! empty( $meta_data ) ) {
2387
-				foreach ( $meta_data as $index => $data ) {
2386
+			if ( ! empty($meta_data)) {
2387
+				foreach ($meta_data as $index => $data) {
2388 2388
 					// Check for duplicate meta values.
2389
-					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 ) ) {
2389
+					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)) {
2390 2390
 						continue;
2391 2391
 					}
2392 2392
 
2393
-					switch ( $post->post_type ) {
2393
+					switch ($post->post_type) {
2394 2394
 						case 'give_forms':
2395 2395
 							$data['form_id'] = $data['post_id'];
2396
-							unset( $data['post_id'] );
2396
+							unset($data['post_id']);
2397 2397
 
2398
-							Give()->form_meta->insert( $data );
2398
+							Give()->form_meta->insert($data);
2399 2399
 							// @todo: delete form meta from post meta table after releases 2.0.
2400 2400
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2401 2401
 
@@ -2403,9 +2403,9 @@  discard block
 block discarded – undo
2403 2403
 
2404 2404
 						case 'give_payment':
2405 2405
 							$data['payment_id'] = $data['post_id'];
2406
-							unset( $data['post_id'] );
2406
+							unset($data['post_id']);
2407 2407
 
2408
-							Give()->payment_meta->insert( $data );
2408
+							Give()->payment_meta->insert($data);
2409 2409
 
2410 2410
 							// @todo: delete donation meta from post meta table after releases 2.0.
2411 2411
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2420,7 +2420,7 @@  discard block
 block discarded – undo
2420 2420
 		wp_reset_postdata();
2421 2421
 	} else {
2422 2422
 		// No more forms found, finish up.
2423
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2423
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2424 2424
 	}
2425 2425
 
2426 2426
 }
@@ -2441,26 +2441,26 @@  discard block
 block discarded – undo
2441 2441
 			SELECT ID FROM $wpdb->posts 
2442 2442
 			WHERE 1=1
2443 2443
 			AND $wpdb->posts.post_type = 'give_log'
2444
-			AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "')
2444
+			AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."')
2445 2445
 			ORDER BY $wpdb->posts.post_date ASC 
2446 2446
 			LIMIT 100
2447
-			OFFSET " . $give_updates->get_offset( 100 )
2447
+			OFFSET ".$give_updates->get_offset(100)
2448 2448
 	);
2449 2449
 
2450
-	if ( ! empty( $logs ) ) {
2451
-		$give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 );
2450
+	if ( ! empty($logs)) {
2451
+		$give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100);
2452 2452
 
2453
-		foreach ( $logs as $log_id ) {
2454
-			$post = get_post( $log_id );
2455
-			setup_postdata( $post );
2453
+		foreach ($logs as $log_id) {
2454
+			$post = get_post($log_id);
2455
+			setup_postdata($post);
2456 2456
 
2457
-			if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2457
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2458 2458
 				continue;
2459 2459
 			}
2460 2460
 
2461
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2462
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2463
-			$term_name = ! empty( $term ) ? $term->slug : '';
2461
+			$term      = get_the_terms($post->ID, 'give_log_type');
2462
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2463
+			$term_name = ! empty($term) ? $term->slug : '';
2464 2464
 
2465 2465
 			$log_data = array(
2466 2466
 				'ID'           => $post->ID,
@@ -2473,29 +2473,29 @@  discard block
 block discarded – undo
2473 2473
 			);
2474 2474
 			$log_meta = array();
2475 2475
 
2476
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2477
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2478
-					switch ( $meta_key ) {
2476
+			if ($old_log_meta = get_post_meta($post->ID)) {
2477
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2478
+					switch ($meta_key) {
2479 2479
 						case '_give_log_payment_id':
2480
-							$log_data['log_parent']        = current( $meta_value );
2480
+							$log_data['log_parent']        = current($meta_value);
2481 2481
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2482 2482
 							break;
2483 2483
 
2484 2484
 						default:
2485
-							$log_meta[ $meta_key ] = current( $meta_value );
2485
+							$log_meta[$meta_key] = current($meta_value);
2486 2486
 					}
2487 2487
 				}
2488 2488
 			}
2489 2489
 
2490
-			if ( 'api_request' === $term_name ) {
2490
+			if ('api_request' === $term_name) {
2491 2491
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2492 2492
 			}
2493 2493
 
2494
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2494
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2495 2495
 
2496
-			if ( ! empty( $log_meta ) ) {
2497
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2498
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2496
+			if ( ! empty($log_meta)) {
2497
+				foreach ($log_meta as $meta_key => $meta_value) {
2498
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2499 2499
 				}
2500 2500
 			}
2501 2501
 
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
 		Give()->logs->delete_cache();
2509 2509
 
2510 2510
 		// No more forms found, finish up.
2511
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2511
+		give_set_upgrade_complete('v201_logs_upgrades');
2512 2512
 	}
2513 2513
 }
2514 2514
 
@@ -2523,51 +2523,51 @@  discard block
 block discarded – undo
2523 2523
 	global $wpdb;
2524 2524
 	give_v201_create_tables();
2525 2525
 
2526
-	if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) {
2527
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2528
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2526
+	if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) {
2527
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2528
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2529 2529
 		$donor_data = array();
2530 2530
 
2531
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2532
-			foreach ( $missing_donors as $donor_id ) {
2531
+		if ($missing_donors = array_diff($customers, $donors)) {
2532
+			foreach ($missing_donors as $donor_id) {
2533 2533
 				$donor_data[] = array(
2534
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2535
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2534
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2535
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2536 2536
 
2537 2537
 				);
2538 2538
 			}
2539 2539
 		}
2540 2540
 
2541
-		if ( ! empty( $donor_data ) ) {
2541
+		if ( ! empty($donor_data)) {
2542 2542
 			$donor_table_name      = Give()->donors->table_name;
2543 2543
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2544 2544
 
2545 2545
 			Give()->donors->table_name     = "{$wpdb->prefix}give_donors";
2546 2546
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2547 2547
 
2548
-			foreach ( $donor_data as $donor ) {
2548
+			foreach ($donor_data as $donor) {
2549 2549
 				$donor['info'][0] = (array) $donor['info'][0];
2550 2550
 
2551 2551
 				// Prevent duplicate meta id issue.
2552
-				if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) {
2552
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2553 2553
 					continue;
2554 2554
 				}
2555 2555
 
2556
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2556
+				$donor_id = Give()->donors->add($donor['info'][0]);
2557 2557
 
2558
-				if ( ! empty( $donor['meta'] ) ) {
2559
-					foreach ( $donor['meta'] as $donor_meta ) {
2558
+				if ( ! empty($donor['meta'])) {
2559
+					foreach ($donor['meta'] as $donor_meta) {
2560 2560
 						$donor_meta = (array) $donor_meta;
2561 2561
 
2562 2562
 						// Prevent duplicate meta id issue.
2563
-						if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) {
2564
-							unset( $donor_meta['meta_id'] );
2563
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2564
+							unset($donor_meta['meta_id']);
2565 2565
 						}
2566 2566
 
2567 2567
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2568
-						unset( $donor_meta['customer_id'] );
2568
+						unset($donor_meta['customer_id']);
2569 2569
 
2570
-						Give()->donor_meta->insert( $donor_meta );
2570
+						Give()->donor_meta->insert($donor_meta);
2571 2571
 					}
2572 2572
 				}
2573 2573
 
@@ -2586,35 +2586,35 @@  discard block
 block discarded – undo
2586 2586
 					)
2587 2587
 				);
2588 2588
 
2589
-				$donor = new Give_Donor( $donor_id );
2589
+				$donor = new Give_Donor($donor_id);
2590 2590
 
2591
-				if ( ! empty( $address ) ) {
2592
-					$address = maybe_unserialize( $address );
2593
-					$donor->add_address( 'personal', $address );
2594
-					$donor->add_address( 'billing[]', $address );
2591
+				if ( ! empty($address)) {
2592
+					$address = maybe_unserialize($address);
2593
+					$donor->add_address('personal', $address);
2594
+					$donor->add_address('billing[]', $address);
2595 2595
 				}
2596 2596
 
2597
-				$donor_name       = explode( ' ', $donor->name, 2 );
2598
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2599
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2597
+				$donor_name       = explode(' ', $donor->name, 2);
2598
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2599
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2600 2600
 
2601 2601
 				// If first name meta of donor is not created, then create it.
2602
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2603
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2602
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2603
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2604 2604
 				}
2605 2605
 
2606 2606
 				// If last name meta of donor is not created, then create it.
2607
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2608
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2607
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2608
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2609 2609
 				}
2610 2610
 
2611 2611
 				// If Donor is connected with WP User then update user meta.
2612
-				if ( $donor->user_id ) {
2613
-					if ( isset( $donor_name[0] ) ) {
2614
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2612
+				if ($donor->user_id) {
2613
+					if (isset($donor_name[0])) {
2614
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2615 2615
 					}
2616
-					if ( isset( $donor_name[1] ) ) {
2617
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2616
+					if (isset($donor_name[1])) {
2617
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2618 2618
 					}
2619 2619
 				}
2620 2620
 			}
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
 	}
2626 2626
 
2627 2627
 	Give_Updates::get_instance()->percentage = 100;
2628
-	give_set_upgrade_complete( 'v201_add_missing_donors' );
2628
+	give_set_upgrade_complete('v201_add_missing_donors');
2629 2629
 }
2630 2630
 
2631 2631
 
@@ -2638,14 +2638,14 @@  discard block
 block discarded – undo
2638 2638
 	global $wpdb;
2639 2639
 
2640 2640
 	// Do not auto load option.
2641
-	$wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) );
2641
+	$wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades'));
2642 2642
 
2643 2643
 	// Remove from cache.
2644 2644
 	$all_options = wp_load_alloptions();
2645 2645
 
2646
-	if ( isset( $all_options['give_completed_upgrades'] ) ) {
2647
-		unset( $all_options['give_completed_upgrades'] );
2648
-		wp_cache_set( 'alloptions', $all_options, 'options' );
2646
+	if (isset($all_options['give_completed_upgrades'])) {
2647
+		unset($all_options['give_completed_upgrades']);
2648
+		wp_cache_set('alloptions', $all_options, 'options');
2649 2649
 	}
2650 2650
 
2651 2651
 }
@@ -2656,7 +2656,7 @@  discard block
 block discarded – undo
2656 2656
  *
2657 2657
  * @since 2.2.0
2658 2658
  */
2659
-function give_v220_upgrades(){
2659
+function give_v220_upgrades() {
2660 2660
 	global $wpdb;
2661 2661
 
2662 2662
 	/**
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 		"
2703 2703
 	);
2704 2704
 
2705
-	if( ! empty( $option_like ) ) {
2706
-		$options = array_merge( $options, $option_like );
2705
+	if ( ! empty($option_like)) {
2706
+		$options = array_merge($options, $option_like);
2707 2707
 	}
2708 2708
 
2709
-	$options_str =  '\'' . implode( "','", $options ) . '\'';
2709
+	$options_str = '\''.implode("','", $options).'\'';
2710 2710
 
2711 2711
 	$wpdb->query(
2712 2712
 		"
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
 	$give_updates = Give_Updates::get_instance();
2728 2728
 
2729 2729
 	// form query.
2730
-	$donation_forms = new WP_Query( array(
2730
+	$donation_forms = new WP_Query(array(
2731 2731
 			'paged'          => $give_updates->step,
2732 2732
 			'status'         => 'any',
2733 2733
 			'order'          => 'ASC',
@@ -2736,16 +2736,16 @@  discard block
 block discarded – undo
2736 2736
 		)
2737 2737
 	);
2738 2738
 
2739
-	if ( $donation_forms->have_posts() ) {
2740
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
2739
+	if ($donation_forms->have_posts()) {
2740
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
2741 2741
 
2742
-		while ( $donation_forms->have_posts() ) {
2742
+		while ($donation_forms->have_posts()) {
2743 2743
 			$donation_forms->the_post();
2744 2744
 			$form_id = get_the_ID();
2745 2745
 
2746
-			$form_closed_status = give_get_meta( $form_id, '_give_form_status', true );
2747
-			if ( empty( $form_closed_status ) ) {
2748
-				give_set_form_closed_status( $form_id );
2746
+			$form_closed_status = give_get_meta($form_id, '_give_form_status', true);
2747
+			if (empty($form_closed_status)) {
2748
+				give_set_form_closed_status($form_id);
2749 2749
 			}
2750 2750
 		}
2751 2751
 
@@ -2755,7 +2755,7 @@  discard block
 block discarded – undo
2755 2755
 	} else {
2756 2756
 
2757 2757
 		// The Update Ran.
2758
-		give_set_upgrade_complete( 'v210_verify_form_status_upgrades' );
2758
+		give_set_upgrade_complete('v210_verify_form_status_upgrades');
2759 2759
 	}
2760 2760
 }
2761 2761
 
@@ -2774,22 +2774,22 @@  discard block
 block discarded – undo
2774 2774
 		SELECT DISTINCT payment_id
2775 2775
 		FROM {$donation_meta_table}
2776 2776
 		LIMIT 20
2777
-		OFFSET {$give_updates->get_offset( 20 )}
2777
+		OFFSET {$give_updates->get_offset(20)}
2778 2778
 		"
2779 2779
 	);
2780 2780
 
2781
-	if ( ! empty( $donations ) ) {
2782
-		foreach ( $donations as $donation ) {
2783
-			$donation_obj = get_post( $donation );
2781
+	if ( ! empty($donations)) {
2782
+		foreach ($donations as $donation) {
2783
+			$donation_obj = get_post($donation);
2784 2784
 
2785
-			if ( ! $donation_obj instanceof WP_Post ) {
2786
-				Give()->payment_meta->delete_all_meta( $donation );
2785
+			if ( ! $donation_obj instanceof WP_Post) {
2786
+				Give()->payment_meta->delete_all_meta($donation);
2787 2787
 			}
2788 2788
 		}
2789 2789
 	} else {
2790 2790
 
2791 2791
 		// The Update Ran.
2792
-		give_set_upgrade_complete( 'v213_delete_donation_meta' );
2792
+		give_set_upgrade_complete('v213_delete_donation_meta');
2793 2793
 	}
2794 2794
 }
2795 2795
 
@@ -2800,12 +2800,12 @@  discard block
 block discarded – undo
2800 2800
  *
2801 2801
  * @since 2.1.3
2802 2802
  */
2803
-function give_v213_rename_donation_meta_type_callback(){
2803
+function give_v213_rename_donation_meta_type_callback() {
2804 2804
 	global $wpdb;
2805 2805
 	$give_updates = Give_Updates::get_instance();
2806 2806
 
2807
-	$wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)" );
2808
-	$wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta" );
2807
+	$wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)");
2808
+	$wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta");
2809 2809
 
2810 2810
 	give_set_upgrade_complete('v213_rename_donation_meta_type');
2811 2811
 	$give_updates->set_percentage(1, 1);
@@ -2818,10 +2818,10 @@  discard block
 block discarded – undo
2818 2818
  */
2819 2819
 function give_v215_update_donor_user_roles_callback() {
2820 2820
 
2821
-	$role = get_role( 'give_manager' );
2822
-	$role->add_cap( 'view_give_payments' );
2821
+	$role = get_role('give_manager');
2822
+	$role->add_cap('view_give_payments');
2823 2823
 
2824
-	give_set_upgrade_complete( 'v215_update_donor_user_roles' );
2824
+	give_set_upgrade_complete('v215_update_donor_user_roles');
2825 2825
 }
2826 2826
 
2827 2827
 
@@ -2833,8 +2833,8 @@  discard block
 block discarded – undo
2833 2833
  *
2834 2834
  * @global wpdb $wpdb
2835 2835
  */
2836
-function give_v220_delete_wp_session_data(){
2836
+function give_v220_delete_wp_session_data() {
2837 2837
 	global $wpdb;
2838 2838
 
2839
-	$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'" );
2839
+	$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'");
2840 2840
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -18,70 +18,70 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<hr class="wp-header-end">
23 23
 
24 24
 		<?php $db_updates = $give_updates->get_pending_db_update_count(); ?>
25
-		<?php if ( ! empty( $db_updates ) ) : ?>
25
+		<?php if ( ! empty($db_updates)) : ?>
26 26
 			<?php
27 27
 			$is_doing_updates = $give_updates->is_doing_updates();
28
-			$db_update_url    = add_query_arg( array( 'type' => 'database', ) );
29
-			$resume_updates   = get_option( 'give_doing_upgrade' );
30
-			$width            = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0;
28
+			$db_update_url    = add_query_arg(array('type' => 'database',));
29
+			$resume_updates   = get_option('give_doing_upgrade');
30
+			$width            = ! empty($resume_updates) ? $resume_updates['percentage'] : 0;
31 31
 			?>
32 32
 			<div class="give-update-panel-content">
33
-				<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
33
+				<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
34 34
 			</div>
35 35
 
36
-			<div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>">
36
+			<div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>">
37 37
 				<div class="postbox-container">
38 38
 					<div class="postbox">
39
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
39
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
40 40
 						<div class="inside">
41 41
 							<div class="panel-content">
42 42
 								<p class="give-update-button">
43 43
 									<?php
44
-									if( ! give_test_ajax_works() ) {
44
+									if ( ! give_test_ajax_works()) {
45 45
 										echo sprintf(
46 46
 											'<div class="notice notice-warning inline"><p>%s</p></div>',
47
-											__( 'Give is currently updating the database. Please do not refresh or leave this page while the update is in progress.', 'give' )
47
+											__('Give is currently updating the database. Please do not refresh or leave this page while the update is in progress.', 'give')
48 48
 										);
49 49
 									}
50 50
 									?>
51 51
 									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
52 52
 										<?php
53 53
 										echo sprintf(
54
-											__( '%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give' ),
54
+											__('%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give'),
55 55
 											$is_doing_updates
56 56
 												? sprintf(
57 57
 													'%s%s',
58
-													__( 'Give is currently updating the database', 'give' ),
59
-													give_test_ajax_works() ?  ' ' . __( 'in the background.', 'give' ) : '.'
58
+													__('Give is currently updating the database', 'give'),
59
+													give_test_ajax_works() ? ' '.__('in the background.', 'give') : '.'
60 60
 												)
61
-												: __( 'Give needs to update the database.', 'give' ),
61
+												: __('Give needs to update the database.', 'give'),
62 62
 											$db_update_url,
63
-											( $is_doing_updates ? 'give-hidden' : '' ),
64
-											__( 'Update now', 'give' )
63
+											($is_doing_updates ? 'give-hidden' : ''),
64
+											__('Update now', 'give')
65 65
 										);
66 66
 										?>
67 67
 									</span>
68 68
 									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
69
-										<?php if ( get_option( 'give_upgrade_error' ) ) : ?>
70
-											&nbsp<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
69
+										<?php if (get_option('give_upgrade_error')) : ?>
70
+											&nbsp<?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?>
71 71
 										<?php else : ?>
72
-											<?php _e( 'The updates have been paused.', 'give' ); ?>
72
+											<?php _e('The updates have been paused.', 'give'); ?>
73 73
 										<?php endif; ?>
74 74
 									</span>
75 75
 
76
-									<?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?>
77
-										<?php $is_disabled = isset( $_GET['give-restart-db-upgrades'] ) ? ' disabled' : ''; ?>
76
+									<?php if (Give_Updates::$background_updater->is_paused_process()) : ?>
77
+										<?php $is_disabled = isset($_GET['give-restart-db-upgrades']) ? ' disabled' : ''; ?>
78 78
 										<button id="give-restart-upgrades" class="button button-primary alignright"
79
-										        data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>><?php _e( 'Restart Upgrades', 'give' ); ?></button>
80
-									<?php elseif ( $give_updates->is_doing_updates() ): ?>
81
-										<?php $is_disabled = isset( $_GET['give-pause-db-upgrades'] ) ? ' disabled' : ''; ?>
79
+										        data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>><?php _e('Restart Upgrades', 'give'); ?></button>
80
+									<?php elseif ($give_updates->is_doing_updates()): ?>
81
+										<?php $is_disabled = isset($_GET['give-pause-db-upgrades']) ? ' disabled' : ''; ?>
82 82
 										<button id="give-pause-upgrades" class="button button-primary alignright"
83
-										        data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>>
84
-											<?php _e( 'Pause Upgrades', 'give' ); ?>
83
+										        data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>>
84
+											<?php _e('Pause Upgrades', 'give'); ?>
85 85
 										</button>
86 86
 									<?php endif; ?>
87 87
 								</p>
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 									<strong>
92 92
 										<?php
93 93
 										echo sprintf(
94
-											__( 'Update %s of %s', 'give' ),
94
+											__('Update %s of %s', 'give'),
95 95
 											$give_updates->get_running_db_update(),
96 96
 											$give_updates->get_total_new_db_update_count()
97 97
 										);
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 									</strong>
100 100
 								</p>
101 101
 								<div class="progress-content">
102
-									<?php if ( $is_doing_updates ) : ?>
102
+									<?php if ($is_doing_updates) : ?>
103 103
 										<div class="notice-wrap give-clearfix">
104 104
 
105
-											<?php if ( ! Give_Updates::$background_updater->is_paused_process() ) : ?>
105
+											<?php if ( ! Give_Updates::$background_updater->is_paused_process()) : ?>
106 106
 												<span class="spinner is-active"></span>
107 107
 											<?php endif; ?>
108 108
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 									<?php endif; ?>
114 114
 								</div>
115 115
 							</div>
116
-							<?php if ( ! $is_doing_updates ) : ?>
116
+							<?php if ( ! $is_doing_updates) : ?>
117 117
 								<div class="give-run-database-update"></div>
118 118
 							<?php endif; ?>
119 119
 						</div>
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 					</div><!-- .postbox -->
122 122
 				</div> <!-- .post-container -->
123 123
 			</div>
124
-		<?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
124
+		<?php else: include GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
125 125
 		<?php endif; ?>
126 126
 
127 127
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
128
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
129
-			<?php $plugin_update_url = add_query_arg( array(
128
+		<?php if ( ! empty($plugin_updates)) : ?>
129
+			<?php $plugin_update_url = add_query_arg(array(
130 130
 				'plugin_status' => 'give',
131
-			), admin_url( '/plugins.php' ) ); ?>
131
+			), admin_url('/plugins.php')); ?>
132 132
 			<div id="give-plugin-updates">
133 133
 				<div class="postbox-container">
134 134
 					<div class="postbox">
135
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
135
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
136 136
 						<div class="inside">
137 137
 							<div class="panel-content">
138 138
 								<p>
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,8 +68,11 @@  discard block
 block discarded – undo
68 68
 									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
69 69
 										<?php if ( get_option( 'give_upgrade_error' ) ) : ?>
70 70
 											&nbsp<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
71
-										<?php else : ?>
72
-											<?php _e( 'The updates have been paused.', 'give' ); ?>
71
+										<?php else {
72
+	: ?>
73
+											<?php _e( 'The updates have been paused.', 'give' );
74
+}
75
+?>
73 76
 										<?php endif; ?>
74 77
 									</span>
75 78
 
@@ -121,7 +124,10 @@  discard block
 block discarded – undo
121 124
 					</div><!-- .postbox -->
122 125
 				</div> <!-- .post-container -->
123 126
 			</div>
124
-		<?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
127
+		<?php else {
128
+	: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';
129
+}
130
+?>
125 131
 		<?php endif; ?>
126 132
 
127 133
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 1 patch
Spacing   +53 added lines, -53 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
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * Class constructor
33 33
 	 */
34 34
 	public function __construct() {
35
-		add_action( 'admin_init', array( $this, 'init'), 999 );
35
+		add_action('admin_init', array($this, 'init'), 999);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 	 * @since 2.1.0
42 42
 	 * @access public
43 43
 	 */
44
-	public function init(){
45
-		if ( $this->is_add_button() ) {
46
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
44
+	public function init() {
45
+		if ($this->is_add_button()) {
46
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
47 47
 
48
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
49
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
50
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
48
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
49
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
50
+			add_action('media_buttons', array($this, 'shortcode_button'));
51 51
 		}
52 52
 
53
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
54
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
53
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
54
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
55 55
 	}
56 56
 
57 57
 	/**
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @since 1.0
65 65
 	 */
66
-	public function mce_external_plugins( $plugin_array ) {
66
+	public function mce_external_plugins($plugin_array) {
67 67
 
68
-		if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
68
+		if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
69 69
 			return false;
70 70
 		}
71 71
 
72
-		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'includes/admin/shortcodes/mce-plugin.js';
72
+		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'includes/admin/shortcodes/mce-plugin.js';
73 73
 
74 74
 		return $plugin_array;
75 75
 	}
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 	 * @since 1.0
83 83
 	 */
84 84
 	public function admin_enqueue_assets() {
85
-		$direction = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : '';
85
+		$direction = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : '';
86 86
 
87 87
 		wp_enqueue_script(
88 88
 			'give_shortcode',
89
-			GIVE_PLUGIN_URL . 'assets/dist/js/admin-shortcodes.js',
90
-			array( 'jquery' ),
89
+			GIVE_PLUGIN_URL.'assets/dist/js/admin-shortcodes.js',
90
+			array('jquery'),
91 91
 			GIVE_VERSION,
92 92
 			true
93 93
 		);
94 94
 
95 95
 		wp_enqueue_style(
96 96
 			'give-admin-shortcode-button-style',
97
-			GIVE_PLUGIN_URL . 'assets/dist/css/admin-shortcode-button' . $direction . '.css',
97
+			GIVE_PLUGIN_URL.'assets/dist/css/admin-shortcode-button'.$direction.'.css',
98 98
 			array(),
99 99
 			GIVE_VERSION
100 100
 		);
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function admin_localize_scripts() {
111 111
 
112
-		if ( ! empty( self::$shortcodes ) ) {
112
+		if ( ! empty(self::$shortcodes)) {
113 113
 
114 114
 			$variables = array();
115 115
 
116
-			foreach ( self::$shortcodes as $shortcode => $values ) {
117
-				if ( ! empty( $values['required'] ) ) {
118
-					$variables[ $shortcode ] = $values['required'];
116
+			foreach (self::$shortcodes as $shortcode => $values) {
117
+				if ( ! empty($values['required'])) {
118
+					$variables[$shortcode] = $values['required'];
119 119
 				}
120 120
 			}
121 121
 
122
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
122
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
123 123
 		}
124 124
 	}
125 125
 
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$shortcodes = array();
136 136
 
137
-		foreach ( self::$shortcodes as $shortcode => $values ) {
137
+		foreach (self::$shortcodes as $shortcode => $values) {
138 138
 
139 139
 			/**
140 140
 			 * Filters the condition for including the current shortcode
141 141
 			 *
142 142
 			 * @since 1.0
143 143
 			 */
144
-			if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
144
+			if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
145 145
 
146
-				$shortcodes[ $shortcode ] = sprintf(
146
+				$shortcodes[$shortcode] = sprintf(
147 147
 					'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>',
148 148
 					$shortcode,
149 149
 					$shortcode,
@@ -152,37 +152,37 @@  discard block
 block discarded – undo
152 152
 			}
153 153
 		}
154 154
 
155
-		if ( ! empty( $shortcodes ) ) {
155
+		if ( ! empty($shortcodes)) {
156 156
 
157 157
 			// check current WP version
158
-			$img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) )
159
-				? '<img src="' . GIVE_PLUGIN_URL . 'assets/dist/images/give-media.png" />'
160
-				: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
158
+			$img = (version_compare(get_bloginfo('version'), '3.5', '<'))
159
+				? '<img src="'.GIVE_PLUGIN_URL.'assets/dist/images/give-media.png" />'
160
+				: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
161 161
 
162
-			reset( $shortcodes );
162
+			reset($shortcodes);
163 163
 
164
-			if ( 1 === count( $shortcodes ) ) {
164
+			if (1 === count($shortcodes)) {
165 165
 
166
-				$shortcode = key( $shortcodes );
166
+				$shortcode = key($shortcodes);
167 167
 
168 168
 				printf(
169 169
 					'<button type="button" class="button sc-shortcode" data-shortcode="%s">%s</button>',
170 170
 					$shortcode,
171
-					sprintf( '%s %s %s',
171
+					sprintf('%s %s %s',
172 172
 						$img,
173
-						__( 'Insert', 'give' ),
174
-						self::$shortcodes[ $shortcode ]['label']
173
+						__('Insert', 'give'),
174
+						self::$shortcodes[$shortcode]['label']
175 175
 					)
176 176
 				);
177 177
 			} else {
178 178
 				printf(
179
-					'<div class="sc-wrap">' .
180
-					'<button class="button sc-button" type="button">%s %s</button>' .
181
-					'<div class="sc-menu mce-menu">%s</div>' .
179
+					'<div class="sc-wrap">'.
180
+					'<button class="button sc-button" type="button">%s %s</button>'.
181
+					'<div class="sc-menu mce-menu">%s</div>'.
182 182
 					'</div>',
183 183
 					$img,
184
-					__( 'Give Shortcodes', 'give' ),
185
-					implode( '', array_values( $shortcodes ) )
184
+					__('Give Shortcodes', 'give'),
185
+					implode('', array_values($shortcodes))
186 186
 				);
187 187
 			}
188 188
 		}
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function shortcode_ajax() {
199 199
 
200
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
200
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
201 201
 		$response  = false;
202 202
 
203
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
203
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
204 204
 
205
-			$data = self::$shortcodes[ $shortcode ];
205
+			$data = self::$shortcodes[$shortcode];
206 206
 
207
-			if ( ! empty( $data['errors'] ) ) {
208
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
207
+			if ( ! empty($data['errors'])) {
208
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
209 209
 			}
210 210
 
211 211
 			$response = array(
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 			);
218 218
 		} else {
219 219
 			// todo: handle error
220
-			error_log( print_r( 'AJAX error!', 1 ) );
220
+			error_log(print_r('AJAX error!', 1));
221 221
 		}
222 222
 
223
-		wp_send_json( $response );
223
+		wp_send_json($response);
224 224
 	}
225 225
 
226 226
 
@@ -234,22 +234,22 @@  discard block
 block discarded – undo
234 234
 	private function is_add_button() {
235 235
 		global $pagenow;
236 236
 
237
-		$shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array(
237
+		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array(
238 238
 			'post.php',
239 239
 			'page.php',
240 240
 			'post-new.php',
241 241
 			'post-edit.php',
242 242
 			'edit.php',
243 243
 			'edit.php?post_type=page',
244
-		) );
244
+		));
245 245
 
246 246
 		$setting_page = give_get_current_setting_page();
247 247
 
248 248
 		// Only run in admin post/page creation and edit screens
249 249
 		if (
250 250
 			! is_admin()
251
-			|| ! in_array( $pagenow, $shortcode_button_pages )
252
-			|| ( 'give-settings' === $setting_page )
251
+			|| ! in_array($pagenow, $shortcode_button_pages)
252
+			|| ('give-settings' === $setting_page)
253 253
 
254 254
 			/**
255 255
 			 * Fire the filter
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 			 * @since 1.0
259 259
 			 *
260 260
 			 */
261
-			|| ! apply_filters( 'give_shortcode_button_condition', true )
262
-			|| empty( self::$shortcodes )
261
+			|| ! apply_filters('give_shortcode_button_condition', true)
262
+			|| empty(self::$shortcodes)
263 263
 		) {
264 264
 			return false;
265 265
 		}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donor-wall.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		$this->shortcode['title'] = esc_html__( 'Donor Wall', 'give' );
28
-		$this->shortcode['label'] = esc_html__( 'Donor Wall', 'give' );
27
+		$this->shortcode['title'] = esc_html__('Donor Wall', 'give');
28
+		$this->shortcode['label'] = esc_html__('Donor Wall', 'give');
29 29
 
30
-		parent::__construct( 'give_donor_wall' );
30
+		parent::__construct('give_donor_wall');
31 31
 	}
32 32
 
33 33
 	/**
@@ -43,90 +43,90 @@  discard block
 block discarded – undo
43 43
 					'post_type' => 'give_forms',
44 44
 				),
45 45
 				'name'        => 'form_id',
46
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
47
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
46
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
47
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
48 48
 			),
49 49
 			array(
50 50
 				'type'        => 'textbox',
51 51
 				'name'        => 'donors_per_page',
52
-				'label'       => esc_attr__( 'Donors Per Page', 'give' ),
52
+				'label'       => esc_attr__('Donors Per Page', 'give'),
53 53
 				'placeholder' => '20',
54 54
 			),
55 55
 			array(
56 56
 				'type'        => 'textbox',
57 57
 				'name'        => 'comment_length',
58
-				'label'       => esc_attr__( 'Comment Length', 'give' ),
58
+				'label'       => esc_attr__('Comment Length', 'give'),
59 59
 				'placeholder' => '20',
60 60
 			),
61 61
 			array(
62 62
 				'type'        => 'textbox',
63 63
 				'name'        => 'readmore_text',
64
-				'label'       => esc_attr__( 'Read More Text', 'give' ),
65
-				'placeholder' => esc_html__( 'Read More', 'give' ),
64
+				'label'       => esc_attr__('Read More Text', 'give'),
65
+				'placeholder' => esc_html__('Read More', 'give'),
66 66
 			),
67 67
 			array(
68 68
 				'type'        => 'textbox',
69 69
 				'name'        => 'loadmore_text',
70
-				'label'       => esc_attr__( 'Load More Text', 'give' ),
71
-				'placeholder' => esc_html__( 'Load More', 'give' ),
70
+				'label'       => esc_attr__('Load More Text', 'give'),
71
+				'placeholder' => esc_html__('Load More', 'give'),
72 72
 			),
73 73
 			array(
74 74
 				'type'        => 'listbox',
75 75
 				'name'        => 'columns',
76
-				'label'       => esc_attr__( 'Columns:', 'give' ),
77
-				'tooltip'     => esc_attr__( 'Sets the number of forms per row.', 'give' ),
76
+				'label'       => esc_attr__('Columns:', 'give'),
77
+				'tooltip'     => esc_attr__('Sets the number of forms per row.', 'give'),
78 78
 				'options'     => array(
79
-					'1' => esc_html__( '1', 'give' ),
80
-					'2' => esc_html__( '2', 'give' ),
81
-					'3' => esc_html__( '3', 'give' ),
82
-					'4' => esc_html__( '4', 'give' ),
79
+					'1' => esc_html__('1', 'give'),
80
+					'2' => esc_html__('2', 'give'),
81
+					'3' => esc_html__('3', 'give'),
82
+					'4' => esc_html__('4', 'give'),
83 83
 				),
84
-				'placeholder' => esc_html__( 'Best Fit', 'give' ),
84
+				'placeholder' => esc_html__('Best Fit', 'give'),
85 85
 			),
86 86
 			array(
87 87
 				'type'        => 'listbox',
88 88
 				'name'        => 'show_avatar',
89
-				'label'       => esc_attr__( 'Show Avatar', 'give' ),
89
+				'label'       => esc_attr__('Show Avatar', 'give'),
90 90
 				'options'     => array(
91
-					'false' => esc_html__( 'Hide', 'give' ),
91
+					'false' => esc_html__('Hide', 'give'),
92 92
 				),
93
-				'placeholder' => esc_html__( 'Show', 'give' ),
93
+				'placeholder' => esc_html__('Show', 'give'),
94 94
 			),
95 95
 			array(
96 96
 				'type'        => 'listbox',
97 97
 				'name'        => 'show_name',
98
-				'label'       => esc_attr__( 'Show Name', 'give' ),
98
+				'label'       => esc_attr__('Show Name', 'give'),
99 99
 				'options'     => array(
100
-					'false' => esc_html__( 'Hide', 'give' ),
100
+					'false' => esc_html__('Hide', 'give'),
101 101
 				),
102
-				'placeholder' => esc_html__( 'Show', 'give' ),
102
+				'placeholder' => esc_html__('Show', 'give'),
103 103
 			),
104 104
 			array(
105 105
 				'type'        => 'listbox',
106 106
 				'name'        => 'show_total',
107
-				'label'       => esc_attr__( 'Show Total', 'give' ),
107
+				'label'       => esc_attr__('Show Total', 'give'),
108 108
 				'options'     => array(
109
-					'false' => esc_html__( 'Hide', 'give' ),
109
+					'false' => esc_html__('Hide', 'give'),
110 110
 				),
111
-				'placeholder' => esc_html__( 'Show', 'give' ),
111
+				'placeholder' => esc_html__('Show', 'give'),
112 112
 			),
113 113
 			array(
114 114
 				'type'        => 'listbox',
115 115
 				'name'        => 'show_time',
116
-				'label'       => esc_attr__( 'Show Date', 'give' ),
116
+				'label'       => esc_attr__('Show Date', 'give'),
117 117
 				'options'     => array(
118
-					'false' => esc_html__( 'Hide', 'give' ),
118
+					'false' => esc_html__('Hide', 'give'),
119 119
 				),
120
-				'placeholder' => esc_html__( 'Show', 'give' ),
120
+				'placeholder' => esc_html__('Show', 'give'),
121 121
 			),
122 122
 			array(
123 123
 				'type'        => 'listbox',
124 124
 				'name'        => 'show_comments',
125
-				'label'       => esc_attr__( 'Show Comments', 'give' ),
125
+				'label'       => esc_attr__('Show Comments', 'give'),
126 126
 				'options'     => array(
127
-					'false' => esc_html__( 'Hide', 'give' ),
127
+					'false' => esc_html__('Hide', 'give'),
128 128
 				),
129
-				'placeholder' => esc_html__( 'Show', 'give' ),
129
+				'placeholder' => esc_html__('Show', 'give'),
130 130
 			)
131 131
 		);
132 132
 	}
Please login to merge, or discard this patch.