Test Failed
Pull Request — master (#3152)
by Devin
07:21
created
includes/emails/class-give-emails.php 1 patch
Spacing   +66 added lines, -66 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
 
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function __construct() {
104 104
 
105
-		if ( 'none' === $this->get_template() ) {
105
+		if ('none' === $this->get_template()) {
106 106
 			$this->html = false;
107 107
 		}
108 108
 
109
-		add_action( 'give_email_send_before', array( $this, 'send_before' ) );
110
-		add_action( 'give_email_send_after', array( $this, 'send_after' ) );
109
+		add_action('give_email_send_before', array($this, 'send_before'));
110
+		add_action('give_email_send_after', array($this, 'send_after'));
111 111
 
112 112
 	}
113 113
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param $key
120 120
 	 * @param $value
121 121
 	 */
122
-	public function __set( $key, $value ) {
122
+	public function __set($key, $value) {
123 123
 		$this->$key = $value;
124 124
 	}
125 125
 
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	 * @since 1.0
130 130
 	 */
131 131
 	public function get_from_name() {
132
-		if ( ! $this->from_name ) {
133
-			$this->from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
132
+		if ( ! $this->from_name) {
133
+			$this->from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
134 134
 		}
135 135
 
136
-		return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
136
+		return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this);
137 137
 	}
138 138
 
139 139
 	/**
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	 * @since 1.0
143 143
 	 */
144 144
 	public function get_from_address() {
145
-		if ( ! $this->from_address ) {
146
-			$this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) );
145
+		if ( ! $this->from_address) {
146
+			$this->from_address = give_get_option('from_email', get_option('admin_email'));
147 147
 		}
148 148
 
149
-		return apply_filters( 'give_email_from_address', $this->from_address, $this );
149
+		return apply_filters('give_email_from_address', $this->from_address, $this);
150 150
 	}
151 151
 
152 152
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
 	 * @since 1.0
156 156
 	 */
157 157
 	public function get_content_type() {
158
-		if ( ! $this->content_type  ) {
158
+		if ( ! $this->content_type) {
159 159
 			$this->content_type = $this->html
160
-				? apply_filters( 'give_email_default_content_type', 'text/html', $this )
160
+				? apply_filters('give_email_default_content_type', 'text/html', $this)
161 161
 				: 'text/plain';
162 162
 		}
163 163
 
164
-		return apply_filters( 'give_email_content_type', $this->content_type, $this );
164
+		return apply_filters('give_email_content_type', $this->content_type, $this);
165 165
 	}
166 166
 
167 167
 	/**
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 	 * @since 1.0
171 171
 	 */
172 172
 	public function get_headers() {
173
-		if ( ! $this->headers ) {
173
+		if ( ! $this->headers) {
174 174
 			$this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
175 175
 			$this->headers .= "Reply-To: {$this->get_from_address()}\r\n";
176 176
 			$this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
177 177
 		}
178 178
 
179
-		return apply_filters( 'give_email_headers', $this->headers, $this );
179
+		return apply_filters('give_email_headers', $this->headers, $this);
180 180
 	}
181 181
 
182 182
 	/**
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function get_templates() {
188 188
 		$templates = array(
189
-			'default' => esc_html__( 'Default Template', 'give' ),
190
-			'none'    => esc_html__( 'No template, plain text only', 'give' )
189
+			'default' => esc_html__('Default Template', 'give'),
190
+			'none'    => esc_html__('No template, plain text only', 'give')
191 191
 		);
192 192
 
193
-		return apply_filters( 'give_email_templates', $templates );
193
+		return apply_filters('give_email_templates', $templates);
194 194
 	}
195 195
 
196 196
 	/**
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 * @since 1.0
200 200
 	 */
201 201
 	public function get_template() {
202
-		if ( ! $this->template ) {
203
-			$this->template = give_get_option( 'email_template', 'default' );
202
+		if ( ! $this->template) {
203
+			$this->template = give_get_option('email_template', 'default');
204 204
 		}
205 205
 
206
-		return apply_filters( 'give_email_template', $this->template );
206
+		return apply_filters('give_email_template', $this->template);
207 207
 	}
208 208
 
209 209
 	/**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @since 1.0
213 213
 	 */
214 214
 	public function get_heading() {
215
-		return apply_filters( 'give_email_heading', $this->heading );
215
+		return apply_filters('give_email_heading', $this->heading);
216 216
 	}
217 217
 
218 218
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return mixed
224 224
 	 */
225
-	public function parse_tags( $content ) {
225
+	public function parse_tags($content) {
226 226
 		return $content;
227 227
 	}
228 228
 
@@ -235,34 +235,34 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return string
237 237
 	 */
238
-	public function build_email( $message ) {
238
+	public function build_email($message) {
239 239
 
240
-		if ( false === $this->html ) {
240
+		if (false === $this->html) {
241 241
 
242 242
 			// Added Replacement check to simply behaviour of anchor tags.
243 243
 			$pattern = '/<a.+?href\=(?:["|\'])(.+?)(?:["|\']).*?>(.+?)<\/a>/i';
244 244
 			$message = preg_replace_callback(
245 245
 				$pattern,
246
-				function ( $return ) {
247
-					if ( $return[1] !== $return[2] ) {
246
+				function($return) {
247
+					if ($return[1] !== $return[2]) {
248 248
 						return "{$return[2]} ( {$return[1]} )";
249 249
 					}
250 250
 
251
-					return trailingslashit( $return[1] );
251
+					return trailingslashit($return[1]);
252 252
 				},
253 253
 				$message
254 254
 			);
255 255
 
256
-			return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this );
256
+			return apply_filters('give_email_message', wp_strip_all_tags($message), $this);
257 257
 		}
258 258
 
259
-		$message = $this->text_to_html( $message );
259
+		$message = $this->text_to_html($message);
260 260
 
261 261
 		$template = $this->get_template();
262 262
 
263 263
 		ob_start();
264 264
 
265
-		give_get_template_part( 'emails/header', $template, true );
265
+		give_get_template_part('emails/header', $template, true);
266 266
 
267 267
 		/**
268 268
 		 * Fires in the email head.
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 		 *
272 272
 		 * @param Give_Emails $this The email object.
273 273
 		 */
274
-		do_action( 'give_email_header', $this );
274
+		do_action('give_email_header', $this);
275 275
 
276
-		if ( has_action( 'give_email_template_' . $template ) ) {
276
+		if (has_action('give_email_template_'.$template)) {
277 277
 			/**
278 278
 			 * Fires in a specific email template.
279 279
 			 *
280 280
 			 * @since 1.0
281 281
 			 */
282
-			do_action( "give_email_template_{$template}" );
282
+			do_action("give_email_template_{$template}");
283 283
 		} else {
284
-			give_get_template_part( 'emails/body', $template, true );
284
+			give_get_template_part('emails/body', $template, true);
285 285
 		}
286 286
 
287 287
 		/**
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 		 *
292 292
 		 * @param Give_Emails $this The email object.
293 293
 		 */
294
-		do_action( 'give_email_body', $this );
294
+		do_action('give_email_body', $this);
295 295
 
296
-		give_get_template_part( 'emails/footer', $template, true );
296
+		give_get_template_part('emails/footer', $template, true);
297 297
 
298 298
 		/**
299 299
 		 * Fires in the email footer.
@@ -302,28 +302,28 @@  discard block
 block discarded – undo
302 302
 		 *
303 303
 		 * @param Give_Emails $this The email object.
304 304
 		 */
305
-		do_action( 'give_email_footer', $this );
305
+		do_action('give_email_footer', $this);
306 306
 
307 307
 		$body    = ob_get_clean();
308 308
 
309 309
 		// Email tag.
310
-		$message = str_replace( '{email}', $message, $body );
310
+		$message = str_replace('{email}', $message, $body);
311 311
 
312 312
 		// Email logo tag.
313
-		$header_img = give_get_meta( $this->form_id, '_give_email_logo', true );
314
-		$header_img = $this->form_id ? $header_img : give_get_option( 'email_logo', '' );
313
+		$header_img = give_get_meta($this->form_id, '_give_email_logo', true);
314
+		$header_img = $this->form_id ? $header_img : give_get_option('email_logo', '');
315 315
 
316
-		if ( ! empty( $header_img ) ) {
316
+		if ( ! empty($header_img)) {
317 317
 			$header_img = sprintf(
318 318
 				'<div id="template_header_image"><p style="margin-top:0;"><img style="max-width:450px;" src="%1$s" alt="%2$s" /></p></div>',
319
-				esc_url( $header_img ),
320
-				get_bloginfo( 'name' )
319
+				esc_url($header_img),
320
+				get_bloginfo('name')
321 321
 			);
322 322
 		}
323 323
 
324
-		$message    = str_replace( '{email_logo}', $header_img, $message );
324
+		$message = str_replace('{email_logo}', $header_img, $message);
325 325
 
326
-		return apply_filters( 'give_email_message', $message, $this );
326
+		return apply_filters('give_email_message', $message, $this);
327 327
 	}
328 328
 
329 329
 	/**
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 * @return bool
338 338
 	 */
339
-	public function send( $to, $subject, $message, $attachments = '' ) {
339
+	public function send($to, $subject, $message, $attachments = '') {
340 340
 
341
-		if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
342
-			give_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null );
341
+		if ( ! did_action('init') && ! did_action('admin_init')) {
342
+			give_doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null);
343 343
 
344 344
 			return false;
345 345
 		}
@@ -351,16 +351,16 @@  discard block
 block discarded – undo
351 351
 		 *
352 352
 		 * @param Give_Emails $this The email object.
353 353
 		 */
354
-		do_action( 'give_email_send_before', $this );
354
+		do_action('give_email_send_before', $this);
355 355
 
356
-		$subject = $this->parse_tags( $subject );
357
-		$message = $this->parse_tags( $message );
356
+		$subject = $this->parse_tags($subject);
357
+		$message = $this->parse_tags($message);
358 358
 
359
-		$message = $this->build_email( $message );
359
+		$message = $this->build_email($message);
360 360
 
361
-		$attachments = apply_filters( 'give_email_attachments', $attachments, $this );
361
+		$attachments = apply_filters('give_email_attachments', $attachments, $this);
362 362
 
363
-		$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
363
+		$sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments);
364 364
 
365 365
 		/**
366 366
 		 * Fires after sending an email.
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		 *
370 370
 		 * @param Give_Emails $this The email object.
371 371
 		 */
372
-		do_action( 'give_email_send_after', $this );
372
+		do_action('give_email_send_after', $this);
373 373
 
374 374
 		return $sent;
375 375
 
@@ -381,9 +381,9 @@  discard block
 block discarded – undo
381 381
 	 * @since 1.0
382 382
 	 */
383 383
 	public function send_before() {
384
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
385
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
386
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
384
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
385
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
386
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
387 387
 	}
388 388
 
389 389
 	/**
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 	 * @since 1.0
393 393
 	 */
394 394
 	public function send_after() {
395
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
396
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
397
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
395
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
396
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
397
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
398 398
 
399 399
 		// Reset email related params.
400 400
 		$this->heading = '';
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @since 1.0
410 410
 	 */
411
-	public function text_to_html( $message ) {
411
+	public function text_to_html($message) {
412 412
 
413
-		if ( 'text/html' == $this->content_type || true === $this->html ) {
414
-			$message = wpautop( $message );
413
+		if ('text/html' == $this->content_type || true === $this->html) {
414
+			$message = wpautop($message);
415 415
 		}
416 416
 
417 417
 		return $message;
Please login to merge, or discard this patch.
includes/emails/actions.php 1 patch
Spacing   +5 added lines, -5 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
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return void
25 25
  */
26
-function give_trigger_donation_receipt( $payment_id ) {
26
+function give_trigger_donation_receipt($payment_id) {
27 27
 	// Make sure we don't send a receipt while editing a donation.
28
-	if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) {
28
+	if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) {
29 29
 		return;
30 30
 	}
31 31
 
32 32
 	// Send email.
33
-	give_email_donation_receipt( $payment_id );
33
+	give_email_donation_receipt($payment_id);
34 34
 }
35 35
 
36
-add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999, 1 );
37 36
\ No newline at end of file
37
+add_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1);
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +52 added lines, -52 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
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
  *
43 43
  * @return string $message Fully formatted message
44 44
  */
45
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
46
-	return give_do_email_tags( $message, $payment_id );
45
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
46
+	return give_do_email_tags($message, $payment_id);
47 47
 }
48 48
 
49 49
 /**
@@ -57,45 +57,45 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return string $message Fully formatted message
59 59
  */
60
-function give_email_preview_template_tags( $message ) {
60
+function give_email_preview_template_tags($message) {
61 61
 
62
-	$price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) );
62
+	$price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false)));
63 63
 
64 64
 	$gateway = 'PayPal';
65 65
 
66
-	$receipt_id = strtolower( md5( uniqid() ) );
66
+	$receipt_id = strtolower(md5(uniqid()));
67 67
 
68
-	$payment_id = rand( 1, 100 );
69
-	$receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id ), give_get_history_page_uri() ) );
68
+	$payment_id = rand(1, 100);
69
+	$receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id), give_get_history_page_uri()));
70 70
 
71 71
 	$receipt_link     = sprintf(
72 72
 		'<a href="%1$s">%2$s</a>',
73 73
 		$receipt_link_url,
74
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
74
+		esc_html__('View the receipt in your browser &raquo;', 'give')
75 75
 	);
76 76
 
77 77
 	// Set user.
78 78
 	$user = wp_get_current_user();
79 79
 
80
-	$message = str_replace( '{name}', $user->display_name, $message );
81
-	$message = str_replace( '{fullname}', $user->display_name, $message );
82
-	$message = str_replace( '{username}', $user->user_login, $message );
83
-	$message = str_replace( '{user_email}', $user->user_email, $message );
84
-	$message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message );
85
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
86
-	$message = str_replace( '{amount}', $price, $message );
87
-	$message = str_replace( '{price}', $price, $message );
88
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
89
-	$message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message );
90
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
91
-	$message = str_replace( '{payment_method}', $gateway, $message );
92
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
93
-	$message = str_replace( '{payment_id}', $payment_id, $message );
94
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
95
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
96
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
97
-
98
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
80
+	$message = str_replace('{name}', $user->display_name, $message);
81
+	$message = str_replace('{fullname}', $user->display_name, $message);
82
+	$message = str_replace('{username}', $user->user_login, $message);
83
+	$message = str_replace('{user_email}', $user->user_email, $message);
84
+	$message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message);
85
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
86
+	$message = str_replace('{amount}', $price, $message);
87
+	$message = str_replace('{price}', $price, $message);
88
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
89
+	$message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message);
90
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
91
+	$message = str_replace('{payment_method}', $gateway, $message);
92
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
93
+	$message = str_replace('{payment_id}', $payment_id, $message);
94
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
95
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
96
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
97
+
98
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
99 99
 }
100 100
 
101 101
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @return array
113 113
  */
114
-function give_email_preview_buttons_callback( $field ) {
115
-	$field_id = str_replace( '_preview_buttons', '', $field['id'] );
114
+function give_email_preview_buttons_callback($field) {
115
+	$field_id = str_replace('_preview_buttons', '', $field['id']);
116 116
 
117 117
 	ob_start();
118 118
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		'<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>',
121 121
 		wp_nonce_url(
122 122
 			add_query_arg(
123
-				array( 'give_action' => 'preview_email', 'email_type' => $field_id ),
123
+				array('give_action' => 'preview_email', 'email_type' => $field_id),
124 124
 				home_url()
125 125
 			), 'give-preview-email'
126 126
 		),
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 	echo sprintf(
131 131
 		' <a href="%1$s" aria-label="%2$s" class="button-secondary">%3$s</a>',
132 132
 		wp_nonce_url(
133
-				add_query_arg( array(
133
+				add_query_arg(array(
134 134
 			'give_action'  => 'send_preview_email',
135 135
 			'email_type' => $field_id,
136 136
 			'give-message' => 'sent-test-email',
137
-		) ), 'give-send-preview-email' ),
138
-		esc_attr__( 'Send Test Email.', 'give' ),
139
-		esc_html__( 'Send Test Email', 'give' )
137
+		)), 'give-send-preview-email' ),
138
+		esc_attr__('Send Test Email.', 'give'),
139
+		esc_html__('Send Test Email', 'give')
140 140
 	);
141 141
 
142 142
 	echo ob_get_clean();
@@ -155,28 +155,28 @@  discard block
 block discarded – undo
155 155
 
156 156
 	//Payment receipt switcher
157 157
 	$payment_count = give_count_payments()->publish;
158
-	$payment_id    = give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' );
158
+	$payment_id    = give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id');
159 159
 
160
-	if ( $payment_count <= 0 ) {
160
+	if ($payment_count <= 0) {
161 161
 		return false;
162 162
 	}
163 163
 
164 164
 	//Get payments.
165
-	$payments = new Give_Payments_Query( array(
165
+	$payments = new Give_Payments_Query(array(
166 166
 		'number' => 100,
167
-	) );
167
+	));
168 168
 	$payments = $payments->get_payments();
169 169
 	$options  = array();
170 170
 
171 171
 	// Default option.
172
-	$options[0] = esc_html__( 'No donations found.', 'give' );
172
+	$options[0] = esc_html__('No donations found.', 'give');
173 173
 
174 174
 	//Provide nice human readable options.
175
-	if ( $payments ) {
176
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
177
-		foreach ( $payments as $payment ) {
175
+	if ($payments) {
176
+		$options[0] = esc_html__('- Select a donation -', 'give');
177
+		foreach ($payments as $payment) {
178 178
 
179
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
179
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
180 180
 
181 181
 		}
182 182
 	}
@@ -185,27 +185,27 @@  discard block
 block discarded – undo
185 185
 	$transaction_header = '<div style="margin:0;padding:10px 0;width:100%;background-color:#FFF;border-bottom:1px solid #eee; text-align:center;">';
186 186
 
187 187
 	// Remove payment id query param if set from request url.
188
-	$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
188
+	$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
189 189
 	$query            = $request_url_data['query'];
190
-	$query            = remove_query_arg( array( 'preview_id' ), $query );
190
+	$query            = remove_query_arg(array('preview_id'), $query);
191 191
 
192
-	$request_url = home_url( '/?' . str_replace( '', '', $query ) );
192
+	$request_url = home_url('/?'.str_replace('', '', $query));
193 193
 
194 194
 	$transaction_header .= '<script>
195 195
 				 function change_preview(){
196 196
 				  var transactions = document.getElementById("give_preview_email_payment_id");
197 197
 			        var selected_trans = transactions.options[transactions.selectedIndex];
198 198
 				        if (selected_trans){
199
-				            var url_string = "' . $request_url . '&preview_id=" + selected_trans.value;
199
+				            var url_string = "' . $request_url.'&preview_id=" + selected_trans.value;
200 200
 				                window.location = url_string;
201 201
 				        }
202 202
 				    }
203 203
 			    </script>';
204 204
 
205
-	$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>';
205
+	$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>';
206 206
 
207 207
 	//The select field with 100 latest transactions
208
-	$transaction_header .= Give()->html->select( array(
208
+	$transaction_header .= Give()->html->select(array(
209 209
 		'name'             => 'preview_email_payment_id',
210 210
 		'selected'         => $payment_id,
211 211
 		'id'               => 'give_preview_email_payment_id',
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 		'select_atts'      => 'onchange="change_preview()"',
216 216
 		'show_option_all'  => false,
217 217
 		'show_option_none' => false,
218
-	) );
218
+	));
219 219
 
220 220
 	//Closing tag
221 221
 	$transaction_header .= '</div>';
222 222
 
223
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
223
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
224 224
 
225 225
 }
226 226
\ No newline at end of file
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +63 added lines, -63 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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @since 1.0
21 21
  */
22
-class Give_Forms_Widget extends WP_Widget{
22
+class Give_Forms_Widget extends WP_Widget {
23 23
 	/**
24 24
 	 * The widget class name
25 25
 	 *
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * Instantiate the class
32 32
 	 */
33
-	public function __construct(){
34
-		$this->self = get_class( $this );
33
+	public function __construct() {
34
+		$this->self = get_class($this);
35 35
 
36 36
 		parent::__construct(
37
-			strtolower( $this->self ),
38
-			esc_html__( 'Give - Donation Form', 'give' ),
37
+			strtolower($this->self),
38
+			esc_html__('Give - Donation Form', 'give'),
39 39
 			array(
40
-				'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
40
+				'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
41 41
 			)
42 42
 		);
43 43
 
44
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
45
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
44
+		add_action('widgets_init', array($this, 'widget_init'));
45
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -52,19 +52,19 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return void
54 54
 	 */
55
-	public function admin_widget_scripts( $hook ){
55
+	public function admin_widget_scripts($hook) {
56 56
 		// Directories of assets
57
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
58
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
59
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
57
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
58
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
59
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
60 60
 
61 61
 		// Use minified libraries if SCRIPT_DEBUG is turned off
62
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
62
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
63 63
 
64 64
 		// Widget Script
65
-		if ( $hook == 'widgets.php' ) {
65
+		if ($hook == 'widgets.php') {
66 66
 
67
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
67
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
68 68
 		}
69 69
 	}
70 70
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 *                        before_widget, and after_widget.
76 76
 	 * @param array $instance The settings for the particular instance of the widget.
77 77
 	 */
78
-	public function widget( $args, $instance ){
79
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
80
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
78
+	public function widget($args, $instance) {
79
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
80
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
81 81
 
82 82
 		echo $args['before_widget'];
83 83
 
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 		 *
87 87
 		 * @since 1.0
88 88
 		 */
89
-		do_action( 'give_before_forms_widget' );
89
+		do_action('give_before_forms_widget');
90 90
 
91
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : '';
91
+		echo $title ? $args['before_title'].$title.$args['after_title'] : '';
92 92
 
93
-		give_get_donation_form( $instance );
93
+		give_get_donation_form($instance);
94 94
 
95 95
 		echo $args['after_widget'];
96 96
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		 *
100 100
 		 * @since 1.0
101 101
 		 */
102
-		do_action( 'give_after_forms_widget' );
102
+		do_action('give_after_forms_widget');
103 103
 	}
104 104
 
105 105
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return string
111 111
 	 */
112
-	public function form( $instance ){
112
+	public function form($instance) {
113 113
 		$defaults = array(
114 114
 			'title'         => '',
115 115
 			'id'            => '',
@@ -119,84 +119,84 @@  discard block
 block discarded – undo
119 119
 			'continue_button_title' => '',
120 120
 		);
121 121
 
122
-		$instance = wp_parse_args( (array) $instance, $defaults );
122
+		$instance = wp_parse_args((array) $instance, $defaults);
123 123
 
124 124
 		// Backward compatibility: Set float labels as default if, it was set as empty previous.
125
-		$instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels'];
125
+		$instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels'];
126 126
 
127 127
 		// Query Give Forms
128 128
 		$args = array(
129 129
 			'post_type'      => 'give_forms',
130
-			'posts_per_page' => - 1,
130
+			'posts_per_page' => -1,
131 131
 			'post_status'    => 'publish',
132 132
 		);
133 133
 
134
-		$give_forms = get_posts( $args );
134
+		$give_forms = get_posts($args);
135 135
 		?>
136 136
 		<div class="give_forms_widget_container">
137 137
 
138 138
 			<?php // Widget: widget Title. ?>
139 139
 			<p>
140
-				<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label>
141
-				<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br>
142
-				<small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
140
+				<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label>
141
+				<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br>
142
+				<small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small>
143 143
 			</p>
144 144
 
145 145
 			<?php // Widget: Give Form?>
146 146
 			<p>
147
-				<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label>
148
-				<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
149
-					<option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option>
150
-					<?php foreach ( $give_forms as $give_form ) { ?>
151
-						<?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?>
152
-						<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $form_title; ?></option>
147
+				<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label>
148
+				<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
149
+					<option value="current"><?php esc_html_e('- Select -', 'give'); ?></option>
150
+					<?php foreach ($give_forms as $give_form) { ?>
151
+						<?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?>
152
+						<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $form_title; ?></option>
153 153
 					<?php } ?>
154 154
 				</select><br>
155
-				<small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
155
+				<small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small>
156 156
 			</p>
157 157
 
158 158
 			<?php // Widget: Display Style ?>
159 159
 			<p class="give_forms_display_style_setting_row">
160
-				<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br>
161
-				<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label>
162
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label>
163
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label>
164
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br>
160
+				<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br>
161
+				<label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label>
162
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label>
163
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label>
164
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br>
165 165
 				<small class="give-field-description">
166
-					<?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?>
166
+					<?php echo esc_html__('Select a Give Form style.', 'give'); ?>
167 167
 				</small>
168 168
 			</p>
169 169
 
170 170
 			<?php // Widget: Continue Button Title. ?>
171 171
 			<p class="give_forms_continue_button_title_setting_row">
172
-				<label for="<?php echo $this->get_field_id( 'continue_button_title' ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label>
173
-				<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'continue_button_title' ); ?>" name="<?php echo $this->get_field_name( 'continue_button_title' ); ?>" value="<?php esc_attr_e( $instance['continue_button_title'] ); ?>" /><br>
174
-				<small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small>
172
+				<label for="<?php echo $this->get_field_id('continue_button_title'); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label>
173
+				<input type="text" class="widefat" id="<?php echo $this->get_field_id('continue_button_title'); ?>" name="<?php echo $this->get_field_name('continue_button_title'); ?>" value="<?php esc_attr_e($instance['continue_button_title']); ?>" /><br>
174
+				<small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small>
175 175
 			</p>
176 176
 
177 177
 			<?php // Widget: Floating Labels ?>
178 178
 			<p>
179
-				<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br>
180
-				<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label>
181
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label>
182
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br>
179
+				<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br>
180
+				<label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label>
181
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label>
182
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br>
183 183
 				<small class="give-field-description">
184 184
 					<?php
185 185
 					printf(
186 186
 					/* translators: %s: http://docs.givewp.com/form-floating-labels */
187
-						__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
188
-						esc_url( 'http://docs.givewp.com/form-floating-labels' )
187
+						__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
188
+						esc_url('http://docs.givewp.com/form-floating-labels')
189 189
 					);
190 190
 					?></small>
191 191
 			</p>
192 192
 
193 193
 			<?php // Widget: Display Content ?>
194 194
 			<p>
195
-				<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br>
196
-				<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label>
197
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label>
198
-				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br>
199
-				<small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small>
195
+				<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br>
196
+				<label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label>
197
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label>
198
+				&nbsp;&nbsp;<label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br>
199
+				<small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small>
200 200
 		</div>
201 201
 		<?php
202 202
 	}
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return void
208 208
 	 */
209
-	function widget_init(){
210
-		register_widget( $this->self );
209
+	function widget_init() {
210
+		register_widget($this->self);
211 211
 	}
212 212
 
213 213
 	/**
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return array
220 220
 	 */
221
-	public function update( $new_instance, $old_instance ){
221
+	public function update($new_instance, $old_instance) {
222 222
 		$this->flush_widget_cache();
223 223
 
224 224
 		return $new_instance;
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 	 *
230 230
 	 * @return void
231 231
 	 */
232
-	public function flush_widget_cache(){
233
-		wp_cache_delete( $this->self, 'widget' );
232
+	public function flush_widget_cache() {
233
+		wp_cache_delete($this->self, 'widget');
234 234
 	}
235 235
 }
236 236
 
Please login to merge, or discard this patch.
includes/class-give-tooltips.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return array
22 22
 	 */
23
-	private function set_toottip_args( $args ) {
23
+	private function set_toottip_args($args) {
24 24
 		$args = wp_parse_args(
25 25
 			$args,
26 26
 			array(
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 
63 63
 		// Auto set width of tooltip.
64 64
 		if (
65
-			! empty( $args['auto_width'] ) &&
66
-			! empty( $args['label'] ) &&
67
-			empty( $args['size'] )
65
+			! empty($args['auto_width']) &&
66
+			! empty($args['label']) &&
67
+			empty($args['size'])
68 68
 		) {
69
-			if ( 15 < str_word_count( $args['label'] ) ) {
69
+			if (15 < str_word_count($args['label'])) {
70 70
 				$args['size'] = 'large';
71
-			} elseif ( 7 < str_word_count( $args['label'] ) ) {
71
+			} elseif (7 < str_word_count($args['label'])) {
72 72
 				$args['size'] = 'medium';
73 73
 			}
74 74
 		}
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string
89 89
 	 */
90
-	public function render( $args ) {
91
-		$args = $this->set_toottip_args( $args );
90
+	public function render($args) {
91
+		$args = $this->set_toottip_args($args);
92 92
 
93 93
 		$tooltip_pos = array(
94 94
 			'top'          => 'hint--top',
@@ -118,21 +118,21 @@  discard block
 block discarded – undo
118 118
 		$args['attributes']['aria-label'] = $args['label'];
119 119
 
120 120
 		// Set classes.
121
-		$args['attributes']['class'] = ! empty( $args['attributes']['class'] ) ? $args['attributes']['class'] : '';
122
-		$args['attributes']['class'] .= " {$tooltip_pos[ $args['position'] ]}";
123
-		$args['attributes']['class'] .= ! empty( $args['status'] ) ? " {$tooltip_status[ $args['status'] ]}" : '';
124
-		$args['attributes']['class'] .= ! empty( $args['size'] ) ? " {$tooltip_size[ $args['size'] ]}" : '';
121
+		$args['attributes']['class'] = ! empty($args['attributes']['class']) ? $args['attributes']['class'] : '';
122
+		$args['attributes']['class'] .= " {$tooltip_pos[$args['position']]}";
123
+		$args['attributes']['class'] .= ! empty($args['status']) ? " {$tooltip_status[$args['status']]}" : '';
124
+		$args['attributes']['class'] .= ! empty($args['size']) ? " {$tooltip_size[$args['size']]}" : '';
125 125
 		$args['attributes']['class'] .= $args['show_always'] ? ' hint--always' : '';
126 126
 		$args['attributes']['class'] .= $args['round_edges'] ? ' hint--rounded' : '';
127 127
 		$args['attributes']['class'] .= $args['animate'] ? ' hint--bounce' : ' hint--no-animate';
128
-		$args['attributes']['class'] = trim( $args['attributes']['class'] );
128
+		$args['attributes']['class'] = trim($args['attributes']['class']);
129 129
 
130 130
 		// Set link attribute in tooltip has anchor tag.
131
-		if ( 'a' === $args['tag'] && ! empty( $args['link'] ) ) {
132
-			$args['attributes']['href'] = esc_url( $args['link'] );
131
+		if ('a' === $args['tag'] && ! empty($args['link'])) {
132
+			$args['attributes']['href'] = esc_url($args['link']);
133 133
 		}
134 134
 
135
-		return sprintf( '<%1$s %2$s rel="tooltip">%3$s</%1$s>', $args['tag'], give_get_attribute_str( $args['attributes'] ), $args['tag_content'] );
135
+		return sprintf('<%1$s %2$s rel="tooltip">%3$s</%1$s>', $args['tag'], give_get_attribute_str($args['attributes']), $args['tag_content']);
136 136
 	}
137 137
 
138 138
 
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return string
148 148
 	 */
149
-	function render_link( $args ) {
149
+	function render_link($args) {
150 150
 		$args['tag']    = 'a';
151
-		$tooltip_markup = $this->render( $args );
151
+		$tooltip_markup = $this->render($args);
152 152
 
153 153
 		return $tooltip_markup;
154 154
 	}
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return string
165 165
 	 */
166
-	function render_span( $args ) {
166
+	function render_span($args) {
167 167
 		// Set tooltip args from string.
168
-		if ( is_string( $args ) ) {
169
-			$args = array( 'label' => $args );
168
+		if (is_string($args)) {
169
+			$args = array('label' => $args);
170 170
 		}
171 171
 
172 172
 		$args['tag']    = 'span';
173
-		$tooltip_markup = $this->render( $args );
173
+		$tooltip_markup = $this->render($args);
174 174
 
175 175
 		return $tooltip_markup;
176 176
 	}
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return string
187 187
 	 */
188
-	function render_help( $args ) {
188
+	function render_help($args) {
189 189
 		// Set tooltip args from string.
190
-		if ( is_string( $args ) ) {
191
-			$args = array( 'label' => $args );
190
+		if (is_string($args)) {
191
+			$args = array('label' => $args);
192 192
 		}
193 193
 
194 194
 		$args['tag_content']         = '<i class="give-icon give-icon-question"></i>';
195 195
 		$args['attributes']['class'] = 'give-tooltip';
196
-		$tooltip_markup              = $this->render_span( $args );
196
+		$tooltip_markup              = $this->render_span($args);
197 197
 
198 198
 		return $tooltip_markup;
199 199
 	}
Please login to merge, or discard this patch.
includes/error-tracking.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * @return array|bool array if errors are present, false if none found
26 26
  */
27 27
 function give_get_errors() {
28
-	return Give()->session->get( 'give_errors' );
28
+	return Give()->session->get('give_errors');
29 29
 }
30 30
 
31 31
 /**
@@ -42,23 +42,23 @@  discard block
 block discarded – undo
42 42
  *
43 43
  * @return void
44 44
  */
45
-function give_set_error( $error_id, $error_message, $notice_args = array() ) {
45
+function give_set_error($error_id, $error_message, $notice_args = array()) {
46 46
 	$errors = give_get_errors();
47
-	if ( ! $errors ) {
47
+	if ( ! $errors) {
48 48
 		$errors = array();
49 49
 	}
50 50
 
51
-	if( is_array( $notice_args ) && ! empty( $notice_args ) ) {
52
-		$errors[ $error_id ] = array(
51
+	if (is_array($notice_args) && ! empty($notice_args)) {
52
+		$errors[$error_id] = array(
53 53
 			'message'     => $error_message,
54 54
 			'notice_args' => $notice_args,
55 55
 		);
56 56
 	} else {
57 57
 		// Backward compatibility v<1.8.11.
58
-		$errors[ $error_id ] = $error_message;
58
+		$errors[$error_id] = $error_message;
59 59
 	}
60 60
 
61
-	Give()->session->set( 'give_errors', $errors );
61
+	Give()->session->set('give_errors', $errors);
62 62
 }
63 63
 
64 64
 /**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  * @return void
70 70
  */
71 71
 function give_clear_errors() {
72
-	Give()->session->set( 'give_errors', null );
72
+	Give()->session->set('give_errors', null);
73 73
 }
74 74
 
75 75
 /**
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
  *
83 83
  * @return void
84 84
  */
85
-function give_unset_error( $error_id ) {
85
+function give_unset_error($error_id) {
86 86
 	$errors = give_get_errors();
87
-	if ( $errors ) {
87
+	if ($errors) {
88 88
 		/**
89 89
 		 * Check If $error_id exists in the array.
90 90
 		 * If exists then unset it.
91 91
 		 *
92 92
 		 * @since 1.8.13
93 93
 		 */
94
-		if ( isset( $errors[ $error_id ] ) ) {
95
-			unset( $errors[ $error_id ] );
94
+		if (isset($errors[$error_id])) {
95
+			unset($errors[$error_id]);
96 96
 		}
97
-		Give()->session->set( 'give_errors', $errors );
97
+		Give()->session->set('give_errors', $errors);
98 98
 	}
99 99
 }
100 100
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
  * @return string
106 106
  */
107 107
 function _give_die_handler() {
108
-	if ( defined( 'GIVE_UNIT_TESTS' ) ) {
108
+	if (defined('GIVE_UNIT_TESTS')) {
109 109
 		return '_give_die_handler';
110 110
 	} else {
111 111
 		die();
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return void
127 127
  */
128
-function give_die( $message = '', $title = '', $status = 400 ) {
129
-	add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 );
130
-	add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 );
131
-	wp_die( $message, $title, array( 'response' => $status ) );
128
+function give_die($message = '', $title = '', $status = 400) {
129
+	add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3);
130
+	add_filter('wp_die_handler', '_give_die_handler', 10, 3);
131
+	wp_die($message, $title, array('response' => $status));
132 132
 }
Please login to merge, or discard this patch.
includes/class-give-async-process.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @category Class
12 12
  * @author   WordImpress
13 13
  */
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
 		 * )
53 53
 		 */
54 54
 
55
-		$_post = give_clean( $_POST );
55
+		$_post = give_clean($_POST);
56 56
 
57
-		if ( empty( $_post ) || empty( $_post['data'] ) || empty( $_post['hook'] ) ) {
57
+		if (empty($_post) || empty($_post['data']) || empty($_post['hook'])) {
58 58
 			exit();
59 59
 		}
60 60
 
61 61
 		/**
62 62
 		 * Fire the hook.
63 63
 		 */
64
-		do_action( $_post['hook'], $_post['data'] );
64
+		do_action($_post['hook'], $_post['data']);
65 65
 
66 66
 		exit();
67 67
 	}
Please login to merge, or discard this patch.
includes/gateways/actions.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param $data
23 23
  */
24
-function give_process_gateway_select( $data ) {
25
-	if ( isset( $_POST['gateway_submit'] ) ) {
26
-		wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) );
24
+function give_process_gateway_select($data) {
25
+	if (isset($_POST['gateway_submit'])) {
26
+		wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode'])));
27 27
 		exit;
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'give_gateway_select', 'give_process_gateway_select' );
31
+add_action('give_gateway_select', 'give_process_gateway_select');
32 32
 
33 33
 /**
34 34
  * Loads a payment gateway via AJAX.
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
  * @return void
39 39
  */
40 40
 function give_load_ajax_gateway() {
41
-	if ( isset( $_POST['give_payment_mode'] ) ) {
41
+	if (isset($_POST['give_payment_mode'])) {
42 42
 		/**
43 43
 		 * Fire to render donation form.
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_donation_form', $_POST['give_form_id'] );
47
+		do_action('give_donation_form', $_POST['give_form_id']);
48 48
 
49 49
 		exit();
50 50
 	}
51 51
 }
52 52
 
53
-add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
54
-add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
53
+add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway');
54
+add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway');
55 55
 
56 56
 /**
57 57
  * Create wp nonce using Ajax call.
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
  * @return void
64 64
  */
65 65
 function give_donation_form_nonce() {
66
-	if ( isset( $_POST['give_form_id'] ) ) {
66
+	if (isset($_POST['give_form_id'])) {
67 67
 
68 68
 		// Get donation form id.
69
-		$form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0;
69
+		$form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0;
70 70
 
71 71
 		// Send nonce json data.
72
-		wp_send_json_success( wp_create_nonce( "donation_form_nonce_{$form_id}" ) );
72
+		wp_send_json_success(wp_create_nonce("donation_form_nonce_{$form_id}"));
73 73
 	}
74 74
 }
75 75
 
76
-add_action( 'wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce' );
77
-add_action( 'wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce' );
76
+add_action('wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce');
77
+add_action('wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce');
78 78
 
79 79
 /**
80 80
  * Sets an error within the donation form if no gateways are enabled.
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 function give_no_gateway_error() {
87 87
 	$gateways = give_get_enabled_payment_gateways();
88 88
 
89
-	if ( empty( $gateways ) ) {
90
-		give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) );
89
+	if (empty($gateways)) {
90
+		give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give'));
91 91
 	} else {
92
-		give_unset_error( 'no_gateways' );
92
+		give_unset_error('no_gateways');
93 93
 	}
94 94
 }
95 95
 
96
-add_action( 'init', 'give_no_gateway_error' );
96
+add_action('init', 'give_no_gateway_error');
Please login to merge, or discard this patch.
templates/emails/header-default.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@  discard block
 block discarded – undo
6 6
  * @version     1.0
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 } // Exit if accessed directly.
12 12
 
13 13
 // For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. !important; is a gmail hack to prevent styles being stripped if it doesn't like something.
14
-$body               = "
14
+$body = "
15 15
 	background-color: #f6f6f6;
16 16
 	font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
17 17
 ";
18
-$wrapper            = "
18
+$wrapper = "
19 19
 	width:100%;
20 20
 	-webkit-text-size-adjust:none !important;
21 21
 	margin:0;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	border-radius:3px !important;
30 30
 	padding: 20px;
31 31
 ";
32
-$template_header    = "
32
+$template_header = "
33 33
 	color: #00000;
34 34
 	border-top-left-radius:3px !important;
35 35
 	border-top-right-radius:3px !important;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	text-align: center;
40 40
 	vertical-align:middle;
41 41
 ";
42
-$body_content       = "
42
+$body_content = "
43 43
 	border-radius:3px !important;
44 44
 	font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
45 45
 ";
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	line-height:150%;
51 51
 	text-align:left;
52 52
 ";
53
-$header_content_h1  = "
53
+$header_content_h1 = "
54 54
 	color: #000000;
55 55
 	margin:0;
56 56
 	padding: 28px 24px;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 <html>
66 66
 	<head>
67 67
 		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
68
-		<title><?php echo get_bloginfo( 'name' ); ?></title>
68
+		<title><?php echo get_bloginfo('name'); ?></title>
69 69
 	</head>
70 70
 	<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="<?php echo $body; ?>">
71 71
 		<div style="<?php echo $wrapper; ?>">
Please login to merge, or discard this patch.