Completed
Pull Request — master (#1749)
by Devin
06:21
created
includes/emails/template.php 1 patch
Spacing   +104 added lines, -104 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
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -56,42 +56,42 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @return string $message Fully formatted message
58 58
  */
59
-function give_email_preview_template_tags( $message ) {
59
+function give_email_preview_template_tags($message) {
60 60
 
61
-	$price = give_currency_filter( give_format_amount( 10.50 ) );
61
+	$price = give_currency_filter(give_format_amount(10.50));
62 62
 
63 63
 	$gateway = 'PayPal';
64 64
 
65
-	$receipt_id = strtolower( md5( uniqid() ) );
65
+	$receipt_id = strtolower(md5(uniqid()));
66 66
 
67
-	$payment_id = rand( 1, 100 );
67
+	$payment_id = rand(1, 100);
68 68
 
69
-	$receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) );
69
+	$receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url()));
70 70
 	$receipt_link = sprintf(
71 71
 		'<a href="%1$s">%2$s</a>',
72 72
 		$receipt_link_url,
73
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
73
+		esc_html__('View the receipt in your browser &raquo;', 'give')
74 74
 	);
75 75
 
76 76
 	$user = wp_get_current_user();
77 77
 
78
-	$message = str_replace( '{name}', $user->display_name, $message );
79
-	$message = str_replace( '{fullname}', $user->display_name, $message );
80
-	$message = str_replace( '{username}', $user->user_login, $message );
81
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
82
-	$message = str_replace( '{amount}', $price, $message );
83
-	$message = str_replace( '{price}', $price, $message );
84
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
85
-	$message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message );
86
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
87
-	$message = str_replace( '{payment_method}', $gateway, $message );
88
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
89
-	$message = str_replace( '{payment_id}', $payment_id, $message );
90
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
91
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
92
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
93
-
94
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
78
+	$message = str_replace('{name}', $user->display_name, $message);
79
+	$message = str_replace('{fullname}', $user->display_name, $message);
80
+	$message = str_replace('{username}', $user->user_login, $message);
81
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
82
+	$message = str_replace('{amount}', $price, $message);
83
+	$message = str_replace('{price}', $price, $message);
84
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
85
+	$message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message);
86
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
87
+	$message = str_replace('{payment_method}', $gateway, $message);
88
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
89
+	$message = str_replace('{payment_id}', $payment_id, $message);
90
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
91
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
92
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
93
+
94
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
95 95
 }
96 96
 
97 97
 /**
@@ -103,23 +103,23 @@  discard block
 block discarded – undo
103 103
  * @since  1.0
104 104
  * @return array|bool
105 105
  */
106
-function give_email_template_preview( $array ) {
106
+function give_email_template_preview($array) {
107 107
 
108
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
108
+	if ( ! current_user_can('manage_give_settings')) {
109 109
 		return false;
110 110
 	}
111 111
 	$custom_field = array(
112
-		'name' => esc_html__( 'Preview Email', 'give' ),
113
-		'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ),
112
+		'name' => esc_html__('Preview Email', 'give'),
113
+		'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'),
114 114
 		'id'   => 'give_email_preview_buttons',
115 115
 		'type' => 'email_preview_buttons'
116 116
 	);
117 117
 
118
-	return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) );
118
+	return give_settings_array_insert($array, 'donation_subject', array($custom_field));
119 119
 
120 120
 }
121 121
 
122
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
122
+add_filter('give_settings_emails', 'give_email_template_preview');
123 123
 
124 124
 /**
125 125
  * Output Email Template Preview Buttons.
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 function give_email_preview_buttons_callback() {
132 132
 	ob_start();
133 133
 	?>
134
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a>
135
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
134
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a>
135
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
136 136
 		'give_action'  => 'send_test_email',
137 137
 		'give-message' => 'sent-test-email',
138 138
 		'tag'          => 'emails'
139
-	) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a>
139
+	)), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a>
140 140
 	<?php
141 141
 	echo ob_get_clean();
142 142
 }
@@ -149,46 +149,46 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function give_display_email_template_preview() {
151 151
 
152
-	if ( empty( $_GET['give_action'] ) ) {
152
+	if (empty($_GET['give_action'])) {
153 153
 		return;
154 154
 	}
155 155
 
156
-	if ( 'preview_email' !== $_GET['give_action'] ) {
156
+	if ('preview_email' !== $_GET['give_action']) {
157 157
 		return;
158 158
 	}
159 159
 
160
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
160
+	if ( ! current_user_can('manage_give_settings')) {
161 161
 		return;
162 162
 	}
163 163
 
164 164
 
165
-	Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' );
165
+	Give()->emails->heading = esc_html__('Donation Receipt', 'give');
166 166
 
167
-	$payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
167
+	$payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
168 168
 
169 169
 	echo give_get_preview_email_header();
170 170
 
171 171
 	//Are we previewing an actual payment?
172
-	if ( ! empty( $payment_id ) ) {
172
+	if ( ! empty($payment_id)) {
173 173
 
174
-		$content = give_get_email_body_content( $payment_id );
174
+		$content = give_get_email_body_content($payment_id);
175 175
 
176
-		$preview_content = give_do_email_tags( $content, $payment_id );
176
+		$preview_content = give_do_email_tags($content, $payment_id);
177 177
 
178 178
 	} else {
179 179
 
180 180
 		//No payment ID, use sample preview content
181
-		$preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
181
+		$preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
182 182
 	}
183 183
 
184 184
 
185
-	echo Give()->emails->build_email( $preview_content );
185
+	echo Give()->emails->build_email($preview_content);
186 186
 
187 187
 	exit;
188 188
 
189 189
 }
190 190
 
191
-add_action( 'init', 'give_display_email_template_preview' );
191
+add_action('init', 'give_display_email_template_preview');
192 192
 
193 193
 /**
194 194
  * Email Template Body.
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
  *
201 201
  * @return string $email_body Body of the email
202 202
  */
203
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
203
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
204 204
 
205 205
 	$default_email_body = give_get_default_donation_receipt_email();
206 206
 
207
-	$email_content = give_get_option( 'donation_receipt' );
208
-	$email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body;
207
+	$email_content = give_get_option('donation_receipt');
208
+	$email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body;
209 209
 
210
-	$email_body = wpautop( $email_content );
210
+	$email_body = wpautop($email_content);
211 211
 
212
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
212
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
213 213
 
214
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
214
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
215 215
 }
216 216
 
217 217
 /**
@@ -224,36 +224,36 @@  discard block
 block discarded – undo
224 224
  *
225 225
  * @return string $email_body Body of the email
226 226
  */
227
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
227
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
228 228
 
229
-	$user_info = maybe_unserialize( $payment_data['user_info'] );
230
-	$email     = give_get_payment_user_email( $payment_id );
229
+	$user_info = maybe_unserialize($payment_data['user_info']);
230
+	$email     = give_get_payment_user_email($payment_id);
231 231
 
232
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
233
-		$user_data = get_userdata( $user_info['id'] );
232
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
233
+		$user_data = get_userdata($user_info['id']);
234 234
 		$name      = $user_data->display_name;
235
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
236
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
235
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
236
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
237 237
 	} else {
238 238
 		$name = $email;
239 239
 	}
240 240
 
241
-	$gateway = give_get_gateway_admin_label( give_get_meta( $payment_id, '_give_payment_gateway', true ) );
241
+	$gateway = give_get_gateway_admin_label(give_get_meta($payment_id, '_give_payment_gateway', true));
242 242
 
243
-	$default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n";
244
-	$default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n";
245
-	$default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n";
246
-	$default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
247
-	$default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
248
-	$default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n";
249
-	$default_email_body .= esc_html__( 'Thank you', 'give' );
243
+	$default_email_body = esc_html__('Hello', 'give')."\n\n";
244
+	$default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n";
245
+	$default_email_body .= esc_html__('Donation:', 'give')."\n\n";
246
+	$default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
247
+	$default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n";
248
+	$default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n";
249
+	$default_email_body .= esc_html__('Thank you', 'give');
250 250
 
251
-	$email = give_get_option( 'donation_notification' );
252
-	$email = isset( $email ) ? stripslashes( $email ) : $default_email_body;
251
+	$email = give_get_option('donation_notification');
252
+	$email = isset($email) ? stripslashes($email) : $default_email_body;
253 253
 
254
-	$email_body = give_do_email_tags( $email, $payment_id );
254
+	$email_body = give_do_email_tags($email, $payment_id);
255 255
 
256
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
256
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
257 257
 }
258 258
 
259 259
 /**
@@ -266,19 +266,19 @@  discard block
 block discarded – undo
266 266
  * @since  1.0
267 267
  */
268 268
 function give_render_receipt_in_browser() {
269
-	if ( ! isset( $_GET['payment_key'] ) ) {
270
-		wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
269
+	if ( ! isset($_GET['payment_key'])) {
270
+		wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
271 271
 	}
272 272
 
273
-	$key = urlencode( $_GET['payment_key'] );
273
+	$key = urlencode($_GET['payment_key']);
274 274
 
275 275
 	ob_start();
276 276
 	//Disallows caching of the page
277
-	header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
278
-	header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
279
-	header( "Cache-Control: post-check=0, pre-check=0", false );
280
-	header( "Pragma: no-cache" ); // HTTP/1.0
281
-	header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
277
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
278
+	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
279
+	header("Cache-Control: post-check=0, pre-check=0", false);
280
+	header("Pragma: no-cache"); // HTTP/1.0
281
+	header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past
282 282
 	?>
283 283
 	<!DOCTYPE html>
284 284
 	<html lang="en">
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 		 *
290 290
 		 * @since 1.0
291 291
 		 */
292
-		do_action( 'give_receipt_head' );
292
+		do_action('give_receipt_head');
293 293
 		?>
294 294
 	</head>
295
-	<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
295
+	<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
296 296
 
297 297
 	<div id="give_receipt_wrapper">
298 298
 		<?php
@@ -301,16 +301,16 @@  discard block
 block discarded – undo
301 301
 		 *
302 302
 		 * @since 1.0
303 303
 		 */
304
-		do_action( 'give_render_receipt_in_browser_before' );
304
+		do_action('give_render_receipt_in_browser_before');
305 305
 
306
-		echo do_shortcode( '[give_receipt payment_key=' . $key . ']' );
306
+		echo do_shortcode('[give_receipt payment_key='.$key.']');
307 307
 
308 308
 		/**
309 309
 		 * Fires in the receipt template after the content.
310 310
 		 *
311 311
 		 * @since 1.0
312 312
 		 */
313
-		do_action( 'give_render_receipt_in_browser_after' );
313
+		do_action('give_render_receipt_in_browser_after');
314 314
 		?>
315 315
 	</div>
316 316
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 *
321 321
 	 * @since 1.0
322 322
 	 */
323
-	do_action( 'give_receipt_footer' );
323
+	do_action('give_receipt_footer');
324 324
 	?>
325 325
 	</body>
326 326
 	</html>
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	die();
330 330
 }
331 331
 
332
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
332
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
333 333
 
334 334
 
335 335
 /**
@@ -344,29 +344,29 @@  discard block
 block discarded – undo
344 344
 
345 345
 	//Payment receipt switcher
346 346
 	$payment_count = give_count_payments()->publish;
347
-	$payment_id    = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
347
+	$payment_id    = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
348 348
 
349
-	if ( $payment_count <= 0 ) {
349
+	if ($payment_count <= 0) {
350 350
 		return false;
351 351
 	}
352 352
 
353 353
 	//Get payments.
354
-	$payments = new Give_Payments_Query( array(
354
+	$payments = new Give_Payments_Query(array(
355 355
 		'number' => 100
356
-	) );
356
+	));
357 357
 	$payments = $payments->get_payments();
358 358
 	$options  = array();
359 359
 
360 360
 	//Provide nice human readable options.
361
-	if ( $payments ) {
362
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
363
-		foreach ( $payments as $payment ) {
361
+	if ($payments) {
362
+		$options[0] = esc_html__('- Select a donation -', 'give');
363
+		foreach ($payments as $payment) {
364 364
 
365
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
365
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
366 366
 
367 367
 		}
368 368
 	} else {
369
-		$options[0] = esc_html__( 'No donations found.', 'give' );
369
+		$options[0] = esc_html__('No donations found.', 'give');
370 370
 	}
371 371
 
372 372
 	//Start constructing HTML output.
@@ -379,16 +379,16 @@  discard block
 block discarded – undo
379 379
 			        var selected_trans = transactions.options[transactions.selectedIndex];
380 380
 				        console.log(selected_trans);
381 381
 				        if (selected_trans){
382
-				            var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value;
382
+				            var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value;
383 383
 				                window.location = url_string;
384 384
 				        }
385 385
 				    }
386 386
 			    </script>';
387 387
 
388
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>';
388
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>';
389 389
 
390 390
 	//The select field with 100 latest transactions
391
-	$transaction_header .= Give()->html->select( array(
391
+	$transaction_header .= Give()->html->select(array(
392 392
 		'name'             => 'preview_email_payment_id',
393 393
 		'selected'         => $payment_id,
394 394
 		'id'               => 'give_preview_email_payment_id',
@@ -398,12 +398,12 @@  discard block
 block discarded – undo
398 398
 		'select_atts'      => 'onchange="change_preview()">',
399 399
 		'show_option_all'  => false,
400 400
 		'show_option_none' => false
401
-	) );
401
+	));
402 402
 
403 403
 	//Closing tag
404 404
 	$transaction_header .= '</div>';
405 405
 
406
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
406
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
407 407
 
408 408
 }
409 409
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 function give_receipt_head_content() {
418 418
 
419 419
 	//Title.
420
-	$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';
420
+	$output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>';
421 421
 
422 422
 	//Meta.
423 423
 	$output .= '<meta charset="utf-8"/>
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
 		<meta name="robots" content="noindex, nofollow"/>';
432 432
 
433 433
 	//CSS
434
-	$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';
434
+	$output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">';
435 435
 
436
-	echo apply_filters( 'give_receipt_head_content', $output );
436
+	echo apply_filters('give_receipt_head_content', $output);
437 437
 
438 438
 }
439 439
 
440
-add_action( 'give_receipt_head', 'give_receipt_head_content' );
441 440
\ No newline at end of file
441
+add_action('give_receipt_head', 'give_receipt_head_content');
442 442
\ No newline at end of file
Please login to merge, or discard this patch.
includes/gateways/functions.php 1 patch
Spacing   +66 added lines, -66 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,16 +24,16 @@  discard block
 block discarded – undo
24 24
 	// Default, built-in gateways
25 25
 	$gateways = array(
26 26
 		'paypal' => array(
27
-			'admin_label'    => __( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => __( 'PayPal', 'give' ),
27
+			'admin_label'    => __('PayPal Standard', 'give'),
28
+			'checkout_label' => __('PayPal', 'give'),
29 29
 		),
30 30
 		'manual' => array(
31
-			'admin_label'    => __( 'Test Donation', 'give' ),
32
-			'checkout_label' => __( 'Test Donation', 'give' )
31
+			'admin_label'    => __('Test Donation', 'give'),
32
+			'checkout_label' => __('Test Donation', 'give')
33 33
 		),
34 34
 	);
35 35
 
36
-	return apply_filters( 'give_payment_gateways', $gateways );
36
+	return apply_filters('give_payment_gateways', $gateways);
37 37
 
38 38
 }
39 39
 
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array $gateway_list All the available gateways
48 48
  */
49
-function give_get_enabled_payment_gateways( $form_id = 0 ) {
49
+function give_get_enabled_payment_gateways($form_id = 0) {
50 50
 
51 51
 	$gateways = give_get_payment_gateways();
52 52
 
53
-	$enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
53
+	$enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
54 54
 
55 55
 	$gateway_list = array();
56 56
 
57
-	foreach ( $gateways as $key => $gateway ) {
58
-		if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
59
-			$gateway_list[ $key ] = $gateway;
57
+	foreach ($gateways as $key => $gateway) {
58
+		if (isset($enabled[$key]) && $enabled[$key] == 1) {
59
+			$gateway_list[$key] = $gateway;
60 60
 		}
61 61
 	}
62 62
 
63 63
 	// Set order of payment gateway in list.
64
-	$gateway_list = give_get_ordered_payment_gateways( $gateway_list );
64
+	$gateway_list = give_get_ordered_payment_gateways($gateway_list);
65 65
 
66
-	return apply_filters( 'give_enabled_payment_gateways', $gateway_list, $form_id );
66
+	return apply_filters('give_enabled_payment_gateways', $gateway_list, $form_id);
67 67
 }
68 68
 
69 69
 /**
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
  *
76 76
  * @return boolean true if enabled, false otherwise
77 77
  */
78
-function give_is_gateway_active( $gateway ) {
78
+function give_is_gateway_active($gateway) {
79 79
 	$gateways = give_get_enabled_payment_gateways();
80 80
 
81
-	$ret = array_key_exists( $gateway, $gateways );
81
+	$ret = array_key_exists($gateway, $gateways);
82 82
 
83
-	return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways );
83
+	return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways);
84 84
 }
85 85
 
86 86
 /**
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
  *
93 93
  * @return string Gateway ID
94 94
  */
95
-function give_get_default_gateway( $form_id ) {
95
+function give_get_default_gateway($form_id) {
96 96
 
97 97
 	$give_options = give_get_settings();
98
-	$default      = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal';
99
-	$form_default = give_get_meta( $form_id, '_give_default_gateway', true );
98
+	$default      = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal';
99
+	$form_default = give_get_meta($form_id, '_give_default_gateway', true);
100 100
 
101 101
 	// Single Form settings varies compared to the Global default settings.
102
-	if ( ! empty( $form_default ) &&
102
+	if ( ! empty($form_default) &&
103 103
 		 $form_id !== null &&
104 104
 		 $default !== $form_default &&
105 105
 		 $form_default !== 'global' &&
106
-		 give_is_gateway_active( $form_default )
106
+		 give_is_gateway_active($form_default)
107 107
 	) {
108 108
 		$default = $form_default;
109 109
 	}
110 110
 
111
-	return apply_filters( 'give_default_gateway', $default );
111
+	return apply_filters('give_default_gateway', $default);
112 112
 }
113 113
 
114 114
 /**
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string Gateway admin label
122 122
  */
123
-function give_get_gateway_admin_label( $gateway ) {
123
+function give_get_gateway_admin_label($gateway) {
124 124
 	$gateways = give_get_payment_gateways();
125
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
126
-	$payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
125
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
126
+	$payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
127 127
 
128
-	if ( $gateway == 'manual' && $payment ) {
129
-		if ( give_get_payment_amount( $payment ) == 0 ) {
130
-			$label = __( 'Test Donation', 'give' );
128
+	if ($gateway == 'manual' && $payment) {
129
+		if (give_get_payment_amount($payment) == 0) {
130
+			$label = __('Test Donation', 'give');
131 131
 		}
132 132
 	}
133 133
 
134
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
134
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
135 135
 }
136 136
 
137 137
 /**
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
  *
144 144
  * @return string Checkout label for the gateway
145 145
  */
146
-function give_get_gateway_checkout_label( $gateway ) {
146
+function give_get_gateway_checkout_label($gateway) {
147 147
 	$gateways = give_get_payment_gateways();
148
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
148
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
149 149
 
150
-	if ( $gateway == 'manual' ) {
151
-		$label = __( 'Test Donation', 'give' );
150
+	if ($gateway == 'manual') {
151
+		$label = __('Test Donation', 'give');
152 152
 	}
153 153
 
154
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
154
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
155 155
 }
156 156
 
157 157
 /**
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return array Options the gateway supports
165 165
  */
166
-function give_get_gateway_supports( $gateway ) {
166
+function give_get_gateway_supports($gateway) {
167 167
 	$gateways = give_get_enabled_payment_gateways();
168
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
168
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
169 169
 
170
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
170
+	return apply_filters('give_gateway_supports', $supports, $gateway);
171 171
 }
172 172
 
173 173
 /**
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @return void
182 182
  */
183
-function give_send_to_gateway( $gateway, $payment_data ) {
183
+function give_send_to_gateway($gateway, $payment_data) {
184 184
 
185
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
185
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
186 186
 
187 187
 	/**
188 188
 	 * Fires while loading payment gateway via AJAX.
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @param array $payment_data All the payment data to be sent to the gateway.
195 195
 	 */
196
-	do_action( "give_gateway_{$gateway}", $payment_data );
196
+	do_action("give_gateway_{$gateway}", $payment_data);
197 197
 }
198 198
 
199 199
 
@@ -207,34 +207,34 @@  discard block
 block discarded – undo
207 207
  *
208 208
  * @return string $enabled_gateway The slug of the gateway
209 209
  */
210
-function give_get_chosen_gateway( $form_id ) {
210
+function give_get_chosen_gateway($form_id) {
211 211
 
212
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
212
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
213 213
 
214 214
 	// Back to check if 'form-id' is present.
215
-	if ( empty( $request_form_id ) ) {
216
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
215
+	if (empty($request_form_id)) {
216
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
217 217
 	}
218 218
 
219
-	$request_payment_mode = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : '';
219
+	$request_payment_mode = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : '';
220 220
 	$chosen               = false;
221 221
 
222 222
 	// If both 'payment-mode' and 'form-id' then set for only this form.
223
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
223
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
224 224
 		$chosen = $request_payment_mode;
225
-	} elseif ( empty( $request_form_id ) && $request_payment_mode ) {
225
+	} elseif (empty($request_form_id) && $request_payment_mode) {
226 226
 		// If no 'form-id' but there is 'payment-mode'.
227 227
 		$chosen = $request_payment_mode;
228 228
 	}
229 229
 
230 230
 	// Get the enable gateway based of chosen var.
231
-	if ( $chosen && give_is_gateway_active( $chosen ) ) {
232
-		$enabled_gateway = urldecode( $chosen );
231
+	if ($chosen && give_is_gateway_active($chosen)) {
232
+		$enabled_gateway = urldecode($chosen);
233 233
 	} else {
234
-		$enabled_gateway = give_get_default_gateway( $form_id );
234
+		$enabled_gateway = give_get_default_gateway($form_id);
235 235
 	}
236 236
 
237
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
237
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
238 238
 
239 239
 }
240 240
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return int ID of the new log entry
254 254
  */
255
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
256
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
255
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
256
+	return give_record_log($title, $message, $parent, 'gateway_error');
257 257
 }
258 258
 
259 259
 /**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
  *
267 267
  * @return int
268 268
  */
269
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
269
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
270 270
 
271 271
 	$ret  = 0;
272 272
 	$args = array(
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 		'fields'      => 'ids',
279 279
 	);
280 280
 
281
-	$payments = new WP_Query( $args );
281
+	$payments = new WP_Query($args);
282 282
 
283
-	if ( $payments ) {
283
+	if ($payments) {
284 284
 		$ret = $payments->post_count;
285 285
 	}
286 286
 
@@ -297,27 +297,27 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @return array $gateways All the available gateways
299 299
  */
300
-function give_get_ordered_payment_gateways( $gateways ) {
300
+function give_get_ordered_payment_gateways($gateways) {
301 301
 
302 302
 	// Get gateways setting.
303
-	$gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
303
+	$gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
304 304
 
305 305
 	// Return from here if we do not have gateways setting.
306
-	if ( empty( $gateways_setting ) ) {
306
+	if (empty($gateways_setting)) {
307 307
 		return $gateways;
308 308
 	}
309 309
 
310 310
 	// Reverse array to order payment gateways.
311
-	$gateways_setting = array_reverse( $gateways_setting );
311
+	$gateways_setting = array_reverse($gateways_setting);
312 312
 
313 313
 	// Reorder gateways array
314
-	foreach ( $gateways_setting as $gateway_key => $value ) {
314
+	foreach ($gateways_setting as $gateway_key => $value) {
315 315
 
316
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
317
-		unset( $gateways[ $gateway_key ] );
316
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
317
+		unset($gateways[$gateway_key]);
318 318
 
319
-		if ( ! empty( $new_gateway_value ) ) {
320
-			$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
319
+		if ( ! empty($new_gateway_value)) {
320
+			$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
321 321
 		}
322 322
 	}
323 323
 
@@ -328,5 +328,5 @@  discard block
 block discarded – undo
328 328
 	 *
329 329
 	 * @param array $gateways All the available gateways
330 330
 	 */
331
-	return apply_filters( 'give_payment_gateways_order', $gateways );
331
+	return apply_filters('give_payment_gateways_order', $gateways);
332 332
 }
333 333
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/reports.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Exit if accessed directly.
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
34 34
 	$views        = give_reports_default_views();
35 35
 	?>
36 36
 	<div class="wrap give-settings-page">
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 		<h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1>
39 39
 
40 40
 		<h2 class="nav-tab-wrapper">
41
-			<?php foreach ( $views as $tab => $label ) { ?>
42
-				<a href="<?php echo esc_url( add_query_arg( array(
41
+			<?php foreach ($views as $tab => $label) { ?>
42
+				<a href="<?php echo esc_url(add_query_arg(array(
43 43
 					'tab'              => $tab,
44 44
 					'settings-updated' => false,
45
-				), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a>
45
+				), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a>
46 46
 			<?php } ?>
47
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
48
-				<a href="<?php echo esc_url( add_query_arg( array(
47
+			<?php if (current_user_can('export_give_reports')) { ?>
48
+				<a href="<?php echo esc_url(add_query_arg(array(
49 49
 					'tab'              => 'export',
50 50
 					'settings-updated' => false,
51
-				), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a>
51
+				), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a>
52 52
 			<?php }
53 53
 			/**
54 54
 			 * Fires in the report tabs.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			 *
58 58
 			 * @since 1.0
59 59
 			 */
60
-			do_action( 'give_reports_tabs' );
60
+			do_action('give_reports_tabs');
61 61
 			?>
62 62
 		</h2>
63 63
 
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		 *
68 68
 		 * @since 1.0
69 69
 		 */
70
-		do_action( 'give_reports_page_top' );
70
+		do_action('give_reports_page_top');
71 71
 
72 72
 		// Set $active_tab prior to hook firing.
73
-		if ( in_array( $active_tab, array_keys( $views ) ) ) {
73
+		if (in_array($active_tab, array_keys($views))) {
74 74
 			$active_tab = 'reports';
75 75
 		}
76 76
 
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @since 1.0
81 81
 		 */
82
-		do_action( "give_reports_tab_{$active_tab}" );
82
+		do_action("give_reports_tab_{$active_tab}");
83 83
 
84 84
 		/**
85 85
 		 * Fires after the report page.
86 86
 		 *
87 87
 		 * @since 1.0
88 88
 		 */
89
-		do_action( 'give_reports_page_bottom' );
89
+		do_action('give_reports_page_bottom');
90 90
 		?>
91 91
 	</div><!-- .wrap -->
92 92
 	<?php
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function give_reports_default_views() {
102 102
 	$views = array(
103
-		'earnings' => esc_html__( 'Income', 'give' ),
104
-		'forms'    => esc_html__( 'Forms', 'give' ),
105
-		'donors'   => esc_html__( 'Donors', 'give' ),
106
-		'gateways' => esc_html__( 'Donation Methods', 'give' ),
103
+		'earnings' => esc_html__('Income', 'give'),
104
+		'forms'    => esc_html__('Forms', 'give'),
105
+		'donors'   => esc_html__('Donors', 'give'),
106
+		'gateways' => esc_html__('Donation Methods', 'give'),
107 107
 	);
108 108
 
109
-	$views = apply_filters( 'give_report_views', $views );
109
+	$views = apply_filters('give_report_views', $views);
110 110
 
111 111
 	return $views;
112 112
 }
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
  * @since 1.0
122 122
  * @return string $view Report View
123 123
  */
124
-function give_get_reporting_view( $default = 'earnings' ) {
124
+function give_get_reporting_view($default = 'earnings') {
125 125
 
126
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
126
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
127 127
 		$view = $default;
128 128
 	} else {
129 129
 		$view = $_GET['view'];
130 130
 	}
131 131
 
132
-	return apply_filters( 'give_get_reporting_view', $view );
132
+	return apply_filters('give_get_reporting_view', $view);
133 133
 }
134 134
 
135 135
 /**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	$current_view = 'earnings';
143 143
 	$views        = give_reports_default_views();
144 144
 
145
-	if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) {
145
+	if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) {
146 146
 		$current_view = $_GET['tab'];
147 147
 	}
148 148
 
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @since 1.0
153 153
 	 */
154
-	do_action( "give_reports_view_{$current_view}" );
154
+	do_action("give_reports_view_{$current_view}");
155 155
 }
156 156
 
157
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
157
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
158 158
 
159 159
 /**
160 160
  * Renders the Reports Page Views Drop Downs
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
  */
165 165
 function give_report_views() {
166 166
 	$views        = give_reports_default_views();
167
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
167
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
168 168
 	/**
169 169
 	 * Fires before the report page actions form.
170 170
 	 *
171 171
 	 * @since 1.0
172 172
 	 */
173
-	do_action( 'give_report_view_actions_before' );
173
+	do_action('give_report_view_actions_before');
174 174
 	?>
175 175
 	<form id="give-reports-filter" method="get">
176 176
 		<select id="give-reports-view" name="view">
177
-			<option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option>
178
-			<?php foreach ( $views as $view_id => $label ) : ?>
179
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
177
+			<option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option>
178
+			<?php foreach ($views as $view_id => $label) : ?>
179
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
180 180
 			<?php endforeach; ?>
181 181
 		</select>
182 182
 
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 		 *
189 189
 		 * @since 1.0
190 190
 		 */
191
-		do_action( 'give_report_view_actions' );
191
+		do_action('give_report_view_actions');
192 192
 		?>
193 193
 
194 194
 		<input type="hidden" name="post_type" value="give_forms"/>
195 195
 		<input type="hidden" name="page" value="give-reports"/>
196
-		<?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
196
+		<?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?>
197 197
 	</form>
198 198
 	<?php
199 199
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @since 1.0
203 203
 	 */
204
-	do_action( 'give_report_view_actions_after' );
204
+	do_action('give_report_view_actions_after');
205 205
 }
206 206
 
207 207
 /**
@@ -214,18 +214,18 @@  discard block
 block discarded – undo
214 214
  */
215 215
 function give_reports_forms_table() {
216 216
 
217
-	if ( isset( $_GET['form-id'] ) ) {
217
+	if (isset($_GET['form-id'])) {
218 218
 		return;
219 219
 	}
220 220
 
221
-	include( dirname( __FILE__ ) . '/class-form-reports-table.php' );
221
+	include(dirname(__FILE__).'/class-form-reports-table.php');
222 222
 
223 223
 	$give_table = new Give_Form_Reports_Table();
224 224
 	$give_table->prepare_items();
225 225
 	$give_table->display();
226 226
 }
227 227
 
228
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
228
+add_action('give_reports_view_forms', 'give_reports_forms_table');
229 229
 
230 230
 /**
231 231
  * Renders the detailed report for a specific give form
@@ -234,20 +234,20 @@  discard block
 block discarded – undo
234 234
  * @return void
235 235
  */
236 236
 function give_reports_form_details() {
237
-	if ( ! isset( $_GET['form-id'] ) ) {
237
+	if ( ! isset($_GET['form-id'])) {
238 238
 		return;
239 239
 	}
240 240
 	?>
241 241
 	<div class="tablenav top reports-forms-details-wrap">
242 242
 		<div class="actions bulkactions">
243
-			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button>
243
+			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button>
244 244
 		</div>
245 245
 	</div>
246 246
 	<?php
247
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
247
+	give_reports_graph_of_form(absint($_GET['form-id']));
248 248
 }
249 249
 
250
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
250
+add_action('give_reports_view_forms', 'give_reports_form_details');
251 251
 
252 252
 /**
253 253
  * Renders the Reports Donors Table
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @return void
259 259
  */
260 260
 function give_reports_donors_table() {
261
-	include( dirname( __FILE__ ) . '/class-donor-reports-table.php' );
261
+	include(dirname(__FILE__).'/class-donor-reports-table.php');
262 262
 
263 263
 	$give_table = new Give_Donor_Reports_Table();
264 264
 	$give_table->prepare_items();
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 		 *
271 271
 		 * @since 1.0
272 272
 		 */
273
-		do_action( 'give_logs_donors_table_top' );
273
+		do_action('give_logs_donors_table_top');
274 274
 		?>
275 275
 		<form id="give-donors-filter" method="get">
276 276
 			<?php
277
-			$give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' );
277
+			$give_table->search_box(esc_html__('Search', 'give'), 'give-donors');
278 278
 			$give_table->display();
279 279
 			?>
280 280
 			<input type="hidden" name="post_type" value="give_forms"/>
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
 		 *
288 288
 		 * @since 1.0
289 289
 		 */
290
-		do_action( 'give_logs_donors_table_bottom' );
290
+		do_action('give_logs_donors_table_bottom');
291 291
 		?>
292 292
 	</div>
293 293
 	<?php
294 294
 }
295 295
 
296
-add_action( 'give_reports_view_donors', 'give_reports_donors_table' );
296
+add_action('give_reports_view_donors', 'give_reports_donors_table');
297 297
 
298 298
 
299 299
 /**
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
  * @return void
306 306
  */
307 307
 function give_reports_gateways_table() {
308
-	include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' );
308
+	include(dirname(__FILE__).'/class-gateways-reports-table.php');
309 309
 
310 310
 	$give_table = new Give_Gateway_Reports_Table();
311 311
 	$give_table->prepare_items();
312 312
 	$give_table->display();
313 313
 }
314 314
 
315
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
315
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
316 316
 
317 317
 
318 318
 /**
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
 function give_reports_earnings() {
325 325
 	?>
326 326
 	<div class="tablenav top reports-table-nav">
327
-		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Report', 'give' ); ?></span></h3>
327
+		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Report', 'give'); ?></span></h3>
328 328
 	</div>
329 329
 	<?php
330 330
 	give_reports_graph();
331 331
 }
332 332
 
333
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
333
+add_action('give_reports_view_earnings', 'give_reports_earnings');
334 334
 
335 335
 
336 336
 /**
@@ -341,9 +341,9 @@  discard block
 block discarded – undo
341 341
  */
342 342
 function give_estimated_monthly_stats() {
343 343
 
344
-	$estimated = Give_Cache::get( 'give_estimated_monthly_stats', true );
344
+	$estimated = Give_Cache::get('give_estimated_monthly_stats', true);
345 345
 
346
-	if ( false === $estimated ) {
346
+	if (false === $estimated) {
347 347
 
348 348
 		$estimated = array(
349 349
 			'earnings' => 0,
@@ -352,22 +352,22 @@  discard block
 block discarded – undo
352 352
 
353 353
 		$stats = new Give_Payment_Stats;
354 354
 
355
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
356
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
355
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
356
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
357 357
 
358
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
359
-		$current_month = date( 'n', current_time( 'timestamp' ) );
360
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
361
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
358
+		$current_day   = date('d', current_time('timestamp'));
359
+		$current_month = date('n', current_time('timestamp'));
360
+		$current_year  = date('Y', current_time('timestamp'));
361
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
362 362
 
363
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
364
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
363
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
364
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
365 365
 
366 366
 		// Cache for one day
367
-		Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true );
367
+		Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true);
368 368
 	}
369 369
 
370
-	return maybe_unserialize( $estimated );
370
+	return maybe_unserialize($estimated);
371 371
 }
372 372
 
373 373
 // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file.
Please login to merge, or discard this patch.
includes/admin/reporting/class-give-graph.php 1 patch
Spacing   +35 added lines, -35 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
 
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
 	 * @param array $_data
82 82
 	 * @param array $options
83 83
 	 */
84
-	public function __construct( $_data, $options = array() ) {
84
+	public function __construct($_data, $options = array()) {
85 85
 
86
-		$this->data      = $_data;
86
+		$this->data = $_data;
87 87
 
88 88
 		// Generate unique ID
89
-		$this->id = md5( rand() );
89
+		$this->id = md5(rand());
90 90
 
91 91
 		// Setup default options;
92
-		$this->options = apply_filters( 'give_graph_args', array(
92
+		$this->options = apply_filters('give_graph_args', array(
93 93
 			'y_mode'          => null,
94 94
 			'x_mode'          => null,
95 95
 			'y_decimals'      => 0,
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 			'lines'           => false,
108 108
 			'points'          => true,
109 109
 			'dataType'        => array()
110
-		) );
110
+		));
111 111
 
112
-		$this->options = wp_parse_args( $options, $this->options );
112
+		$this->options = wp_parse_args($options, $this->options);
113 113
 	}
114 114
 
115 115
 	/**
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @since 1.0
122 122
 	 */
123
-	public function set( $key, $value ) {
124
-		$this->options[ $key ] = $value;
123
+	public function set($key, $value) {
124
+		$this->options[$key] = $value;
125 125
 	}
126 126
 
127 127
 	/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @since 1.0
133 133
 	 */
134
-	public function get( $key ) {
135
-		return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false;
134
+	public function get($key) {
135
+		return isset($this->options[$key]) ? $this->options[$key] : false;
136 136
 	}
137 137
 
138 138
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @since 1.0
142 142
 	 */
143 143
 	public function get_data() {
144
-		return apply_filters( 'give_get_graph_data', $this->data, $this );
144
+		return apply_filters('give_get_graph_data', $this->data, $this);
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function load_scripts() {
153 153
 		// Use minified libraries if SCRIPT_DEBUG is turned off
154
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
154
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
155 155
 
156
-		wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
157
-		wp_enqueue_script( 'jquery-flot-orderbars' );
156
+		wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
157
+		wp_enqueue_script('jquery-flot-orderbars');
158 158
 
159
-		wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
160
-		wp_enqueue_script( 'jquery-flot-time' );
159
+		wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
160
+		wp_enqueue_script('jquery-flot-time');
161 161
 
162
-		wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
163
-		wp_enqueue_script( 'jquery-flot-resize' );
162
+		wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
163
+		wp_enqueue_script('jquery-flot-resize');
164 164
 
165
-		wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION );
166
-		wp_enqueue_script( 'jquery-flot' );
165
+		wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION);
166
+		wp_enqueue_script('jquery-flot');
167 167
 
168 168
 	}
169 169
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 					[
191 191
 						<?php
192 192
 							$order = 0;
193
-							foreach( $this->get_data() as $label => $data ) :
193
+							foreach ($this->get_data() as $label => $data) :
194 194
 						?>
195 195
 						{
196
-							label : "<?php echo esc_attr( $label ); ?>",
197
-							id    : "<?php echo sanitize_key( $label ); ?>",
198
-							dataType  : '<?php echo ( ! empty( $this->options['dataType'][$order] ) ? $this->options['dataType'][$order] : 'count' ); ?>',
196
+							label : "<?php echo esc_attr($label); ?>",
197
+							id    : "<?php echo sanitize_key($label); ?>",
198
+							dataType  : '<?php echo ( ! empty($this->options['dataType'][$order]) ? $this->options['dataType'][$order] : 'count'); ?>',
199 199
 							// data format is: [ point on x, value on y ]
200
-							data  : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>],
200
+							data  : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>],
201 201
 							points: {
202 202
 								show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>,
203 203
 							},
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 								fill     : true,
213 213
 								fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]}
214 214
 							},
215
-							<?php if( $this->options[ 'multiple_y_axes' ] ) : ?>
215
+							<?php if ($this->options['multiple_y_axes']) : ?>
216 216
 							yaxis : <?php echo $yaxis_count; ?>
217 217
 							<?php endif; ?>
218 218
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 						grid: {
227 227
 							show           : true,
228 228
 							aboveData      : false,
229
-							color          : "<?php echo $this->options[ 'color' ]; ?>",
230
-							backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>",
231
-							borderColor    : "<?php echo $this->options[ 'bordercolor' ]; ?>",
232
-							borderWidth    : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>,
229
+							color          : "<?php echo $this->options['color']; ?>",
230
+							backgroundColor: "<?php echo $this->options['bgcolor']; ?>",
231
+							borderColor    : "<?php echo $this->options['bordercolor']; ?>",
232
+							borderWidth    : <?php echo absint($this->options['borderwidth']); ?>,
233 233
 							clickable      : false,
234 234
 							hoverable      : true
235 235
 						},
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 							mode        : "<?php echo $this->options['x_mode']; ?>",
241 241
 							timeFormat  : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
242 242
 							tickSize    : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>",
243
-							<?php if( $this->options['x_mode'] != 'time' ) : ?>
243
+							<?php if ($this->options['x_mode'] != 'time') : ?>
244 244
 							tickDecimals: <?php echo $this->options['x_decimals']; ?>
245 245
 							<?php endif; ?>
246 246
 						},
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 							min         : 0,
250 250
 							mode        : "<?php echo $this->options['y_mode']; ?>",
251 251
 							timeFormat  : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
252
-							<?php if( $this->options['y_mode'] != 'time' ) : ?>
252
+							<?php if ($this->options['y_mode'] != 'time') : ?>
253 253
 							tickDecimals: <?php echo $this->options['y_decimals']; ?>
254 254
 							<?php endif; ?>
255 255
 						}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 		 *
321 321
 		 * @param Give_Graph $this Graph object.
322 322
 		 */
323
-		do_action( 'give_before_graph', $this );
323
+		do_action('give_before_graph', $this);
324 324
 
325 325
 		// Build the graph.
326 326
 		echo $this->build_graph();
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 		 *
333 333
 		 * @param Give_Graph $this Graph object.
334 334
 		 */
335
-		do_action( 'give_after_graph', $this );
335
+		do_action('give_after_graph', $this);
336 336
 	}
337 337
 
338 338
 }
Please login to merge, or discard this patch.
includes/admin/class-addon-activation-banner.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 // Exit if accessed directly.
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	 *                               'testing'           => false, // (required) Never leave as "true" in production!!!
33 33
 	 *                               }
34 34
 	 */
35
-	function __construct( $_banner_details ) {
35
+	function __construct($_banner_details) {
36 36
 		$current_user = wp_get_current_user();
37 37
 
38 38
 		$this->plugin_activate_by   = 0;
39 39
 		$this->banner_details       = $_banner_details;
40
-		$this->test_mode            = ( $this->banner_details['testing'] == 'true' ) ? true : false;
41
-		$this->nag_meta_key         = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] );
42
-		$this->activate_by_meta_key = 'give_addon_' . sanitize_title( $this->banner_details['name'] ) . '_active_by_user';
40
+		$this->test_mode            = ($this->banner_details['testing'] == 'true') ? true : false;
41
+		$this->nag_meta_key         = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']);
42
+		$this->activate_by_meta_key = 'give_addon_'.sanitize_title($this->banner_details['name']).'_active_by_user';
43 43
 
44 44
 		//Get current user
45 45
 		$this->user_id = $current_user->ID;
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	public function init() {
63 63
 
64 64
 		//Testing?
65
-		if ( $this->test_mode ) {
66
-			delete_user_meta( $this->user_id, $this->nag_meta_key );
65
+		if ($this->test_mode) {
66
+			delete_user_meta($this->user_id, $this->nag_meta_key);
67 67
 		}
68 68
 
69 69
 		//Get the current page to add the notice to
70
-		add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) );
71
-		add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) );
70
+		add_action('current_screen', array($this, 'give_addon_notice_ignore'));
71
+		add_action('admin_notices', array($this, 'give_addon_activation_admin_notice'));
72 72
 
73 73
 		// File path of addon must be included in banner detail other addon activate meta will not delete.
74 74
 		$file_name = $this->get_plugin_file_name();
75 75
 
76
-		if ( ! empty( $file_name ) ) {
77
-			add_action( 'deactivate_' . $file_name, array( $this, 'remove_addon_activate_meta' ) );
76
+		if ( ! empty($file_name)) {
77
+			add_action('deactivate_'.$file_name, array($this, 'remove_addon_activate_meta'));
78 78
 		}
79 79
 	}
80 80
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	private function is_plugin_page() {
90 90
 		$screen = get_current_screen();
91 91
 
92
-		return ( $screen->parent_file === 'plugins.php' );
92
+		return ($screen->parent_file === 'plugins.php');
93 93
 	}
94 94
 
95 95
 
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 	public function give_addon_activation_admin_notice() {
103 103
 
104 104
 		// Bailout.
105
-		if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by ) {
105
+		if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by) {
106 106
 			return;
107 107
 		}
108 108
 
109 109
 		// If the user hasn't already dismissed the alert, output activation banner.
110
-		if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) {
110
+		if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) {
111 111
 
112 112
 			// Output inline styles here because there's no reason
113 113
 			// to enqueued them after the alert is dismissed.
@@ -189,44 +189,44 @@  discard block
 block discarded – undo
189 189
 					<h3><?php
190 190
 						printf(
191 191
 						/* translators: %s: Add-on name */
192
-							esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ),
193
-							'<span>' . $this->banner_details['name'] . '</span>'
192
+							esc_html__("Thank you for installing Give's %s Add-on!", 'give'),
193
+							'<span>'.$this->banner_details['name'].'</span>'
194 194
 						);
195 195
 						?></h3>
196 196
 
197 197
 					<a href="<?php
198 198
 					//The Dismiss Button.
199
-					$nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0';
200
-					echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span
199
+					$nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0';
200
+					echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span
201 201
 							class="dashicons dashicons-dismiss"></span></a>
202 202
 
203 203
 					<div class="alert-actions">
204 204
 
205 205
 						<?php //Point them to your settings page.
206
-						if ( isset( $this->banner_details['settings_url'] ) ) { ?>
206
+						if (isset($this->banner_details['settings_url'])) { ?>
207 207
 							<a href="<?php echo $this->banner_details['settings_url']; ?>">
208
-								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?>
208
+								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?>
209 209
 							</a>
210 210
 						<?php } ?>
211 211
 
212 212
 						<?php
213 213
 						// Show them how to configure the Addon.
214
-						if ( isset( $this->banner_details['documentation_url'] ) ) { ?>
214
+						if (isset($this->banner_details['documentation_url'])) { ?>
215 215
 							<a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank">
216 216
 								<span class="dashicons dashicons-media-text"></span><?php
217 217
 								printf(
218 218
 								/* translators: %s: Add-on name */
219
-									esc_html__( 'Documentation: %s Add-on', 'give' ),
219
+									esc_html__('Documentation: %s Add-on', 'give'),
220 220
 									$this->banner_details['name']
221 221
 								);
222 222
 								?></a>
223 223
 						<?php } ?>
224 224
 						<?php
225 225
 						//Let them signup for plugin updates
226
-						if ( isset( $this->banner_details['support_url'] ) ) { ?>
226
+						if (isset($this->banner_details['support_url'])) { ?>
227 227
 
228 228
 							<a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank">
229
-								<span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?>
229
+								<span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?>
230 230
 							</a>
231 231
 
232 232
 						<?php } ?>
@@ -253,13 +253,13 @@  discard block
 block discarded – undo
253 253
 		 * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not.
254 254
 		 * See here: http://codex.wordpress.org/Function_Reference/add_user_meta
255 255
 		 */
256
-		if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) {
256
+		if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) {
257 257
 
258 258
 			//Get the global user
259 259
 			$current_user = wp_get_current_user();
260 260
 			$user_id      = $current_user->ID;
261 261
 
262
-			add_user_meta( $user_id, $this->nag_meta_key, 'true', true );
262
+			add_user_meta($user_id, $this->nag_meta_key, 'true', true);
263 263
 		}
264 264
 	}
265 265
 
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	 * @access private
271 271
 	 */
272 272
 	private function add_addon_activate_meta() {
273
-		$user_id                  = get_option( $this->activate_by_meta_key );
273
+		$user_id                  = get_option($this->activate_by_meta_key);
274 274
 		$this->plugin_activate_by = (int) $user_id;
275 275
 
276
-		if ( ! $user_id ) {
277
-			add_option( $this->activate_by_meta_key, $this->user_id, '', 'no' );
276
+		if ( ! $user_id) {
277
+			add_option($this->activate_by_meta_key, $this->user_id, '', 'no');
278 278
 			$this->plugin_activate_by = (int) $this->user_id;
279 279
 		}
280 280
 	}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 	 * @access public
288 288
 	 */
289 289
 	public function remove_addon_activate_meta() {
290
-		$user_id = get_option( $this->activate_by_meta_key );
290
+		$user_id = get_option($this->activate_by_meta_key);
291 291
 
292
-		if ( $user_id ) {
293
-			delete_option( $this->activate_by_meta_key );
292
+		if ($user_id) {
293
+			delete_option($this->activate_by_meta_key);
294 294
 		}
295 295
 	}
296 296
 
@@ -303,39 +303,39 @@  discard block
 block discarded – undo
303 303
 	 * @return mixed
304 304
 	 */
305 305
 	private function get_plugin_file_name() {
306
-		$active_plugins = get_option( 'active_plugins' );
306
+		$active_plugins = get_option('active_plugins');
307 307
 		$file_name      = '';
308 308
 
309 309
 		try {
310 310
 
311 311
 			// Check addon file path.
312
-			if ( ! empty( $this->banner_details['file'] ) ) {
312
+			if ( ! empty($this->banner_details['file'])) {
313 313
 				$file_name = '';
314
-				if ( $file_path = explode( '/plugins/', $this->banner_details['file'] ) ) {
315
-					$file_path = array_pop( $file_path );
316
-					$file_name = current( explode( '/', $file_path ) );
314
+				if ($file_path = explode('/plugins/', $this->banner_details['file'])) {
315
+					$file_path = array_pop($file_path);
316
+					$file_name = current(explode('/', $file_path));
317 317
 				}
318 318
 
319
-				if ( empty( $file_name ) ) {
319
+				if (empty($file_name)) {
320 320
 					return false;
321 321
 				}
322 322
 
323
-				foreach ( $active_plugins as $plugin ) {
324
-					if ( false !== strpos( $plugin, $file_name ) ) {
323
+				foreach ($active_plugins as $plugin) {
324
+					if (false !== strpos($plugin, $file_name)) {
325 325
 						$file_name = $plugin;
326 326
 						break;
327 327
 					}
328 328
 				}
329
-			} elseif ( WP_DEBUG ) {
330
-				throw new Exception( __( "File path must be added within the {$this->banner_details['name']} add-on in the banner details.", 'give' ) );
329
+			} elseif (WP_DEBUG) {
330
+				throw new Exception(__("File path must be added within the {$this->banner_details['name']} add-on in the banner details.", 'give'));
331 331
 			}
332 332
 
333 333
 			// Check plugin path calculated by addon file path.
334
-			if ( empty( $file_name ) && WP_DEBUG ) {
335
-				throw new Exception( __( "Empty add-on plugin path for {$this->banner_details['name']} add-on.", 'give' ) );
334
+			if (empty($file_name) && WP_DEBUG) {
335
+				throw new Exception(__("Empty add-on plugin path for {$this->banner_details['name']} add-on.", 'give'));
336 336
 			}
337 337
 
338
-		} catch ( Exception $e ) {
338
+		} catch (Exception $e) {
339 339
 			echo $e->getMessage();
340 340
 		}
341 341
 
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
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
 
@@ -909,19 +909,19 @@  discard block
 block discarded – undo
909 909
 
910 910
 	global $wp_roles;
911 911
 
912
-    // Get the role object.
913
-    $give_worker = get_role( 'give_worker' );
912
+	// Get the role object.
913
+	$give_worker = get_role( 'give_worker' );
914 914
 
915 915
 	// A list of capabilities to add for give workers.
916
-    $caps_to_add = array(
917
-        'edit_posts',
918
-        'edit_pages'
919
-    );
920
-
921
-    foreach ( $caps_to_add as $cap ) {
922
-        // Add the capability.
923
-        $give_worker->add_cap( $cap );
924
-    }
916
+	$caps_to_add = array(
917
+		'edit_posts',
918
+		'edit_pages'
919
+	);
920
+
921
+	foreach ( $caps_to_add as $cap ) {
922
+		// Add the capability.
923
+		$give_worker->add_cap( $cap );
924
+	}
925 925
 
926 926
 }
927 927
 
Please login to merge, or discard this patch.
Spacing   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -25,44 +25,44 @@  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 57
 	}
58 58
 
59
-	if ( $did_upgrade ) {
60
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
59
+	if ($did_upgrade) {
60
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
61 61
 	}
62 62
 }
63 63
 
64
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
65
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
64
+add_action('admin_init', 'give_do_automatic_upgrades');
65
+add_action('give_upgrades', 'give_do_automatic_upgrades');
66 66
 
67 67
 /**
68 68
  * Display Upgrade Notices
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function give_show_upgrade_notices() {
74 74
 	// Don't show notices on the upgrades page.
75
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
75
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
76 76
 		return;
77 77
 	}
78 78
 
79
-	$give_version = get_option( 'give_version' );
79
+	$give_version = get_option('give_version');
80 80
 
81
-	if ( ! $give_version ) {
81
+	if ( ! $give_version) {
82 82
 		// 1.0 is the first version to use this option so we must add it.
83 83
 		$give_version = '1.0';
84 84
 	}
85 85
 
86
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
86
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
87 87
 
88 88
 	/*
89 89
 	 *  NOTICE:
@@ -94,31 +94,31 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 
96 96
 	// v1.3.2 Upgrades
97
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
97
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
98 98
 		printf(
99 99
 			/* translators: %s: upgrade URL */
100
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
101
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
100
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
101
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
102 102
 		);
103 103
 	}
104 104
 
105 105
 	// v1.3.4 Upgrades //ensure the user has gone through 1.3.4.
106
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
106
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
107 107
 		printf(
108 108
 			/* translators: %s: upgrade URL */
109
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
110
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
109
+			'<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
110
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
111 111
 		);
112 112
 	}
113 113
 
114 114
 	// Check if we have a stalled upgrade.
115 115
 	$resume_upgrade = give_maybe_resume_upgrade();
116
-	if ( ! empty( $resume_upgrade ) ) {
117
-		$resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) );
116
+	if ( ! empty($resume_upgrade)) {
117
+		$resume_url = add_query_arg($resume_upgrade, admin_url('index.php'));
118 118
 		echo Give_Notices::notice_html(
119 119
 			sprintf(
120
-				__( 'Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give' ),
121
-				esc_url( $resume_url )
120
+				__('Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give'),
121
+				esc_url($resume_url)
122 122
 			)
123 123
 		);
124 124
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	// v1.8 form metadata upgrades.
129
-	if ( version_compare( $give_version, '1.8', '<' ) || ! give_has_upgrade_completed( 'v18_upgrades_form_metadata' ) ) {
129
+	if (version_compare($give_version, '1.8', '<') || ! give_has_upgrade_completed('v18_upgrades_form_metadata')) {
130 130
 		echo Give_Notices::notice_html(
131 131
 			sprintf(
132
-				esc_html__( 'Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give' ),
133
-				'<a class="give-upgrade-link" href="' . esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata' ) ) . '">',
132
+				esc_html__('Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give'),
133
+				'<a class="give-upgrade-link" href="'.esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata')).'">',
134 134
 				'</a>'
135 135
 			)
136 136
 		);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 				$upgrade_links.on( 'click', function(e){
146 146
 					e.preventDefault();
147 147
 
148
-					if( ! window.confirm( '<?php _e( 'Please make sure to create a database backup before initiating the upgrade.', 'give' ); ?>' ) ) {
148
+					if( ! window.confirm( '<?php _e('Please make sure to create a database backup before initiating the upgrade.', 'give'); ?>' ) ) {
149 149
 						return;
150 150
 					}
151 151
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	<?php
159 159
 }
160 160
 
161
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
161
+add_action('admin_notices', 'give_show_upgrade_notices');
162 162
 
163 163
 /**
164 164
  * Triggers all upgrade functions
@@ -170,29 +170,29 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function give_trigger_upgrades() {
172 172
 
173
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
174
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
173
+	if ( ! current_user_can('manage_give_settings')) {
174
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
175 175
 			'response' => 403,
176
-		) );
176
+		));
177 177
 	}
178 178
 
179
-	$give_version = get_option( 'give_version' );
179
+	$give_version = get_option('give_version');
180 180
 
181
-	if ( ! $give_version ) {
181
+	if ( ! $give_version) {
182 182
 		// 1.0 is the first version to use this option so we must add it.
183 183
 		$give_version = '1.0';
184
-		add_option( 'give_version', $give_version );
184
+		add_option('give_version', $give_version);
185 185
 	}
186 186
 
187
-	update_option( 'give_version', GIVE_VERSION );
188
-	delete_option( 'give_doing_upgrade' );
187
+	update_option('give_version', GIVE_VERSION);
188
+	delete_option('give_doing_upgrade');
189 189
 
190
-	if ( DOING_AJAX ) {
191
-		die( 'complete' );
190
+	if (DOING_AJAX) {
191
+		die('complete');
192 192
 	} // End if().
193 193
 }
194 194
 
195
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
195
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
196 196
 
197 197
 /**
198 198
  * Check if the upgrade routine has been run for a specific action
@@ -203,15 +203,15 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @return bool                   If the action has been added to the completed actions array
205 205
  */
206
-function give_has_upgrade_completed( $upgrade_action = '' ) {
206
+function give_has_upgrade_completed($upgrade_action = '') {
207 207
 
208
-	if ( empty( $upgrade_action ) ) {
208
+	if (empty($upgrade_action)) {
209 209
 		return false;
210 210
 	}
211 211
 
212 212
 	$completed_upgrades = give_get_completed_upgrades();
213 213
 
214
-	return in_array( $upgrade_action, $completed_upgrades );
214
+	return in_array($upgrade_action, $completed_upgrades);
215 215
 
216 216
 }
217 217
 
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
224 224
  */
225 225
 function give_maybe_resume_upgrade() {
226
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
227
-	if ( empty( $doing_upgrade ) ) {
226
+	$doing_upgrade = get_option('give_doing_upgrade', false);
227
+	if (empty($doing_upgrade)) {
228 228
 		return false;
229 229
 	}
230 230
 
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
  *
241 241
  * @return bool                   If the function was successfully added
242 242
  */
243
-function give_set_upgrade_complete( $upgrade_action = '' ) {
243
+function give_set_upgrade_complete($upgrade_action = '') {
244 244
 
245
-	if ( empty( $upgrade_action ) ) {
245
+	if (empty($upgrade_action)) {
246 246
 		return false;
247 247
 	}
248 248
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	$completed_upgrades[] = $upgrade_action;
251 251
 
252 252
 	// Remove any blanks, and only show uniques.
253
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
253
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
254 254
 
255
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
255
+	return update_option('give_completed_upgrades', $completed_upgrades);
256 256
 }
257 257
 
258 258
 /**
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
  */
264 264
 function give_get_completed_upgrades() {
265 265
 
266
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
266
+	$completed_upgrades = get_option('give_completed_upgrades');
267 267
 
268
-	if ( false === $completed_upgrades ) {
268
+	if (false === $completed_upgrades) {
269 269
 		$completed_upgrades = array();
270 270
 	}
271 271
 
@@ -282,31 +282,31 @@  discard block
 block discarded – undo
282 282
  */
283 283
 function give_v132_upgrade_give_payment_customer_id() {
284 284
 	global $wpdb;
285
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
286
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
285
+	if ( ! current_user_can('manage_give_settings')) {
286
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
287 287
 			'response' => 403,
288
-		) );
288
+		));
289 289
 	}
290 290
 
291
-	ignore_user_abort( true );
291
+	ignore_user_abort(true);
292 292
 
293
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
294
-		@set_time_limit( 0 );
293
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
294
+		@set_time_limit(0);
295 295
 	}
296 296
 
297 297
 	// UPDATE DB METAKEYS.
298 298
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
299
-	$query = $wpdb->query( $sql );
299
+	$query = $wpdb->query($sql);
300 300
 
301
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
302
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
303
-	delete_option( 'give_doing_upgrade' );
304
-	wp_redirect( admin_url() );
301
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
302
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
303
+	delete_option('give_doing_upgrade');
304
+	wp_redirect(admin_url());
305 305
 	exit;
306 306
 
307 307
 }
308 308
 
309
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
309
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
310 310
 
311 311
 /**
312 312
  * Upgrades the Offline Status
@@ -319,16 +319,16 @@  discard block
 block discarded – undo
319 319
 
320 320
 	global $wpdb;
321 321
 
322
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
323
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
322
+	if ( ! current_user_can('manage_give_settings')) {
323
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
324 324
 			'response' => 403,
325
-		) );
325
+		));
326 326
 	}
327 327
 
328
-	ignore_user_abort( true );
328
+	ignore_user_abort(true);
329 329
 
330
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
331
-		@set_time_limit( 0 );
330
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
331
+		@set_time_limit(0);
332 332
 	}
333 333
 
334 334
 	// Get abandoned offline payments.
@@ -338,31 +338,31 @@  discard block
 block discarded – undo
338 338
 	$where .= "AND ( p.post_status = 'abandoned' )";
339 339
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
340 340
 
341
-	$sql            = $select . $join . $where;
342
-	$found_payments = $wpdb->get_col( $sql );
341
+	$sql            = $select.$join.$where;
342
+	$found_payments = $wpdb->get_col($sql);
343 343
 
344
-	foreach ( $found_payments as $payment ) {
344
+	foreach ($found_payments as $payment) {
345 345
 
346 346
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
347
-		$modified_time = get_post_modified_time( 'U', false, $payment );
347
+		$modified_time = get_post_modified_time('U', false, $payment);
348 348
 
349 349
 		// 1450124863 =  12/10/2015 20:42:25.
350
-		if ( $modified_time >= 1450124863 ) {
350
+		if ($modified_time >= 1450124863) {
351 351
 
352
-			give_update_payment_status( $payment, 'pending' );
352
+			give_update_payment_status($payment, 'pending');
353 353
 
354 354
 		}
355 355
 	}
356 356
 
357
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
358
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
359
-	delete_option( 'give_doing_upgrade' );
360
-	wp_redirect( admin_url() );
357
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
358
+	give_set_upgrade_complete('upgrade_give_offline_status');
359
+	delete_option('give_doing_upgrade');
360
+	wp_redirect(admin_url());
361 361
 	exit;
362 362
 
363 363
 }
364 364
 
365
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
365
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
366 366
 
367 367
 /**
368 368
  * Cleanup User Roles
@@ -373,17 +373,17 @@  discard block
 block discarded – undo
373 373
  */
374 374
 function give_v152_cleanup_users() {
375 375
 
376
-	$give_version = get_option( 'give_version' );
376
+	$give_version = get_option('give_version');
377 377
 
378
-	if ( ! $give_version ) {
378
+	if ( ! $give_version) {
379 379
 		// 1.0 is the first version to use this option so we must add it.
380 380
 		$give_version = '1.0';
381 381
 	}
382 382
 
383
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
383
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
384 384
 
385 385
 	// v1.5.2 Upgrades
386
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
386
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
387 387
 
388 388
 		// Delete all caps with "ss".
389 389
 		// Also delete all unused "campaign" roles.
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
 		);
431 431
 
432 432
 		global $wp_roles;
433
-		foreach ( $delete_caps as $cap ) {
434
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
435
-				$wp_roles->remove_cap( $role, $cap );
433
+		foreach ($delete_caps as $cap) {
434
+			foreach (array_keys($wp_roles->roles) as $role) {
435
+				$wp_roles->remove_cap($role, $cap);
436 436
 			}
437 437
 		}
438 438
 
@@ -442,15 +442,15 @@  discard block
 block discarded – undo
442 442
 		$roles->add_caps();
443 443
 
444 444
 		// The Update Ran.
445
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
446
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
447
-		delete_option( 'give_doing_upgrade' );
445
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
446
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
447
+		delete_option('give_doing_upgrade');
448 448
 
449 449
 	}// End if().
450 450
 
451 451
 }
452 452
 
453
-add_action( 'admin_init', 'give_v152_cleanup_users' );
453
+add_action('admin_init', 'give_v152_cleanup_users');
454 454
 
455 455
 /**
456 456
  * 1.6 Upgrade routine to create the customer meta table.
@@ -490,53 +490,53 @@  discard block
 block discarded – undo
490 490
 
491 491
 	// Get addons license key.
492 492
 	$addons = array();
493
-	foreach ( $give_options as $key => $value ) {
494
-		if ( false !== strpos( $key, '_license_key' ) ) {
495
-			$addons[ $key ] = $value;
493
+	foreach ($give_options as $key => $value) {
494
+		if (false !== strpos($key, '_license_key')) {
495
+			$addons[$key] = $value;
496 496
 		}
497 497
 	}
498 498
 
499 499
 	// Bailout: We do not have any addon license data to upgrade.
500
-	if ( empty( $addons ) ) {
500
+	if (empty($addons)) {
501 501
 		return false;
502 502
 	}
503 503
 
504
-	foreach ( $addons as $key => $addon_license ) {
504
+	foreach ($addons as $key => $addon_license) {
505 505
 
506 506
 		// Get addon shortname.
507
-		$shortname = str_replace( '_license_key', '', $key );
507
+		$shortname = str_replace('_license_key', '', $key);
508 508
 
509 509
 		// Addon license option name.
510
-		$addon_license_option_name = $shortname . '_license_active';
510
+		$addon_license_option_name = $shortname.'_license_active';
511 511
 
512 512
 		// bailout if license is empty.
513
-		if ( empty( $addon_license ) ) {
514
-			delete_option( $addon_license_option_name );
513
+		if (empty($addon_license)) {
514
+			delete_option($addon_license_option_name);
515 515
 			continue;
516 516
 		}
517 517
 
518 518
 		// Get addon name.
519 519
 		$addon_name       = array();
520
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
521
-		foreach ( $addon_name_parts as $name_part ) {
520
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
521
+		foreach ($addon_name_parts as $name_part) {
522 522
 
523 523
 			// Fix addon name
524
-			switch ( $name_part ) {
524
+			switch ($name_part) {
525 525
 				case 'authorizenet' :
526 526
 					$name_part = 'authorize.net';
527 527
 					break;
528 528
 			}
529 529
 
530
-			$addon_name[] = ucfirst( $name_part );
530
+			$addon_name[] = ucfirst($name_part);
531 531
 		}
532 532
 
533
-		$addon_name = implode( ' ', $addon_name );
533
+		$addon_name = implode(' ', $addon_name);
534 534
 
535 535
 		// Data to send to the API
536 536
 		$api_params = array(
537 537
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
538 538
 			'license'    => $addon_license,
539
-			'item_name'  => urlencode( $addon_name ),
539
+			'item_name'  => urlencode($addon_name),
540 540
 			'url'        => home_url(),
541 541
 		);
542 542
 
@@ -551,17 +551,17 @@  discard block
 block discarded – undo
551 551
 		);
552 552
 
553 553
 		// Make sure there are no errors.
554
-		if ( is_wp_error( $response ) ) {
555
-			delete_option( $addon_license_option_name );
554
+		if (is_wp_error($response)) {
555
+			delete_option($addon_license_option_name);
556 556
 			continue;
557 557
 		}
558 558
 
559 559
 		// Tell WordPress to look for updates.
560
-		set_site_transient( 'update_plugins', null );
560
+		set_site_transient('update_plugins', null);
561 561
 
562 562
 		// Decode license data.
563
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
564
-		update_option( $addon_license_option_name, $license_data );
563
+		$license_data = json_decode(wp_remote_retrieve_body($response));
564
+		update_option($addon_license_option_name, $license_data);
565 565
 	}// End foreach().
566 566
 }
567 567
 
@@ -591,9 +591,9 @@  discard block
 block discarded – undo
591 591
 	);
592 592
 
593 593
 	global $wp_roles;
594
-	foreach ( $delete_caps as $cap ) {
595
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
596
-			$wp_roles->remove_cap( $role, $cap );
594
+	foreach ($delete_caps as $cap) {
595
+		foreach (array_keys($wp_roles->roles) as $role) {
596
+			$wp_roles->remove_cap($role, $cap);
597 597
 		}
598 598
 	}
599 599
 
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 function give_v18_upgrades_core_setting() {
628 628
 	// Core settings which changes from checkbox to radio.
629 629
 	$core_setting_names = array_merge(
630
-		array_keys( give_v18_renamed_core_settings() ),
630
+		array_keys(give_v18_renamed_core_settings()),
631 631
 		array(
632 632
 			'uninstall_on_delete',
633 633
 			'scripts_footer',
@@ -639,48 +639,48 @@  discard block
 block discarded – undo
639 639
 	);
640 640
 
641 641
 	// Bailout: If not any setting define.
642
-	if ( $give_settings = get_option( 'give_settings' ) ) {
642
+	if ($give_settings = get_option('give_settings')) {
643 643
 
644 644
 		$setting_changed = false;
645 645
 
646 646
 		// Loop: check each setting field.
647
-		foreach ( $core_setting_names as $setting_name ) {
647
+		foreach ($core_setting_names as $setting_name) {
648 648
 			// New setting name.
649
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
649
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
650 650
 
651 651
 			// Continue: If setting already set.
652 652
 			if (
653
-				array_key_exists( $new_setting_name, $give_settings )
654
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
653
+				array_key_exists($new_setting_name, $give_settings)
654
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
655 655
 			) {
656 656
 				continue;
657 657
 			}
658 658
 
659 659
 			// Set checkbox value to radio value.
660
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
660
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
661 661
 
662 662
 			// @see https://github.com/WordImpress/Give/issues/1063
663
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
663
+			if (false !== strpos($setting_name, 'disable_')) {
664 664
 
665
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
666
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
665
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
666
+			} elseif (false !== strpos($setting_name, 'enable_')) {
667 667
 
668
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
668
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
669 669
 			}
670 670
 
671 671
 			// Tell bot to update core setting to db.
672
-			if ( ! $setting_changed ) {
672
+			if ( ! $setting_changed) {
673 673
 				$setting_changed = true;
674 674
 			}
675 675
 		}
676 676
 
677 677
 		// Update setting only if they changed.
678
-		if ( $setting_changed ) {
679
-			update_option( 'give_settings', $give_settings );
678
+		if ($setting_changed) {
679
+			update_option('give_settings', $give_settings);
680 680
 		}
681 681
 	}// End if().
682 682
 
683
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
683
+	give_set_upgrade_complete('v18_upgrades_core_setting');
684 684
 }
685 685
 
686 686
 /**
@@ -690,22 +690,22 @@  discard block
 block discarded – undo
690 690
  * @return void
691 691
  */
692 692
 function give_v18_upgrades_form_metadata() {
693
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
694
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
693
+	if ( ! current_user_can('manage_give_settings')) {
694
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
695 695
 			'response' => 403,
696
-		) );
696
+		));
697 697
 	}
698 698
 
699
-	ignore_user_abort( true );
699
+	ignore_user_abort(true);
700 700
 
701
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
702
-		@set_time_limit( 0 );
701
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
702
+		@set_time_limit(0);
703 703
 	}
704 704
 
705
-	$step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
705
+	$step = isset($_GET['step']) ? absint($_GET['step']) : 1;
706 706
 
707 707
 	// form query
708
-	$forms = new WP_Query( array(
708
+	$forms = new WP_Query(array(
709 709
 			'paged'          => $step,
710 710
 			'status'         => 'any',
711 711
 			'order'          => 'ASC',
@@ -714,39 +714,39 @@  discard block
 block discarded – undo
714 714
 		)
715 715
 	);
716 716
 
717
-	if ( $forms->have_posts() ) {
718
-		while ( $forms->have_posts() ) {
717
+	if ($forms->have_posts()) {
718
+		while ($forms->have_posts()) {
719 719
 			$forms->the_post();
720 720
 
721 721
 			// Form content.
722 722
 			// Note in version 1.8 display content setting split into display content and content placement setting.
723 723
 			// You can delete _give_content_option in future
724
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
725
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
726
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
727
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
724
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
725
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
726
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
727
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
728 728
 
729
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
730
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
729
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
730
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
731 731
 			}
732 732
 
733 733
 			// "Disable" Guest Donation. Checkbox
734 734
 			// See: https://github.com/WordImpress/Give/issues/1470
735
-			$guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
736
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
737
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
735
+			$guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
736
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
737
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
738 738
 
739 739
 			// Offline Donations
740 740
 			// See: https://github.com/WordImpress/Give/issues/1579
741
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
742
-			if ( 'no' === $offline_donation ) {
741
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
742
+			if ('no' === $offline_donation) {
743 743
 				$offline_donation_newval = 'global';
744
-			} elseif ( 'yes' === $offline_donation ) {
744
+			} elseif ('yes' === $offline_donation) {
745 745
 				$offline_donation_newval = 'enabled';
746 746
 			} else {
747 747
 				$offline_donation_newval = 'disabled';
748 748
 			}
749
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
749
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
750 750
 
751 751
 			// Convert yes/no setting field to enabled/disabled.
752 752
 			$form_radio_settings = array(
@@ -766,15 +766,15 @@  discard block
 block discarded – undo
766 766
 				'_give_offline_donation_enable_billing_fields_single',
767 767
 			);
768 768
 
769
-			foreach ( $form_radio_settings as $meta_key ) {
769
+			foreach ($form_radio_settings as $meta_key) {
770 770
 				// Get value.
771
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
771
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
772 772
 
773 773
 				// Convert meta value only if it is in yes/no/none.
774
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
774
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
775 775
 
776
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
777
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
776
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
777
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
778 778
 				}
779 779
 			}
780 780
 		}// End while().
@@ -782,27 +782,27 @@  discard block
 block discarded – undo
782 782
 		wp_reset_postdata();
783 783
 
784 784
 		// Forms found so upgrade them
785
-		$step ++;
786
-		$redirect = add_query_arg( array(
785
+		$step++;
786
+		$redirect = add_query_arg(array(
787 787
 			'page'         => 'give-upgrades',
788 788
 			'give-upgrade' => 'give_v18_upgrades_form_metadata',
789 789
 			'step'         => $step,
790
-		), admin_url( 'index.php' ) );
791
-		wp_redirect( $redirect );
790
+		), admin_url('index.php'));
791
+		wp_redirect($redirect);
792 792
 		exit();
793 793
 
794 794
 	} else {
795 795
 		// No more forms found, finish up.
796
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
797
-		delete_option( 'give_doing_upgrade' );
798
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
796
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
797
+		delete_option('give_doing_upgrade');
798
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
799 799
 
800
-		wp_redirect( admin_url() );
800
+		wp_redirect(admin_url());
801 801
 		exit;
802 802
 	}
803 803
 }
804 804
 
805
-add_action( 'give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata' );
805
+add_action('give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata');
806 806
 
807 807
 /**
808 808
  * Get list of core setting renamed in version 1.8.
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
  * @since  1.8.7
836 836
  * @return void
837 837
  */
838
-function give_v187_upgrades(){
838
+function give_v187_upgrades() {
839 839
 	global $wpdb;
840 840
 
841 841
 	/**
@@ -875,24 +875,24 @@  discard block
 block discarded – undo
875 875
 		ARRAY_A
876 876
 	);
877 877
 
878
-	if( ! empty( $user_apikey_options ) ) {
879
-		foreach ( $user_apikey_options as $user ) {
880
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
881
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
882
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
878
+	if ( ! empty($user_apikey_options)) {
879
+		foreach ($user_apikey_options as $user) {
880
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
881
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
882
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
883 883
 		}
884 884
 	}
885 885
 
886
-	if ( ! empty( $cached_options ) ) {
887
-		foreach ( $cached_options as $option ) {
888
-			switch ( true ) {
889
-				case ( false !== strpos( $option, 'transient' ) ):
890
-					$option = str_replace( '_transient_', '', $option );
891
-					delete_transient( $option );
886
+	if ( ! empty($cached_options)) {
887
+		foreach ($cached_options as $option) {
888
+			switch (true) {
889
+				case (false !== strpos($option, 'transient')):
890
+					$option = str_replace('_transient_', '', $option);
891
+					delete_transient($option);
892 892
 					break;
893 893
 
894 894
 				default:
895
-					delete_option( $option );
895
+					delete_option($option);
896 896
 			}
897 897
 		}
898 898
 	}
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 	global $wp_roles;
911 911
 
912 912
     // Get the role object.
913
-    $give_worker = get_role( 'give_worker' );
913
+    $give_worker = get_role('give_worker');
914 914
 
915 915
 	// A list of capabilities to add for give workers.
916 916
     $caps_to_add = array(
@@ -918,9 +918,9 @@  discard block
 block discarded – undo
918 918
         'edit_pages'
919 919
     );
920 920
 
921
-    foreach ( $caps_to_add as $cap ) {
921
+    foreach ($caps_to_add as $cap) {
922 922
         // Add the capability.
923
-        $give_worker->add_cap( $cap );
923
+        $give_worker->add_cap($cap);
924 924
     }
925 925
 
926 926
 }
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	// Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => esc_html__( 'Name', 'give' ),
36
-		'form_category' => esc_html__( 'Categories', 'give' ),
37
-		'form_tag'      => esc_html__( 'Tags', 'give' ),
38
-		'price'         => esc_html__( 'Amount', 'give' ),
39
-		'goal'          => esc_html__( 'Goal', 'give' ),
40
-		'donations'     => esc_html__( 'Donations', 'give' ),
41
-		'earnings'      => esc_html__( 'Income', 'give' ),
42
-		'shortcode'     => esc_html__( 'Shortcode', 'give' ),
43
-		'date'          => esc_html__( 'Date', 'give' ),
35
+		'title'         => esc_html__('Name', 'give'),
36
+		'form_category' => esc_html__('Categories', 'give'),
37
+		'form_tag'      => esc_html__('Tags', 'give'),
38
+		'price'         => esc_html__('Amount', 'give'),
39
+		'goal'          => esc_html__('Goal', 'give'),
40
+		'donations'     => esc_html__('Donations', 'give'),
41
+		'earnings'      => esc_html__('Income', 'give'),
42
+		'shortcode'     => esc_html__('Shortcode', 'give'),
43
+		'date'          => esc_html__('Date', 'give'),
44 44
 	);
45 45
 
46 46
 	// Does the user want categories / tags?
47
-	if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,59 +66,59 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form_category':
74
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
74
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
75 75
 				break;
76 76
 			case 'form_tag':
77
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
77
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
78 78
 				break;
79 79
 			case 'price':
80
-				if ( give_has_variable_prices( $post_id ) ) {
81
-					echo give_price_range( $post_id );
80
+				if (give_has_variable_prices($post_id)) {
81
+					echo give_price_range($post_id);
82 82
 				} else {
83
-					echo give_price( $post_id, false );
84
-					echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />';
83
+					echo give_price($post_id, false);
84
+					echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />';
85 85
 				}
86 86
 				break;
87 87
 			case 'goal':
88
-				if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) {
89
-					echo give_goal( $post_id, false );
88
+				if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) {
89
+					echo give_goal($post_id, false);
90 90
 				} else {
91
-					esc_html_e( 'No Goal Set', 'give' );
91
+					esc_html_e('No Goal Set', 'give');
92 92
 				}
93 93
 
94
-				echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />';
94
+				echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />';
95 95
 				break;
96 96
 			case 'donations':
97
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
98
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-tools&tab=logs&form=' . $post_id ) ) . '">';
99
-					echo give_get_form_sales_stats( $post_id );
97
+				if (current_user_can('view_give_form_stats', $post_id)) {
98
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-tools&tab=logs&form='.$post_id)).'">';
99
+					echo give_get_form_sales_stats($post_id);
100 100
 					echo '</a>';
101 101
 				} else {
102 102
 					echo '-';
103 103
 				}
104 104
 				break;
105 105
 			case 'earnings':
106
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
107
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $post_id ) ) . '">';
108
-					echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) );
106
+				if (current_user_can('view_give_form_stats', $post_id)) {
107
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$post_id)).'">';
108
+					echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id)));
109 109
 					echo '</a>';
110 110
 				} else {
111 111
 					echo '-';
112 112
 				}
113 113
 				break;
114 114
 			case 'shortcode':
115
-				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;' . absint( $post_id ) . '&#34;]">';
115
+				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;'.absint($post_id).'&#34;]">';
116 116
 				break;
117 117
 		}
118 118
 	}
119 119
 }
120 120
 
121
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
121
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
122 122
 
123 123
 /**
124 124
  * Registers the sortable columns in the list table
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  *
130 130
  * @return array $columns Array of sortable columns
131 131
  */
132
-function give_sortable_form_columns( $columns ) {
132
+function give_sortable_form_columns($columns) {
133 133
 	$columns['price']     = 'amount';
134 134
 	$columns['sales']     = 'sales';
135 135
 	$columns['earnings']  = 'earnings';
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	return $columns;
140 140
 }
141 141
 
142
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
142
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
143 143
 
144 144
 /**
145 145
  * Sorts Columns in the Forms List Table
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
  *
151 151
  * @return array $vars Array of all the sort variables
152 152
  */
153
-function give_sort_forms( $vars ) {
153
+function give_sort_forms($vars) {
154 154
 	// Check if we're viewing the "give_forms" post type
155
-	if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) {
155
+	if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) {
156 156
 		return $vars;
157 157
 	}
158 158
 
159
-	switch ( $vars['orderby'] ) {
159
+	switch ($vars['orderby']) {
160 160
 		// Check if 'orderby' is set to "sales"
161 161
 		case 'sales':
162 162
 			$vars = array_merge(
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
  *
226 226
  * @return array       Array of all sort variables
227 227
  */
228
-function give_filter_forms( $vars ) {
229
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
228
+function give_filter_forms($vars) {
229
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
230 230
 
231 231
 		// If an author ID was passed, use it
232
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
232
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
233 233
 
234 234
 			$author_id = $_REQUEST['author'];
235
-			if ( (int) $author_id !== get_current_user_id() ) {
235
+			if ((int) $author_id !== get_current_user_id()) {
236 236
 				// Tried to view the products of another person, sorry
237
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
237
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
238 238
 			}
239 239
 			$vars = array_merge(
240 240
 				$vars,
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
  * @return void
259 259
  */
260 260
 function give_forms_load() {
261
-	add_filter( 'request', 'give_sort_forms' );
262
-	add_filter( 'request', 'give_filter_forms' );
261
+	add_filter('request', 'give_sort_forms');
262
+	add_filter('request', 'give_filter_forms');
263 263
 }
264 264
 
265
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
265
+add_action('load-edit.php', 'give_forms_load', 9999);
266 266
 
267 267
 /**
268 268
  * Remove Forms Month Filter
@@ -276,17 +276,17 @@  discard block
 block discarded – undo
276 276
  * @global      $typenow The post type we are viewing
277 277
  * @return array Empty array disables the dropdown
278 278
  */
279
-function give_remove_month_filter( $dates ) {
279
+function give_remove_month_filter($dates) {
280 280
 	global $typenow;
281 281
 
282
-	if ( $typenow == 'give_forms' ) {
282
+	if ($typenow == 'give_forms') {
283 283
 		$dates = array();
284 284
 	}
285 285
 
286 286
 	return $dates;
287 287
 }
288 288
 
289
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
289
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
290 290
 
291 291
 /**
292 292
  * Updates price when saving post
@@ -297,23 +297,23 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @return int|null
299 299
  */
300
-function give_price_save_quick_edit( $post_id ) {
301
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
300
+function give_price_save_quick_edit($post_id) {
301
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
302 302
 		return;
303 303
 	}
304
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
304
+	if ( ! current_user_can('edit_post', $post_id)) {
305 305
 		return $post_id;
306 306
 	}
307
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
307
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
308 308
 		return $post_id;
309 309
 	}
310 310
 
311
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
312
-		give_update_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) );
311
+	if (isset($_REQUEST['_give_regprice'])) {
312
+		give_update_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice'])));
313 313
 	}
314 314
 }
315 315
 
316
-add_action( 'save_post', 'give_price_save_quick_edit' );
316
+add_action('save_post', 'give_price_save_quick_edit');
317 317
 
318 318
 /**
319 319
  * Process bulk edit actions via AJAX
@@ -323,18 +323,18 @@  discard block
 block discarded – undo
323 323
  */
324 324
 function give_save_bulk_edit() {
325 325
 
326
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
326
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
327 327
 
328
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
329
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
330
-		foreach ( $post_ids as $post_id ) {
328
+	if ( ! empty($post_ids) && is_array($post_ids)) {
329
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
330
+		foreach ($post_ids as $post_id) {
331 331
 
332
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
332
+			if ( ! current_user_can('edit_post', $post_id)) {
333 333
 				continue;
334 334
 			}
335 335
 
336
-			if ( ! empty( $price ) ) {
337
-				give_update_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) );
336
+			if ( ! empty($price)) {
337
+				give_update_meta($post_id, '_give_set_price', give_sanitize_amount($price));
338 338
 			}
339 339
 		}
340 340
 	}
@@ -342,4 +342,4 @@  discard block
 block discarded – undo
342 342
 	die();
343 343
 }
344 344
 
345
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
345
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/admin-pages.php 1 patch
Spacing   +99 added lines, -99 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
 
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
 	global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page, $give_tools_page;
34 34
 
35 35
 	//Payments
36
-	$give_payment       = get_post_type_object( 'give_payment' );
37
-	$give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' );
36
+	$give_payment       = get_post_type_object('give_payment');
37
+	$give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page');
38 38
 
39 39
 	//Donors
40
-	$give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' );
40
+	$give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page');
41 41
 
42 42
 	//Reports`
43 43
 	$give_reports_page = add_submenu_page(
44 44
 		'edit.php?post_type=give_forms',
45
-		esc_html__( 'Donation Reports', 'give' ),
46
-		esc_html__( 'Reports', 'give' ),
45
+		esc_html__('Donation Reports', 'give'),
46
+		esc_html__('Reports', 'give'),
47 47
 		'view_give_reports',
48 48
 		'give-reports',
49 49
 		array(
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	//Settings
56 56
 	$give_settings_page = add_submenu_page(
57 57
 		'edit.php?post_type=give_forms',
58
-		esc_html__( 'Give Settings', 'give' ),
59
-		esc_html__( 'Settings', 'give' ),
58
+		esc_html__('Give Settings', 'give'),
59
+		esc_html__('Settings', 'give'),
60 60
 		'manage_give_settings',
61 61
 		'give-settings',
62 62
 		array(
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 	);
67 67
 
68 68
 	//Tools.
69
-	$give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array(
69
+	$give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array(
70 70
 		Give()->give_settings,
71 71
 		'output'
72
-	) );
72
+	));
73 73
 
74 74
 	//Add-ons
75
-	$give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' );
75
+	$give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page');
76 76
 
77 77
 	//Upgrades
78
-	$give_upgrades_screen = add_submenu_page( null, esc_html__( 'Give Upgrades', 'give' ), esc_html__( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' );
78
+	$give_upgrades_screen = add_submenu_page(null, esc_html__('Give Upgrades', 'give'), esc_html__('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen');
79 79
 
80 80
 
81 81
 }
82 82
 
83
-add_action( 'admin_menu', 'give_add_options_links', 10 );
83
+add_action('admin_menu', 'give_add_options_links', 10);
84 84
 
85 85
 /**
86 86
  *  Determines whether the current admin page is a Give admin page.
@@ -95,224 +95,224 @@  discard block
 block discarded – undo
95 95
  *
96 96
  * @return bool True if Give admin page.
97 97
  */
98
-function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
98
+function give_is_admin_page($passed_page = '', $passed_view = '') {
99 99
 
100 100
 	global $pagenow, $typenow;
101 101
 
102 102
 	$found     = false;
103
-	$post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false;
104
-	$action    = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false;
105
-	$taxonomy  = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false;
106
-	$page      = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
107
-	$view      = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false;
108
-	$tab       = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false;
109
-
110
-	switch ( $passed_page ) {
103
+	$post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false;
104
+	$action    = isset($_GET['action']) ? strtolower($_GET['action']) : false;
105
+	$taxonomy  = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false;
106
+	$page      = isset($_GET['page']) ? strtolower($_GET['page']) : false;
107
+	$view      = isset($_GET['view']) ? strtolower($_GET['view']) : false;
108
+	$tab       = isset($_GET['tab']) ? strtolower($_GET['tab']) : false;
109
+
110
+	switch ($passed_page) {
111 111
 		case 'give_forms':
112
-			switch ( $passed_view ) {
112
+			switch ($passed_view) {
113 113
 				case 'list-table':
114
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) {
114
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') {
115 115
 						$found = true;
116 116
 					}
117 117
 					break;
118 118
 				case 'edit':
119
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) {
119
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') {
120 120
 						$found = true;
121 121
 					}
122 122
 					break;
123 123
 				case 'new':
124
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) {
124
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') {
125 125
 						$found = true;
126 126
 					}
127 127
 					break;
128 128
 				default:
129
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) {
129
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) {
130 130
 						$found = true;
131 131
 					}
132 132
 					break;
133 133
 			}
134 134
 			break;
135 135
 		case 'categories':
136
-			switch ( $passed_view ) {
136
+			switch ($passed_view) {
137 137
 				case 'list-table':
138 138
 				case 'new':
139
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) {
139
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) {
140 140
 						$found = true;
141 141
 					}
142 142
 					break;
143 143
 				case 'edit':
144
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) {
144
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) {
145 145
 						$found = true;
146 146
 					}
147 147
 					break;
148 148
 				default:
149
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) {
149
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) {
150 150
 						$found = true;
151 151
 					}
152 152
 					break;
153 153
 			}
154 154
 			break;
155 155
 		case 'tags':
156
-			switch ( $passed_view ) {
156
+			switch ($passed_view) {
157 157
 				case 'list-table':
158 158
 				case 'new':
159
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) {
159
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) {
160 160
 						$found = true;
161 161
 					}
162 162
 					break;
163 163
 				case 'edit':
164
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) {
164
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) {
165 165
 						$found = true;
166 166
 					}
167 167
 					break;
168 168
 				default:
169
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) {
169
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) {
170 170
 						$found = true;
171 171
 					}
172 172
 					break;
173 173
 			}
174 174
 			break;
175 175
 		case 'payments':
176
-			switch ( $passed_view ) {
176
+			switch ($passed_view) {
177 177
 				case 'list-table':
178
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) {
178
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) {
179 179
 						$found = true;
180 180
 					}
181 181
 					break;
182 182
 				case 'edit':
183
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) {
183
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) {
184 184
 						$found = true;
185 185
 					}
186 186
 					break;
187 187
 				default:
188
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) {
188
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) {
189 189
 						$found = true;
190 190
 					}
191 191
 					break;
192 192
 			}
193 193
 			break;
194 194
 		case 'reports':
195
-			switch ( $passed_view ) {
195
+			switch ($passed_view) {
196 196
 				// If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ]
197 197
 				case 'earnings':
198
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) {
198
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) {
199 199
 						$found = true;
200 200
 					}
201 201
 					break;
202 202
 				case 'donors':
203
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) {
203
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) {
204 204
 						$found = true;
205 205
 					}
206 206
 					break;
207 207
 				case 'gateways':
208
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) {
208
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) {
209 209
 						$found = true;
210 210
 					}
211 211
 					break;
212 212
 				case 'export':
213
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) {
213
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) {
214 214
 						$found = true;
215 215
 					}
216 216
 					break;
217 217
 				case 'logs':
218
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) {
218
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) {
219 219
 						$found = true;
220 220
 					}
221 221
 					break;
222 222
 				default:
223
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
223
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
224 224
 						$found = true;
225 225
 					}
226 226
 					break;
227 227
 			}
228 228
 			break;
229 229
 		case 'settings':
230
-			switch ( $passed_view ) {
230
+			switch ($passed_view) {
231 231
 				case 'general':
232
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) {
232
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) {
233 233
 						$found = true;
234 234
 					}
235 235
 					break;
236 236
 				case 'gateways':
237
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) {
237
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) {
238 238
 						$found = true;
239 239
 					}
240 240
 					break;
241 241
 				case 'emails':
242
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) {
242
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) {
243 243
 						$found = true;
244 244
 					}
245 245
 					break;
246 246
 				case 'display':
247
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) {
247
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) {
248 248
 						$found = true;
249 249
 					}
250 250
 					break;
251 251
 				case 'licenses':
252
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) {
252
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) {
253 253
 						$found = true;
254 254
 					}
255 255
 					break;
256 256
 				case 'api':
257
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) {
257
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) {
258 258
 						$found = true;
259 259
 					}
260 260
 					break;
261 261
 				case 'advanced':
262
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) {
262
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) {
263 263
 						$found = true;
264 264
 					}
265 265
 					break;
266 266
 				case 'system_info':
267
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) {
267
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) {
268 268
 						$found = true;
269 269
 					}
270 270
 					break;
271 271
 				default:
272
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) {
272
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) {
273 273
 						$found = true;
274 274
 					}
275 275
 					break;
276 276
 			}
277 277
 			break;
278 278
 		case 'addons':
279
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) {
279
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) {
280 280
 				$found = true;
281 281
 			}
282 282
 			break;
283 283
 		case 'donors':
284
-			switch ( $passed_view ) {
284
+			switch ($passed_view) {
285 285
 				case 'list-table':
286
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) {
286
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) {
287 287
 						$found = true;
288 288
 					}
289 289
 					break;
290 290
 				case 'overview':
291
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) {
291
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) {
292 292
 						$found = true;
293 293
 					}
294 294
 					break;
295 295
 				case 'notes':
296
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) {
296
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) {
297 297
 						$found = true;
298 298
 					}
299 299
 					break;
300 300
 				default:
301
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) {
301
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) {
302 302
 						$found = true;
303 303
 					}
304 304
 					break;
305 305
 			}
306 306
 			break;
307 307
 		case 'reports':
308
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
308
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
309 309
 				$found = true;
310 310
 			}
311 311
 			break;
312 312
 		default:
313 313
 			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page, $give_tools_page;
314 314
 
315
-			$admin_pages = apply_filters( 'give_admin_pages', array(
315
+			$admin_pages = apply_filters('give_admin_pages', array(
316 316
 				$give_payments_page,
317 317
 				$give_settings_page,
318 318
 				$give_reports_page,
@@ -323,19 +323,19 @@  discard block
 block discarded – undo
323 323
 				$give_customers_page,
324 324
 				$give_tools_page,
325 325
 				'widgets.php'
326
-		) );
327
-			if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
326
+		));
327
+			if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) {
328 328
 				$found = true;
329
-				if ( 'give-upgrades' === $page ) {
329
+				if ('give-upgrades' === $page) {
330 330
 					$found = false;
331 331
 				}
332
-			} elseif ( in_array( $pagenow, $admin_pages ) ) {
332
+			} elseif (in_array($pagenow, $admin_pages)) {
333 333
 				$found = true;
334 334
 			}
335 335
 			break;
336 336
 	}
337 337
 
338
-	return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view );
338
+	return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view);
339 339
 
340 340
 }
341 341
 
@@ -347,37 +347,37 @@  discard block
 block discarded – undo
347 347
  * @param  array $settings
348 348
  * @return array
349 349
  */
350
-function give_settings_page_pages( $settings ) {
351
-	include( 'abstract-admin-settings-page.php' );
352
-	include( 'settings/class-settings-cmb2-backward-compatibility.php' );
350
+function give_settings_page_pages($settings) {
351
+	include('abstract-admin-settings-page.php');
352
+	include('settings/class-settings-cmb2-backward-compatibility.php');
353 353
 
354 354
 	$settings = array(
355 355
 		// General settings.
356
-		include( 'settings/class-settings-general.php' ),
356
+		include('settings/class-settings-general.php'),
357 357
 
358 358
 		// Payment Gateways Settings.
359
-		include( 'settings/class-settings-gateways.php' ),
359
+		include('settings/class-settings-gateways.php'),
360 360
 
361 361
 		// Display settings.
362
-		include( 'settings/class-settings-display.php' ),
362
+		include('settings/class-settings-display.php'),
363 363
 
364 364
 		// Emails settings.
365
-		include( 'settings/class-settings-email.php' ),
365
+		include('settings/class-settings-email.php'),
366 366
 
367 367
 		// Addons settings.
368
-		include( 'settings/class-settings-addon.php' ),
368
+		include('settings/class-settings-addon.php'),
369 369
 
370 370
 		// License settings.
371
-		include( 'settings/class-settings-license.php' ),
371
+		include('settings/class-settings-license.php'),
372 372
 
373 373
 		// Advanced settinns.
374
-		include( 'settings/class-settings-advanced.php' )
374
+		include('settings/class-settings-advanced.php')
375 375
 	);
376 376
 
377 377
 	// Output.
378 378
 	return $settings;
379 379
 }
380
-add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 );
380
+add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1);
381 381
 
382 382
 
383 383
 /**
@@ -387,28 +387,28 @@  discard block
 block discarded – undo
387 387
  * @param  array $settings
388 388
  * @return array
389 389
  */
390
-function give_reports_page_pages( $settings ) {
391
-	include( 'abstract-admin-settings-page.php' );
390
+function give_reports_page_pages($settings) {
391
+	include('abstract-admin-settings-page.php');
392 392
 
393 393
 	$settings = array(
394 394
 		// Earnings.
395
-		include( 'reporting/class-settings-earnings.php' ),
395
+		include('reporting/class-settings-earnings.php'),
396 396
 
397 397
 		// Forms.
398
-		include( 'reporting/class-settings-forms.php' ),
398
+		include('reporting/class-settings-forms.php'),
399 399
 
400 400
 		// Donors.
401
-		include( 'reporting/class-settings-donors.php' ),
401
+		include('reporting/class-settings-donors.php'),
402 402
 
403 403
 		// Gateways.
404
-		include( 'reporting/class-settings-gateways.php' ),
404
+		include('reporting/class-settings-gateways.php'),
405 405
 
406 406
 	);
407 407
 
408 408
 	// Output.
409 409
 	return $settings;
410 410
 }
411
-add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 );
411
+add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1);
412 412
 
413 413
 /**
414 414
  * Add setting tab to give-settings page
@@ -417,31 +417,31 @@  discard block
 block discarded – undo
417 417
  * @param  array $settings
418 418
  * @return array
419 419
  */
420
-function give_tools_page_pages( $settings ) {
421
-	include( 'abstract-admin-settings-page.php' );
420
+function give_tools_page_pages($settings) {
421
+	include('abstract-admin-settings-page.php');
422 422
 
423 423
 	$settings = array(
424 424
 		// System Info.
425
-		include( 'tools/class-settings-system-info.php' ),
425
+		include('tools/class-settings-system-info.php'),
426 426
 
427 427
 		// Logs.
428
-		include( 'tools/class-settings-logs.php' ),
428
+		include('tools/class-settings-logs.php'),
429 429
 
430 430
 		// API.
431
-		include( 'tools/class-settings-api.php' ),
431
+		include('tools/class-settings-api.php'),
432 432
 
433 433
 		// Data.
434
-		include( 'tools/class-settings-data.php' ),
434
+		include('tools/class-settings-data.php'),
435 435
 
436 436
 		// Export.
437
-		include( 'tools/class-settings-export.php' ),
437
+		include('tools/class-settings-export.php'),
438 438
 
439 439
 	);
440 440
 
441 441
 	// Output.
442 442
 	return $settings;
443 443
 }
444
-add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 );
444
+add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1);
445 445
 
446 446
 /**
447 447
  * Set default tools page tab.
@@ -450,10 +450,10 @@  discard block
 block discarded – undo
450 450
  * @param  string $default_tab Default tab name.
451 451
  * @return string
452 452
  */
453
-function give_set_default_tab_form_tools_page( $default_tab ) {
453
+function give_set_default_tab_form_tools_page($default_tab) {
454 454
 	return 'system-info';
455 455
 }
456
-add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 );
456
+add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1);
457 457
 
458 458
 
459 459
 /**
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
  * @param  string $default_tab Default tab name.
464 464
  * @return string
465 465
  */
466
-function give_set_default_tab_form_reports_page( $default_tab ) {
466
+function give_set_default_tab_form_reports_page($default_tab) {
467 467
 	return 'earnings';
468 468
 }
469
-add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 );
470 469
\ No newline at end of file
470
+add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1);
471 471
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-display.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 								'disabled' => __( 'Disabled', 'give' ),
88 88
 							)
89 89
 						),
90
-                        array(
91
-                            'name'  => __( 'Display Settings Docs Link', 'give' ),
92
-                            'id'    => 'display_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/form-display-options' ),
94
-                            'title' => __( 'Display Options Settings', 'give' ),
95
-                            'type'  => 'give_docs_link',
96
-                        ),
90
+						array(
91
+							'name'  => __( 'Display Settings Docs Link', 'give' ),
92
+							'id'    => 'display_settings_docs_link',
93
+							'url'   => esc_url( 'http://docs.givewp.com/form-display-options' ),
94
+							'title' => __( 'Display Options Settings', 'give' ),
95
+							'type'  => 'give_docs_link',
96
+						),
97 97
 						array(
98 98
 							'id'   => 'give_title_display_settings_1',
99 99
 							'type' => 'sectionend'
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 								'disabled' => __( 'Disabled', 'give' ),
171 171
 							)
172 172
 						),
173
-                        array(
174
-                            'name'  => __( 'Post Types Docs Link', 'give' ),
175
-                            'id'    => 'post_types_settings_docs_link',
176
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-post-types' ),
177
-                            'title' => __( 'Post Types Settings', 'give' ),
178
-                            'type'  => 'give_docs_link',
179
-                        ),
173
+						array(
174
+							'name'  => __( 'Post Types Docs Link', 'give' ),
175
+							'id'    => 'post_types_settings_docs_link',
176
+							'url'   => esc_url( 'http://docs.givewp.com/settings-post-types' ),
177
+							'title' => __( 'Post Types Settings', 'give' ),
178
+							'type'  => 'give_docs_link',
179
+						),
180 180
 						array(
181 181
 							'id'   => 'give_title_display_settings_2',
182 182
 							'type' => 'sectionend'
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 								'disabled' => __( 'Disabled', 'give' ),
213 213
 							)
214 214
 						),
215
-                        array(
216
-                            'name'  => __( 'Taxonomies Docs Link', 'give' ),
217
-                            'id'    => 'taxonomies_settings_docs_link',
218
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-taxonomies' ),
219
-                            'title' => __( 'Taxonomies Settings', 'give' ),
220
-                            'type'  => 'give_docs_link',
221
-                        ),
215
+						array(
216
+							'name'  => __( 'Taxonomies Docs Link', 'give' ),
217
+							'id'    => 'taxonomies_settings_docs_link',
218
+							'url'   => esc_url( 'http://docs.givewp.com/settings-taxonomies' ),
219
+							'title' => __( 'Taxonomies Settings', 'give' ),
220
+							'type'  => 'give_docs_link',
221
+						),
222 222
 						array(
223 223
 							'id'   => 'give_title_display_settings_3',
224 224
 							'type' => 'sectionend'
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 							'id'   => 'agreement_text',
259 259
 							'type' => 'wysiwyg'
260 260
 						),
261
-                        array(
262
-                            'name'  => __( 'Terms and Conditions Docs Link', 'give' ),
263
-                            'id'    => 'terms_settings_docs_link',
264
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-terms' ),
265
-                            'title' => __( 'Terms and Conditions Settings', 'give' ),
266
-                            'type'  => 'give_docs_link',
267
-                        ),
261
+						array(
262
+							'name'  => __( 'Terms and Conditions Docs Link', 'give' ),
263
+							'id'    => 'terms_settings_docs_link',
264
+							'url'   => esc_url( 'http://docs.givewp.com/settings-terms' ),
265
+							'title' => __( 'Terms and Conditions Settings', 'give' ),
266
+							'type'  => 'give_docs_link',
267
+						),
268 268
 						array(
269 269
 							'id'   => 'give_title_display_settings_4',
270 270
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Display' ) ) :
16
+if ( ! class_exists('Give_Settings_Display')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Display.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'display';
30
-			$this->label = __( 'Display Options', 'give' );
30
+			$this->label = __('Display Options', 'give');
31 31
 
32 32
 			$this->default_tab = 'display-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'display-settings' :
49 49
 					$settings = array(
50 50
 						// Section 1: Display
@@ -53,45 +53,45 @@  discard block
 block discarded – undo
53 53
 							'type' => 'title'
54 54
 						),
55 55
 						array(
56
-							'name'    => __( 'Default Give Styles', 'give' ),
57
-							'desc'    => __( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ),
56
+							'name'    => __('Default Give Styles', 'give'),
57
+							'desc'    => __('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'),
58 58
 							'id'      => 'css',
59 59
 							'type'    => 'radio_inline',
60 60
 							'default' => 'enabled',
61 61
 							'options' => array(
62
-								'enabled' => __( 'Enabled', 'give' ),
63
-								'disabled' => __( 'Disabled', 'give' ),
62
+								'enabled' => __('Enabled', 'give'),
63
+								'disabled' => __('Disabled', 'give'),
64 64
 							)
65 65
 						),
66 66
 						array(
67
-							'name' => __( 'Floating Labels', 'give' ),
67
+							'name' => __('Floating Labels', 'give'),
68 68
 							/* translators: %s: http://docs.givewp.com/form-floating-labels */
69
-							'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your lables to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
69
+							'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your lables to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('http://docs.givewp.com/form-floating-labels')),
70 70
 							'id'   => 'floatlabels',
71 71
 							'type'    => 'radio_inline',
72 72
 							'default' => 'disabled',
73 73
 							'options' => array(
74
-								'enabled' => __( 'Enabled', 'give' ),
75
-								'disabled' => __( 'Disabled', 'give' ),
74
+								'enabled' => __('Enabled', 'give'),
75
+								'disabled' => __('Disabled', 'give'),
76 76
 							)
77 77
 						),
78 78
 						array(
79
-							'name'    => __( 'Welcome Screen', 'give' ),
79
+							'name'    => __('Welcome Screen', 'give'),
80 80
 							/* translators: %s: about page URL */
81
-							'desc'    => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
81
+							'desc'    => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))),
82 82
 							'id'      => 'welcome',
83 83
 							'type'    => 'radio_inline',
84 84
 							'default' => 'enabled',
85 85
 							'options' => array(
86
-								'enabled' => __( 'Enabled', 'give' ),
87
-								'disabled' => __( 'Disabled', 'give' ),
86
+								'enabled' => __('Enabled', 'give'),
87
+								'disabled' => __('Disabled', 'give'),
88 88
 							)
89 89
 						),
90 90
                         array(
91
-                            'name'  => __( 'Display Settings Docs Link', 'give' ),
91
+                            'name'  => __('Display Settings Docs Link', 'give'),
92 92
                             'id'    => 'display_settings_docs_link',
93
-                            'url'   => esc_url( 'http://docs.givewp.com/form-display-options' ),
94
-                            'title' => __( 'Display Options Settings', 'give' ),
93
+                            'url'   => esc_url('http://docs.givewp.com/form-display-options'),
94
+                            'title' => __('Display Options Settings', 'give'),
95 95
                             'type'  => 'give_docs_link',
96 96
                         ),
97 97
 						array(
@@ -108,73 +108,73 @@  discard block
 block discarded – undo
108 108
 							'type' => 'title'
109 109
 						),
110 110
 						array(
111
-							'name'    => __( 'Form Single Views', 'give' ),
112
-							'desc'    => __( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
111
+							'name'    => __('Form Single Views', 'give'),
112
+							'desc'    => __('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
113 113
 							'id'      => 'forms_singular',
114 114
 							'type'    => 'radio_inline',
115 115
 							'default' => 'enabled',
116 116
 							'options' => array(
117
-								'enabled' => __( 'Enabled', 'give' ),
118
-								'disabled' => __( 'Disabled', 'give' ),
117
+								'enabled' => __('Enabled', 'give'),
118
+								'disabled' => __('Disabled', 'give'),
119 119
 							)
120 120
 						),
121 121
 						array(
122
-							'name'    => __( 'Form Archives', 'give' ),
123
-							'desc'    => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'options-permalink.php' ) ) ),
122
+							'name'    => __('Form Archives', 'give'),
123
+							'desc'    => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('options-permalink.php'))),
124 124
 							'id'      => 'forms_archives',
125 125
 							'type'    => 'radio_inline',
126 126
 							'default' => 'enabled',
127 127
 							'options' => array(
128
-								'enabled' => __( 'Enabled', 'give' ),
129
-								'disabled' => __( 'Disabled', 'give' ),
128
+								'enabled' => __('Enabled', 'give'),
129
+								'disabled' => __('Disabled', 'give'),
130 130
 							)
131 131
 						),
132 132
 						array(
133
-							'name'    => __( 'Form Excerpts', 'give' ),
134
-							'desc'    => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
133
+							'name'    => __('Form Excerpts', 'give'),
134
+							'desc'    => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
135 135
 							'id'      => 'forms_excerpt',
136 136
 							'type'    => 'radio_inline',
137 137
 							'default' => 'enabled',
138 138
 							'options' => array(
139
-								'enabled' => __( 'Enabled', 'give' ),
140
-								'disabled' => __( 'Disabled', 'give' ),
139
+								'enabled' => __('Enabled', 'give'),
140
+								'disabled' => __('Disabled', 'give'),
141 141
 							)
142 142
 						),
143 143
 						array(
144
-							'name'    => __( 'Form Featured Image', 'give' ),
145
-							'desc'    => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
144
+							'name'    => __('Form Featured Image', 'give'),
145
+							'desc'    => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
146 146
 							'id'      => 'form_featured_img',
147 147
 							'type'    => 'radio_inline',
148 148
 							'default' => 'enabled',
149 149
 							'options' => array(
150
-								'enabled' => __( 'Enabled', 'give' ),
151
-								'disabled' => __( 'Disabled', 'give' ),
150
+								'enabled' => __('Enabled', 'give'),
151
+								'disabled' => __('Disabled', 'give'),
152 152
 							)
153 153
 						),
154 154
 						array(
155
-							'name'    => __( 'Featured Image Size', 'give' ),
156
-							'desc'    => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ),
155
+							'name'    => __('Featured Image Size', 'give'),
156
+							'desc'    => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'),
157 157
 							'id'      => 'featured_image_size',
158 158
 							'type'    => 'select',
159 159
 							'default' => 'large',
160 160
 							'options' => give_get_featured_image_sizes()
161 161
 						),
162 162
 						array(
163
-							'name'    => __( 'Single Form Sidebar', 'give' ),
164
-							'desc'    => __( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
163
+							'name'    => __('Single Form Sidebar', 'give'),
164
+							'desc'    => __('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
165 165
 							'id'      => 'form_sidebar',
166 166
 							'type'    => 'radio_inline',
167 167
 							'default' => 'enabled',
168 168
 							'options' => array(
169
-								'enabled' => __( 'Enabled', 'give' ),
170
-								'disabled' => __( 'Disabled', 'give' ),
169
+								'enabled' => __('Enabled', 'give'),
170
+								'disabled' => __('Disabled', 'give'),
171 171
 							)
172 172
 						),
173 173
                         array(
174
-                            'name'  => __( 'Post Types Docs Link', 'give' ),
174
+                            'name'  => __('Post Types Docs Link', 'give'),
175 175
                             'id'    => 'post_types_settings_docs_link',
176
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-post-types' ),
177
-                            'title' => __( 'Post Types Settings', 'give' ),
176
+                            'url'   => esc_url('http://docs.givewp.com/settings-post-types'),
177
+                            'title' => __('Post Types Settings', 'give'),
178 178
                             'type'  => 'give_docs_link',
179 179
                         ),
180 180
 						array(
@@ -191,32 +191,32 @@  discard block
 block discarded – undo
191 191
 							'type' => 'title'
192 192
 						),
193 193
 						array(
194
-							'name' => __( 'Form Categories', 'give' ),
195
-							'desc' => __( 'Enable Categories for all Give forms.', 'give' ),
194
+							'name' => __('Form Categories', 'give'),
195
+							'desc' => __('Enable Categories for all Give forms.', 'give'),
196 196
 							'id'   => 'categories',
197 197
 							'type'    => 'radio_inline',
198 198
 							'default' => 'disabled',
199 199
 							'options' => array(
200
-								'enabled' => __( 'Enabled', 'give' ),
201
-								'disabled' => __( 'Disabled', 'give' ),
200
+								'enabled' => __('Enabled', 'give'),
201
+								'disabled' => __('Disabled', 'give'),
202 202
 							)
203 203
 						),
204 204
 						array(
205
-							'name' => __( 'Form Tags', 'give' ),
206
-							'desc' => __( 'Enable Tags for all Give forms.', 'give' ),
205
+							'name' => __('Form Tags', 'give'),
206
+							'desc' => __('Enable Tags for all Give forms.', 'give'),
207 207
 							'id'   => 'tags',
208 208
 							'type'    => 'radio_inline',
209 209
 							'default' => 'disabled',
210 210
 							'options' => array(
211
-								'enabled' => __( 'Enabled', 'give' ),
212
-								'disabled' => __( 'Disabled', 'give' ),
211
+								'enabled' => __('Enabled', 'give'),
212
+								'disabled' => __('Disabled', 'give'),
213 213
 							)
214 214
 						),
215 215
                         array(
216
-                            'name'  => __( 'Taxonomies Docs Link', 'give' ),
216
+                            'name'  => __('Taxonomies Docs Link', 'give'),
217 217
                             'id'    => 'taxonomies_settings_docs_link',
218
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-taxonomies' ),
219
-                            'title' => __( 'Taxonomies Settings', 'give' ),
218
+                            'url'   => esc_url('http://docs.givewp.com/settings-taxonomies'),
219
+                            'title' => __('Taxonomies Settings', 'give'),
220 220
                             'type'  => 'give_docs_link',
221 221
                         ),
222 222
 						array(
@@ -233,36 +233,36 @@  discard block
 block discarded – undo
233 233
 							'type' => 'title'
234 234
 						),
235 235
 						array(
236
-							'name'    => __( 'Terms and Conditions', 'give' ),
237
-							'desc'    => __( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ),
236
+							'name'    => __('Terms and Conditions', 'give'),
237
+							'desc'    => __('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'),
238 238
 							'id'      => 'terms',
239 239
 							'type'    => 'radio_inline',
240 240
 							'default' => 'disabled',
241 241
 							'options' => array(
242
-								'enabled' => __( 'Enabled', 'give' ),
243
-								'disabled' => __( 'Disabled', 'give' ),
242
+								'enabled' => __('Enabled', 'give'),
243
+								'disabled' => __('Disabled', 'give'),
244 244
 							)
245 245
 						),
246 246
 						array(
247
-							'name' => __( 'Agree to Terms Label', 'give' ),
248
-							'desc' => __( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ),
247
+							'name' => __('Agree to Terms Label', 'give'),
248
+							'desc' => __('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'),
249 249
 							'id'   => 'agree_to_terms_label',
250 250
 							'attributes'  => array(
251
-								'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
251
+								'placeholder' => esc_attr__('Agree to Terms?', 'give'),
252 252
 							),
253 253
 							'type' => 'text'
254 254
 						),
255 255
 						array(
256
-							'name' => __( 'Agreement Text', 'give' ),
257
-							'desc' => __( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ),
256
+							'name' => __('Agreement Text', 'give'),
257
+							'desc' => __('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'),
258 258
 							'id'   => 'agreement_text',
259 259
 							'type' => 'wysiwyg'
260 260
 						),
261 261
                         array(
262
-                            'name'  => __( 'Terms and Conditions Docs Link', 'give' ),
262
+                            'name'  => __('Terms and Conditions Docs Link', 'give'),
263 263
                             'id'    => 'terms_settings_docs_link',
264
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-terms' ),
265
-                            'title' => __( 'Terms and Conditions Settings', 'give' ),
264
+                            'url'   => esc_url('http://docs.givewp.com/settings-terms'),
265
+                            'title' => __('Terms and Conditions Settings', 'give'),
266 266
                             'type'  => 'give_docs_link',
267 267
                         ),
268 268
 						array(
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			 * Filter the display options settings.
278 278
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
279 279
 			 */
280
-			$settings = apply_filters( 'give_settings_display', $settings );
280
+			$settings = apply_filters('give_settings_display', $settings);
281 281
 
282 282
 			/**
283 283
 			 * Filter the settings.
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			 * @since  1.8
286 286
 			 * @param  array $settings
287 287
 			 */
288
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
288
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
289 289
 
290 290
 			// Output.
291 291
 			return $settings;
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 		 */
300 300
 		public function get_sections() {
301 301
 			$sections = array(
302
-				'display-settings'    => __( 'Display', 'give' ),
303
-				'post-types'          => __( 'Post Types', 'give' ),
304
-				'taxonomies'          => __( 'Taxonomies', 'give' ),
305
-				'term-and-conditions' => __( 'Terms and Conditions', 'give' )
302
+				'display-settings'    => __('Display', 'give'),
303
+				'post-types'          => __('Post Types', 'give'),
304
+				'taxonomies'          => __('Taxonomies', 'give'),
305
+				'term-and-conditions' => __('Terms and Conditions', 'give')
306 306
 			);
307 307
 
308
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
308
+			return apply_filters('give_get_sections_'.$this->id, $sections);
309 309
 		}
310 310
 	}
311 311
 
Please login to merge, or discard this patch.