Test Failed
Push — master ( 553162...c86db0 )
by Devin
03:45
created
includes/filters.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -26,34 +26,34 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_set_settings_with_disable_prefix( $old_settings, $settings ) {
29
+function give_set_settings_with_disable_prefix($old_settings, $settings) {
30 30
 	// Bailout.
31
-	if( ! function_exists( 'give_v18_renamed_core_settings' ) ) {
31
+	if ( ! function_exists('give_v18_renamed_core_settings')) {
32 32
 		return;
33 33
 	}
34 34
 
35 35
 	// Get old setting names.
36
-	$old_settings   = array_flip( give_v18_renamed_core_settings() );
36
+	$old_settings   = array_flip(give_v18_renamed_core_settings());
37 37
 	$update_setting = false;
38 38
 
39
-	foreach ( $settings as $key => $value ) {
39
+	foreach ($settings as $key => $value) {
40 40
 
41 41
 		// Check 1. Check if new option is really updated or not.
42 42
 		// Check 2. Continue if key is not renamed.
43
-		if ( ! isset( $old_settings[ $key ] ) ) {
43
+		if ( ! isset($old_settings[$key])) {
44 44
 			continue;
45 45
 		}
46 46
 
47 47
 		// Set old setting.
48
-		$settings[ $old_settings[ $key ] ] = 'on';
48
+		$settings[$old_settings[$key]] = 'on';
49 49
 
50 50
 		// Do not need to set old setting if new setting is not set.
51 51
 		if (
52
-			( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) )
53
-			|| ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) )
52
+			(give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_')))
53
+			|| ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_')))
54 54
 
55 55
 		) {
56
-			unset( $settings[ $old_settings[ $key ] ] );
56
+			unset($settings[$old_settings[$key]]);
57 57
 		}
58 58
 
59 59
 		// Tell bot to update setting.
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	}
62 62
 
63 63
 	// Update setting if any old setting set.
64
-	if ( $update_setting ) {
65
-		update_option( 'give_settings', $settings );
64
+	if ($update_setting) {
65
+		update_option('give_settings', $settings);
66 66
 	}
67 67
 }
68
-add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 );
68
+add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2);
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +94 added lines, -94 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
 
@@ -62,50 +62,50 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return bool If the gravatar exists or not
64 64
 	 */
65
-	public function validate_gravatar( $id_or_email ) {
65
+	public function validate_gravatar($id_or_email) {
66 66
 		//id or email code borrowed from wp-includes/pluggable.php
67 67
 		$email = '';
68
-		if ( is_numeric( $id_or_email ) ) {
68
+		if (is_numeric($id_or_email)) {
69 69
 			$id   = (int) $id_or_email;
70
-			$user = get_userdata( $id );
71
-			if ( $user ) {
70
+			$user = get_userdata($id);
71
+			if ($user) {
72 72
 				$email = $user->user_email;
73 73
 			}
74
-		} elseif ( is_object( $id_or_email ) ) {
74
+		} elseif (is_object($id_or_email)) {
75 75
 			// No avatar for pingbacks or trackbacks
76
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
77
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
76
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
77
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
78 78
 				return false;
79 79
 			}
80 80
 
81
-			if ( ! empty( $id_or_email->user_id ) ) {
81
+			if ( ! empty($id_or_email->user_id)) {
82 82
 				$id   = (int) $id_or_email->user_id;
83
-				$user = get_userdata( $id );
84
-				if ( $user ) {
83
+				$user = get_userdata($id);
84
+				if ($user) {
85 85
 					$email = $user->user_email;
86 86
 				}
87
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
87
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
88 88
 				$email = $id_or_email->comment_author_email;
89 89
 			}
90 90
 		} else {
91 91
 			$email = $id_or_email;
92 92
 		}
93 93
 
94
-		$hashkey = md5( strtolower( trim( $email ) ) );
95
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
94
+		$hashkey = md5(strtolower(trim($email)));
95
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
96 96
 
97
-		$data = wp_cache_get( $hashkey );
98
-		if ( false === $data ) {
99
-			$response = wp_remote_head( $uri );
100
-			if ( is_wp_error( $response ) ) {
97
+		$data = wp_cache_get($hashkey);
98
+		if (false === $data) {
99
+			$response = wp_remote_head($uri);
100
+			if (is_wp_error($response)) {
101 101
 				$data = 'not200';
102 102
 			} else {
103 103
 				$data = $response['response']['code'];
104 104
 			}
105
-			wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
105
+			wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
106 106
 
107 107
 		}
108
-		if ( $data == '200' ) {
108
+		if ($data == '200') {
109 109
 			return true;
110 110
 		} else {
111 111
 			return false;
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return array        IDs if logs, false otherwise
124 124
 	 */
125
-	public function get_log_ids( $form_id = '' ) {
125
+	public function get_log_ids($form_id = '') {
126 126
 
127 127
 		// get Give_Logging class
128 128
 		global $give_logs;
129 129
 
130 130
 		// get log for this form
131
-		$logs = $give_logs->get_logs( $form_id );
131
+		$logs = $give_logs->get_logs($form_id);
132 132
 
133
-		if ( $logs ) {
133
+		if ($logs) {
134 134
 			$log_ids = array();
135 135
 
136 136
 			// make an array with all the donor IDs
137
-			foreach ( $logs as $log ) {
137
+			foreach ($logs as $log) {
138 138
 				$log_ids[] = $log->ID;
139 139
 			}
140 140
 
@@ -155,51 +155,51 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return mixed
157 157
 	 */
158
-	public function get_payment_ids( $form_id = '' ) {
158
+	public function get_payment_ids($form_id = '') {
159 159
 
160 160
 		$give_options = give_get_settings();
161 161
 
162
-		$log_ids = $this->get_log_ids( $form_id );
162
+		$log_ids = $this->get_log_ids($form_id);
163 163
 
164
-		if ( $log_ids ) {
164
+		if ($log_ids) {
165 165
 
166 166
 			$payment_ids = array();
167 167
 
168
-			foreach ( $log_ids as $id ) {
168
+			foreach ($log_ids as $id) {
169 169
 				// get the payment ID for each corresponding log ID
170
-				$payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true );
170
+				$payment_ids[] = give_get_meta($id, '_give_log_payment_id', true);
171 171
 			}
172 172
 
173 173
 			// remove donors who have donated more than once so we can have unique avatars
174 174
 			$unique_emails = array();
175 175
 
176
-			foreach ( $payment_ids as $key => $id ) {
176
+			foreach ($payment_ids as $key => $id) {
177 177
 
178
-				$email = give_get_meta( $id, '_give_payment_user_email', true );
178
+				$email = give_get_meta($id, '_give_payment_user_email', true);
179 179
 
180
-				if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) {
181
-					if ( ! $this->validate_gravatar( $email ) ) {
180
+				if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) {
181
+					if ( ! $this->validate_gravatar($email)) {
182 182
 						continue;
183 183
 					}
184 184
 				}
185 185
 
186
-				$unique_emails[ $id ] = give_get_meta( $id, '_give_payment_user_email', true );
186
+				$unique_emails[$id] = give_get_meta($id, '_give_payment_user_email', true);
187 187
 
188 188
 			}
189 189
 
190 190
 			$unique_ids = array();
191 191
 
192 192
 			// strip duplicate emails
193
-			$unique_emails = array_unique( $unique_emails );
193
+			$unique_emails = array_unique($unique_emails);
194 194
 
195 195
 			// convert the unique IDs back into simple array
196
-			foreach ( $unique_emails as $id => $email ) {
196
+			foreach ($unique_emails as $id => $email) {
197 197
 				$unique_ids[] = $id;
198 198
 			}
199 199
 
200 200
 			// randomize the payment IDs if enabled
201
-			if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) {
202
-				shuffle( $unique_ids );
201
+			if (isset($give_options['give_donors_gravatars_random_gravatars'])) {
202
+				shuffle($unique_ids);
203 203
 			}
204 204
 
205 205
 			// return our unique IDs
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string
222 222
 	 */
223
-	public function gravatars( $form_id = false, $title = '' ) {
223
+	public function gravatars($form_id = false, $title = '') {
224 224
 
225 225
 		// unique $payment_ids 
226
-		$payment_ids = $this->get_payment_ids( $form_id );
226
+		$payment_ids = $this->get_payment_ids($form_id);
227 227
 
228 228
 		$give_options = give_get_settings();
229 229
 
230 230
 		// return if no ID
231
-		if ( ! $form_id ) {
231
+		if ( ! $form_id) {
232 232
 			return;
233 233
 		}
234 234
 
235 235
 		// minimum amount of donations before showing gravatars
236 236
 		// if the number of items in array is not greater or equal to the number specified, then exit
237
-		if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) {
238
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) {
237
+		if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) {
238
+			if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) {
239 239
 				return;
240 240
 			}
241 241
 		}
@@ -246,28 +246,28 @@  discard block
 block discarded – undo
246 246
 		echo '<div id="give-purchase-gravatars">';
247 247
 
248 248
 
249
-		if ( isset ( $title ) ) {
249
+		if (isset ($title)) {
250 250
 
251
-			if ( $title ) {
252
-				echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' );
253
-			} elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) {
254
-				echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' );
251
+			if ($title) {
252
+				echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>');
253
+			} elseif (isset($give_options['give_donors_gravatars_heading'])) {
254
+				echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>');
255 255
 			}
256 256
 
257 257
 		}
258 258
 		echo '<ul class="give-purchase-gravatars-list">';
259 259
 		$i = 0;
260 260
 
261
-		if ( $payment_ids ) {
262
-			foreach ( $payment_ids as $id ) {
261
+		if ($payment_ids) {
262
+			foreach ($payment_ids as $id) {
263 263
 
264 264
 				// Give saves a blank option even when the control is turned off, hence the extra check
265
-				if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) {
265
+				if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) {
266 266
 					continue;
267 267
 				}
268 268
 
269 269
 				// get the payment meta
270
-				$payment_meta = give_get_meta( $id, '_give_payment_meta', true );
270
+				$payment_meta = give_get_meta($id, '_give_payment_meta', true);
271 271
 
272 272
 				$user_info = $payment_meta['user_info'];
273 273
 
@@ -275,21 +275,21 @@  discard block
 block discarded – undo
275 275
 				$name = $user_info['first_name'];
276 276
 
277 277
 				// get donor's email
278
-				$email = give_get_meta( $id, '_give_payment_user_email', true );
278
+				$email = give_get_meta($id, '_give_payment_user_email', true);
279 279
 
280 280
 				// set gravatar size and provide filter
281
-				$size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : '';
281
+				$size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : '';
282 282
 
283 283
 				// default image
284
-				$default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false );
284
+				$default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false);
285 285
 
286 286
 				// assemble output
287 287
 				$output .= '<li>';
288 288
 
289
-				$output .= get_avatar( $email, $size, $default_image, $name );
289
+				$output .= get_avatar($email, $size, $default_image, $name);
290 290
 				$output .= '</li>';
291 291
 
292
-				$i ++;
292
+				$i++;
293 293
 
294 294
 			} // end foreach
295 295
 		}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		echo '</ul>';
299 299
 		echo '</div>';
300 300
 
301
-		return apply_filters( 'give_donors_gravatars', ob_get_clean() );
301
+		return apply_filters('give_donors_gravatars', ob_get_clean());
302 302
 	}
303 303
 
304 304
 	/**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * @return void
311 311
 	 */
312 312
 	public function register_widget() {
313
-		register_widget( 'Give_Donors_Gravatars_Widget' );
313
+		register_widget('Give_Donors_Gravatars_Widget');
314 314
 	}
315 315
 
316 316
 	/**
@@ -324,19 +324,19 @@  discard block
 block discarded – undo
324 324
 	 *
325 325
 	 * @return string
326 326
 	 */
327
-	public function shortcode( $atts, $content = null ) {
327
+	public function shortcode($atts, $content = null) {
328 328
 
329
-		$atts = shortcode_atts( array(
329
+		$atts = shortcode_atts(array(
330 330
 			'id'    => '',
331 331
 			'title' => ''
332
-		), $atts, 'give_donors_gravatars' );
332
+		), $atts, 'give_donors_gravatars');
333 333
 
334 334
 		// if no ID is passed on single give_forms pages, get the correct ID
335
-		if ( is_singular( 'give_forms' ) ) {
335
+		if (is_singular('give_forms')) {
336 336
 			$id = get_the_ID();
337 337
 		}
338 338
 
339
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
339
+		$content = $this->gravatars($atts['id'], $atts['title']);
340 340
 
341 341
 		return $content;
342 342
 
@@ -352,56 +352,56 @@  discard block
 block discarded – undo
352 352
 	 *
353 353
 	 * @return array           Gravatar settings.
354 354
 	 */
355
-	public function settings( $settings ) {
355
+	public function settings($settings) {
356 356
 
357 357
 		$give_gravatar_settings = array(
358 358
 			array(
359
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
359
+				'name' => esc_html__('Donator Gravatars', 'give'),
360 360
 				'desc' => '<hr>',
361 361
 				'id'   => 'give_title',
362 362
 				'type' => 'give_title'
363 363
 			),
364 364
 			array(
365
-				'name' => esc_html__( 'Heading', 'give' ),
366
-				'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ),
365
+				'name' => esc_html__('Heading', 'give'),
366
+				'desc' => esc_html__('The heading to display above the Gravatars.', 'give'),
367 367
 				'type' => 'text',
368 368
 				'id'   => 'give_donors_gravatars_heading'
369 369
 			),
370 370
 			array(
371
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
372
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ),
371
+				'name'    => esc_html__('Gravatar Size', 'give'),
372
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'),
373 373
 				'type'    => 'text_small',
374 374
 				'id'      => 'give_donors_gravatars_gravatar_size',
375 375
 				'default' => '64'
376 376
 			),
377 377
 			array(
378
-				'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ),
379
-				'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ),
378
+				'name' => esc_html__('Minimum Unique Donations Required', 'give'),
379
+				'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'),
380 380
 				'type' => 'text_small',
381 381
 				'id'   => 'give_donors_gravatars_min_purchases_required',
382 382
 			),
383 383
 			array(
384
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
385
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
384
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
385
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
386 386
 				'type'    => 'text',
387 387
 				'id'      => 'give_donors_gravatars_maximum_number',
388 388
 				'default' => '20',
389 389
 			),
390 390
 			array(
391
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
392
-				'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ),
391
+				'name' => esc_html__('Gravatar Visibility', 'give'),
392
+				'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'),
393 393
 				'id'   => 'give_donors_gravatars_has_gravatar_account',
394 394
 				'type' => 'checkbox',
395 395
 			),
396 396
 			array(
397
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
398
-				'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ),
397
+				'name' => esc_html__('Randomize Gravatars', 'give'),
398
+				'desc' => esc_html__('Randomize the Gravatars.', 'give'),
399 399
 				'id'   => 'give_donors_gravatars_random_gravatars',
400 400
 				'type' => 'checkbox',
401 401
 			),
402 402
 		);
403 403
 
404
-		return array_merge( $settings, $give_gravatar_settings );
404
+		return array_merge($settings, $give_gravatar_settings);
405 405
 	}
406 406
 
407 407
 }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		// widget settings
428 428
 		$widget_ops = array(
429 429
 			'classname'   => 'give-donors-gravatars',
430
-			'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ),
430
+			'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'),
431 431
 		);
432 432
 
433 433
 		// widget control settings
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		// create the widget
441 441
 		parent::__construct(
442 442
 			'give_donors_gravatars_widget',
443
-			esc_html__( 'Give Donors Gravatars', 'give' ),
443
+			esc_html__('Give Donors Gravatars', 'give'),
444 444
 			$widget_ops,
445 445
 			$control_ops
446 446
 		);
@@ -460,29 +460,29 @@  discard block
 block discarded – undo
460 460
 	 *
461 461
 	 * @return void
462 462
 	 */
463
-	public function widget( $args, $instance ) {
463
+	public function widget($args, $instance) {
464 464
 
465 465
 		//@TODO: Don't extract it!!!
466
-		extract( $args );
466
+		extract($args);
467 467
 
468
-		if ( ! is_singular( 'give_forms' ) ) {
468
+		if ( ! is_singular('give_forms')) {
469 469
 			return;
470 470
 		}
471 471
 
472 472
 		// Variables from widget settings
473
-		$title = apply_filters( 'widget_title', $instance['title'] );
473
+		$title = apply_filters('widget_title', $instance['title']);
474 474
 
475 475
 		// Used by themes. Opens the widget
476 476
 		echo $before_widget;
477 477
 
478 478
 		// Display the widget title
479
-		if ( $title ) {
480
-			echo $before_title . $title . $after_title;
479
+		if ($title) {
480
+			echo $before_title.$title.$after_title;
481 481
 		}
482 482
 
483 483
 		$gravatars = new Give_Donors_Gravatars();
484 484
 
485
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
485
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
486 486
 
487 487
 		// Used by themes. Closes the widget
488 488
 		echo $after_widget;
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @return array Updated settings to save.
504 504
 	 */
505
-	public function update( $new_instance, $old_instance ) {
505
+	public function update($new_instance, $old_instance) {
506 506
 
507 507
 		$instance = $old_instance;
508 508
 
509
-		$instance['title'] = strip_tags( $new_instance['title'] );
509
+		$instance['title'] = strip_tags($new_instance['title']);
510 510
 
511 511
 		return $instance;
512 512
 
@@ -524,19 +524,19 @@  discard block
 block discarded – undo
524 524
 	 *
525 525
 	 * @return void
526 526
 	 */
527
-	public function form( $instance ) {
527
+	public function form($instance) {
528 528
 
529 529
 		// Set up some default widget settings.
530 530
 		$defaults = array(
531 531
 			'title' => '',
532 532
 		);
533 533
 
534
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
534
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
535 535
 
536 536
 		<!-- Title -->
537 537
 		<p>
538
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
539
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
538
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
539
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
540 540
 		</p>
541 541
 
542 542
 		<?php
Please login to merge, or discard this patch.
includes/class-give-roles.php 1 patch
Spacing   +60 added lines, -60 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
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @access public
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 );
38
+		add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4);
39 39
 	}
40 40
 
41 41
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function add_roles() {
52
-		add_role( 'give_manager', __( 'Give Manager', 'give' ), array(
52
+		add_role('give_manager', __('Give Manager', 'give'), array(
53 53
 			'read'                   => true,
54 54
 			'edit_posts'             => true,
55 55
 			'delete_posts'           => true,
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
 			'publish_posts'          => true,
79 79
 			'read_private_pages'     => true,
80 80
 			'read_private_posts'     => true,
81
-		) );
81
+		));
82 82
 
83
-		add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array(
83
+		add_role('give_accountant', __('Give Accountant', 'give'), array(
84 84
 			'read'         => true,
85 85
 			'edit_posts'   => false,
86 86
 			'delete_posts' => false
87
-		) );
87
+		));
88 88
 
89
-		add_role( 'give_worker', __( 'Give Worker', 'give' ), array(
89
+		add_role('give_worker', __('Give Worker', 'give'), array(
90 90
 			'read'         => true,
91 91
 			'edit_posts'   => true,
92 92
 			'edit_pages'   => true,
93 93
 			'upload_files' => true,
94 94
 			'delete_posts' => false,
95
-		) );
95
+		));
96 96
 
97
-		add_role( 'give_donor', __( 'Give Donor', 'give' ), array(
97
+		add_role('give_donor', __('Give Donor', 'give'), array(
98 98
 			'read'         => true,
99
-		) );
99
+		));
100 100
 
101 101
 	}
102 102
 
@@ -115,38 +115,38 @@  discard block
 block discarded – undo
115 115
 	public function add_caps() {
116 116
 		global $wp_roles;
117 117
 
118
-		if ( class_exists( 'WP_Roles' ) ) {
119
-			if ( ! isset( $wp_roles ) ) {
118
+		if (class_exists('WP_Roles')) {
119
+			if ( ! isset($wp_roles)) {
120 120
 				$wp_roles = new WP_Roles();
121 121
 			}
122 122
 		}
123 123
 
124
-		if ( is_object( $wp_roles ) ) {
125
-			$wp_roles->add_cap( 'give_manager', 'view_give_reports' );
126
-			$wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' );
127
-			$wp_roles->add_cap( 'give_manager', 'export_give_reports' );
128
-			$wp_roles->add_cap( 'give_manager', 'manage_give_settings' );
124
+		if (is_object($wp_roles)) {
125
+			$wp_roles->add_cap('give_manager', 'view_give_reports');
126
+			$wp_roles->add_cap('give_manager', 'view_give_sensitive_data');
127
+			$wp_roles->add_cap('give_manager', 'export_give_reports');
128
+			$wp_roles->add_cap('give_manager', 'manage_give_settings');
129 129
 
130
-			$wp_roles->add_cap( 'administrator', 'view_give_reports' );
131
-			$wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' );
132
-			$wp_roles->add_cap( 'administrator', 'export_give_reports' );
133
-			$wp_roles->add_cap( 'administrator', 'manage_give_settings' );
130
+			$wp_roles->add_cap('administrator', 'view_give_reports');
131
+			$wp_roles->add_cap('administrator', 'view_give_sensitive_data');
132
+			$wp_roles->add_cap('administrator', 'export_give_reports');
133
+			$wp_roles->add_cap('administrator', 'manage_give_settings');
134 134
 
135 135
 			// Add the main post type capabilities.
136 136
 			$capabilities = $this->get_core_caps();
137
-			foreach ( $capabilities as $cap_group ) {
138
-				foreach ( $cap_group as $cap ) {
139
-					$wp_roles->add_cap( 'administrator', $cap );
140
-					$wp_roles->add_cap( 'give_manager', $cap );
141
-					$wp_roles->add_cap( 'give_worker', $cap );
137
+			foreach ($capabilities as $cap_group) {
138
+				foreach ($cap_group as $cap) {
139
+					$wp_roles->add_cap('administrator', $cap);
140
+					$wp_roles->add_cap('give_manager', $cap);
141
+					$wp_roles->add_cap('give_worker', $cap);
142 142
 				}
143 143
 			}
144 144
 
145
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_forms' );
146
-			$wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' );
147
-			$wp_roles->add_cap( 'give_accountant', 'view_give_reports' );
148
-			$wp_roles->add_cap( 'give_accountant', 'export_give_reports' );
149
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_payments' );
145
+			$wp_roles->add_cap('give_accountant', 'edit_give_forms');
146
+			$wp_roles->add_cap('give_accountant', 'read_private_give_forms');
147
+			$wp_roles->add_cap('give_accountant', 'view_give_reports');
148
+			$wp_roles->add_cap('give_accountant', 'export_give_reports');
149
+			$wp_roles->add_cap('give_accountant', 'edit_give_payments');
150 150
 
151 151
 		}
152 152
 	}
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 	public function get_core_caps() {
165 165
 		$capabilities = array();
166 166
 
167
-		$capability_types = array( 'give_form', 'give_payment' );
167
+		$capability_types = array('give_form', 'give_payment');
168 168
 
169
-		foreach ( $capability_types as $capability_type ) {
170
-			$capabilities[ $capability_type ] = array(
169
+		foreach ($capability_types as $capability_type) {
170
+			$capabilities[$capability_type] = array(
171 171
 				// Post type.
172 172
 				"edit_{$capability_type}",
173 173
 				"read_{$capability_type}",
@@ -213,22 +213,22 @@  discard block
 block discarded – undo
213 213
 	 *
214 214
 	 * @return array  $caps    Meta capabilities.
215 215
 	 */
216
-	public function meta_caps( $caps, $cap, $user_id, $args ) {
216
+	public function meta_caps($caps, $cap, $user_id, $args) {
217 217
 
218
-		switch ( $cap ) {
218
+		switch ($cap) {
219 219
 
220 220
 			case 'view_give_form_stats' :
221 221
 
222
-				if ( empty( $args[0] ) ) {
222
+				if (empty($args[0])) {
223 223
 					break;
224 224
 				}
225 225
 
226
-				$form = get_post( $args[0] );
227
-				if ( empty( $form ) ) {
226
+				$form = get_post($args[0]);
227
+				if (empty($form)) {
228 228
 					break;
229 229
 				}
230 230
 
231
-				if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) {
231
+				if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) {
232 232
 					$caps = array();
233 233
 				}
234 234
 
@@ -255,41 +255,41 @@  discard block
 block discarded – undo
255 255
 
256 256
 		global $wp_roles;
257 257
 
258
-		if ( class_exists( 'WP_Roles' ) ) {
259
-			if ( ! isset( $wp_roles ) ) {
258
+		if (class_exists('WP_Roles')) {
259
+			if ( ! isset($wp_roles)) {
260 260
 				$wp_roles = new WP_Roles();
261 261
 			}
262 262
 		}
263 263
 
264
-		if ( is_object( $wp_roles ) ) {
264
+		if (is_object($wp_roles)) {
265 265
 			// Give Manager Capabilities.
266
-			$wp_roles->remove_cap( 'give_manager', 'view_give_reports' );
267
-			$wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' );
268
-			$wp_roles->remove_cap( 'give_manager', 'export_give_reports' );
269
-			$wp_roles->remove_cap( 'give_manager', 'manage_give_settings' );
266
+			$wp_roles->remove_cap('give_manager', 'view_give_reports');
267
+			$wp_roles->remove_cap('give_manager', 'view_give_sensitive_data');
268
+			$wp_roles->remove_cap('give_manager', 'export_give_reports');
269
+			$wp_roles->remove_cap('give_manager', 'manage_give_settings');
270 270
 
271 271
 			// Site Administrator Capabilities.
272
-			$wp_roles->remove_cap( 'administrator', 'view_give_reports' );
273
-			$wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' );
274
-			$wp_roles->remove_cap( 'administrator', 'export_give_reports' );
275
-			$wp_roles->remove_cap( 'administrator', 'manage_give_settings' );
272
+			$wp_roles->remove_cap('administrator', 'view_give_reports');
273
+			$wp_roles->remove_cap('administrator', 'view_give_sensitive_data');
274
+			$wp_roles->remove_cap('administrator', 'export_give_reports');
275
+			$wp_roles->remove_cap('administrator', 'manage_give_settings');
276 276
 
277 277
 			// Remove the Main Post Type Capabilities.
278 278
 			$capabilities = $this->get_core_caps();
279 279
 
280
-			foreach ( $capabilities as $cap_group ) {
281
-				foreach ( $cap_group as $cap ) {
282
-					$wp_roles->remove_cap( 'give_manager', $cap );
283
-					$wp_roles->remove_cap( 'administrator', $cap );
284
-					$wp_roles->remove_cap( 'give_worker', $cap );
280
+			foreach ($capabilities as $cap_group) {
281
+				foreach ($cap_group as $cap) {
282
+					$wp_roles->remove_cap('give_manager', $cap);
283
+					$wp_roles->remove_cap('administrator', $cap);
284
+					$wp_roles->remove_cap('give_worker', $cap);
285 285
 				}
286 286
 			}
287 287
 
288 288
 			/** Give Accountant Capabilities */
289
-			$wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' );
290
-			$wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' );
291
-			$wp_roles->remove_cap( 'give_accountant', 'view_give_reports' );
292
-			$wp_roles->remove_cap( 'give_accountant', 'export_give_reports' );
289
+			$wp_roles->remove_cap('give_accountant', 'edit_give_forms');
290
+			$wp_roles->remove_cap('give_accountant', 'read_private_give_forms');
291
+			$wp_roles->remove_cap('give_accountant', 'view_give_reports');
292
+			$wp_roles->remove_cap('give_accountant', 'export_give_reports');
293 293
 
294 294
 		}
295 295
 	}
Please login to merge, or discard this patch.
includes/class-give-db-donor-meta.php 1 patch
Spacing   +26 added lines, -26 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,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		/* @var WPDB $wpdb */
34 34
 		global $wpdb;
35 35
 
36
-		$wpdb->customermeta = $this->table_name  = $wpdb->prefix . 'give_customermeta';
36
+		$wpdb->customermeta = $this->table_name = $wpdb->prefix.'give_customermeta';
37 37
 		$this->primary_key = 'meta_id';
38 38
 		$this->version     = '1.0';
39 39
 
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return  mixed                 Will be an array if $single is false. Will be value of meta data field if $single is true.
73 73
 	 */
74
-	public function get_meta( $donor_id = 0, $meta_key = '', $single = false ) {
75
-		$donor_id = $this->sanitize_donor_id( $donor_id );
76
-		if ( false === $donor_id ) {
74
+	public function get_meta($donor_id = 0, $meta_key = '', $single = false) {
75
+		$donor_id = $this->sanitize_donor_id($donor_id);
76
+		if (false === $donor_id) {
77 77
 			return false;
78 78
 		}
79 79
 
80
-		return get_metadata( 'customer', $donor_id, $meta_key, $single );
80
+		return get_metadata('customer', $donor_id, $meta_key, $single);
81 81
 	}
82 82
 
83 83
 	/**
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return  bool                  False for failure. True for success.
97 97
 	 */
98
-	public function add_meta( $donor_id = 0, $meta_key = '', $meta_value, $unique = false ) {
99
-		$donor_id = $this->sanitize_donor_id( $donor_id );
100
-		if ( false === $donor_id ) {
98
+	public function add_meta($donor_id = 0, $meta_key = '', $meta_value, $unique = false) {
99
+		$donor_id = $this->sanitize_donor_id($donor_id);
100
+		if (false === $donor_id) {
101 101
 			return false;
102 102
 		}
103 103
 
104
-		return add_metadata( 'customer', $donor_id, $meta_key, $meta_value, $unique );
104
+		return add_metadata('customer', $donor_id, $meta_key, $meta_value, $unique);
105 105
 	}
106 106
 
107 107
 	/**
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return  bool                  False on failure, true if success.
126 126
 	 */
127
-	public function update_meta( $donor_id = 0, $meta_key = '', $meta_value, $prev_value = '' ) {
128
-		$donor_id = $this->sanitize_donor_id( $donor_id );
129
-		if ( false === $donor_id ) {
127
+	public function update_meta($donor_id = 0, $meta_key = '', $meta_value, $prev_value = '') {
128
+		$donor_id = $this->sanitize_donor_id($donor_id);
129
+		if (false === $donor_id) {
130 130
 			return false;
131 131
 		}
132 132
 
133
-		return update_metadata( 'customer', $donor_id, $meta_key, $meta_value, $prev_value );
133
+		return update_metadata('customer', $donor_id, $meta_key, $meta_value, $prev_value);
134 134
 	}
135 135
 
136 136
 	/**
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @return  bool                  False for failure. True for success.
153 153
 	 */
154
-	public function delete_meta( $donor_id = 0, $meta_key = '', $meta_value = '' ) {
155
-		return delete_metadata( 'customer', $donor_id, $meta_key, $meta_value );
154
+	public function delete_meta($donor_id = 0, $meta_key = '', $meta_value = '') {
155
+		return delete_metadata('customer', $donor_id, $meta_key, $meta_value);
156 156
 	}
157 157
 
158 158
 	/**
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return  bool  False for failure. True for success.
167 167
 	 */
168
-	public function delete_all_meta( $donor_id = 0 ) {
168
+	public function delete_all_meta($donor_id = 0) {
169 169
 		global $wpdb;
170
-		$wpdb->delete( $this->table_name, array( 'customer_id' => $donor_id ), array( '%d' ) );
170
+		$wpdb->delete($this->table_name, array('customer_id' => $donor_id), array('%d'));
171 171
 	}
172 172
 
173 173
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function create_table() {
182 182
 
183
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
183
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
184 184
 
185 185
 		$sql = "CREATE TABLE {$this->table_name} (
186 186
 			meta_id bigint(20) NOT NULL AUTO_INCREMENT,
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 			KEY meta_key (meta_key)
193 193
 			) CHARACTER SET utf8 COLLATE utf8_general_ci;";
194 194
 
195
-		dbDelta( $sql );
195
+		dbDelta($sql);
196 196
 
197
-		update_option( $this->table_name . '_db_version', $this->version );
197
+		update_option($this->table_name.'_db_version', $this->version);
198 198
 	}
199 199
 
200 200
 	/**
@@ -207,23 +207,23 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return int|bool                The normalized donor ID or false if it's found to not be valid.
209 209
 	 */
210
-	private function sanitize_donor_id( $donor_id ) {
211
-		if ( ! is_numeric( $donor_id ) ) {
210
+	private function sanitize_donor_id($donor_id) {
211
+		if ( ! is_numeric($donor_id)) {
212 212
 			return false;
213 213
 		}
214 214
 
215 215
 		$donor_id = (int) $donor_id;
216 216
 
217 217
 		// We were given a non positive number.
218
-		if ( absint( $donor_id ) !== $donor_id ) {
218
+		if (absint($donor_id) !== $donor_id) {
219 219
 			return false;
220 220
 		}
221 221
 
222
-		if ( empty( $donor_id ) ) {
222
+		if (empty($donor_id)) {
223 223
 			return false;
224 224
 		}
225 225
 
226
-		return absint( $donor_id );
226
+		return absint($donor_id);
227 227
 
228 228
 	}
229 229
 
Please login to merge, or discard this patch.
includes/template-functions.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @return string
22 22
  */
23 23
 function give_get_templates_dir() {
24
-	return GIVE_PLUGIN_DIR . 'templates';
24
+	return GIVE_PLUGIN_DIR.'templates';
25 25
 }
26 26
 
27 27
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function give_get_templates_url() {
34
-	return GIVE_PLUGIN_URL . 'templates';
34
+	return GIVE_PLUGIN_URL.'templates';
35 35
 }
36 36
 
37 37
 /**
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
  * @param string $template_path Template file path. Default is empty.
45 45
  * @param string $default_path  Default path. Default is empty.
46 46
  */
47
-function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
48
-	if ( ! empty( $args ) && is_array( $args ) ) {
49
-		extract( $args );
47
+function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
48
+	if ( ! empty($args) && is_array($args)) {
49
+		extract($args);
50 50
 	}
51 51
 
52
-	$template_names = array( $template_name . '.php' );
52
+	$template_names = array($template_name.'.php');
53 53
 
54
-	$located = give_locate_template( $template_names, $template_path, $default_path );
54
+	$located = give_locate_template($template_names, $template_path, $default_path);
55 55
 
56
-	if ( ! file_exists( $located ) ) {
56
+	if ( ! file_exists($located)) {
57 57
 		/* translators: %s: the template */
58
-		Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
58
+		Give()->notices->print_frontend_notice(sprintf(__('The %s template was not found.', 'give'), $located), true);
59 59
 
60 60
 		return;
61 61
 	}
62 62
 
63 63
 	// Allow 3rd party plugin filter template file from their plugin.
64
-	$located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
64
+	$located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path);
65 65
 
66 66
 	/**
67 67
 	 * Fires in give template, before the file is included.
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 * @param string $located       Template file filter by 3rd party plugin.
76 76
 	 * @param array  $args          Passed arguments.
77 77
 	 */
78
-	do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
78
+	do_action('give_before_template_part', $template_name, $template_path, $located, $args);
79 79
 
80
-	include( $located );
80
+	include($located);
81 81
 
82 82
 	/**
83 83
 	 * Fires in give template, after the file is included.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param string $located       Template file filter by 3rd party plugin.
92 92
 	 * @param array  $args          Passed arguments.
93 93
 	 */
94
-	do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
94
+	do_action('give_after_template_part', $template_name, $template_path, $located, $args);
95 95
 }
96 96
 
97 97
 /**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return string
109 109
  */
110
-function give_get_template_part( $slug, $name = null, $load = true ) {
110
+function give_get_template_part($slug, $name = null, $load = true) {
111 111
 
112 112
 	/**
113 113
 	 * Fires in give template part, before the template part is retrieved.
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 	 * @param string $slug Template part file slug {slug}.php.
120 120
 	 * @param string $name Template part file name {slug}-{name}.php.
121 121
 	 */
122
-	do_action( "get_template_part_{$slug}", $slug, $name );
122
+	do_action("get_template_part_{$slug}", $slug, $name);
123 123
 
124 124
 	// Setup possible parts
125 125
 	$templates = array();
126
-	if ( isset( $name ) ) {
127
-		$templates[] = $slug . '-' . $name . '.php';
126
+	if (isset($name)) {
127
+		$templates[] = $slug.'-'.$name.'.php';
128 128
 	}
129
-	$templates[] = $slug . '.php';
129
+	$templates[] = $slug.'.php';
130 130
 
131 131
 	// Allow template parts to be filtered
132
-	$templates = apply_filters( 'give_get_template_part', $templates, $slug, $name );
132
+	$templates = apply_filters('give_get_template_part', $templates, $slug, $name);
133 133
 
134 134
 	// Return the part that is found
135
-	return give_locate_template( $templates, $load, false );
135
+	return give_locate_template($templates, $load, false);
136 136
 }
137 137
 
138 138
 /**
@@ -153,37 +153,37 @@  discard block
 block discarded – undo
153 153
  *
154 154
  * @return string The template filename if one is located.
155 155
  */
156
-function give_locate_template( $template_names, $load = false, $require_once = true ) {
156
+function give_locate_template($template_names, $load = false, $require_once = true) {
157 157
 	// No file found yet
158 158
 	$located = false;
159 159
 
160 160
 	// Try to find a template file
161
-	foreach ( (array) $template_names as $template_name ) {
161
+	foreach ((array) $template_names as $template_name) {
162 162
 
163 163
 		// Continue if template is empty
164
-		if ( empty( $template_name ) ) {
164
+		if (empty($template_name)) {
165 165
 			continue;
166 166
 		}
167 167
 
168 168
 		// Trim off any slashes from the template name
169
-		$template_name = ltrim( $template_name, '/' );
169
+		$template_name = ltrim($template_name, '/');
170 170
 
171 171
 		// try locating this template file by looping through the template paths
172
-		foreach ( give_get_theme_template_paths() as $template_path ) {
172
+		foreach (give_get_theme_template_paths() as $template_path) {
173 173
 
174
-			if ( file_exists( $template_path . $template_name ) ) {
175
-				$located = $template_path . $template_name;
174
+			if (file_exists($template_path.$template_name)) {
175
+				$located = $template_path.$template_name;
176 176
 				break;
177 177
 			}
178 178
 		}
179 179
 
180
-		if ( $located ) {
180
+		if ($located) {
181 181
 			break;
182 182
 		}
183 183
 	}
184 184
 
185
-	if ( ( true == $load ) && ! empty( $located ) ) {
186
-		load_template( $located, $require_once );
185
+	if ((true == $load) && ! empty($located)) {
186
+		load_template($located, $require_once);
187 187
 	}
188 188
 
189 189
 	return $located;
@@ -200,17 +200,17 @@  discard block
 block discarded – undo
200 200
 	$template_dir = give_get_theme_template_dir_name();
201 201
 
202 202
 	$file_paths = array(
203
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
204
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
203
+		1   => trailingslashit(get_stylesheet_directory()).$template_dir,
204
+		10  => trailingslashit(get_template_directory()).$template_dir,
205 205
 		100 => give_get_templates_dir(),
206 206
 	);
207 207
 
208
-	$file_paths = apply_filters( 'give_template_paths', $file_paths );
208
+	$file_paths = apply_filters('give_template_paths', $file_paths);
209 209
 
210 210
 	// sort the file paths based on priority
211
-	ksort( $file_paths, SORT_NUMERIC );
211
+	ksort($file_paths, SORT_NUMERIC);
212 212
 
213
-	return array_map( 'trailingslashit', $file_paths );
213
+	return array_map('trailingslashit', $file_paths);
214 214
 }
215 215
 
216 216
 /**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
  * @return string
223 223
  */
224 224
 function give_get_theme_template_dir_name() {
225
-	return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) );
225
+	return trailingslashit(apply_filters('give_templates_dir', 'give'));
226 226
 }
227 227
 
228 228
 /**
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
  * @return void
233 233
  */
234 234
 function give_version_in_header() {
235
-	echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n";
235
+	echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n";
236 236
 }
237 237
 
238
-add_action( 'wp_head', 'give_version_in_header' );
238
+add_action('wp_head', 'give_version_in_header');
239 239
 
240 240
 /**
241 241
  * Determines if we're currently on the Donations History page.
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function give_is_donation_history_page() {
247 247
 
248
-	$ret = is_page( give_get_option( 'history_page' ) );
248
+	$ret = is_page(give_get_option('history_page'));
249 249
 
250
-	return apply_filters( 'give_is_donation_history_page', $ret );
250
+	return apply_filters('give_is_donation_history_page', $ret);
251 251
 }
252 252
 
253 253
 /**
@@ -259,25 +259,25 @@  discard block
 block discarded – undo
259 259
  *
260 260
  * @return array Modified array of classes
261 261
  */
262
-function give_add_body_classes( $class ) {
262
+function give_add_body_classes($class) {
263 263
 	$classes = (array) $class;
264 264
 
265
-	if ( give_is_success_page() ) {
265
+	if (give_is_success_page()) {
266 266
 		$classes[] = 'give-success';
267 267
 		$classes[] = 'give-page';
268 268
 	}
269 269
 
270
-	if ( give_is_failed_transaction_page() ) {
270
+	if (give_is_failed_transaction_page()) {
271 271
 		$classes[] = 'give-failed-transaction';
272 272
 		$classes[] = 'give-page';
273 273
 	}
274 274
 
275
-	if ( give_is_donation_history_page() ) {
275
+	if (give_is_donation_history_page()) {
276 276
 		$classes[] = 'give-donation-history';
277 277
 		$classes[] = 'give-page';
278 278
 	}
279 279
 
280
-	if ( give_is_test_mode() ) {
280
+	if (give_is_test_mode()) {
281 281
 		$classes[] = 'give-test-mode';
282 282
 		$classes[] = 'give-page';
283 283
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	/* @var WP_Theme $current_theme */
287 287
 	$current_theme = wp_get_theme();
288 288
 
289
-	switch ( $current_theme->get_template() ) {
289
+	switch ($current_theme->get_template()) {
290 290
 
291 291
 		case 'Divi':
292 292
 			$classes[] = 'give-divi';
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 
304 304
 	}
305 305
 
306
-	return array_unique( $classes );
306
+	return array_unique($classes);
307 307
 }
308 308
 
309
-add_filter( 'body_class', 'give_add_body_classes' );
309
+add_filter('body_class', 'give_add_body_classes');
310 310
 
311 311
 
312 312
 /**
@@ -322,22 +322,22 @@  discard block
 block discarded – undo
322 322
  *
323 323
  * @return array
324 324
  */
325
-function give_add_post_class( $classes, $class = '', $post_id = '' ) {
326
-	if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
325
+function give_add_post_class($classes, $class = '', $post_id = '') {
326
+	if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) {
327 327
 		return $classes;
328 328
 	}
329 329
 
330 330
 	//@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
331 331
 
332
-	if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
333
-		unset( $classes[ $key ] );
332
+	if (false !== ($key = array_search('hentry', $classes))) {
333
+		unset($classes[$key]);
334 334
 	}
335 335
 
336 336
 	return $classes;
337 337
 }
338 338
 
339 339
 
340
-add_filter( 'post_class', 'give_add_post_class', 20, 3 );
340
+add_filter('post_class', 'give_add_post_class', 20, 3);
341 341
 
342 342
 /**
343 343
  * Get the placeholder image URL for forms etc
@@ -347,74 +347,74 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function give_get_placeholder_img_src() {
349 349
 
350
-	$placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
350
+	$placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give'));
351 351
 
352
-	return apply_filters( 'give_placeholder_img_src', $placeholder_url );
352
+	return apply_filters('give_placeholder_img_src', $placeholder_url);
353 353
 }
354 354
 
355 355
 
356 356
 /**
357 357
  * Global
358 358
  */
359
-if ( ! function_exists( 'give_output_content_wrapper' ) ) {
359
+if ( ! function_exists('give_output_content_wrapper')) {
360 360
 
361 361
 	/**
362 362
 	 * Output the start of the page wrapper.
363 363
 	 */
364 364
 	function give_output_content_wrapper() {
365
-		give_get_template_part( 'global/wrapper-start' );
365
+		give_get_template_part('global/wrapper-start');
366 366
 	}
367 367
 }
368
-if ( ! function_exists( 'give_output_content_wrapper_end' ) ) {
368
+if ( ! function_exists('give_output_content_wrapper_end')) {
369 369
 
370 370
 	/**
371 371
 	 * Output the end of the page wrapper.
372 372
 	 */
373 373
 	function give_output_content_wrapper_end() {
374
-		give_get_template_part( 'global/wrapper-end' );
374
+		give_get_template_part('global/wrapper-end');
375 375
 	}
376 376
 }
377 377
 
378 378
 /**
379 379
  * Single Give Form
380 380
  */
381
-if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) {
381
+if ( ! function_exists('give_left_sidebar_pre_wrap')) {
382 382
 	function give_left_sidebar_pre_wrap() {
383
-		echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' );
383
+		echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">');
384 384
 	}
385 385
 }
386 386
 
387
-if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) {
387
+if ( ! function_exists('give_left_sidebar_post_wrap')) {
388 388
 	function give_left_sidebar_post_wrap() {
389
-		echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' );
389
+		echo apply_filters('give_left_sidebar_post_wrap', '</div>');
390 390
 	}
391 391
 }
392 392
 
393
-if ( ! function_exists( 'give_get_forms_sidebar' ) ) {
393
+if ( ! function_exists('give_get_forms_sidebar')) {
394 394
 	function give_get_forms_sidebar() {
395
-		give_get_template_part( 'single-give-form/sidebar' );
395
+		give_get_template_part('single-give-form/sidebar');
396 396
 	}
397 397
 }
398 398
 
399
-if ( ! function_exists( 'give_show_form_images' ) ) {
399
+if ( ! function_exists('give_show_form_images')) {
400 400
 
401 401
 	/**
402 402
 	 * Output the donation form featured image.
403 403
 	 */
404 404
 	function give_show_form_images() {
405
-		if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
406
-			give_get_template_part( 'single-give-form/featured-image' );
405
+		if (give_is_setting_enabled(give_get_option('form_featured_img'))) {
406
+			give_get_template_part('single-give-form/featured-image');
407 407
 		}
408 408
 	}
409 409
 }
410 410
 
411
-if ( ! function_exists( 'give_template_single_title' ) ) {
411
+if ( ! function_exists('give_template_single_title')) {
412 412
 
413 413
 	/**
414 414
 	 * Output the form title.
415 415
 	 */
416 416
 	function give_template_single_title() {
417
-		give_get_template_part( 'single-give-form/title' );
417
+		give_get_template_part('single-give-form/title');
418 418
 	}
419 419
 }
420 420
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
  * Conditional Functions
423 423
  */
424 424
 
425
-if ( ! function_exists( 'is_give_form' ) ) {
425
+if ( ! function_exists('is_give_form')) {
426 426
 
427 427
 	/**
428 428
 	 * is_give_form
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 	 * @return bool
435 435
 	 */
436 436
 	function is_give_form() {
437
-		return is_singular( array( 'give_form' ) );
437
+		return is_singular(array('give_form'));
438 438
 	}
439 439
 }
440 440
 
441
-if ( ! function_exists( 'is_give_category' ) ) {
441
+if ( ! function_exists('is_give_category')) {
442 442
 
443 443
 	/**
444 444
 	 * is_give_category
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @return bool
455 455
 	 */
456
-	function is_give_category( $term = '' ) {
457
-		return is_tax( 'give_forms_category', $term );
456
+	function is_give_category($term = '') {
457
+		return is_tax('give_forms_category', $term);
458 458
 	}
459 459
 }
460 460
 
461
-if ( ! function_exists( 'is_give_tag' ) ) {
461
+if ( ! function_exists('is_give_tag')) {
462 462
 
463 463
 	/**
464 464
 	 * is_give_tag
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
 	 *
474 474
 	 * @return bool
475 475
 	 */
476
-	function is_give_tag( $term = '' ) {
477
-		return is_tax( 'give_forms_tag', $term );
476
+	function is_give_tag($term = '') {
477
+		return is_tax('give_forms_tag', $term);
478 478
 	}
479 479
 }
480 480
 
481
-if ( ! function_exists( 'is_give_taxonomy' ) ) {
481
+if ( ! function_exists('is_give_taxonomy')) {
482 482
 
483 483
 	/**
484 484
 	 * is_give_taxonomy
@@ -490,6 +490,6 @@  discard block
 block discarded – undo
490 490
 	 * @return bool
491 491
 	 */
492 492
 	function is_give_taxonomy() {
493
-		return is_tax( get_object_taxonomies( 'give_form' ) );
493
+		return is_tax(get_object_taxonomies('give_form'));
494 494
 	}
495 495
 }
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +107 added lines, -107 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,45 +56,45 @@  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, array( 'sanitize' => false ) ) );
61
+	$price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false)));
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
 	// Set user.
77 77
 	$user = wp_get_current_user();
78 78
 
79
-	$message = str_replace( '{name}', $user->display_name, $message );
80
-	$message = str_replace( '{fullname}', $user->display_name, $message );
81
-	$message = str_replace( '{username}', $user->user_login, $message );
82
-	$message = str_replace( '{user_email}', $user->user_email, $message );
83
-	$message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message );
84
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
85
-	$message = str_replace( '{amount}', $price, $message );
86
-	$message = str_replace( '{price}', $price, $message );
87
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
88
-	$message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message );
89
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
90
-	$message = str_replace( '{payment_method}', $gateway, $message );
91
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
92
-	$message = str_replace( '{payment_id}', $payment_id, $message );
93
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
94
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
95
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
96
-
97
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
79
+	$message = str_replace('{name}', $user->display_name, $message);
80
+	$message = str_replace('{fullname}', $user->display_name, $message);
81
+	$message = str_replace('{username}', $user->user_login, $message);
82
+	$message = str_replace('{user_email}', $user->user_email, $message);
83
+	$message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message);
84
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
85
+	$message = str_replace('{amount}', $price, $message);
86
+	$message = str_replace('{price}', $price, $message);
87
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
88
+	$message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message);
89
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
90
+	$message = str_replace('{payment_method}', $gateway, $message);
91
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
92
+	$message = str_replace('{payment_id}', $payment_id, $message);
93
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
94
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
95
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
96
+
97
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
98 98
 }
99 99
 
100 100
 /**
@@ -106,23 +106,23 @@  discard block
 block discarded – undo
106 106
  * @since  1.0
107 107
  * @return array|bool
108 108
  */
109
-function give_email_template_preview( $array ) {
109
+function give_email_template_preview($array) {
110 110
 
111
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
111
+	if ( ! current_user_can('manage_give_settings')) {
112 112
 		return false;
113 113
 	}
114 114
 	$custom_field = array(
115
-		'name' => esc_html__( 'Preview Email', 'give' ),
116
-		'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ),
115
+		'name' => esc_html__('Preview Email', 'give'),
116
+		'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'),
117 117
 		'id'   => 'give_email_preview_buttons',
118 118
 		'type' => 'email_preview_buttons',
119 119
 	);
120 120
 
121
-	return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) );
121
+	return give_settings_array_insert($array, 'donation_subject', array($custom_field));
122 122
 
123 123
 }
124 124
 
125
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
125
+add_filter('give_settings_emails', 'give_email_template_preview');
126 126
 
127 127
 /**
128 128
  * Output Email Template Preview Buttons.
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 function give_email_preview_buttons_callback() {
135 135
 	ob_start();
136 136
 	?>
137
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary"
138
-	   target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a>
139
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
137
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary"
138
+	   target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a>
139
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
140 140
 		'give_action'  => 'send_test_email',
141 141
 		'give-message' => 'sent-test-email',
142 142
 		'tag'          => 'emails',
143
-	) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>"
144
-	   class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a>
143
+	)), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>"
144
+	   class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a>
145 145
 	<?php
146 146
 	echo ob_get_clean();
147 147
 }
@@ -154,46 +154,46 @@  discard block
 block discarded – undo
154 154
  */
155 155
 function give_display_email_template_preview() {
156 156
 
157
-	if ( empty( $_GET['give_action'] ) ) {
157
+	if (empty($_GET['give_action'])) {
158 158
 		return;
159 159
 	}
160 160
 
161
-	if ( 'preview_email' !== $_GET['give_action'] ) {
161
+	if ('preview_email' !== $_GET['give_action']) {
162 162
 		return;
163 163
 	}
164 164
 
165
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
165
+	if ( ! current_user_can('manage_give_settings')) {
166 166
 		return;
167 167
 	}
168 168
 
169 169
 
170
-	Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' );
170
+	Give()->emails->heading = esc_html__('Donation Receipt', 'give');
171 171
 
172
-	$payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
172
+	$payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
173 173
 
174 174
 	echo give_get_preview_email_header();
175 175
 
176 176
 	//Are we previewing an actual payment?
177
-	if ( ! empty( $payment_id ) ) {
177
+	if ( ! empty($payment_id)) {
178 178
 
179
-		$content = give_get_email_body_content( $payment_id );
179
+		$content = give_get_email_body_content($payment_id);
180 180
 
181
-		$preview_content = give_do_email_tags( $content, $payment_id );
181
+		$preview_content = give_do_email_tags($content, $payment_id);
182 182
 
183 183
 	} else {
184 184
 
185 185
 		//No payment ID, use sample preview content
186
-		$preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
186
+		$preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
187 187
 	}
188 188
 
189 189
 
190
-	echo Give()->emails->build_email( $preview_content );
190
+	echo Give()->emails->build_email($preview_content);
191 191
 
192 192
 	exit;
193 193
 
194 194
 }
195 195
 
196
-add_action( 'init', 'give_display_email_template_preview' );
196
+add_action('init', 'give_display_email_template_preview');
197 197
 
198 198
 /**
199 199
  * Email Template Body.
@@ -205,18 +205,18 @@  discard block
 block discarded – undo
205 205
  *
206 206
  * @return string $email_body Body of the email
207 207
  */
208
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
208
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
209 209
 
210 210
 	$default_email_body = give_get_default_donation_receipt_email();
211 211
 
212
-	$email_content = give_get_option( 'donation_receipt' );
213
-	$email_content = ( $email_content ) ? stripslashes( $email_content ) : $default_email_body;
212
+	$email_content = give_get_option('donation_receipt');
213
+	$email_content = ($email_content) ? stripslashes($email_content) : $default_email_body;
214 214
 
215
-	$email_body = wpautop( $email_content );
215
+	$email_body = wpautop($email_content);
216 216
 
217
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
217
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
218 218
 
219
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
219
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
220 220
 }
221 221
 
222 222
 /**
@@ -229,35 +229,35 @@  discard block
 block discarded – undo
229 229
  *
230 230
  * @return string $email_body Body of the email
231 231
  */
232
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
232
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
233 233
 
234
-	$payment = new Give_Payment( $payment_id );
234
+	$payment = new Give_Payment($payment_id);
235 235
 
236
-	if ( $payment->user_id > 0 ) {
237
-		$user_data = get_userdata( $payment->user_id );
236
+	if ($payment->user_id > 0) {
237
+		$user_data = get_userdata($payment->user_id);
238 238
 		$name      = $user_data->display_name;
239
-	} elseif ( ! empty( $payment->first_name ) && ! empty( $payment->last_name ) ) {
240
-		$name = $payment->first_name . ' ' . $payment->last_name;
239
+	} elseif ( ! empty($payment->first_name) && ! empty($payment->last_name)) {
240
+		$name = $payment->first_name.' '.$payment->last_name;
241 241
 	} else {
242 242
 		$name = $payment->email;
243 243
 	}
244 244
 
245
-	$gateway = give_get_gateway_admin_label( $payment->gateway );
245
+	$gateway = give_get_gateway_admin_label($payment->gateway);
246 246
 
247
-	$default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n";
248
-	$default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n";
249
-	$default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n";
250
-	$default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
251
-	$default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
252
-	$default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n";
253
-	$default_email_body .= esc_html__( 'Thank you', 'give' );
247
+	$default_email_body = esc_html__('Hello', 'give')."\n\n";
248
+	$default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n";
249
+	$default_email_body .= esc_html__('Donation:', 'give')."\n\n";
250
+	$default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
251
+	$default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount($payment->total, array('sanitize' => false))), ENT_COMPAT, 'UTF-8')."\n";
252
+	$default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n";
253
+	$default_email_body .= esc_html__('Thank you', 'give');
254 254
 
255
-	$message = give_get_option( 'donation_notification' );
256
-	$message = isset( $message ) ? stripslashes( $message ) : $default_email_body;
255
+	$message = give_get_option('donation_notification');
256
+	$message = isset($message) ? stripslashes($message) : $default_email_body;
257 257
 
258
-	$email_body = give_do_email_tags( $message, $payment_id );
258
+	$email_body = give_do_email_tags($message, $payment_id);
259 259
 
260
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
260
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
261 261
 }
262 262
 
263 263
 /**
@@ -270,19 +270,19 @@  discard block
 block discarded – undo
270 270
  * @since  1.0
271 271
  */
272 272
 function give_render_receipt_in_browser() {
273
-	if ( ! isset( $_GET['payment_key'] ) ) {
274
-		wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
273
+	if ( ! isset($_GET['payment_key'])) {
274
+		wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
275 275
 	}
276 276
 
277
-	$key = urlencode( $_GET['payment_key'] );
277
+	$key = urlencode($_GET['payment_key']);
278 278
 
279 279
 	ob_start();
280 280
 	//Disallows caching of the page
281
-	header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
282
-	header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
283
-	header( "Cache-Control: post-check=0, pre-check=0", false );
284
-	header( "Pragma: no-cache" ); // HTTP/1.0
285
-	header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
281
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
282
+	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
283
+	header("Cache-Control: post-check=0, pre-check=0", false);
284
+	header("Pragma: no-cache"); // HTTP/1.0
285
+	header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past
286 286
 	?>
287 287
 	<!DOCTYPE html>
288 288
 	<html lang="en">
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 		 *
294 294
 		 * @since 1.0
295 295
 		 */
296
-		do_action( 'give_receipt_head' );
296
+		do_action('give_receipt_head');
297 297
 		?>
298 298
 	</head>
299
-	<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
299
+	<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
300 300
 
301 301
 	<div id="give_receipt_wrapper">
302 302
 		<?php
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 		 *
306 306
 		 * @since 1.0
307 307
 		 */
308
-		do_action( 'give_render_receipt_in_browser_before' );
308
+		do_action('give_render_receipt_in_browser_before');
309 309
 
310
-		echo do_shortcode( '[give_receipt payment_key=' . $key . ']' );
310
+		echo do_shortcode('[give_receipt payment_key='.$key.']');
311 311
 
312 312
 		/**
313 313
 		 * Fires in the receipt template after the content.
314 314
 		 *
315 315
 		 * @since 1.0
316 316
 		 */
317
-		do_action( 'give_render_receipt_in_browser_after' );
317
+		do_action('give_render_receipt_in_browser_after');
318 318
 		?>
319 319
 	</div>
320 320
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 *
325 325
 	 * @since 1.0
326 326
 	 */
327
-	do_action( 'give_receipt_footer' );
327
+	do_action('give_receipt_footer');
328 328
 	?>
329 329
 	</body>
330 330
 	</html>
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	die();
334 334
 }
335 335
 
336
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
336
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
337 337
 
338 338
 
339 339
 /**
@@ -348,29 +348,29 @@  discard block
 block discarded – undo
348 348
 
349 349
 	//Payment receipt switcher
350 350
 	$payment_count = give_count_payments()->publish;
351
-	$payment_id    = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
351
+	$payment_id    = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
352 352
 
353
-	if ( $payment_count <= 0 ) {
353
+	if ($payment_count <= 0) {
354 354
 		return false;
355 355
 	}
356 356
 
357 357
 	//Get payments.
358
-	$payments = new Give_Payments_Query( array(
358
+	$payments = new Give_Payments_Query(array(
359 359
 		'number' => 100,
360
-	) );
360
+	));
361 361
 	$payments = $payments->get_payments();
362 362
 	$options  = array();
363 363
 
364 364
 	//Provide nice human readable options.
365
-	if ( $payments ) {
366
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
367
-		foreach ( $payments as $payment ) {
365
+	if ($payments) {
366
+		$options[0] = esc_html__('- Select a donation -', 'give');
367
+		foreach ($payments as $payment) {
368 368
 
369
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
369
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
370 370
 
371 371
 		}
372 372
 	} else {
373
-		$options[0] = esc_html__( 'No donations found.', 'give' );
373
+		$options[0] = esc_html__('No donations found.', 'give');
374 374
 	}
375 375
 
376 376
 	//Start constructing HTML output.
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
 			        var selected_trans = transactions.options[transactions.selectedIndex];
384 384
 				        console.log(selected_trans);
385 385
 				        if (selected_trans){
386
-				            var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value;
386
+				            var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value;
387 387
 				                window.location = url_string;
388 388
 				        }
389 389
 				    }
390 390
 			    </script>';
391 391
 
392
-	$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>';
392
+	$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>';
393 393
 
394 394
 	//The select field with 100 latest transactions
395
-	$transaction_header .= Give()->html->select( array(
395
+	$transaction_header .= Give()->html->select(array(
396 396
 		'name'             => 'preview_email_payment_id',
397 397
 		'selected'         => $payment_id,
398 398
 		'id'               => 'give_preview_email_payment_id',
@@ -402,12 +402,12 @@  discard block
 block discarded – undo
402 402
 		'select_atts'      => 'onchange="change_preview()">',
403 403
 		'show_option_all'  => false,
404 404
 		'show_option_none' => false,
405
-	) );
405
+	));
406 406
 
407 407
 	//Closing tag
408 408
 	$transaction_header .= '</div>';
409 409
 
410
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
410
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
411 411
 
412 412
 }
413 413
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 function give_receipt_head_content() {
422 422
 
423 423
 	//Title.
424
-	$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';
424
+	$output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>';
425 425
 
426 426
 	//Meta.
427 427
 	$output .= '<meta charset="utf-8"/>
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
 		<meta name="robots" content="noindex, nofollow"/>';
436 436
 
437 437
 	//CSS
438
-	$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';
438
+	$output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">';
439 439
 
440
-	echo apply_filters( 'give_receipt_head_content', $output );
440
+	echo apply_filters('give_receipt_head_content', $output);
441 441
 
442 442
 }
443 443
 
444
-add_action( 'give_receipt_head', 'give_receipt_head_content' );
445 444
\ No newline at end of file
445
+add_action('give_receipt_head', 'give_receipt_head_content');
446 446
\ No newline at end of file
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +106 added lines, -106 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
 
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30 30
 
31
-	$payment_data = give_get_payment_meta( $payment_id );
31
+	$payment_data = give_get_payment_meta($payment_id);
32 32
 
33
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
33
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
34 34
 
35 35
 	/**
36 36
 	 * Filters the from name.
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @since 1.0
42 42
 	 */
43
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
43
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
44 44
 
45
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
45
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
46 46
 
47 47
 	/**
48 48
 	 * Filters the from email.
@@ -52,19 +52,19 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @since 1.0
54 54
 	 */
55
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
55
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
56 56
 
57
-	$to_email = give_get_payment_user_email( $payment_id );
57
+	$to_email = give_get_payment_user_email($payment_id);
58 58
 
59
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
59
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
60 60
 
61 61
 	/**
62 62
 	 * Filters the donation email receipt subject.
63 63
 	 *
64 64
 	 * @since 1.0
65 65
 	 */
66
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
67
-	$subject = give_do_email_tags( $subject, $payment_id );
66
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
67
+	$subject = give_do_email_tags($subject, $payment_id);
68 68
 
69 69
 	/**
70 70
 	 * Filters the donation email receipt attachments. By default, there is no attachment but plugins can hook in to provide one more multiple for the donor. Examples would be a printable ticket or PDF receipt.
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @since 1.0
76 76
 	 */
77
-	$attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data );
78
-	$message     = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id );
77
+	$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
78
+	$message     = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
79 79
 
80 80
 	$emails = Give()->emails;
81 81
 
82
-	$emails->__set( 'from_name', $from_name );
83
-	$emails->__set( 'from_email', $from_email );
84
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
82
+	$emails->__set('from_name', $from_name);
83
+	$emails->__set('from_email', $from_email);
84
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
85 85
 
86 86
 	/**
87 87
 	 * Filters the donation receipt's email headers.
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @since 1.0
93 93
 	 */
94
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
95
-	$emails->__set( 'headers', $headers );
94
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
95
+	$emails->__set('headers', $headers);
96 96
 
97 97
 	//Send the donation receipt.
98
-	$emails->send( $to_email, $subject, $message, $attachments );
98
+	$emails->send($to_email, $subject, $message, $attachments);
99 99
 
100 100
 	//If admin notifications are on, send the admin notice.
101
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
101
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
102 102
 		/**
103 103
 		 * Fires in the donation email receipt.
104 104
 		 *
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		 * @param int   $payment_id   Payment id.
110 110
 		 * @param mixed $payment_data Payment meta data.
111 111
 		 */
112
-		do_action( 'give_admin_donation_email', $payment_id, $payment_data );
112
+		do_action('give_admin_donation_email', $payment_id, $payment_data);
113 113
 	}
114 114
 }
115 115
 
@@ -122,41 +122,41 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function give_email_test_donation_receipt() {
124 124
 
125
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
125
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
126 126
 
127 127
 	/**
128 128
 	 * Filters the from name.
129 129
 	 *
130 130
 	 * @since 1.7
131 131
 	 */
132
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, 0, array() );
132
+	$from_name = apply_filters('give_donation_from_name', $from_name, 0, array());
133 133
 
134
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
134
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
135 135
 
136 136
 	/**
137 137
 	 * Filters the from email.
138 138
 	 *
139 139
 	 * @since 1.7
140 140
 	 */
141
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, 0, array() );
141
+	$from_email = apply_filters('give_donation_from_address', $from_email, 0, array());
142 142
 
143
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
144
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 );
145
-	$subject = give_do_email_tags( $subject, 0 );
143
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
144
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
145
+	$subject = give_do_email_tags($subject, 0);
146 146
 
147
-	$attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() );
147
+	$attachments = apply_filters('give_receipt_attachments', array(), 0, array());
148 148
 
149
-	$message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
149
+	$message = give_email_preview_template_tags(give_get_email_body_content(0, array()));
150 150
 
151 151
 	$emails = Give()->emails;
152
-	$emails->__set( 'from_name', $from_name );
153
-	$emails->__set( 'from_email', $from_email );
154
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
152
+	$emails->__set('from_name', $from_name);
153
+	$emails->__set('from_email', $from_email);
154
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
155 155
 
156
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() );
157
-	$emails->__set( 'headers', $headers );
156
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
157
+	$emails->__set('headers', $headers);
158 158
 
159
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
159
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
160 160
 
161 161
 }
162 162
 
@@ -170,49 +170,49 @@  discard block
 block discarded – undo
170 170
  *
171 171
  * @return void
172 172
  */
173
-function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
173
+function give_admin_email_notice($payment_id = 0, $payment_data = array()) {
174 174
 
175
-	$payment_id = absint( $payment_id );
175
+	$payment_id = absint($payment_id);
176 176
 
177
-	if ( empty( $payment_id ) ) {
177
+	if (empty($payment_id)) {
178 178
 		return;
179 179
 	}
180 180
 
181
-	if ( ! give_get_payment_by( 'id', $payment_id ) ) {
181
+	if ( ! give_get_payment_by('id', $payment_id)) {
182 182
 		return;
183 183
 	}
184 184
 
185
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
185
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
186 186
 
187 187
 	/**
188 188
 	 * Filters the from name.
189 189
 	 *
190 190
 	 * @since 1.0
191 191
 	 */
192
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
192
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
193 193
 
194
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
194
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
195 195
 
196 196
 	/**
197 197
 	 * Filters the from email.
198 198
 	 *
199 199
 	 * @since 1.0
200 200
 	 */
201
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
201
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
202 202
 
203 203
 	/* translators: %s: payment id */
204
-	$subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) );
204
+	$subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id));
205 205
 
206 206
 	/**
207 207
 	 * Filters the donation notification subject.
208 208
 	 *
209 209
 	 * @since 1.0
210 210
 	 */
211
-	$subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
212
-	$subject = give_do_email_tags( $subject, $payment_id );
211
+	$subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
212
+	$subject = give_do_email_tags($subject, $payment_id);
213 213
 
214
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
215
-	$headers .= "Reply-To: " . $from_email . "\r\n";
214
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
215
+	$headers .= "Reply-To: ".$from_email."\r\n";
216 216
 	//$headers  .= "MIME-Version: 1.0\r\n";
217 217
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
218 218
 
@@ -221,28 +221,28 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @since 1.0
223 223
 	 */
224
-	$headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data );
224
+	$headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
225 225
 
226 226
 	/**
227 227
 	 * Filters the donation notification email attachments. By default, there is no attachment but plugins can hook in to provide one more multiple.
228 228
 	 *
229 229
 	 * @since 1.0
230 230
 	 */
231
-	$attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data );
231
+	$attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
232 232
 
233
-	$message = give_get_donation_notification_body_content( $payment_id, $payment_data );
233
+	$message = give_get_donation_notification_body_content($payment_id, $payment_data);
234 234
 
235 235
 	$emails = Give()->emails;
236
-	$emails->__set( 'from_name', $from_name );
237
-	$emails->__set( 'from_email', $from_email );
238
-	$emails->__set( 'headers', $headers );
239
-	$emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) );
236
+	$emails->__set('from_name', $from_name);
237
+	$emails->__set('from_email', $from_email);
238
+	$emails->__set('headers', $headers);
239
+	$emails->__set('heading', esc_html__('New Donation!', 'give'));
240 240
 
241
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
241
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
242 242
 
243 243
 }
244 244
 
245
-add_action( 'give_admin_donation_email', 'give_admin_email_notice', 10, 2 );
245
+add_action('give_admin_donation_email', 'give_admin_email_notice', 10, 2);
246 246
 
247 247
 /**
248 248
  * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings).
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
  */
253 253
 function give_get_admin_notice_emails() {
254 254
 
255
-	$email_option = give_get_option( 'admin_notice_emails' );
255
+	$email_option = give_get_option('admin_notice_emails');
256 256
 
257
-	$emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' );
258
-	$emails = array_map( 'trim', explode( "\n", $emails ) );
257
+	$emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email');
258
+	$emails = array_map('trim', explode("\n", $emails));
259 259
 
260
-	return apply_filters( 'give_admin_notice_emails', $emails );
260
+	return apply_filters('give_admin_notice_emails', $emails);
261 261
 }
262 262
 
263 263
 /**
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return mixed
271 271
  */
272
-function give_admin_notices_disabled( $payment_id = 0 ) {
272
+function give_admin_notices_disabled($payment_id = 0) {
273 273
 
274 274
 	return apply_filters(
275 275
 		'give_admin_notices_disabled',
276
-		! give_is_setting_enabled( give_get_option( 'admin_notices' ) ),
276
+		! give_is_setting_enabled(give_get_option('admin_notices')),
277 277
 		$payment_id
278 278
 	);
279 279
 }
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
  */
289 289
 function give_get_default_donation_notification_email() {
290 290
 
291
-	$default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n";
292
-	$default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
293
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
294
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
295
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
296
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
297
-	$default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n";
298
-	$default_email_body .= '{sitename}' . "\n";
291
+	$default_email_body = esc_html__('Hi there,', 'give')."\n\n";
292
+	$default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
293
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n";
294
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
295
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n";
296
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
297
+	$default_email_body .= esc_html__('Thank you,', 'give')."\n\n";
298
+	$default_email_body .= '{sitename}'."\n";
299 299
 
300
-	$custom_message = give_get_option( 'donation_notification' );
301
-	$message        = ! empty( $custom_message ) ? $custom_message : $default_email_body;
300
+	$custom_message = give_get_option('donation_notification');
301
+	$message        = ! empty($custom_message) ? $custom_message : $default_email_body;
302 302
 
303
-	return apply_filters( 'give_default_donation_notification_email', $message );
303
+	return apply_filters('give_default_donation_notification_email', $message);
304 304
 }
305 305
 
306 306
 
@@ -314,25 +314,25 @@  discard block
 block discarded – undo
314 314
  */
315 315
 function give_get_default_donation_receipt_email() {
316 316
 
317
-	$default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n";
318
-	$default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
319
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
320
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
321
-	$default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
322
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
323
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
324
-	$default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
325
-	$default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
326
-	$default_email_body .= '{receipt_link}' . "\n\n";
317
+	$default_email_body = esc_html__('Dear', 'give')." {name},\n\n";
318
+	$default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
319
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n";
320
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
321
+	$default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n";
322
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n";
323
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
324
+	$default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
325
+	$default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
326
+	$default_email_body .= '{receipt_link}'."\n\n";
327 327
 	$default_email_body .= "\n\n";
328
-	$default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n";
329
-	$default_email_body .= '{sitename}' . "\n";
328
+	$default_email_body .= esc_html__('Sincerely,', 'give')."\n";
329
+	$default_email_body .= '{sitename}'."\n";
330 330
 
331
-	$custom_message = give_get_option( 'donation_receipt' );
331
+	$custom_message = give_get_option('donation_receipt');
332 332
 
333
-	$message = ! empty( $custom_message ) ? $custom_message : $default_email_body;
333
+	$message = ! empty($custom_message) ? $custom_message : $default_email_body;
334 334
 
335
-	return apply_filters( 'give_default_donation_receipt_email', $message );
335
+	return apply_filters('give_default_donation_receipt_email', $message);
336 336
 }
337 337
 
338 338
 /**
@@ -345,22 +345,22 @@  discard block
 block discarded – undo
345 345
  *
346 346
  * @return array $email_names
347 347
  */
348
-function give_get_email_names( $user_info, $payment = false ) {
348
+function give_get_email_names($user_info, $payment = false) {
349 349
 	$email_names = array();
350 350
 
351
-	if ( is_a( $payment, 'Give_Payment' ) ) {
351
+	if (is_a($payment, 'Give_Payment')) {
352 352
 
353
-		if ( $payment->user_id > 0 ) {
353
+		if ($payment->user_id > 0) {
354 354
 
355
-			$user_data               = get_userdata( $payment->user_id );
355
+			$user_data               = get_userdata($payment->user_id);
356 356
 			$email_names['name']     = $payment->first_name;
357
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
357
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
358 358
 			$email_names['username'] = $user_data->user_login;
359 359
 
360
-		} elseif ( ! empty( $payment->first_name ) ) {
360
+		} elseif ( ! empty($payment->first_name)) {
361 361
 
362 362
 			$email_names['name']     = $payment->first_name;
363
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
363
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
364 364
 			$email_names['username'] = $payment->first_name;
365 365
 
366 366
 		} else {
@@ -373,30 +373,30 @@  discard block
 block discarded – undo
373 373
 	} else {
374 374
 
375 375
 		// Support for old serialized data
376
-		if ( is_serialized( $user_info ) ) {
376
+		if (is_serialized($user_info)) {
377 377
 
378 378
 			// Security check.
379
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
380
-			if ( ! empty( $matches ) ) {
379
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
380
+			if ( ! empty($matches)) {
381 381
 				return array(
382 382
 					'name'     => '',
383 383
 					'fullname' => '',
384 384
 					'username' => '',
385 385
 				);
386 386
 			} else {
387
-				$user_info = maybe_unserialize( $user_info );
387
+				$user_info = maybe_unserialize($user_info);
388 388
 			}
389 389
 
390 390
 		}
391 391
 
392
-		if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
393
-			$user_data               = get_userdata( $user_info['id'] );
392
+		if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
393
+			$user_data               = get_userdata($user_info['id']);
394 394
 			$email_names['name']     = $user_info['first_name'];
395
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
395
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
396 396
 			$email_names['username'] = $user_data->user_login;
397
-		} elseif ( isset( $user_info['first_name'] ) ) {
397
+		} elseif (isset($user_info['first_name'])) {
398 398
 			$email_names['name']     = $user_info['first_name'];
399
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
399
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
400 400
 			$email_names['username'] = $user_info['first_name'];
401 401
 		} else {
402 402
 			$email_names['name']     = $user_info['email'];
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load Give file.
18
-include_once( 'give.php' );
18
+include_once('give.php');
19 19
 
20 20
 global $wpdb, $wp_roles;
21 21
 
22 22
 
23
-if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) {
23
+if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) {
24 24
 
25 25
 	// Delete All the Custom Post Types.
26
-	$give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' );
27
-	$give_post_types = array( 'give_forms', 'give_payment', 'give_log' );
28
-	foreach ( $give_post_types as $post_type ) {
26
+	$give_taxonomies = array('form_category', 'form_tag', 'give_log_type');
27
+	$give_post_types = array('give_forms', 'give_payment', 'give_log');
28
+	foreach ($give_post_types as $post_type) {
29 29
 
30
-		$give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) );
31
-		$items           = get_posts( array(
30
+		$give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type));
31
+		$items           = get_posts(array(
32 32
 			'post_type'   => $post_type,
33 33
 			'post_status' => 'any',
34
-			'numberposts' => - 1,
34
+			'numberposts' => -1,
35 35
 			'fields'      => 'ids',
36
-		) );
36
+		));
37 37
 
38
-		if ( $items ) {
39
-			foreach ( $items as $item ) {
40
-				wp_delete_post( $item, true );
38
+		if ($items) {
39
+			foreach ($items as $item) {
40
+				wp_delete_post($item, true);
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45 45
 	// Delete All the Terms & Taxonomies.
46
-	foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) {
46
+	foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) {
47 47
 
48
-		$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
48
+		$terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
49 49
 
50 50
 		// Delete Terms.
51
-		if ( $terms ) {
52
-			foreach ( $terms as $term ) {
53
-				$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
54
-				$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
51
+		if ($terms) {
52
+			foreach ($terms as $term) {
53
+				$wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id));
54
+				$wpdb->delete($wpdb->terms, array('term_id' => $term->term_id));
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Delete Taxonomies.
59
-		$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
59
+		$wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s'));
60 60
 	}
61 61
 
62 62
 	// Delete the Plugin Pages.
63
-	$give_created_pages = array( 'success_page', 'failure_page', 'history_page' );
64
-	foreach ( $give_created_pages as $p ) {
65
-		$page = give_get_option( $p, false );
66
-		if ( $page ) {
67
-			wp_delete_post( $page, true );
63
+	$give_created_pages = array('success_page', 'failure_page', 'history_page');
64
+	foreach ($give_created_pages as $p) {
65
+		$page = give_get_option($p, false);
66
+		if ($page) {
67
+			wp_delete_post($page, true);
68 68
 		}
69 69
 	}
70 70
 
@@ -73,21 +73,21 @@  discard block
 block discarded – undo
73 73
 	Give()->roles->remove_caps();
74 74
 
75 75
 	// Delete the Roles.
76
-	$give_roles = array( 'give_manager', 'give_accountant', 'give_worker', 'give_donor' );
77
-	foreach ( $give_roles as $role ) {
78
-		remove_role( $role );
76
+	$give_roles = array('give_manager', 'give_accountant', 'give_worker', 'give_donor');
77
+	foreach ($give_roles as $role) {
78
+		remove_role($role);
79 79
 	}
80 80
 
81 81
 	// Remove all database tables.
82
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' );
83
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' );
84
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' );
82
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors');
83
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers');
84
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta');
85 85
 
86 86
 	// Cleanup Cron Events.
87
-	wp_clear_scheduled_hook( 'give_daily_scheduled_events' );
88
-	wp_clear_scheduled_hook( 'give_weekly_scheduled_events' );
89
-	wp_clear_scheduled_hook( 'give_daily_cron' );
90
-	wp_clear_scheduled_hook( 'give_weekly_cron' );
87
+	wp_clear_scheduled_hook('give_daily_scheduled_events');
88
+	wp_clear_scheduled_hook('give_weekly_scheduled_events');
89
+	wp_clear_scheduled_hook('give_daily_cron');
90
+	wp_clear_scheduled_hook('give_weekly_cron');
91 91
 
92 92
 	// Get all options.
93 93
 	$give_option_names = $wpdb->get_col(
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 		)
98 98
 	);
99 99
 
100
-	if ( ! empty( $give_option_names ) ) {
100
+	if ( ! empty($give_option_names)) {
101 101
 		// Convert option name to transient or option name.
102 102
 		$new_give_option_names = array();
103 103
 
104 104
 		// Delete all the Plugin Options.
105
-		foreach ( $give_option_names as $option ) {
106
-			if ( false !== strpos( $option, 'give_cache' ) ) {
107
-				Give_Cache::delete( $option );
105
+		foreach ($give_option_names as $option) {
106
+			if (false !== strpos($option, 'give_cache')) {
107
+				Give_Cache::delete($option);
108 108
 			} else {
109
-				delete_option( $option );
109
+				delete_option($option);
110 110
 			}
111 111
 		}
112 112
 	}
Please login to merge, or discard this patch.
includes/admin/reports/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
 							tickFormatter: function(val) {
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @param Give_Graph $this Graph object.
325 325
 		 */
326
-		do_action( 'give_before_graph', $this );
326
+		do_action('give_before_graph', $this);
327 327
 
328 328
 		// Build the graph.
329 329
 		echo $this->build_graph();
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @param Give_Graph $this Graph object.
337 337
 		 */
338
-		do_action( 'give_after_graph', $this );
338
+		do_action('give_after_graph', $this);
339 339
 	}
340 340
 
341 341
 }
Please login to merge, or discard this patch.