Test Failed
Push — master ( 2f4c9e...518013 )
by Devin
06:05
created
includes/admin/emails/class-new-offline-donation-email.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if access directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19
-if ( ! class_exists( 'Give_New_Offline_Donation_Email' ) ) :
19
+if ( ! class_exists('Give_New_Offline_Donation_Email')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_New_Offline_Donation_Email
@@ -36,33 +36,33 @@  discard block
 block discarded – undo
36 36
 		 */
37 37
 		public function init() {
38 38
 			// Initialize empty payment.
39
-			$this->payment = new Give_Payment( 0 );
39
+			$this->payment = new Give_Payment(0);
40 40
 
41
-			$this->load( array(
41
+			$this->load(array(
42 42
 				'id'                           => 'new-offline-donation',
43
-				'label'                        => __( 'New Offline Donation', 'give' ),
44
-				'description'                  => __( 'Sent to designated recipient(s) for a new (pending) offline donation.', 'give' ),
43
+				'label'                        => __('New Offline Donation', 'give'),
44
+				'description'                  => __('Sent to designated recipient(s) for a new (pending) offline donation.', 'give'),
45 45
 				'has_recipient_field'          => true,
46
-				'notification_status'          => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled',
46
+				'notification_status'          => give_is_gateway_active('offline') ? 'enabled' : 'disabled',
47 47
 				'notification_status_editable' => false,
48 48
 				'preview_email_tags_values'    => array(
49
-					'payment_method' => esc_html__( 'Offline', 'give' ),
49
+					'payment_method' => esc_html__('Offline', 'give'),
50 50
 				),
51 51
 				'default_email_subject'        => $this->get_default_email_subject(),
52 52
 				'default_email_message'        => $this->get_default_email_message(),
53
-				'default_email_header'         => __( 'New Offline Donation!', 'give' ),
53
+				'default_email_header'         => __('New Offline Donation!', 'give'),
54 54
 				'notices' => array(
55 55
 					'non-notification-status-editable' => sprintf(
56 56
 						'%1$s <a href="%2$s">%3$s &raquo;</a>',
57
-						__( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ),
58
-						esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations') ),
59
-						__( 'Edit Setting', 'give' )
57
+						__('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'),
58
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations')),
59
+						__('Edit Setting', 'give')
60 60
 					)
61 61
 				),
62
-			) );
62
+			));
63 63
 
64
-			add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) );
65
-			add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
64
+			add_action('give_insert_payment', array($this, 'setup_email_notification'));
65
+			add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2);
66 66
 		}
67 67
 
68 68
 		/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			 */
82 82
 			$subject = apply_filters(
83 83
 				'give_offline_admin_donation_notification_subject',
84
-				__( 'New Pending Donation', 'give' )
84
+				__('New Pending Donation', 'give')
85 85
 			);
86 86
 
87 87
 			/**
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
 		 * @return string
107 107
 		 */
108 108
 		public function get_default_email_message() {
109
-			$message = __( 'Dear Admin,', 'give' ) . "\n\n";
110
-			$message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' ';
111
-			$message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
109
+			$message = __('Dear Admin,', 'give')."\n\n";
110
+			$message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' ';
111
+			$message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
112 112
 
113
-			$message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
114
-			$message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
113
+			$message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
114
+			$message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
115 115
 
116 116
 			$message .= sprintf(
117 117
 				'<a href="%1$s">%2$s</a>',
118
-				admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $this->payment->ID ),
119
-				__( 'Click Here to View and/or Update Donation Details', 'give' )
120
-			) . "\n\n";
118
+				admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$this->payment->ID),
119
+				__('Click Here to View and/or Update Donation Details', 'give')
120
+			)."\n\n";
121 121
 
122 122
 			/**
123 123
 			 * Filter the donation receipt email message
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 		 *
156 156
 		 * @return string
157 157
 		 */
158
-		public function get_email_message( $form_id = null ) {
158
+		public function get_email_message($form_id = null) {
159 159
 			$message = Give_Email_Notification_Util::get_value(
160 160
 				$this,
161
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
161
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
162 162
 				$form_id,
163 163
 				$this->config['default_email_message']
164 164
 			);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		 *
199 199
 		 * @return array
200 200
 		 */
201
-		public function get_email_attachments( $form_id = null ) {
201
+		public function get_email_attachments($form_id = null) {
202 202
 			/**
203 203
 			 * Filter the attachments.
204 204
 			 * Note: This filter will deprecate soon.
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 		 *
250 250
 		 * @param int $payment_id
251 251
 		 */
252
-		public function setup_email_notification( $payment_id ) {
253
-			$this->payment = new Give_Payment( $payment_id );
252
+		public function setup_email_notification($payment_id) {
253
+			$this->payment = new Give_Payment($payment_id);
254 254
 
255 255
 			// Exit if not donation was not with offline donation.
256
-			if ( 'offline' !== $this->payment->gateway ) {
256
+			if ('offline' !== $this->payment->gateway) {
257 257
 				return;
258 258
 			}
259 259
 
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 			$this->setup_email_data();
262 262
 
263 263
 			// Send email.
264
-			$this->send_email_notification( array(
264
+			$this->send_email_notification(array(
265 265
 				'payment_id' => $this->payment->ID,
266
-			) );
266
+			));
267 267
 		}
268 268
 
269 269
 		/**
@@ -275,18 +275,18 @@  discard block
 block discarded – undo
275 275
 		 * @param $update_options
276 276
 		 * @param $option_name
277 277
 		 */
278
-		public function set_notification_status( $update_options, $option_name ) {
278
+		public function set_notification_status($update_options, $option_name) {
279 279
 			// Get updated settings.
280 280
 			$update_options = give_get_settings();
281 281
 
282
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
282
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
283 283
 
284 284
 			if (
285
-				empty( $update_options[ "{$this->config['id']}_notification" ] )
286
-				|| $notification_status !== $update_options[ "{$this->config['id']}_notification" ]
285
+				empty($update_options["{$this->config['id']}_notification"])
286
+				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
287 287
 			) {
288
-				$update_options[ "{$this->config['id']}_notification" ] = $notification_status;
289
-				update_option( $option_name, $update_options, false );
288
+				$update_options["{$this->config['id']}_notification"] = $notification_status;
289
+				update_option($option_name, $update_options, false);
290 290
 			}
291 291
 		}
292 292
 
@@ -301,13 +301,13 @@  discard block
 block discarded – undo
301 301
 		 *
302 302
 		 * @return array
303 303
 		 */
304
-		public function add_metabox_setting_field( $settings, $form_id ) {
304
+		public function add_metabox_setting_field($settings, $form_id) {
305 305
 
306
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
306
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
307 307
 				$settings[] = array(
308 308
 					'id'     => $this->config['id'],
309 309
 					'title'  => $this->config['label'],
310
-					'fields' => $this->get_setting_fields( $form_id ),
310
+					'fields' => $this->get_setting_fields($form_id),
311 311
 				);
312 312
 			}
313 313
 
Please login to merge, or discard this patch.
includes/admin/emails/class-donation-receipt-email.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if access directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Donation_Receipt_Email' ) ) :
18
+if ( ! class_exists('Give_Donation_Receipt_Email')) :
19 19
 
20 20
 	/**
21 21
 	 * Give_Donation_Receipt_Email
@@ -35,22 +35,22 @@  discard block
 block discarded – undo
35 35
 		 */
36 36
 		public function init() {
37 37
 			// Initialize empty payment.
38
-			$this->payment = new Give_Payment( 0 );
38
+			$this->payment = new Give_Payment(0);
39 39
 
40
-			$this->load( array(
40
+			$this->load(array(
41 41
 				'id'                   => 'donation-receipt',
42
-				'label'                => __( 'Donation Receipt', 'give' ),
43
-				'description'          => __( 'Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give' ),
42
+				'label'                => __('Donation Receipt', 'give'),
43
+				'description'          => __('Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give'),
44 44
 				'notification_status'  => 'enabled',
45 45
 				'form_metabox_setting' => true,
46
-				'recipient_group_name' => __( 'Donor', 'give' ),
47
-				'default_email_subject' => esc_attr__( 'Donation Receipt', 'give' ),
46
+				'recipient_group_name' => __('Donor', 'give'),
47
+				'default_email_subject' => esc_attr__('Donation Receipt', 'give'),
48 48
 				'default_email_message' => give_get_default_donation_receipt_email(),
49
-				'default_email_header'  => __( 'Donation Receipt', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('Donation Receipt', 'give'),
50
+			));
51 51
 
52
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_donation_receipt' ) );
53
-			add_action( 'give_email_links', array( $this, 'resend_donation_receipt' ) );
52
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'send_donation_receipt'));
53
+			add_action('give_email_links', array($this, 'resend_donation_receipt'));
54 54
 		}
55 55
 
56 56
 		/**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		 * @param int $form_id
63 63
 		 * @return string
64 64
 		 */
65
-		public function get_email_subject( $form_id = null ) {
65
+		public function get_email_subject($form_id = null) {
66 66
 			$subject = wp_strip_all_tags(
67 67
 				Give_Email_Notification_Util::get_value(
68 68
 					$this,
69
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
69
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
70 70
 					$form_id,
71 71
 					$this->config['default_email_subject']
72 72
 				)
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 		 * @param int $form_id
110 110
 		 * @return string
111 111
 		 */
112
-		public function get_email_message( $form_id = null ) {
112
+		public function get_email_message($form_id = null) {
113 113
 			$message = Give_Email_Notification_Util::get_value(
114 114
 				$this,
115
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
115
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
116 116
 				$form_id,
117 117
 				$this->config['default_email_message']
118 118
 			);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			 * @since 1.0
125 125
 			 */
126 126
 			$message = apply_filters(
127
-				'give_donation_receipt_' . Give()->emails->get_template(),
127
+				'give_donation_receipt_'.Give()->emails->get_template(),
128 128
 				$message,
129 129
 				$this->payment->ID,
130 130
 				$this->payment->payment_meta
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		 * @param int $form_id
168 168
 		 * @return array
169 169
 		 */
170
-		public function get_email_attachments( $form_id = null) {
170
+		public function get_email_attachments($form_id = null) {
171 171
 			/**
172 172
 			 * Filter the attachments.
173 173
 			 * Note: this filter will deprecate soon.
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 				$this->payment->payment_meta
237 237
 			);
238 238
 
239
-			Give()->emails->__set( 'from_name', $from_name );
240
-			Give()->emails->__set( 'from_email', $from_email );
239
+			Give()->emails->__set('from_name', $from_name);
240
+			Give()->emails->__set('from_email', $from_email);
241 241
 
242 242
 			/**
243 243
 			 * Filters the donation receipt's email headers.
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				$this->payment->payment_meta
255 255
 			);
256 256
 
257
-			Give()->emails->__set( 'headers', $headers );
257
+			Give()->emails->__set('headers', $headers);
258 258
 		}
259 259
 
260 260
 		/**
@@ -265,16 +265,16 @@  discard block
 block discarded – undo
265 265
 		 *
266 266
 		 * @param $payment_id
267 267
 		 */
268
-		public function send_donation_receipt( $payment_id ) {
269
-			$this->payment = new Give_Payment( $payment_id );
268
+		public function send_donation_receipt($payment_id) {
269
+			$this->payment = new Give_Payment($payment_id);
270 270
 
271 271
 			// Setup email data.
272 272
 			$this->setup_email_data();
273 273
 
274 274
 			// Send email.
275
-			$this->send_email_notification( array(
275
+			$this->send_email_notification(array(
276 276
 				'payment_id' => $this->payment->ID,
277
-			) );
277
+			));
278 278
 		}
279 279
 
280 280
 		/**
@@ -285,35 +285,35 @@  discard block
 block discarded – undo
285 285
 		 *
286 286
 		 * @param array $data Donation details.
287 287
 		 */
288
-		public function resend_donation_receipt( $data ) {
289
-			$purchase_id = absint( $data['purchase_id'] );
288
+		public function resend_donation_receipt($data) {
289
+			$purchase_id = absint($data['purchase_id']);
290 290
 
291
-			if ( empty( $purchase_id ) ) {
291
+			if (empty($purchase_id)) {
292 292
 				return;
293 293
 			}
294 294
 
295 295
 			// Get donation payment information.
296
-			$this->payment = new Give_Payment( $purchase_id );
296
+			$this->payment = new Give_Payment($purchase_id);
297 297
 
298
-			if ( ! current_user_can( 'edit_give_payments', $this->payment->ID ) ) {
299
-				wp_die( esc_html__( 'You do not have permission to edit donations.', 'give' ), esc_html__( 'Error', 'give' ), array(
298
+			if ( ! current_user_can('edit_give_payments', $this->payment->ID)) {
299
+				wp_die(esc_html__('You do not have permission to edit donations.', 'give'), esc_html__('Error', 'give'), array(
300 300
 					'response' => 403,
301
-				) );
301
+				));
302 302
 			}
303 303
 
304 304
 			// Setup email data.
305 305
 			$this->setup_email_data();
306 306
 
307 307
 			// Send email.
308
-			$this->send_email_notification( array(
308
+			$this->send_email_notification(array(
309 309
 				'payment_id' => $this->payment->ID,
310
-			) );
310
+			));
311 311
 
312
-			wp_redirect( add_query_arg( array(
312
+			wp_redirect(add_query_arg(array(
313 313
 				'give-messages[]' => 'email-sent',
314 314
 				'give-action'     => false,
315 315
 				'purchase_id'     => false,
316
-			) ) );
316
+			)));
317 317
 			exit;
318 318
 		}
319 319
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donation-email.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if access directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
20
-if ( ! class_exists( 'Give_New_Donation_Email' ) ) :
20
+if ( ! class_exists('Give_New_Donation_Email')) :
21 21
 
22 22
 	/**
23 23
 	 * Give_New_Donation_Email
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
 		 */
38 38
 		public function init() {
39 39
 			// Initialize empty payment.
40
-			$this->payment = new Give_Payment( 0 );
40
+			$this->payment = new Give_Payment(0);
41 41
 
42
-			$this->load( array(
42
+			$this->load(array(
43 43
 				'id'                    => 'new-donation',
44
-				'label'                 => __( 'New Donation', 'give' ),
45
-				'description'           => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ),
44
+				'label'                 => __('New Donation', 'give'),
45
+				'description'           => __('Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give'),
46 46
 				'has_recipient_field'   => true,
47 47
 				'notification_status'   => 'enabled',
48 48
 				'form_metabox_setting'  => true,
49
-				'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ),
49
+				'default_email_subject' => esc_attr__('New Donation - #{payment_id}', 'give'),
50 50
 				'default_email_message' => give_get_default_donation_notification_email(),
51
-				'default_email_header'  => __( 'New Donation!', 'give' ),
52
-			) );
51
+				'default_email_header'  => __('New Donation!', 'give'),
52
+			));
53 53
 
54
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ) );
54
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'));
55 55
 		}
56 56
 
57 57
 		/**
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		 *
65 65
 		 * @return string
66 66
 		 */
67
-		public function get_email_subject( $form_id = null ) {
67
+		public function get_email_subject($form_id = null) {
68 68
 			$subject = wp_strip_all_tags(
69 69
 				Give_Email_Notification_Util::get_value(
70 70
 					$this,
71
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
71
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
72 72
 					$form_id,
73 73
 					$this->config['default_email_subject']
74 74
 				)
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 			 *
81 81
 			 * @since 1.0
82 82
 			 */
83
-			$subject = apply_filters( 'give_admin_donation_notification_subject', $subject, $this->payment->ID );
83
+			$subject = apply_filters('give_admin_donation_notification_subject', $subject, $this->payment->ID);
84 84
 
85 85
 			/**
86 86
 			 * Filters the donation notification subject.
87 87
 			 *
88 88
 			 * @since 2.0
89 89
 			 */
90
-			$subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id );
90
+			$subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id);
91 91
 
92 92
 			return $subject;
93 93
 		}
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @return string
105 105
 		 */
106
-		public function get_email_message( $form_id = null ) {
106
+		public function get_email_message($form_id = null) {
107 107
 			$message = Give_Email_Notification_Util::get_value(
108 108
 				$this,
109
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
109
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
110 110
 				$form_id,
111 111
 				$this->config['default_email_message']
112 112
 			);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		 * @param int $form_id
150 150
 		 * @return array
151 151
 		 */
152
-		public function get_email_attachments( $form_id = null ) {
152
+		public function get_email_attachments($form_id = null) {
153 153
 			/**
154 154
 			 * Filters the donation notification email attachments.
155 155
 			 * By default, there is no attachment but plugins can hook in to provide one more multiple.
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 				$this->payment->payment_meta
213 213
 			);
214 214
 
215
-			Give()->emails->__set( 'from_name', $from_name );
216
-			Give()->emails->__set( 'from_email', $from_email );
215
+			Give()->emails->__set('from_name', $from_name);
216
+			Give()->emails->__set('from_email', $from_email);
217 217
 
218 218
 			/**
219 219
 			 * Filters the donation notification email headers.
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 				$this->payment->payment_meta
228 228
 			);
229 229
 
230
-			Give()->emails->__set( 'headers', $headers );
230
+			Give()->emails->__set('headers', $headers);
231 231
 		}
232 232
 
233 233
 		/**
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 		 *
239 239
 		 * @param int $payment_id
240 240
 		 */
241
-		public function setup_email_notification( $payment_id ) {
242
-			$this->payment = new Give_Payment( $payment_id );
241
+		public function setup_email_notification($payment_id) {
242
+			$this->payment = new Give_Payment($payment_id);
243 243
 
244 244
 			// Set email data.
245 245
 			$this->setup_email_data();
246 246
 
247 247
 			// Send email.
248
-			$this->send_email_notification( array(
248
+			$this->send_email_notification(array(
249 249
 				'payment_id' => $payment_id,
250
-			) );
250
+			));
251 251
 		}
252 252
 	}
253 253
 
Please login to merge, or discard this patch.
includes/admin/emails/class-email-access-email.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if access directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Email_Access_Email' ) ) :
18
+if ( ! class_exists('Give_Email_Access_Email')) :
19 19
 
20 20
 	/**
21 21
 	 * Give_Email_Access_Email
@@ -31,31 +31,31 @@  discard block
 block discarded – undo
31 31
 		 * @since  2.0
32 32
 		 */
33 33
 		public function init() {
34
-			$this->load( array(
34
+			$this->load(array(
35 35
 				'id'                           => 'email-access',
36
-				'label'                        => __( 'Email access', 'give' ),
37
-				'description'                  => __( 'Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give' ),
38
-				'notification_status'          => give_get_option( 'email_access', 'disabled' ),
36
+				'label'                        => __('Email access', 'give'),
37
+				'description'                  => __('Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give'),
38
+				'notification_status'          => give_get_option('email_access', 'disabled'),
39 39
 				'form_metabox_setting'         => false,
40 40
 				'notification_status_editable' => false,
41 41
 				'email_tag_context'            => 'donor',
42
-				'recipient_group_name'         => __( 'Donor', 'give' ),
43
-				'default_email_subject'        => sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ),
42
+				'recipient_group_name'         => __('Donor', 'give'),
43
+				'default_email_subject'        => sprintf(__('Please confirm your email for %s', 'give'), get_bloginfo('url')),
44 44
 				'default_email_message'        => $this->get_default_email_message(),
45
-				'default_email_header'         => __( 'Confirm Email', 'give' ),
45
+				'default_email_header'         => __('Confirm Email', 'give'),
46 46
 				'notices' => array(
47 47
 					'non-notification-status-editable' => sprintf(
48 48
 						'%1$s <a href="%2$s">%3$s &raquo;</a>',
49
-						__( 'This notification is automatically toggled based on whether the email access is enabled or not.', 'give' ),
50
-						esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general&section=access-control') ),
51
-						__( 'Edit Setting', 'give' )
49
+						__('This notification is automatically toggled based on whether the email access is enabled or not.', 'give'),
50
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general&section=access-control')),
51
+						__('Edit Setting', 'give')
52 52
 					)
53 53
 				),
54
-			) );
54
+			));
55 55
 
56
-			add_filter( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ), 10, 2 );
57
-			add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
58
-			add_filter( 'give_email_preview_header', array( $this, 'email_preview_header' ), 10, 2 );
56
+			add_filter("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'), 10, 2);
57
+			add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2);
58
+			add_filter('give_email_preview_header', array($this, 'email_preview_header'), 10, 2);
59 59
 		}
60 60
 
61 61
 		/**
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 		 *
69 69
 		 * @return string
70 70
 		 */
71
-		public function get_email_subject( $form_id = null ) {
71
+		public function get_email_subject($form_id = null) {
72 72
 			$subject = wp_strip_all_tags(
73 73
 				Give_Email_Notification_Util::get_value(
74 74
 					$this,
75
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
75
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
76 76
 					$form_id,
77 77
 					$this->config['default_email_subject']
78 78
 				)
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 			 *
85 85
 			 * @since 1.0
86 86
 			 */
87
-			$subject = apply_filters( 'give_email_access_token_subject', $subject );
87
+			$subject = apply_filters('give_email_access_token_subject', $subject);
88 88
 
89 89
 			/**
90 90
 			 * Filters the donation notification subject.
91 91
 			 *
92 92
 			 * @since 2.0
93 93
 			 */
94
-			$subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id );
94
+			$subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id);
95 95
 
96 96
 			return $subject;
97 97
 		}
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 		 *
108 108
 		 * @return string
109 109
 		 */
110
-		public function get_email_message( $form_id = null ) {
110
+		public function get_email_message($form_id = null) {
111 111
 			$message = Give_Email_Notification_Util::get_value(
112 112
 				$this,
113
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
113
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
114 114
 				$form_id,
115 115
 				$this->config['default_email_message']
116 116
 			);
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 			 *
122 122
 			 * @since 1.0
123 123
 			 */
124
-			$message = apply_filters( 'give_email_access_token_message', $message );
124
+			$message = apply_filters('give_email_access_token_message', $message);
125 125
 
126 126
 			/**
127 127
 			 * Filter the email message
128 128
 			 *
129 129
 			 * @since 2.0
130 130
 			 */
131
-			$message = apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id );
131
+			$message = apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id);
132 132
 
133 133
 			return $message;
134 134
 		}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @param int $form_id
144 144
 		 * @return array
145 145
 		 */
146
-		public function get_email_attachments( $form_id = null ) {
146
+		public function get_email_attachments($form_id = null) {
147 147
 			/**
148 148
 			 * Filters the donation notification email attachments.
149 149
 			 * By default, there is no attachment but plugins can hook in to provide one more multiple.
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			 *
152 152
 			 * @since 1.0
153 153
 			 */
154
-			$attachments = apply_filters( 'give_admin_donation_notification_attachments', array() );
154
+			$attachments = apply_filters('give_admin_donation_notification_attachments', array());
155 155
 
156 156
 			/**
157 157
 			 * Filters the donation notification email attachments.
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			 *
160 160
 			 * @since 2.0
161 161
 			 */
162
-			$attachments = apply_filters( "give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id );
162
+			$attachments = apply_filters("give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id);
163 163
 
164 164
 			return $attachments;
165 165
 		}
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 		 * @return string
175 175
 		 */
176 176
 		public function get_default_email_message() {
177
-			$message = __( 'Please click the link to access your donation history on {site_url}. If you did not request this email, please contact {admin_email}.', 'give' ) . "\n\n";
178
-			$message .= '{email_access_link}' . "\n\n";
177
+			$message = __('Please click the link to access your donation history on {site_url}. If you did not request this email, please contact {admin_email}.', 'give')."\n\n";
178
+			$message .= '{email_access_link}'."\n\n";
179 179
 			$message .= "\n\n";
180
-			$message .= __( 'Sincerely,', 'give' ) . "\n";
181
-			$message .= get_bloginfo( 'name' ) . "\n";
180
+			$message .= __('Sincerely,', 'give')."\n";
181
+			$message .= get_bloginfo('name')."\n";
182 182
 
183 183
 			/**
184 184
 			 * Filter the new donation email message
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			 *
188 188
 			 * @param string $message
189 189
 			 */
190
-			return apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this );
190
+			return apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this);
191 191
 		}
192 192
 
193 193
 
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 		 *
202 202
 		 * @return string
203 203
 		 */
204
-		public function get_email_header( $form_id = null ) {
205
-			$subject = parent::get_email_header( $form_id );
204
+		public function get_email_header($form_id = null) {
205
+			$subject = parent::get_email_header($form_id);
206 206
 
207 207
 			/**
208 208
 			 * Filter the email header
209 209
 			 *
210 210
 			 * @since 1.0
211 211
 			 */
212
-			$subject  =  apply_filters( 'give_email_access_token_heading', $subject );
212
+			$subject = apply_filters('give_email_access_token_heading', $subject);
213 213
 
214 214
 			return  $subject;
215 215
 		}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			 *
228 228
 			 * @since 1.0
229 229
 			 */
230
-			$from_name = apply_filters( 'give_donation_from_name', Give()->emails->get_from_name() );
230
+			$from_name = apply_filters('give_donation_from_name', Give()->emails->get_from_name());
231 231
 
232 232
 			/**
233 233
 			 * Filters the from email.
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
 			 *
236 236
 			 * @since 1.0
237 237
 			 */
238
-			$from_email = apply_filters( 'give_donation_from_address', Give()->emails->get_from_address() );
238
+			$from_email = apply_filters('give_donation_from_address', Give()->emails->get_from_address());
239 239
 
240
-			Give()->emails->__set( 'from_name', $from_name );
241
-			Give()->emails->__set( 'from_email', $from_email );
240
+			Give()->emails->__set('from_name', $from_name);
241
+			Give()->emails->__set('from_email', $from_email);
242 242
 
243 243
 			/**
244 244
 			 * Filters the donation notification email headers.
245 245
 			 *
246 246
 			 * @since 1.0
247 247
 			 */
248
-			$headers = apply_filters( 'give_admin_donation_notification_headers', Give()->emails->get_headers() );
248
+			$headers = apply_filters('give_admin_donation_notification_headers', Give()->emails->get_headers());
249 249
 
250
-			Give()->emails->__set( 'headers', $headers );
250
+			Give()->emails->__set('headers', $headers);
251 251
 		}
252 252
 
253 253
 		/**
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 		 *
262 262
 		 * @return bool
263 263
 		 */
264
-		public function setup_email_notification( $donor_id, $email ) {
265
-			$donor = Give()->donors->get_donor_by( 'email', $email );
264
+		public function setup_email_notification($donor_id, $email) {
265
+			$donor = Give()->donors->get_donor_by('email', $email);
266 266
 			$this->recipient_email = $email;
267 267
 
268 268
 			// Set email data.
@@ -287,17 +287,17 @@  discard block
 block discarded – undo
287 287
 		 * @param $update_options
288 288
 		 * @param $option_name
289 289
 		 */
290
-		public function set_notification_status( $update_options, $option_name ) {
290
+		public function set_notification_status($update_options, $option_name) {
291 291
 			// Get updated settings.
292 292
 			$update_options = give_get_settings();
293 293
 
294 294
 			if (
295
-				! empty( $update_options['email_access'] )
296
-				&& ! empty( $update_options[ "{$this->config['id']}_notification" ] )
297
-				&& $update_options['email_access'] !== $update_options[ "{$this->config['id']}_notification" ]
295
+				! empty($update_options['email_access'])
296
+				&& ! empty($update_options["{$this->config['id']}_notification"])
297
+				&& $update_options['email_access'] !== $update_options["{$this->config['id']}_notification"]
298 298
 			) {
299
-				$update_options[ "{$this->config['id']}_notification" ] = $update_options['email_access'];
300
-				update_option( $option_name, $update_options, false );
299
+				$update_options["{$this->config['id']}_notification"] = $update_options['email_access'];
300
+				update_option($option_name, $update_options, false);
301 301
 			}
302 302
 		}
303 303
 
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 		 * @param Give_Email_Access_Email $email
313 313
 		 * @return string
314 314
 		 */
315
-		public function email_preview_header( $email_preview_header, $email ) {
316
-			if( $this->config['id'] === $email->config['id'] ) {
315
+		public function email_preview_header($email_preview_header, $email) {
316
+			if ($this->config['id'] === $email->config['id']) {
317 317
 				$email_preview_header = '';
318 318
 			}
319 319
 
Please login to merge, or discard this patch.
includes/donors/class-give-donor-wall.php 1 patch
Spacing   +39 added lines, -39 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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @return Give_Donor_Wall
51 51
 	 */
52 52
 	public static function get_instance() {
53
-		if ( null === static::$instance ) {
53
+		if (null === static::$instance) {
54 54
 			self::$instance = new static();
55 55
 
56 56
 			self::$instance->setup_actions();
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function setup_actions() {
70 70
 
71
-		add_shortcode( 'give_donor_wall', array( $this, 'render_shortcode' ) );
71
+		add_shortcode('give_donor_wall', array($this, 'render_shortcode'));
72 72
 
73
-		add_action( 'wp_ajax_give_get_donor_comments', array( $this, 'ajax_handler' ) );
74
-		add_action( 'wp_ajax_nopriv_give_get_donor_comments', array( $this, 'ajax_handler' ) );
73
+		add_action('wp_ajax_give_get_donor_comments', array($this, 'ajax_handler'));
74
+		add_action('wp_ajax_nopriv_give_get_donor_comments', array($this, 'ajax_handler'));
75 75
 
76 76
 	}
77 77
 
@@ -107,29 +107,29 @@  discard block
 block discarded – undo
107 107
 	 * }
108 108
 	 * @return string|bool The markup of the form grid or false.
109 109
 	 */
110
-	public function render_shortcode( $atts ) {
110
+	public function render_shortcode($atts) {
111 111
 
112 112
 		$give_settings = give_get_settings();
113 113
 
114
-		$atts        = $this->parse_atts( $atts );
115
-		$donor_query = $this->get_donor_query_atts( $atts );
116
-		$donors      = $this->get_donors( $donor_query );
114
+		$atts        = $this->parse_atts($atts);
115
+		$donor_query = $this->get_donor_query_atts($atts);
116
+		$donors      = $this->get_donors($donor_query);
117 117
 		$html        = '';
118 118
 
119
-		if ( $donors ) {
119
+		if ($donors) {
120 120
 
121 121
 			ob_start();
122 122
 
123
-			foreach ( $donors as $donor ) {
123
+			foreach ($donors as $donor) {
124 124
 				// Give/templates/shortcode-donor-wall.php.
125
-				give_get_template( 'shortcode-donor-wall', array( $donor, $give_settings, $atts ) );
125
+				give_get_template('shortcode-donor-wall', array($donor, $give_settings, $atts));
126 126
 			}
127 127
 
128 128
 			$html = ob_get_clean();
129 129
 
130 130
 			// Return only donor html.
131 131
 			if (
132
-				isset( $atts['only_donor_html'] )
132
+				isset($atts['only_donor_html'])
133 133
 				&& wp_doing_ajax()
134 134
 				&& $atts['only_donor_html']
135 135
 			) {
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 		$next_donor_query['fields'] = 'id';
143 143
 
144 144
 		$more_btn_html = '';
145
-		if ( $this->get_donors( $next_donor_query ) ) {
145
+		if ($this->get_donors($next_donor_query)) {
146 146
 			$more_btn_html = sprintf(
147 147
 				'<button class="give-donor__load_more give-button-with-loader" data-shortcode="%1$s"><span class="give-loading-animation"></span>%2$s</button>',
148
-				rawurlencode( http_build_query( $atts ) ),
148
+				rawurlencode(http_build_query($atts)),
149 149
 				$atts['loadmore_text']
150 150
 			);
151 151
 		}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		$html = $html
154 154
 			? sprintf(
155 155
 				'<div class="give-wrap give-grid-ie-utility"><div class="give-grid give-grid--%1$s">%2$s</div>%3$s</div>',
156
-				esc_attr( $atts['columns'] ),
156
+				esc_attr($atts['columns']),
157 157
 				$html,
158 158
 				$more_btn_html
159 159
 			)
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return array
174 174
 	 */
175
-	public function parse_atts( $atts ) {
175
+	public function parse_atts($atts) {
176 176
 		$atts = shortcode_atts(
177 177
 			array(
178 178
 				'donors_per_page' => 20,
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 				'show_comments'   => true,
188 188
 				'comment_length'  => 20,
189 189
 				'only_comments'   => true,
190
-				'readmore_text'   => esc_html__( 'Read More', 'give' ),
191
-				'loadmore_text'   => esc_html__( 'Load More', 'give' ),
190
+				'readmore_text'   => esc_html__('Read More', 'give'),
191
+				'loadmore_text'   => esc_html__('Load More', 'give'),
192 192
 				'avatar_size'     => 60,
193 193
 				'orderby'         => 'donation_count',
194 194
 				'order'           => 'DESC',
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		);
199 199
 
200 200
 		// Validate integer attributes.
201
-		$atts['donors_per_page'] = absint( $atts['donors_per_page'] );
201
+		$atts['donors_per_page'] = absint($atts['donors_per_page']);
202 202
 
203 203
 		// Validate boolean attributes.
204 204
 		$boolean_attributes = array(
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
 			'only_donor_html',
214 214
 		);
215 215
 
216
-		foreach ( $boolean_attributes as $att ) {
216
+		foreach ($boolean_attributes as $att) {
217 217
 			// Convert numeric to boolean.
218 218
 			// It will prevent condition check against boolean value.
219
-			if ( is_numeric( $atts[ $att ] ) ) {
220
-				$atts[ $att ] = (bool) $atts[ $att ];
219
+			if (is_numeric($atts[$att])) {
220
+				$atts[$att] = (bool) $atts[$att];
221 221
 			}
222 222
 
223
-			$atts[ $att ] = filter_var( $atts[ $att ], FILTER_VALIDATE_BOOLEAN );
223
+			$atts[$att] = filter_var($atts[$att], FILTER_VALIDATE_BOOLEAN);
224 224
 		}
225 225
 
226 226
 		return $atts;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @return array
238 238
 	 */
239
-	public function get_donor_query_atts( $atts ) {
239
+	public function get_donor_query_atts($atts) {
240 240
 		// Set default form query args.
241 241
 		$donor_args = array(
242 242
 			'number'  => $atts['donors_per_page'],
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		);
247 247
 
248 248
 		// Hide donors with zero donation amount.
249
-		if ( $atts['hide_empty'] ) {
249
+		if ($atts['hide_empty']) {
250 250
 			$donor_args['donation_amount'] = array(
251 251
 				'compare' => '>=',
252 252
 				'amount'  => 1,
@@ -254,18 +254,18 @@  discard block
 block discarded – undo
254 254
 		}
255 255
 
256 256
 		// Show donor who donated to specific form.
257
-		if ( $atts['form_id'] ) {
257
+		if ($atts['form_id']) {
258 258
 			$donor_args['give_forms'] = $atts['form_id'];
259 259
 		}
260 260
 
261 261
 		// Show donor by id.
262
-		if ( $atts['ids'] ) {
262
+		if ($atts['ids']) {
263 263
 			$donor_args['donor'] = $atts['ids'];
264 264
 		}
265 265
 
266 266
 		// Replace donation with purchase because donor table has that prefix in column name.
267 267
 		$donor_args['orderby'] = str_replace(
268
-			array( 'donation', 'amount' ), array(
268
+			array('donation', 'amount'), array(
269 269
 				'purchase',
270 270
 				'value',
271 271
 			), $atts['orderby']
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 			'date_created'         => 'DESC',
278 278
 		);
279 279
 
280
-		unset( $donor_args['order'] );
280
+		unset($donor_args['order']);
281 281
 
282 282
 		// Set payment query.
283 283
 		// @codingStandardsIgnoreStart
284
-		if ( true === $atts['only_comments'] ) {
284
+		if (true === $atts['only_comments']) {
285 285
 			$donor_args['meta_query'] = array(
286 286
 				array(
287 287
 					'key'   => '_give_has_comment',
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	 *
305 305
 	 * @return array
306 306
 	 */
307
-	public function get_donors( $donor_query ) {
308
-		$donor_query = new Give_Donors_Query( $donor_query );
307
+	public function get_donors($donor_query) {
308
+		$donor_query = new Give_Donors_Query($donor_query);
309 309
 		$donors      = $donor_query->get_donors();
310 310
 
311 311
 		return $donors;
@@ -319,26 +319,26 @@  discard block
 block discarded – undo
319 319
 	 * @access public
320 320
 	 */
321 321
 	public function ajax_handler() {
322
-		$shortcode_atts = wp_parse_args( give_clean( rawurldecode( $_POST['data'] ) ) ); // @codingStandardsIgnoreLine
322
+		$shortcode_atts = wp_parse_args(give_clean(rawurldecode($_POST['data']))); // @codingStandardsIgnoreLine
323 323
 
324 324
 		// Get next page donor comments.
325 325
 		$shortcode_atts['paged']           = $shortcode_atts['paged'] + 1;
326 326
 		$shortcode_atts['only_donor_html'] = true;
327 327
 
328
-		$donors_comment_html = $this->render_shortcode( $shortcode_atts );
328
+		$donors_comment_html = $this->render_shortcode($shortcode_atts);
329 329
 
330 330
 		// Check if donor comment remaining.
331
-		$donor_query           = $this->get_donor_query_atts( $shortcode_atts );
331
+		$donor_query           = $this->get_donor_query_atts($shortcode_atts);
332 332
 		$donor_query['paged']  = $donor_query['paged'] + 1;
333 333
 		$donor_query['fields'] = 'id';
334
-		$has_donors            = $this->get_donors( $donor_query ) ? 1 : 0;
334
+		$has_donors            = $this->get_donors($donor_query) ? 1 : 0;
335 335
 
336 336
 		// Remove internal shortcode param.
337
-		unset( $shortcode_atts['only_donor_html'] );
337
+		unset($shortcode_atts['only_donor_html']);
338 338
 
339 339
 		wp_send_json(
340 340
 			array(
341
-				'shortcode' => rawurlencode( http_build_query( $shortcode_atts ) ),
341
+				'shortcode' => rawurlencode(http_build_query($shortcode_atts)),
342 342
 				'html'      => $donors_comment_html,
343 343
 				'remaining' => $has_donors,
344 344
 			)
Please login to merge, or discard this patch.
includes/donors/class-give-donor-stats.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @return Give_Donor_Stats
39 39
 	 */
40 40
 	public static function get_instance() {
41
-		if ( null === static::$instance ) {
41
+		if (null === static::$instance) {
42 42
 			self::$instance = new static();
43 43
 		}
44 44
 
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 	 * @return string
58 58
 	 *
59 59
 	 */
60
-	public static function donated( $args = array() ) {
60
+	public static function donated($args = array()) {
61 61
 		global $wpdb;
62
-		$donation_id_col = Give()->payment_meta->get_meta_type() . '_id';
62
+		$donation_id_col = Give()->payment_meta->get_meta_type().'_id';
63 63
 
64 64
 		$donated_amount = '';
65 65
 
66
-		if ( empty( $args['donor'] ) ) {
66
+		if (empty($args['donor'])) {
67 67
 			return $donated_amount;
68 68
 		}
69 69
 
@@ -72,25 +72,25 @@  discard block
 block discarded – undo
72 72
 		$args['fields'] = 'ids';
73 73
 		$args['number'] = - 1;
74 74
 
75
-		$donation_query  = new Give_Payments_Query( $args );
75
+		$donation_query  = new Give_Payments_Query($args);
76 76
 		$donations       = $donation_query->get_payments();
77
-		$donation_id_str = implode( '\',\'', $donations );
77
+		$donation_id_str = implode('\',\'', $donations);
78 78
 
79 79
 		$query = "SELECT {$donation_id_col} as id, meta_value as total
80 80
 					FROM {$wpdb->donationmeta}
81 81
 					WHERE meta_key='_give_payment_total'
82 82
 					AND {$donation_id_col} IN ('{$donation_id_str}')";
83 83
 
84
-		$donated_amounts = $wpdb->get_results( $query, ARRAY_A );
84
+		$donated_amounts = $wpdb->get_results($query, ARRAY_A);
85 85
 
86
-		if ( ! empty( $donated_amounts ) ) {
87
-			foreach ( $donated_amounts as $donation ) {
86
+		if ( ! empty($donated_amounts)) {
87
+			foreach ($donated_amounts as $donation) {
88 88
 				// Do not include anonymous donation in calculation.
89
-				if( give_is_anonymous_donation( $donation['id']) ){
89
+				if (give_is_anonymous_donation($donation['id'])) {
90 90
 					continue;
91 91
 				}
92 92
 
93
-				$currency_code = give_get_payment_currency_code( $donation['id'] );
93
+				$currency_code = give_get_payment_currency_code($donation['id']);
94 94
 
95 95
 				/**
96 96
 				 * Filter the donation amount
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 				 */
101 101
 				$formatted_amount = apply_filters(
102 102
 					'give_donation_amount',
103
-					give_format_amount( $donation['total'], array( 'currency' => $currency_code ) ),
103
+					give_format_amount($donation['total'], array('currency' => $currency_code)),
104 104
 					$donation['total'],
105 105
 					$donation['id'],
106
-					array( 'type' => 'stats', 'currency' => false, 'amount' => false )
106
+					array('type' => 'stats', 'currency' => false, 'amount' => false)
107 107
 				);
108 108
 
109
-				$donated_amount += (float) give_maybe_sanitize_amount( $formatted_amount, array( 'currency' => $currency_code  ) );
109
+				$donated_amount += (float) give_maybe_sanitize_amount($formatted_amount, array('currency' => $currency_code));
110 110
 			}
111 111
 		}
112 112
 
Please login to merge, or discard this patch.
includes/emails/class-give-email-tags.php 1 patch
Spacing   +288 added lines, -288 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly.
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * }
73 73
 	 */
74
-	public function add( $args ) {
75
-		__give_211_bc_email_template_tag_param( $args, func_get_args() );
74
+	public function add($args) {
75
+		__give_211_bc_email_template_tag_param($args, func_get_args());
76 76
 
77
-		if ( is_callable( $args['func'] ) ) {
78
-			$this->tags[ $args['tag'] ] = array(
77
+		if (is_callable($args['func'])) {
78
+			$this->tags[$args['tag']] = array(
79 79
 				'tag'         => $args['tag'],
80 80
 				'desc'        => $args['desc'],
81 81
 				'func'        => $args['func'],
82
-				'context'     => give_check_variable( $args['context'], 'empty', 'general' ),
82
+				'context'     => give_check_variable($args['context'], 'empty', 'general'),
83 83
 				'is_admin'    => (bool) $args['is_admin'], // Introduced in 2.2.1
84 84
 				'description' => $args['desc'], // deprecated in 2.2.1
85 85
 			);
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @param string $tag Email tag to remove hook from
95 95
 	 */
96
-	public function remove( $tag ) {
97
-		unset( $this->tags[ $tag ] );
96
+	public function remove($tag) {
97
+		unset($this->tags[$tag]);
98 98
 	}
99 99
 
100 100
 	/**
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return bool
108 108
 	 */
109
-	public function email_tag_exists( $tag ) {
110
-		return array_key_exists( $tag, $this->tags );
109
+	public function email_tag_exists($tag) {
110
+		return array_key_exists($tag, $this->tags);
111 111
 	}
112 112
 
113 113
 	/**
@@ -121,23 +121,23 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return array
123 123
 	 */
124
-	public function get_tags( $context_type = 'all', $field = '' ) {
124
+	public function get_tags($context_type = 'all', $field = '') {
125 125
 		$tags = $this->tags;
126 126
 
127
-		if ( 'all' !== $context_type ) {
127
+		if ('all' !== $context_type) {
128 128
 			$tags = array();
129 129
 
130
-			foreach ( $this->tags as $tag ) {
131
-				if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) {
130
+			foreach ($this->tags as $tag) {
131
+				if (empty($tag['context']) || $context_type !== $tag['context']) {
132 132
 					continue;
133 133
 				}
134 134
 
135
-				$tags[ $tag['tag'] ] = $tag;
135
+				$tags[$tag['tag']] = $tag;
136 136
 			}
137 137
 		}
138 138
 
139
-		if ( ! empty( $tags ) && ! empty( $field ) ) {
140
-			$tags = wp_list_pluck( $tags, $field );
139
+		if ( ! empty($tags) && ! empty($field)) {
140
+			$tags = wp_list_pluck($tags, $field);
141 141
 		}
142 142
 
143 143
 		return $tags;
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return string Content with email tags filtered out.
157 157
 	 */
158
-	public function do_tags( $content, $tag_args ) {
158
+	public function do_tags($content, $tag_args) {
159 159
 
160 160
 		// Check if there is at least one tag added.
161
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
161
+		if (empty($this->tags) || ! is_array($this->tags)) {
162 162
 			return $content;
163 163
 		}
164 164
 
165 165
 		$this->tag_args = $tag_args;
166 166
 
167
-		$new_content = preg_replace_callback( '/{([A-z0-9\-\_]+)}/s', array( $this, 'do_tag' ), $content );
167
+		$new_content = preg_replace_callback('/{([A-z0-9\-\_]+)}/s', array($this, 'do_tag'), $content);
168 168
 
169 169
 		$this->tag_args = null;
170 170
 
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return mixed
182 182
 	 */
183
-	public function do_tag( $m ) {
183
+	public function do_tag($m) {
184 184
 
185 185
 		// Get tag
186 186
 		$tag = $m[1];
187 187
 
188 188
 		// Return tag if tag not set
189
-		if ( ! $this->email_tag_exists( $tag ) ) {
189
+		if ( ! $this->email_tag_exists($tag)) {
190 190
 			return $m[0];
191 191
 		}
192 192
 
193
-		return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag );
193
+		return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag);
194 194
 	}
195 195
 
196 196
 }
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
  * @param array $args Email template tag argument
205 205
  *                    Check Give_Email_Template_Tags::add function description for more information
206 206
  */
207
-function give_add_email_tag( $args ) {
208
-	__give_211_bc_email_template_tag_param( $args, func_get_args() );
207
+function give_add_email_tag($args) {
208
+	__give_211_bc_email_template_tag_param($args, func_get_args());
209 209
 
210
-	Give()->email_tags->add( $args );
210
+	Give()->email_tags->add($args);
211 211
 }
212 212
 
213 213
 /**
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
  *
218 218
  * @param string $tag Email tag to remove hook from
219 219
  */
220
-function give_remove_email_tag( $tag ) {
221
-	Give()->email_tags->remove( $tag );
220
+function give_remove_email_tag($tag) {
221
+	Give()->email_tags->remove($tag);
222 222
 }
223 223
 
224 224
 /**
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
  *
231 231
  * @return bool
232 232
  */
233
-function give_email_tag_exists( $tag ) {
234
-	return Give()->email_tags->email_tag_exists( $tag );
233
+function give_email_tag_exists($tag) {
234
+	return Give()->email_tags->email_tag_exists($tag);
235 235
 }
236 236
 
237 237
 /**
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
 	$email_tags = give_get_email_tags();
259 259
 
260 260
 	ob_start();
261
-	if ( count( $email_tags ) > 0 ) : ?>
261
+	if (count($email_tags) > 0) : ?>
262 262
 		<div class="give-email-tags-wrap">
263
-			<?php foreach ( $email_tags as $email_tag ) : ?>
263
+			<?php foreach ($email_tags as $email_tag) : ?>
264 264
 				<span class="give_<?php echo $email_tag['tag']; ?>_tag">
265 265
 					<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['desc']; ?>
266 266
 				</span>
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
  *
286 286
  * @return string Content with email tags filtered out.
287 287
  */
288
-function give_do_email_tags( $content, $tag_args ) {
288
+function give_do_email_tags($content, $tag_args) {
289 289
 	// Backward compatibility < 2.0
290
-	if ( ! is_array( $tag_args ) && is_numeric( $tag_args ) ) {
291
-		$tag_args = array( 'payment_id' => $tag_args );
290
+	if ( ! is_array($tag_args) && is_numeric($tag_args)) {
291
+		$tag_args = array('payment_id' => $tag_args);
292 292
 	}
293 293
 
294 294
 	$email_tags = Give()->email_tags instanceof Give_Email_Template_Tags
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 		: new Give_Email_Template_Tags();
297 297
 
298 298
 	// Replace all tags
299
-	$content = $email_tags->do_tags( $content, $tag_args );
299
+	$content = $email_tags->do_tags($content, $tag_args);
300 300
 
301 301
 	/**
302 302
 	 * Filter the filtered content text.
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	 * @since 1.0
305 305
 	 * @since 2.0 $payment_meta, $payment_id removed and $tag_args added.
306 306
 	 */
307
-	$content = apply_filters( 'give_email_template_tags', $content, $tag_args );
307
+	$content = apply_filters('give_email_template_tags', $content, $tag_args);
308 308
 
309 309
 	// Return content
310 310
 	return $content;
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 	 *
324 324
 	 * @since 1.0
325 325
 	 */
326
-	do_action( 'give_add_email_tags' );
326
+	do_action('give_add_email_tags');
327 327
 }
328 328
 
329
-add_action( 'init', 'give_load_email_tags', - 999 );
329
+add_action('init', 'give_load_email_tags', - 999);
330 330
 
331 331
 
332 332
 /**
@@ -341,67 +341,67 @@  discard block
 block discarded – undo
341 341
 		/*	Donation Payment */
342 342
 		array(
343 343
 			'tag'     => 'donation',
344
-			'desc'    => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ),
344
+			'desc'    => esc_html__('The donation form name, and the donation level (if applicable).', 'give'),
345 345
 			'func'    => 'give_email_tag_donation',
346 346
 			'context' => 'donation',
347 347
 		),
348 348
 		array(
349 349
 			'tag'     => 'amount',
350
-			'desc'    => esc_html__( 'The total donation amount with currency sign.', 'give' ),
350
+			'desc'    => esc_html__('The total donation amount with currency sign.', 'give'),
351 351
 			'func'    => 'give_email_tag_amount',
352 352
 			'context' => 'donation',
353 353
 		),
354 354
 		array(
355 355
 			'tag'     => 'price',
356
-			'desc'    => esc_html__( 'The total donation amount with currency sign.', 'give' ),
356
+			'desc'    => esc_html__('The total donation amount with currency sign.', 'give'),
357 357
 			'func'    => 'give_email_tag_price',
358 358
 			'context' => 'donation',
359 359
 		),
360 360
 		array(
361 361
 			'tag'     => 'billing_address',
362
-			'desc'    => esc_html__( 'The donor\'s billing address.', 'give' ),
362
+			'desc'    => esc_html__('The donor\'s billing address.', 'give'),
363 363
 			'func'    => 'give_email_tag_billing_address',
364 364
 			'context' => 'donation',
365 365
 		),
366 366
 		array(
367 367
 			'tag'     => 'date',
368
-			'desc'    => esc_html__( 'The date of the donation.', 'give' ),
368
+			'desc'    => esc_html__('The date of the donation.', 'give'),
369 369
 			'func'    => 'give_email_tag_date',
370 370
 			'context' => 'donation',
371 371
 		),
372 372
 		array(
373 373
 			'tag'     => 'payment_id',
374
-			'desc'    => esc_html__( 'The unique ID number for this donation.', 'give' ),
374
+			'desc'    => esc_html__('The unique ID number for this donation.', 'give'),
375 375
 			'func'    => 'give_email_tag_payment_id',
376 376
 			'context' => 'donation',
377 377
 		),
378 378
 		array(
379 379
 			'tag'     => 'payment_method',
380
-			'desc'    => esc_html__( 'The method of payment used for this donation.', 'give' ),
380
+			'desc'    => esc_html__('The method of payment used for this donation.', 'give'),
381 381
 			'func'    => 'give_email_tag_payment_method',
382 382
 			'context' => 'donation',
383 383
 		),
384 384
 		array(
385 385
 			'tag'     => 'payment_total',
386
-			'desc'    => esc_html__( 'The payment total for this donation.', 'give' ),
386
+			'desc'    => esc_html__('The payment total for this donation.', 'give'),
387 387
 			'func'    => 'give_email_tag_payment_total',
388 388
 			'context' => 'donation',
389 389
 		),
390 390
 		array(
391 391
 			'tag'     => 'receipt_id',
392
-			'desc'    => esc_html__( 'The unique ID number for this donation receipt.', 'give' ),
392
+			'desc'    => esc_html__('The unique ID number for this donation receipt.', 'give'),
393 393
 			'func'    => 'give_email_tag_receipt_id',
394 394
 			'context' => 'donation',
395 395
 		),
396 396
 		array(
397 397
 			'tag'     => 'receipt_link',
398
-			'desc'    => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
398
+			'desc'    => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'),
399 399
 			'func'    => 'give_email_tag_receipt_link',
400 400
 			'context' => 'donation',
401 401
 		),
402 402
 		array(
403 403
 			'tag'     => 'receipt_link_url',
404
-			'desc'    => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
404
+			'desc'    => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'),
405 405
 			'func'    => 'give_email_tag_receipt_link_url',
406 406
 			'context' => 'donation',
407 407
 		),
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 		/* Donation Form */
410 410
 		array(
411 411
 			'tag'     => 'form_title',
412
-			'desc'    => esc_html__( 'The donation form name.', 'give' ),
412
+			'desc'    => esc_html__('The donation form name.', 'give'),
413 413
 			'func'    => 'give_email_tag_form_title',
414 414
 			'context' => 'form',
415 415
 		),
@@ -417,37 +417,37 @@  discard block
 block discarded – undo
417 417
 		/* Donor */
418 418
 		array(
419 419
 			'tag'     => 'name',
420
-			'desc'    => esc_html__( 'The donor\'s first name.', 'give' ),
420
+			'desc'    => esc_html__('The donor\'s first name.', 'give'),
421 421
 			'func'    => 'give_email_tag_first_name',
422 422
 			'context' => 'donor',
423 423
 		),
424 424
 		array(
425 425
 			'tag'     => 'fullname',
426
-			'desc'    => esc_html__( 'The donor\'s full name, first and last.', 'give' ),
426
+			'desc'    => esc_html__('The donor\'s full name, first and last.', 'give'),
427 427
 			'func'    => 'give_email_tag_fullname',
428 428
 			'context' => 'donor',
429 429
 		),
430 430
 		array(
431 431
 			'tag'     => 'username',
432
-			'desc'    => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
432
+			'desc'    => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'),
433 433
 			'func'    => 'give_email_tag_username',
434 434
 			'context' => 'donor',
435 435
 		),
436 436
 		array(
437 437
 			'tag'     => 'company_name',
438
-			'desc'    => esc_html__( 'Company name.', 'give' ),
438
+			'desc'    => esc_html__('Company name.', 'give'),
439 439
 			'func'    => 'give_email_tag_company_name',
440 440
 			'context' => 'donation',
441 441
 		),
442 442
 		array(
443 443
 			'tag'     => 'user_email',
444
-			'desc'    => esc_html__( 'The donor\'s email address.', 'give' ),
444
+			'desc'    => esc_html__('The donor\'s email address.', 'give'),
445 445
 			'func'    => 'give_email_tag_user_email',
446 446
 			'context' => 'donor',
447 447
 		),
448 448
 		array(
449 449
 			'tag'     => 'email_access_link',
450
-			'desc'    => esc_html__( 'The donor\'s email access link.', 'give' ),
450
+			'desc'    => esc_html__('The donor\'s email access link.', 'give'),
451 451
 			'func'    => 'give_email_tag_email_access_link',
452 452
 			'context' => 'donor',
453 453
 		),
@@ -455,35 +455,35 @@  discard block
 block discarded – undo
455 455
 		/* General */
456 456
 		array(
457 457
 			'tag'     => 'sitename',
458
-			'desc'    => esc_html__( 'The name of your site.', 'give' ),
458
+			'desc'    => esc_html__('The name of your site.', 'give'),
459 459
 			'func'    => 'give_email_tag_sitename',
460 460
 			'context' => 'general',
461 461
 		),
462 462
 
463 463
 		array(
464 464
 			'tag'     => 'reset_password_link',
465
-			'desc'    => esc_html__( 'The reset password link for user.', 'give' ),
465
+			'desc'    => esc_html__('The reset password link for user.', 'give'),
466 466
 			'func'    => 'give_email_tag_reset_password_link',
467 467
 			'context' => 'general',
468 468
 		),
469 469
 
470 470
 		array(
471 471
 			'tag'     => 'admin_email',
472
-			'desc'    => esc_html__( 'The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give' ),
472
+			'desc'    => esc_html__('The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give'),
473 473
 			'func'    => 'give_email_admin_email',
474 474
 			'context' => 'general',
475 475
 		),
476 476
 
477 477
 		array(
478 478
 			'tag'     => 'site_url',
479
-			'desc'    => esc_html__( 'The website URL.', 'give' ),
479
+			'desc'    => esc_html__('The website URL.', 'give'),
480 480
 			'func'    => 'give_email_site_url',
481 481
 			'context' => 'general',
482 482
 		),
483 483
 
484 484
 		array(
485 485
 			'tag'     => 'offline_mailing_address',
486
-			'desc'    => esc_html__( 'The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give' ),
486
+			'desc'    => esc_html__('The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give'),
487 487
 			'func'    => 'give_email_offline_mailing_address',
488 488
 			'context' => 'general',
489 489
 		),
@@ -491,16 +491,16 @@  discard block
 block discarded – undo
491 491
 	);
492 492
 
493 493
 	// Apply give_email_tags filter
494
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
494
+	$email_tags = apply_filters('give_email_tags', $email_tags);
495 495
 
496 496
 	// Add email tags
497
-	foreach ( $email_tags as $email_tag ) {
498
-		give_add_email_tag( $email_tag );
497
+	foreach ($email_tags as $email_tag) {
498
+		give_add_email_tag($email_tag);
499 499
 	}
500 500
 
501 501
 }
502 502
 
503
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
503
+add_action('give_add_email_tags', 'give_setup_email_tags');
504 504
 
505 505
 
506 506
 /**
@@ -512,24 +512,24 @@  discard block
 block discarded – undo
512 512
  *
513 513
  * @return string $firstname
514 514
  */
515
-function give_email_tag_first_name( $tag_args ) {
515
+function give_email_tag_first_name($tag_args) {
516 516
 	$user_info = array();
517 517
 	$firstname = '';
518 518
 
519 519
 	// Backward compatibility.
520
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
520
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
521 521
 
522
-	switch ( true ) {
523
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
524
-			$donor_info  = give_get_payment_meta_user_info( $tag_args['payment_id'] );
525
-			$email_names = give_get_email_names( $donor_info );
522
+	switch (true) {
523
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
524
+			$donor_info  = give_get_payment_meta_user_info($tag_args['payment_id']);
525
+			$email_names = give_get_email_names($donor_info);
526 526
 			$firstname   = $email_names['name'];
527 527
 
528 528
 			break;
529 529
 
530
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
530
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
531 531
 			$firstname = Give()->donor_meta->get_meta(
532
-				Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ),
532
+				Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']),
533 533
 				'_give_donor_first_name',
534 534
 				true
535 535
 			);
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
 		 *
541 541
 		 * @since 2.0
542 542
 		 */
543
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
544
-			$firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true );
543
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
544
+			$firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true);
545 545
 			break;
546 546
 	}
547 547
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 	 * @param string $firstname
554 554
 	 * @param array  $tag_args
555 555
 	 */
556
-	$firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args );
556
+	$firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args);
557 557
 
558 558
 	return $firstname;
559 559
 }
@@ -567,21 +567,21 @@  discard block
 block discarded – undo
567 567
  *
568 568
  * @return string $fullname
569 569
  */
570
-function give_email_tag_fullname( $tag_args ) {
570
+function give_email_tag_fullname($tag_args) {
571 571
 	$fullname = '';
572 572
 
573 573
 	// Backward compatibility.
574
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
574
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
575 575
 
576
-	switch ( true ) {
577
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
578
-			$donor_info  = give_get_payment_meta_user_info( $tag_args['payment_id'] );
579
-			$email_names = give_get_email_names( $donor_info );
576
+	switch (true) {
577
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
578
+			$donor_info  = give_get_payment_meta_user_info($tag_args['payment_id']);
579
+			$email_names = give_get_email_names($donor_info);
580 580
 			$fullname    = $email_names['fullname'];
581 581
 			break;
582 582
 
583
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
584
-			$fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] );
583
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
584
+			$fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']);
585 585
 			break;
586 586
 
587 587
 		/**
@@ -589,8 +589,8 @@  discard block
 block discarded – undo
589 589
 		 *
590 590
 		 * @since 2.0
591 591
 		 */
592
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
593
-			$fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] );
592
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
593
+			$fullname = Give()->donors->get_column('name', $tag_args['donor_id']);
594 594
 			break;
595 595
 	}
596 596
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 	 * @param string $fullname
603 603
 	 * @param array  $tag_args
604 604
 	 */
605
-	$fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args );
605
+	$fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args);
606 606
 
607 607
 	return $fullname;
608 608
 }
@@ -616,21 +616,21 @@  discard block
 block discarded – undo
616 616
  *
617 617
  * @return string username.
618 618
  */
619
-function give_email_tag_username( $tag_args ) {
619
+function give_email_tag_username($tag_args) {
620 620
 	$username = '';
621 621
 
622 622
 	// Backward compatibility.
623
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
623
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
624 624
 
625
-	switch ( true ) {
626
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
627
-			$donor_info  = give_get_payment_meta_user_info( $tag_args['payment_id'] );
628
-			$email_names = give_get_email_names( $donor_info );
625
+	switch (true) {
626
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
627
+			$donor_info  = give_get_payment_meta_user_info($tag_args['payment_id']);
628
+			$email_names = give_get_email_names($donor_info);
629 629
 			$username    = $email_names['username'];
630 630
 			break;
631 631
 
632
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
633
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
632
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
633
+			$user_info = get_user_by('id', $tag_args['user_id']);
634 634
 			$username  = $user_info->user_login;
635 635
 			break;
636 636
 
@@ -639,9 +639,9 @@  discard block
 block discarded – undo
639 639
 		 *
640 640
 		 * @since 2.0
641 641
 		 */
642
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
643
-			if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) {
644
-				$user_info = get_user_by( 'id', $user_id );
642
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
643
+			if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) {
644
+				$user_info = get_user_by('id', $user_id);
645 645
 				$username  = $user_info->user_login;
646 646
 			}
647 647
 			break;
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	 * @param string $username
656 656
 	 * @param array  $tag_args
657 657
 	 */
658
-	$username = apply_filters( 'give_email_tag_username', $username, $tag_args );
658
+	$username = apply_filters('give_email_tag_username', $username, $tag_args);
659 659
 
660 660
 	return $username;
661 661
 }
@@ -669,19 +669,19 @@  discard block
 block discarded – undo
669 669
  *
670 670
  * @return string user_email
671 671
  */
672
-function give_email_tag_user_email( $tag_args ) {
672
+function give_email_tag_user_email($tag_args) {
673 673
 	$email = '';
674 674
 
675 675
 	// Backward compatibility.
676
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
676
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
677 677
 
678
-	switch ( true ) {
679
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
680
-			$email = give_get_donation_donor_email( $tag_args['payment_id'] );
678
+	switch (true) {
679
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
680
+			$email = give_get_donation_donor_email($tag_args['payment_id']);
681 681
 			break;
682 682
 
683
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
684
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
683
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
684
+			$user_info = get_user_by('id', $tag_args['user_id']);
685 685
 			$email     = $user_info->user_email;
686 686
 			break;
687 687
 
@@ -690,8 +690,8 @@  discard block
 block discarded – undo
690 690
 		 *
691 691
 		 * @since 2.0
692 692
 		 */
693
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
694
-			$email = Give()->donors->get_column( 'email', $tag_args['donor_id'] );
693
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
694
+			$email = Give()->donors->get_column('email', $tag_args['donor_id']);
695 695
 			break;
696 696
 	}
697 697
 
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	 * @param string $email
704 704
 	 * @param array  $tag_args
705 705
 	 */
706
-	$email = apply_filters( 'give_email_tag_user_email', $email, $tag_args );
706
+	$email = apply_filters('give_email_tag_user_email', $email, $tag_args);
707 707
 
708 708
 	return $email;
709 709
 }
@@ -717,22 +717,22 @@  discard block
 block discarded – undo
717 717
  *
718 718
  * @return string billing_address
719 719
  */
720
-function give_email_tag_billing_address( $tag_args ) {
720
+function give_email_tag_billing_address($tag_args) {
721 721
 	$address = '';
722 722
 
723 723
 	// Backward compatibility.
724
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
724
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
725 725
 
726
-	switch ( true ) {
727
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
728
-			$donation_address = give_get_donation_address( $tag_args['payment_id'] );
726
+	switch (true) {
727
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
728
+			$donation_address = give_get_donation_address($tag_args['payment_id']);
729 729
 
730 730
 			$billing_address                   = array();
731 731
 			$billing_address['street_address'] = '';
732 732
 			$billing_address['street_address'] .= $donation_address['line1'];
733 733
 
734
-			if ( ! empty( $donation_address['line2'] ) ) {
735
-				$billing_address['street_address'] .= "\n" . $donation_address['line2'];
734
+			if ( ! empty($donation_address['line2'])) {
735
+				$billing_address['street_address'] .= "\n".$donation_address['line2'];
736 736
 			}
737 737
 
738 738
 			$billing_address['city']        = $donation_address['city'];
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 			$billing_address['postal_code'] = $donation_address['zip'];
741 741
 			$billing_address['country']     = $donation_address['country'];
742 742
 
743
-			$address = give_get_formatted_address( $billing_address );
743
+			$address = give_get_formatted_address($billing_address);
744 744
 
745 745
 			break;
746 746
 	}
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	 * @param string $address
754 754
 	 * @param array  $tag_args
755 755
 	 */
756
-	$address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args );
756
+	$address = apply_filters('give_email_tag_billing_address', $address, $tag_args);
757 757
 
758 758
 	return $address;
759 759
 }
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
  *
768 768
  * @return string $date Post Date.
769 769
  */
770
-function give_email_tag_date( $tag_args ) {
770
+function give_email_tag_date($tag_args) {
771 771
 	$date = '';
772 772
 
773 773
 	// Backward compatibility.
774
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
774
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
775 775
 
776
-	switch ( true ) {
777
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
778
-			$date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) );
776
+	switch (true) {
777
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
778
+			$date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id']));
779 779
 			break;
780 780
 	}
781 781
 
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 	 * @param string $date
788 788
 	 * @param array  $tag_args
789 789
 	 */
790
-	$date = apply_filters( 'give_email_tag_date', $date, $tag_args );
790
+	$date = apply_filters('give_email_tag_date', $date, $tag_args);
791 791
 
792 792
 	return $date;
793 793
 }
@@ -801,16 +801,16 @@  discard block
 block discarded – undo
801 801
  *
802 802
  * @return string amount
803 803
  */
804
-function give_email_tag_amount( $tag_args ) {
804
+function give_email_tag_amount($tag_args) {
805 805
 	$amount = '';
806 806
 
807 807
 	// Backward compatibility.
808
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
808
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
809 809
 
810
-	switch ( true ) {
811
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
812
-			$give_amount = give_donation_amount( $tag_args['payment_id'], true );
813
-			$amount      = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' );
810
+	switch (true) {
811
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
812
+			$give_amount = give_donation_amount($tag_args['payment_id'], true);
813
+			$amount      = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8');
814 814
 			break;
815 815
 	}
816 816
 
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 	 * @param string $amount
823 823
 	 * @param array  $tag_args
824 824
 	 */
825
-	$amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args );
825
+	$amount = apply_filters('give_email_tag_amount', $amount, $tag_args);
826 826
 
827 827
 	return $amount;
828 828
 }
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
  *
837 837
  * @return string price
838 838
  */
839
-function give_email_tag_price( $tag_args ) {
840
-	return give_email_tag_amount( $tag_args );
839
+function give_email_tag_price($tag_args) {
840
+	return give_email_tag_amount($tag_args);
841 841
 }
842 842
 
843 843
 /**
@@ -849,15 +849,15 @@  discard block
 block discarded – undo
849 849
  *
850 850
  * @return int payment_id
851 851
  */
852
-function give_email_tag_payment_id( $tag_args ) {
852
+function give_email_tag_payment_id($tag_args) {
853 853
 	$payment_id = '';
854 854
 
855 855
 	// Backward compatibility.
856
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
856
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
857 857
 
858
-	switch ( true ) {
859
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
860
-			$payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] );
858
+	switch (true) {
859
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
860
+			$payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']);
861 861
 			break;
862 862
 	}
863 863
 
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 	 * @param string $payment_id
870 870
 	 * @param array  $tag_args
871 871
 	 */
872
-	return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args );
872
+	return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args);
873 873
 }
874 874
 
875 875
 /**
@@ -881,15 +881,15 @@  discard block
 block discarded – undo
881 881
  *
882 882
  * @return string receipt_id
883 883
  */
884
-function give_email_tag_receipt_id( $tag_args ) {
884
+function give_email_tag_receipt_id($tag_args) {
885 885
 	$receipt_id = '';
886 886
 
887 887
 	// Backward compatibility.
888
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
888
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
889 889
 
890
-	switch ( true ) {
891
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
892
-			$receipt_id = give_get_payment_key( $tag_args['payment_id'] );
890
+	switch (true) {
891
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
892
+			$receipt_id = give_get_payment_key($tag_args['payment_id']);
893 893
 			break;
894 894
 	}
895 895
 
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 	 * @param string $receipt_id
902 902
 	 * @param array  $tag_args
903 903
 	 */
904
-	return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args );
904
+	return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args);
905 905
 }
906 906
 
907 907
 /**
@@ -913,21 +913,21 @@  discard block
 block discarded – undo
913 913
  *
914 914
  * @return string $form_title
915 915
  */
916
-function give_email_tag_donation( $tag_args ) {
916
+function give_email_tag_donation($tag_args) {
917 917
 	$donation_form_title = '';
918 918
 
919 919
 	// Backward compatibility.
920
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
920
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
921 921
 
922
-	switch ( true ) {
923
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
924
-			$level_title         = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) );
922
+	switch (true) {
923
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
924
+			$level_title         = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id']));
925 925
 			$separator           = $level_title ? '-' : '';
926 926
 			$donation_form_title = strip_tags(
927 927
 				give_check_variable(
928 928
 					give_get_donation_form_title(
929 929
 						$tag_args['payment_id'],
930
-						array( 'separator' => $separator )
930
+						array('separator' => $separator)
931 931
 					),
932 932
 					'empty',
933 933
 					''
@@ -960,15 +960,15 @@  discard block
 block discarded – undo
960 960
  *
961 961
  * @return string $form_title
962 962
  */
963
-function give_email_tag_form_title( $tag_args ) {
963
+function give_email_tag_form_title($tag_args) {
964 964
 	$donation_form_title = '';
965 965
 
966 966
 	// Backward compatibility.
967
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
967
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
968 968
 
969
-	switch ( true ) {
970
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
971
-			$donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' );
969
+	switch (true) {
970
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
971
+			$donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title');
972 972
 			break;
973 973
 	}
974 974
 
@@ -997,15 +997,15 @@  discard block
 block discarded – undo
997 997
  *
998 998
  * @return string $company_name
999 999
  */
1000
-function give_email_tag_company_name( $tag_args ) {
1000
+function give_email_tag_company_name($tag_args) {
1001 1001
 	$company_name = '';
1002 1002
 
1003 1003
 	// Backward compatibility.
1004
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1004
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1005 1005
 
1006
-	switch ( true ) {
1007
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1008
-			$company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true );
1006
+	switch (true) {
1007
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1008
+			$company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true);
1009 1009
 			break;
1010 1010
 	}
1011 1011
 
@@ -1033,18 +1033,18 @@  discard block
 block discarded – undo
1033 1033
  *
1034 1034
  * @return string gateway
1035 1035
  */
1036
-function give_email_tag_payment_method( $tag_args ) {
1036
+function give_email_tag_payment_method($tag_args) {
1037 1037
 	$payment_method = '';
1038 1038
 
1039 1039
 	// Backward compatibility.
1040
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1040
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1041 1041
 
1042 1042
 	// Backward compatibility.
1043
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1043
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1044 1044
 
1045
-	switch ( true ) {
1046
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1047
-			$payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) );
1045
+	switch (true) {
1046
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1047
+			$payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id']));
1048 1048
 			break;
1049 1049
 	}
1050 1050
 
@@ -1075,15 +1075,15 @@  discard block
 block discarded – undo
1075 1075
  *
1076 1076
  * @return string
1077 1077
  */
1078
-function give_email_tag_payment_total( $tag_args ) {
1078
+function give_email_tag_payment_total($tag_args) {
1079 1079
 	$payment_total = '';
1080 1080
 
1081 1081
 	// Backward compatibility.
1082
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1082
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1083 1083
 
1084
-	switch ( true ) {
1085
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1086
-			$payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) );
1084
+	switch (true) {
1085
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1086
+			$payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id']));
1087 1087
 			break;
1088 1088
 	}
1089 1089
 
@@ -1111,11 +1111,11 @@  discard block
 block discarded – undo
1111 1111
  *
1112 1112
  * @return string
1113 1113
  */
1114
-function give_email_tag_sitename( $tag_args = array() ) {
1115
-	$sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
1114
+function give_email_tag_sitename($tag_args = array()) {
1115
+	$sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
1116 1116
 
1117 1117
 	// Backward compatibility.
1118
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1118
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1119 1119
 
1120 1120
 	/**
1121 1121
 	 * Filter the {sitename} email template tag output.
@@ -1141,21 +1141,21 @@  discard block
 block discarded – undo
1141 1141
  *
1142 1142
  * @return string receipt_link
1143 1143
  */
1144
-function give_email_tag_receipt_link( $tag_args ) {
1144
+function give_email_tag_receipt_link($tag_args) {
1145 1145
 	// Backward compatibility.
1146
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1146
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1147 1147
 
1148
-	$receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1148
+	$receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1149 1149
 
1150 1150
 	// Bailout.
1151
-	if ( give_get_option( 'email_template' ) === 'none' ) {
1151
+	if (give_get_option('email_template') === 'none') {
1152 1152
 		return $receipt_url;
1153 1153
 	}
1154 1154
 
1155 1155
 	$receipt_url = esc_url(
1156 1156
 		add_query_arg(
1157 1157
 			array(
1158
-				'payment_key' => give_get_payment_key( $tag_args['payment_id'] ),
1158
+				'payment_key' => give_get_payment_key($tag_args['payment_id']),
1159 1159
 			), give_get_history_page_uri()
1160 1160
 		)
1161 1161
 	);
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 	$formatted = sprintf(
1164 1164
 		'<a href="%1$s">%2$s</a>',
1165 1165
 		$receipt_url,
1166
-		__( 'View it in your browser &raquo;', 'give' )
1166
+		__('View it in your browser &raquo;', 'give')
1167 1167
 	);
1168 1168
 
1169 1169
 	/**
@@ -1192,11 +1192,11 @@  discard block
 block discarded – undo
1192 1192
  *
1193 1193
  * @return string receipt_url
1194 1194
  */
1195
-function give_email_tag_receipt_link_url( $tag_args ) {
1195
+function give_email_tag_receipt_link_url($tag_args) {
1196 1196
 	// Backward compatibility.
1197
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1197
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1198 1198
 
1199
-	$receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1199
+	$receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1200 1200
 
1201 1201
 	/**
1202 1202
 	 * Filter the {receipt_link_url} email template tag output.
@@ -1223,14 +1223,14 @@  discard block
 block discarded – undo
1223 1223
  *
1224 1224
  * @return string
1225 1225
  */
1226
-function give_get_receipt_url( $payment_id ) {
1226
+function give_get_receipt_url($payment_id) {
1227 1227
 	$receipt_url = '';
1228 1228
 
1229
-	if ( $payment_id ) {
1229
+	if ($payment_id) {
1230 1230
 		$receipt_url = esc_url(
1231 1231
 			add_query_arg(
1232 1232
 				array(
1233
-					'payment_key' => give_get_payment_key( $payment_id ),
1233
+					'payment_key' => give_get_payment_key($payment_id),
1234 1234
 				), give_get_history_page_uri()
1235 1235
 			)
1236 1236
 		);
@@ -1249,22 +1249,22 @@  discard block
 block discarded – undo
1249 1249
  *
1250 1250
  * @return string
1251 1251
  */
1252
-function give_email_tag_email_access_link( $tag_args ) {
1252
+function give_email_tag_email_access_link($tag_args) {
1253 1253
 	$donor_id          = 0;
1254 1254
 	$donor             = array();
1255 1255
 	$email_access_link = '';
1256 1256
 
1257 1257
 	// Backward compatibility.
1258
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1258
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1259 1259
 
1260
-	switch ( true ) {
1261
-		case ! empty( $tag_args['donor_id'] ):
1260
+	switch (true) {
1261
+		case ! empty($tag_args['donor_id']):
1262 1262
 			$donor_id = $tag_args['donor_id'];
1263
-			$donor    = Give()->donors->get_by( 'id', $tag_args['donor_id'] );
1263
+			$donor    = Give()->donors->get_by('id', $tag_args['donor_id']);
1264 1264
 			break;
1265 1265
 
1266
-		case ! empty( $tag_args['user_id'] ):
1267
-			$donor    = Give()->donors->get_by( 'user_id', $tag_args['user_id'] );
1266
+		case ! empty($tag_args['user_id']):
1267
+			$donor    = Give()->donors->get_by('user_id', $tag_args['user_id']);
1268 1268
 			$donor_id = $donor->id;
1269 1269
 			break;
1270 1270
 
@@ -1273,11 +1273,11 @@  discard block
 block discarded – undo
1273 1273
 	}
1274 1274
 
1275 1275
 	// Set email access link if donor exist.
1276
-	if ( $donor_id ) {
1277
-		$verify_key = wp_generate_password( 20, false );
1276
+	if ($donor_id) {
1277
+		$verify_key = wp_generate_password(20, false);
1278 1278
 
1279 1279
 		// Generate a new verify key
1280
-		Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key );
1280
+		Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key);
1281 1281
 		// update verify key in email tags.
1282 1282
 		$tag_args['verify_key'] = $verify_key;
1283 1283
 
@@ -1292,28 +1292,28 @@  discard block
 block discarded – undo
1292 1292
 		);
1293 1293
 
1294 1294
 		// Add Payment Key to email access url, if it exists.
1295
-		if ( ! empty( $_GET['payment_key'] ) ) {
1295
+		if ( ! empty($_GET['payment_key'])) {
1296 1296
 			$access_url = add_query_arg(
1297 1297
 				array(
1298
-					'payment_key' => give_clean( $_GET['payment_key'] ),
1298
+					'payment_key' => give_clean($_GET['payment_key']),
1299 1299
 				),
1300 1300
 				$access_url
1301 1301
 			);
1302 1302
 		}
1303 1303
 
1304
-		if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1304
+		if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1305 1305
 			$email_access_link = sprintf(
1306 1306
 				'<a href="%1$s" target="_blank">%2$s</a>',
1307
-				esc_url( $access_url ),
1308
-				__( 'View your donation history &raquo;', 'give' )
1307
+				esc_url($access_url),
1308
+				__('View your donation history &raquo;', 'give')
1309 1309
 			);
1310 1310
 
1311 1311
 		} else {
1312 1312
 
1313 1313
 			$email_access_link = sprintf(
1314 1314
 				'%1$s: %2$s',
1315
-				__( 'View your donation history', 'give' ),
1316
-				esc_url( $access_url )
1315
+				__('View your donation history', 'give'),
1316
+				esc_url($access_url)
1317 1317
 			);
1318 1318
 		}
1319 1319
 	}
@@ -1345,23 +1345,23 @@  discard block
 block discarded – undo
1345 1345
  *
1346 1346
  * @return array
1347 1347
  */
1348
-function __give_20_bc_str_type_email_tag_param( $tag_args ) {
1349
-	if ( ! is_array( $tag_args ) ) {
1350
-		switch ( true ) {
1351
-			case ( 'give_payment' === get_post_type( $tag_args ) ):
1352
-				$tag_args = array( 'payment_id' => $tag_args );
1348
+function __give_20_bc_str_type_email_tag_param($tag_args) {
1349
+	if ( ! is_array($tag_args)) {
1350
+		switch (true) {
1351
+			case ('give_payment' === get_post_type($tag_args)):
1352
+				$tag_args = array('payment_id' => $tag_args);
1353 1353
 				break;
1354 1354
 
1355
-			case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ):
1356
-				$tag_args = array( 'user_id' => $tag_args );
1355
+			case ( ! is_wp_error(get_user_by('id', $tag_args))):
1356
+				$tag_args = array('user_id' => $tag_args);
1357 1357
 				break;
1358 1358
 
1359
-			case ( Give()->donors->get_by( 'id', $tag_args ) ):
1360
-				$tag_args = array( 'donor_id' => $tag_args );
1359
+			case (Give()->donors->get_by('id', $tag_args)):
1360
+				$tag_args = array('donor_id' => $tag_args);
1361 1361
 				break;
1362 1362
 
1363
-			case ( Give()->donors->get_by( 'user_id', $tag_args ) ):
1364
-				$tag_args = array( 'user_id' => $tag_args );
1363
+			case (Give()->donors->get_by('user_id', $tag_args)):
1364
+				$tag_args = array('user_id' => $tag_args);
1365 1365
 				break;
1366 1366
 		}
1367 1367
 	}
@@ -1379,18 +1379,18 @@  discard block
 block discarded – undo
1379 1379
  *
1380 1380
  * @since 2.2.1
1381 1381
  */
1382
-function __give_211_bc_email_template_tag_param( &$args, $func_args = array() ) {
1382
+function __give_211_bc_email_template_tag_param(&$args, $func_args = array()) {
1383 1383
 
1384 1384
 	/**
1385 1385
 	 * This is for backward-compatibility, i.e.; if the parameters are
1386 1386
 	 * still passed as 4 separate arguments instead of 1 single array.
1387 1387
 	 */
1388
-	if ( ! is_array( $args ) ) {
1388
+	if ( ! is_array($args)) {
1389 1389
 		$args = array(
1390
-			'tag'      => isset( $func_args[0] ) ? $func_args[0] : '',
1391
-			'desc'     => isset( $func_args[1] ) ? $func_args[1] : '',
1392
-			'func'     => isset( $func_args[2] ) ? $func_args[2] : '',
1393
-			'context'  => isset( $func_args[3] ) ? $func_args[3] : '',
1390
+			'tag'      => isset($func_args[0]) ? $func_args[0] : '',
1391
+			'desc'     => isset($func_args[1]) ? $func_args[1] : '',
1392
+			'func'     => isset($func_args[2]) ? $func_args[2] : '',
1393
+			'context'  => isset($func_args[3]) ? $func_args[3] : '',
1394 1394
 			'is_admin' => false,
1395 1395
 		);
1396 1396
 	} else {
@@ -1417,36 +1417,36 @@  discard block
 block discarded – undo
1417 1417
  *
1418 1418
  * @return array
1419 1419
  */
1420
-function give_email_tag_reset_password_link( $tag_args, $payment_id ) {
1420
+function give_email_tag_reset_password_link($tag_args, $payment_id) {
1421 1421
 
1422 1422
 	$reset_password_url = '';
1423 1423
 
1424
-	switch ( true ) {
1425
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1426
-			$payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] );
1424
+	switch (true) {
1425
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1426
+			$payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']);
1427 1427
 			break;
1428 1428
 
1429
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
1430
-			$reset_password_url = give_get_reset_password_url( $tag_args['user_id'] );
1429
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
1430
+			$reset_password_url = give_get_reset_password_url($tag_args['user_id']);
1431 1431
 			break;
1432 1432
 
1433
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
1434
-			$reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) );
1433
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
1434
+			$reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id']));
1435 1435
 			break;
1436 1436
 	}
1437 1437
 
1438
-	if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1438
+	if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1439 1439
 		// Generate link, if Email content type is html.
1440 1440
 		$reset_password_link = sprintf(
1441 1441
 			'<a href="%1$s" target="_blank">%2$s</a>',
1442
-			esc_url( $reset_password_url ),
1443
-			__( 'Reset your password &raquo;', 'give' )
1442
+			esc_url($reset_password_url),
1443
+			__('Reset your password &raquo;', 'give')
1444 1444
 		);
1445 1445
 	} else {
1446 1446
 		$reset_password_link = sprintf(
1447 1447
 			'%1$s: %2$s',
1448
-			__( 'Reset your password', 'give' ),
1449
-			esc_url( $reset_password_url )
1448
+			__('Reset your password', 'give'),
1449
+			esc_url($reset_password_url)
1450 1450
 		);
1451 1451
 	}
1452 1452
 
@@ -1475,21 +1475,21 @@  discard block
 block discarded – undo
1475 1475
  *
1476 1476
  * @return mixed|string
1477 1477
  */
1478
-function give_get_reset_password_url( $user_id ) {
1478
+function give_get_reset_password_url($user_id) {
1479 1479
 	$reset_password_url = '';
1480 1480
 
1481 1481
 	// Proceed further only, if user_id exists.
1482
-	if ( $user_id ) {
1482
+	if ($user_id) {
1483 1483
 
1484 1484
 		// Get User Object Details.
1485
-		$user = get_user_by( 'ID', $user_id );
1485
+		$user = get_user_by('ID', $user_id);
1486 1486
 
1487 1487
 		// Prepare Reset Password URL.
1488 1488
 		$reset_password_url = esc_url(
1489 1489
 			add_query_arg(
1490 1490
 				array(
1491 1491
 					'action' => 'rp',
1492
-					'key'    => get_password_reset_key( $user ),
1492
+					'key'    => get_password_reset_key($user),
1493 1493
 					'login'  => $user->user_login,
1494 1494
 				), wp_login_url()
1495 1495
 			)
@@ -1508,15 +1508,15 @@  discard block
 block discarded – undo
1508 1508
  */
1509 1509
 function give_email_admin_email() {
1510 1510
 
1511
-	$admin_email = give_get_option( 'contact_admin_email' );
1511
+	$admin_email = give_get_option('contact_admin_email');
1512 1512
 
1513
-	if ( empty( $admin_email ) ) {
1514
-		give_delete_option( 'contact_admin_email' );
1513
+	if (empty($admin_email)) {
1514
+		give_delete_option('contact_admin_email');
1515 1515
 	}
1516 1516
 
1517
-	return ( ! empty( $admin_email ) )
1517
+	return ( ! empty($admin_email))
1518 1518
 		? $admin_email
1519
-		: get_bloginfo( 'admin_email' );
1519
+		: get_bloginfo('admin_email');
1520 1520
 }
1521 1521
 
1522 1522
 /**
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
  * @return string
1528 1528
  */
1529 1529
 function give_email_site_url() {
1530
-	return get_bloginfo( 'url' );
1530
+	return get_bloginfo('url');
1531 1531
 }
1532 1532
 
1533 1533
 
@@ -1539,10 +1539,10 @@  discard block
 block discarded – undo
1539 1539
  * @return string
1540 1540
  */
1541 1541
 function give_email_offline_mailing_address() {
1542
-	$offline_address = give_get_option( 'contact_offline_mailing_address' );
1542
+	$offline_address = give_get_option('contact_offline_mailing_address');
1543 1543
 
1544
-	if ( false === $offline_address ) {
1545
-		return sprintf( '&nbsp;&nbsp;&nbsp;&nbsp;<em>%s</em></em><br>&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>', get_bloginfo( 'sitename' ) );
1544
+	if (false === $offline_address) {
1545
+		return sprintf('&nbsp;&nbsp;&nbsp;&nbsp;<em>%s</em></em><br>&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>', get_bloginfo('sitename'));
1546 1546
 	}
1547 1547
 
1548 1548
 	return $offline_address;
@@ -1560,97 +1560,97 @@  discard block
 block discarded – undo
1560 1560
  *
1561 1561
  * @return mixed
1562 1562
  */
1563
-function __give_render_metadata_email_tag( $content, $tag_args ) {
1564
-	preg_match_all( '/{meta_([A-z0-9\-\_\ ]+)}/s', $content, $matches );
1563
+function __give_render_metadata_email_tag($content, $tag_args) {
1564
+	preg_match_all('/{meta_([A-z0-9\-\_\ ]+)}/s', $content, $matches);
1565 1565
 
1566
-	if ( ! empty( $matches[0] ) ) {
1566
+	if ( ! empty($matches[0])) {
1567 1567
 		$search = $replace = array();
1568
-		foreach ( $matches[0] as $index => $meta_tag ) {
1569
-			if ( in_array( $meta_tag, $search ) ) {
1568
+		foreach ($matches[0] as $index => $meta_tag) {
1569
+			if (in_array($meta_tag, $search)) {
1570 1570
 				continue;
1571 1571
 			}
1572 1572
 
1573 1573
 			$search[] = $meta_tag;
1574 1574
 
1575
-			$meta_tag     = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag );
1576
-			$meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) );
1577
-			$meta_tag     = current( $meta_tag_arr );
1575
+			$meta_tag     = str_replace(array('{', 'meta_', '}'), '', $meta_tag);
1576
+			$meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2));
1577
+			$meta_tag     = current($meta_tag_arr);
1578 1578
 
1579
-			$meta_tag  = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag );
1580
-			$type      = current( explode( '_', $meta_tag, 2 ) );
1581
-			$meta_name = preg_replace( "/^{$type}_/", '', $meta_tag );
1579
+			$meta_tag  = str_replace(array('{', 'meta_', '}'), '', $meta_tag);
1580
+			$type      = current(explode('_', $meta_tag, 2));
1581
+			$meta_name = preg_replace("/^{$type}_/", '', $meta_tag);
1582 1582
 
1583
-			switch ( $type ) {
1583
+			switch ($type) {
1584 1584
 				case 'donation':
1585 1585
 					// Bailout.
1586
-					if ( ! isset( $tag_args['payment_id'] ) ) {
1586
+					if ( ! isset($tag_args['payment_id'])) {
1587 1587
 						$replace[] = '';
1588 1588
 						continue;
1589 1589
 					}
1590 1590
 
1591
-					$meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' );
1591
+					$meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, '');
1592 1592
 
1593
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1593
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1594 1594
 						$replace[] = $meta_data;
1595
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1596
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1595
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1596
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1597 1597
 					}
1598 1598
 
1599 1599
 					break;
1600 1600
 
1601 1601
 				case 'form':
1602
-					$form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0;
1602
+					$form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0;
1603 1603
 
1604 1604
 					// Bailout.
1605
-					if ( ! $form_id && isset( $tag_args['payment_id'] ) ) {
1606
-						$form_id = give_get_payment_form_id( $tag_args['payment_id'] );
1605
+					if ( ! $form_id && isset($tag_args['payment_id'])) {
1606
+						$form_id = give_get_payment_form_id($tag_args['payment_id']);
1607 1607
 					}
1608 1608
 
1609
-					$meta_data = give_get_meta( $form_id, $meta_name, true, '' );
1610
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1609
+					$meta_data = give_get_meta($form_id, $meta_name, true, '');
1610
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1611 1611
 						$replace[] = $meta_data;
1612
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1613
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1612
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1613
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1614 1614
 					}
1615 1615
 					break;
1616 1616
 
1617 1617
 				case 'donor':
1618
-					$donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0;
1618
+					$donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0;
1619 1619
 
1620 1620
 					// Bailout.
1621
-					if ( ! $donor_id ) {
1622
-						if ( isset( $tag_args['payment_id'] ) ) {
1623
-							$donor_id = give_get_payment_donor_id( $tag_args['payment_id'] );
1624
-						} elseif ( isset( $tag_args['user_id'] ) ) {
1625
-							$donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] );
1621
+					if ( ! $donor_id) {
1622
+						if (isset($tag_args['payment_id'])) {
1623
+							$donor_id = give_get_payment_donor_id($tag_args['payment_id']);
1624
+						} elseif (isset($tag_args['user_id'])) {
1625
+							$donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']);
1626 1626
 						}
1627 1627
 					}
1628 1628
 
1629
-					$meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true );
1629
+					$meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true);
1630 1630
 
1631
-					if ( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) {
1632
-						$meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id );
1631
+					if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) {
1632
+						$meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id);
1633 1633
 					}
1634 1634
 
1635
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1635
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1636 1636
 						$replace[] = $meta_data;
1637
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1638
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1637
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1638
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1639 1639
 					}
1640 1640
 
1641 1641
 					break;
1642 1642
 
1643 1643
 				default:
1644
-					$replace[] = end( $search );
1644
+					$replace[] = end($search);
1645 1645
 			}
1646 1646
 		}
1647 1647
 
1648
-		if ( ! empty( $search ) && ! empty( $replace ) ) {
1649
-			$content = str_replace( $search, $replace, $content );
1648
+		if ( ! empty($search) && ! empty($replace)) {
1649
+			$content = str_replace($search, $replace, $content);
1650 1650
 		}
1651 1651
 	}
1652 1652
 
1653 1653
 	return $content;
1654 1654
 }
1655 1655
 
1656
-add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 );
1656
+add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2);
Please login to merge, or discard this patch.
includes/admin/reports/graphing.php 1 patch
Spacing   +241 added lines, -241 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,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$dates          = give_get_report_dates();
27 27
 
28 28
 	// Determine graph options.
29
-	switch ( $dates['range'] ) :
29
+	switch ($dates['range']) :
30 30
 		case 'today':
31 31
 		case 'yesterday':
32 32
 			$day_by_day = true;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			$day_by_day = false;
39 39
 			break;
40 40
 		case 'other':
41
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) {
41
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) {
42 42
 				$day_by_day = false;
43 43
 			} else {
44 44
 				$day_by_day = true;
@@ -55,60 +55,60 @@  discard block
 block discarded – undo
55 55
 	$earnings_data = array();
56 56
 	$sales_data    = array();
57 57
 
58
-	if ( 'today' === $dates['range'] || 'yesterday' === $dates['range'] ) {
58
+	if ('today' === $dates['range'] || 'yesterday' === $dates['range']) {
59 59
 
60 60
 		// Hour by hour.
61 61
 		$hour  = 0;
62
-		$month = date( 'n', current_time( 'timestamp' ) );
63
-		while ( $hour <= 23 ) :
62
+		$month = date('n', current_time('timestamp'));
63
+		while ($hour <= 23) :
64 64
 
65
-			$start_date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] );
66
-			$end_date   = mktime( $hour, 59, 59, $month, $dates['day'], $dates['year'] );
67
-			$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
68
-			$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
65
+			$start_date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']);
66
+			$end_date   = mktime($hour, 59, 59, $month, $dates['day'], $dates['year']);
67
+			$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
68
+			$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
69 69
 
70 70
 			$sales_totals    += $sales;
71 71
 			$earnings_totals += $earnings;
72 72
 
73
-			$sales_data[]    = array( $start_date * 1000, $sales );
74
-			$earnings_data[] = array( $start_date * 1000, $earnings );
73
+			$sales_data[]    = array($start_date * 1000, $sales);
74
+			$earnings_data[] = array($start_date * 1000, $earnings);
75 75
 
76
-			$hour ++;
76
+			$hour++;
77 77
 		endwhile;
78 78
 
79
-	} elseif ( 'this_week' === $dates['range'] || 'last_week' === $dates['range'] ) {
79
+	} elseif ('this_week' === $dates['range'] || 'last_week' === $dates['range']) {
80 80
 
81 81
 		// Day by day.
82 82
 		$day     = $dates['day'];
83 83
 		$day_end = $dates['day_end'];
84 84
 		$month   = $dates['m_start'];
85
-		while ( $day <= $day_end ) :
85
+		while ($day <= $day_end) :
86 86
 
87
-			$start_date = mktime( 0, 0, 0, $month, $day, $dates['year'] );
88
-			$end_date   = mktime( 23, 59, 59, $month, $day, $dates['year'] );
89
-			$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
90
-			$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
87
+			$start_date = mktime(0, 0, 0, $month, $day, $dates['year']);
88
+			$end_date   = mktime(23, 59, 59, $month, $day, $dates['year']);
89
+			$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
90
+			$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
91 91
 
92 92
 			$sales_totals    += $sales;
93 93
 			$earnings_totals += $earnings;
94 94
 
95
-			$sales_data[]    = array( $start_date * 1000, $sales );
96
-			$earnings_data[] = array( $start_date * 1000, $earnings );
97
-			$day ++;
95
+			$sales_data[]    = array($start_date * 1000, $sales);
96
+			$earnings_data[] = array($start_date * 1000, $earnings);
97
+			$day++;
98 98
 		endwhile;
99 99
 
100 100
 	} else {
101 101
 
102 102
 		$y = $dates['year'];
103
-		while ( $y <= $dates['year_end'] ) :
103
+		while ($y <= $dates['year_end']) :
104 104
 
105
-			if ( $dates['year'] === $dates['year_end'] ) {
105
+			if ($dates['year'] === $dates['year_end']) {
106 106
 				$month_start = $dates['m_start'];
107 107
 				$month_end   = $dates['m_end'];
108
-			} elseif ( $y === $dates['year'] ) {
108
+			} elseif ($y === $dates['year']) {
109 109
 				$month_start = $dates['m_start'];
110 110
 				$month_end   = 12;
111
-			} elseif ( $y === $dates['year_end'] ) {
111
+			} elseif ($y === $dates['year_end']) {
112 112
 				$month_start = 1;
113 113
 				$month_end   = $dates['m_end'];
114 114
 			} else {
@@ -117,67 +117,67 @@  discard block
 block discarded – undo
117 117
 			}
118 118
 
119 119
 			$i = $month_start;
120
-			while ( $i <= $month_end ) :
120
+			while ($i <= $month_end) :
121 121
 
122
-				if ( $day_by_day ) {
122
+				if ($day_by_day) {
123 123
 
124
-					if ( $i === $month_end ) {
124
+					if ($i === $month_end) {
125 125
 
126 126
 						$num_of_days = $dates['day_end'];
127 127
 
128 128
 					} else {
129 129
 
130
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
130
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
131 131
 
132 132
 					}
133 133
 
134 134
 					$d = $dates['day'];
135 135
 
136
-					while ( $d <= $num_of_days ) :
136
+					while ($d <= $num_of_days) :
137 137
 
138
-						$start_date = mktime( 0, 0, 0, $i, $d, $y );
139
-						$end_date   = mktime( 23, 59, 59, $i, $d, $y );
140
-						$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
141
-						$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
138
+						$start_date = mktime(0, 0, 0, $i, $d, $y);
139
+						$end_date   = mktime(23, 59, 59, $i, $d, $y);
140
+						$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
141
+						$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
142 142
 
143 143
 						$sales_totals    += $sales;
144 144
 						$earnings_totals += $earnings;
145 145
 
146
-						$sales_data[]    = array( $start_date * 1000, $sales );
147
-						$earnings_data[] = array( $start_date * 1000, $earnings );
146
+						$sales_data[]    = array($start_date * 1000, $sales);
147
+						$earnings_data[] = array($start_date * 1000, $earnings);
148 148
 
149
-						$d ++;
149
+						$d++;
150 150
 
151 151
 					endwhile;
152 152
 
153 153
 				} else {
154 154
 
155 155
 					// This Quarter, Last Quarter, This Year, Last Year.
156
-					$start_date = mktime( 0, 0, 0, $i, 1, $y );
157
-					$end_date   = mktime( 23, 59, 59, $i + 1, 0, $y );
158
-					$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
159
-					$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
156
+					$start_date = mktime(0, 0, 0, $i, 1, $y);
157
+					$end_date   = mktime(23, 59, 59, $i + 1, 0, $y);
158
+					$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
159
+					$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
160 160
 
161 161
 					$sales_totals    += $sales;
162 162
 					$earnings_totals += $earnings;
163 163
 
164
-					$sales_data[]    = array( $start_date * 1000, $sales );
165
-					$earnings_data[] = array( $start_date * 1000, $earnings );
164
+					$sales_data[]    = array($start_date * 1000, $sales);
165
+					$earnings_data[] = array($start_date * 1000, $earnings);
166 166
 
167 167
 				}
168 168
 
169
-				$i ++;
169
+				$i++;
170 170
 
171 171
 			endwhile;
172 172
 
173
-			$y ++;
173
+			$y++;
174 174
 		endwhile;
175 175
 
176 176
 	}
177 177
 
178 178
 	$data = array(
179
-		__( 'Income', 'give' )    => $earnings_data,
180
-		__( 'Donations', 'give' ) => $sales_data,
179
+		__('Income', 'give')    => $earnings_data,
180
+		__('Donations', 'give') => $sales_data,
181 181
 	);
182 182
 
183 183
 	// start our own output buffer.
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 				<div class="inside">
191 191
 					<?php give_reports_graph_controls(); ?>
192 192
 					<?php
193
-					$graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
194
-					$graph->set( 'x_mode', 'time' );
195
-					$graph->set( 'multiple_y_axes', true );
193
+					$graph = new Give_Graph($data, array('dataType' => array('amount', 'count')));
194
+					$graph->set('x_mode', 'time');
195
+					$graph->set('multiple_y_axes', true);
196 196
 					$graph->display();
197 197
 
198
-					if ( 'this_month' === $dates['range'] ) {
198
+					if ('this_month' === $dates['range']) {
199 199
 						$estimated = give_estimated_monthly_stats();
200 200
 					}
201 201
 					?>
@@ -204,21 +204,21 @@  discard block
 block discarded – undo
204 204
 			<table class="widefat reports-table alignleft" style="max-width:450px">
205 205
 				<tbody>
206 206
 				<tr>
207
-					<th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
208
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
207
+					<th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th>
208
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td>
209 209
 				</tr>
210 210
 				<tr class="alternate">
211
-					<th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?><strong></th>
211
+					<th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?><strong></th>
212 212
 					<td><?php echo $sales_totals; ?></td>
213 213
 				</tr>
214
-				<?php if ( 'this_month' === $dates['range'] ) : ?>
214
+				<?php if ('this_month' === $dates['range']) : ?>
215 215
 					<tr>
216
-						<th scope="row"><strong><?php _e( 'Estimated monthly income:', 'give' ); ?></strong></th>
217
-						<td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'], array( 'sanitize' => false ) ) ); ?></td>
216
+						<th scope="row"><strong><?php _e('Estimated monthly income:', 'give'); ?></strong></th>
217
+						<td><?php echo give_currency_filter(give_format_amount($estimated['earnings'], array('sanitize' => false))); ?></td>
218 218
 					</tr>
219 219
 					<tr class="alternate">
220
-						<th scope="row"><strong><?php _e( 'Estimated monthly donations:', 'give' ); ?></strong></th>
221
-						<td><?php echo floor( $estimated['sales'] ); ?></td>
220
+						<th scope="row"><strong><?php _e('Estimated monthly donations:', 'give'); ?></strong></th>
221
+						<td><?php echo floor($estimated['sales']); ?></td>
222 222
 					</tr>
223 223
 				<?php endif; ?>
224 224
 			</table>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			 *
232 232
 			 * @since 1.0
233 233
 			 */
234
-			do_action( 'give_reports_graph_additional_stats' );
234
+			do_action('give_reports_graph_additional_stats');
235 235
 			?>
236 236
 
237 237
 		</div>
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return void
255 255
  */
256
-function give_reports_graph_of_form( $form_id = 0 ) {
256
+function give_reports_graph_of_form($form_id = 0) {
257 257
 	// Retrieve the queried dates.
258 258
 	$dates = give_get_report_dates();
259 259
 
260 260
 	// Determine graph options.
261
-	switch ( $dates['range'] ) :
261
+	switch ($dates['range']) :
262 262
 		case 'today':
263 263
 		case 'yesterday':
264 264
 			$day_by_day = true;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			$day_by_day = false;
277 277
 			break;
278 278
 		case 'other':
279
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) {
279
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) {
280 280
 				$day_by_day = false;
281 281
 			} else {
282 282
 				$day_by_day = true;
@@ -288,75 +288,75 @@  discard block
 block discarded – undo
288 288
 	endswitch;
289 289
 
290 290
 	$earnings_totals = (float) 0.00; // Total earnings for time period shown.
291
-	$sales_totals    = 0;            // Total sales for time period shown.
291
+	$sales_totals    = 0; // Total sales for time period shown.
292 292
 
293 293
 	$earnings_data = array();
294 294
 	$sales_data    = array();
295 295
 	$stats         = new Give_Payment_Stats();
296 296
 
297
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
297
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
298 298
 
299 299
 		// Hour by hour
300 300
 		$month  = $dates['m_start'];
301 301
 		$hour   = 0;
302 302
 		$minute = 0;
303 303
 		$second = 0;
304
-		while ( $hour <= 23 ) :
304
+		while ($hour <= 23) :
305 305
 
306
-			if ( $hour == 23 ) {
306
+			if ($hour == 23) {
307 307
 				$minute = $second = 59;
308 308
 			}
309 309
 
310
-			$date     = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] );
311
-			$date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] );
310
+			$date     = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']);
311
+			$date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']);
312 312
 
313
-			$sales         = $stats->get_sales( $form_id, $date, $date_end );
313
+			$sales         = $stats->get_sales($form_id, $date, $date_end);
314 314
 			$sales_totals += $sales;
315 315
 
316
-			$earnings         = $stats->get_earnings( $form_id, $date, $date_end );
316
+			$earnings         = $stats->get_earnings($form_id, $date, $date_end);
317 317
 			$earnings_totals += $earnings;
318 318
 
319
-			$sales_data[]    = array( $date * 1000, $sales );
320
-			$earnings_data[] = array( $date * 1000, $earnings );
319
+			$sales_data[]    = array($date * 1000, $sales);
320
+			$earnings_data[] = array($date * 1000, $earnings);
321 321
 
322
-			$hour ++;
322
+			$hour++;
323 323
 		endwhile;
324 324
 
325
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
325
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
326 326
 
327 327
 		// Day by day.
328 328
 		$day     = $dates['day'];
329 329
 		$day_end = $dates['day_end'];
330 330
 		$month   = $dates['m_start'];
331
-		while ( $day <= $day_end ) :
331
+		while ($day <= $day_end) :
332 332
 
333
-			$date          = mktime( 0, 0, 0, $month, $day, $dates['year'] );
334
-			$date_end      = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] );
335
-			$sales         = $stats->get_sales( $form_id, $date, $date_end );
333
+			$date          = mktime(0, 0, 0, $month, $day, $dates['year']);
334
+			$date_end      = mktime(0, 0, 0, $month, $day + 1, $dates['year']);
335
+			$sales         = $stats->get_sales($form_id, $date, $date_end);
336 336
 			$sales_totals += $sales;
337 337
 
338
-			$earnings         = $stats->get_earnings( $form_id, $date, $date_end );
338
+			$earnings         = $stats->get_earnings($form_id, $date, $date_end);
339 339
 			$earnings_totals += $earnings;
340 340
 
341
-			$sales_data[]    = array( $date * 1000, $sales );
342
-			$earnings_data[] = array( $date * 1000, $earnings );
341
+			$sales_data[]    = array($date * 1000, $sales);
342
+			$earnings_data[] = array($date * 1000, $earnings);
343 343
 
344
-			$day ++;
344
+			$day++;
345 345
 		endwhile;
346 346
 
347 347
 	} else {
348 348
 
349 349
 		$y = $dates['year'];
350 350
 
351
-		while ( $y <= $dates['year_end'] ) :
351
+		while ($y <= $dates['year_end']) :
352 352
 
353 353
 			$last_year = false;
354 354
 
355
-			if ( $dates['year'] == $dates['year_end'] ) {
355
+			if ($dates['year'] == $dates['year_end']) {
356 356
 				$month_start = $dates['m_start'];
357 357
 				$month_end   = $dates['m_end'];
358 358
 				$last_year   = true;
359
-			} elseif ( $y == $dates['year'] ) {
359
+			} elseif ($y == $dates['year']) {
360 360
 				$month_start = $dates['m_start'];
361 361
 				$month_end   = 12;
362 362
 			} else {
@@ -365,68 +365,68 @@  discard block
 block discarded – undo
365 365
 			}
366 366
 
367 367
 			$i = $month_start;
368
-			while ( $i <= $month_end ) :
368
+			while ($i <= $month_end) :
369 369
 
370
-				if ( $day_by_day ) {
370
+				if ($day_by_day) {
371 371
 
372
-					if ( $i == $month_end && $last_year ) {
372
+					if ($i == $month_end && $last_year) {
373 373
 
374 374
 						$num_of_days = $dates['day_end'];
375 375
 
376 376
 					} else {
377 377
 
378
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
378
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
379 379
 
380 380
 					}
381 381
 
382 382
 					$d = $dates['day'];
383
-					while ( $d <= $num_of_days ) :
383
+					while ($d <= $num_of_days) :
384 384
 
385
-						$date     = mktime( 0, 0, 0, $i, $d, $y );
386
-						$end_date = mktime( 23, 59, 59, $i, $d, $y );
385
+						$date     = mktime(0, 0, 0, $i, $d, $y);
386
+						$end_date = mktime(23, 59, 59, $i, $d, $y);
387 387
 
388
-						$sales         = $stats->get_sales( $form_id, $date, $end_date );
388
+						$sales         = $stats->get_sales($form_id, $date, $end_date);
389 389
 						$sales_totals += $sales;
390 390
 
391
-						$earnings         = $stats->get_earnings( $form_id, $date, $end_date );
391
+						$earnings         = $stats->get_earnings($form_id, $date, $end_date);
392 392
 						$earnings_totals += $earnings;
393 393
 
394
-						$sales_data[]    = array( $date * 1000, $sales );
395
-						$earnings_data[] = array( $date * 1000, $earnings );
396
-						$d ++;
394
+						$sales_data[]    = array($date * 1000, $sales);
395
+						$earnings_data[] = array($date * 1000, $earnings);
396
+						$d++;
397 397
 
398 398
 					endwhile;
399 399
 
400 400
 				} else {
401 401
 
402
-					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
402
+					$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
403 403
 
404
-					$date     = mktime( 0, 0, 0, $i, 1, $y );
405
-					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
404
+					$date     = mktime(0, 0, 0, $i, 1, $y);
405
+					$end_date = mktime(23, 59, 59, $i, $num_of_days, $y);
406 406
 
407
-					$sales         = $stats->get_sales( $form_id, $date, $end_date );
407
+					$sales         = $stats->get_sales($form_id, $date, $end_date);
408 408
 					$sales_totals += $sales;
409 409
 
410
-					$earnings         = $stats->get_earnings( $form_id, $date, $end_date );
410
+					$earnings         = $stats->get_earnings($form_id, $date, $end_date);
411 411
 					$earnings_totals += $earnings;
412 412
 
413
-					$sales_data[]    = array( $date * 1000, $sales );
414
-					$earnings_data[] = array( $date * 1000, $earnings );
413
+					$sales_data[]    = array($date * 1000, $sales);
414
+					$earnings_data[] = array($date * 1000, $earnings);
415 415
 
416 416
 				}
417 417
 
418
-				$i ++;
418
+				$i++;
419 419
 
420 420
 			endwhile;
421 421
 
422
-			$y ++;
422
+			$y++;
423 423
 		endwhile;
424 424
 
425 425
 	}
426 426
 
427 427
 	$data = array(
428
-		__( 'Income', 'give' )    => $earnings_data,
429
-		__( 'Donations', 'give' ) => $sales_data,
428
+		__('Income', 'give')    => $earnings_data,
429
+		__('Donations', 'give') => $sales_data,
430 430
 	);
431 431
 
432 432
 	?>
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	<?php
435 435
 			printf(
436 436
 				/* translators: %s: form title */
437
-				esc_html__( 'Income Report for %s', 'give' ),
438
-				get_the_title( $form_id )
437
+				esc_html__('Income Report for %s', 'give'),
438
+				get_the_title($form_id)
439 439
 			);
440 440
 			?>
441 441
 			</span></h3>
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 				<div class="inside">
446 446
 					<?php give_reports_graph_controls(); ?>
447 447
 					<?php
448
-					$graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
449
-					$graph->set( 'x_mode', 'time' );
450
-					$graph->set( 'multiple_y_axes', true );
448
+					$graph = new Give_Graph($data, array('dataType' => array('amount', 'count')));
449
+					$graph->set('x_mode', 'time');
450
+					$graph->set('multiple_y_axes', true);
451 451
 					$graph->display();
452 452
 					?>
453 453
 				</div>
@@ -456,20 +456,20 @@  discard block
 block discarded – undo
456 456
 			<table class="widefat reports-table alignleft" style="max-width:450px">
457 457
 				<tbody>
458 458
 				<tr>
459
-					<th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
460
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
459
+					<th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th>
460
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td>
461 461
 				</tr>
462 462
 				<tr class="alternate">
463
-					<th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?></strong></th>
463
+					<th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?></strong></th>
464 464
 					<td><?php echo $sales_totals; ?></td>
465 465
 				</tr>
466 466
 				<tr>
467
-					<th scope="row"><strong><?php _e( 'Average monthly income:', 'give' ); ?></strong></th>
468
-					<td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ), array( 'sanitize' => false ) ) ); ?></td>
467
+					<th scope="row"><strong><?php _e('Average monthly income:', 'give'); ?></strong></th>
468
+					<td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id), array('sanitize' => false))); ?></td>
469 469
 				</tr>
470 470
 				<tr class="alternate">
471
-					<th scope="row"><strong><?php _e( 'Average monthly donations:', 'give' ); ?></strong></th>
472
-					<td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
471
+					<th scope="row"><strong><?php _e('Average monthly donations:', 'give'); ?></strong></th>
472
+					<td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td>
473 473
 				</tr>
474 474
 				</tbody>
475 475
 			</table>
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 			 *
483 483
 			 * @since 1.0
484 484
 			 */
485
-			do_action( 'give_reports_graph_additional_stats' );
485
+			do_action('give_reports_graph_additional_stats');
486 486
 			?>
487 487
 
488 488
 		</div>
@@ -502,26 +502,26 @@  discard block
 block discarded – undo
502 502
 function give_reports_graph_controls() {
503 503
 	$date_options = apply_filters(
504 504
 		'give_report_date_options', array(
505
-			'today'        => __( 'Today', 'give' ),
506
-			'yesterday'    => __( 'Yesterday', 'give' ),
507
-			'this_week'    => __( 'This Week', 'give' ),
508
-			'last_week'    => __( 'Last Week', 'give' ),
509
-			'this_month'   => __( 'This Month', 'give' ),
510
-			'last_month'   => __( 'Last Month', 'give' ),
511
-			'this_quarter' => __( 'This Quarter', 'give' ),
512
-			'last_quarter' => __( 'Last Quarter', 'give' ),
513
-			'this_year'    => __( 'This Year', 'give' ),
514
-			'last_year'    => __( 'Last Year', 'give' ),
515
-			'other'        => __( 'Custom', 'give' ),
505
+			'today'        => __('Today', 'give'),
506
+			'yesterday'    => __('Yesterday', 'give'),
507
+			'this_week'    => __('This Week', 'give'),
508
+			'last_week'    => __('Last Week', 'give'),
509
+			'this_month'   => __('This Month', 'give'),
510
+			'last_month'   => __('Last Month', 'give'),
511
+			'this_quarter' => __('This Quarter', 'give'),
512
+			'last_quarter' => __('Last Quarter', 'give'),
513
+			'this_year'    => __('This Year', 'give'),
514
+			'last_year'    => __('Last Year', 'give'),
515
+			'other'        => __('Custom', 'give'),
516 516
 		)
517 517
 	);
518 518
 
519 519
 	$dates   = give_get_report_dates();
520 520
 	$display = $dates['range'] == 'other' ? '' : 'display: none;';
521
-	$tab     = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
521
+	$tab     = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
522 522
 
523
-	if ( empty( $dates['day_end'] ) ) {
524
-		$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
523
+	if (empty($dates['day_end'])) {
524
+		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y'));
525 525
 	}
526 526
 
527 527
 	/**
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	 *
530 530
 	 * @since 1.0
531 531
 	 */
532
-	do_action( 'give_report_graph_controls_before' );
532
+	do_action('give_report_graph_controls_before');
533 533
 	?>
534 534
 	<form id="give-graphs-filter" method="get">
535 535
 		<div class="tablenav top">
@@ -537,56 +537,56 @@  discard block
 block discarded – undo
537 537
 
538 538
 				<input type="hidden" name="post_type" value="give_forms" />
539 539
 				<input type="hidden" name="page" value="give-reports" />
540
-				<input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
540
+				<input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" />
541 541
 
542
-				<?php if ( isset( $_GET['form-id'] ) ) : ?>
543
-					<input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" />
542
+				<?php if (isset($_GET['form-id'])) : ?>
543
+					<input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" />
544 544
 				<?php endif; ?>
545 545
 
546 546
 				<div id="give-graphs-date-options-wrap">
547 547
 					<select id="give-graphs-date-options" name="range">
548
-						<?php foreach ( $date_options as $key => $option ) : ?>
549
-							<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
548
+						<?php foreach ($date_options as $key => $option) : ?>
549
+							<option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option>
550 550
 						<?php endforeach; ?>
551 551
 					</select>
552 552
 
553
-					<div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>">
554
-						<span class="screen-reader-text"><?php _e( 'From', 'give' ); ?>&nbsp;</span>
553
+					<div id="give-date-range-options" style="<?php echo esc_attr($display); ?>">
554
+						<span class="screen-reader-text"><?php _e('From', 'give'); ?>&nbsp;</span>
555 555
 						<select id="give-graphs-month-start" name="m_start" aria-label="Start Month">
556
-							<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
557
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option>
556
+							<?php for ($i = 1; $i <= 12; $i++) : ?>
557
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option>
558 558
 							<?php endfor; ?>
559 559
 						</select>
560 560
 						<select id="give-graphs-day-start" name="day" aria-label="Start Day">
561
-							<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
562
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option>
561
+							<?php for ($i = 1; $i <= 31; $i++) : ?>
562
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option>
563 563
 							<?php endfor; ?>
564 564
 						</select>
565 565
 						<select id="give-graphs-year-start" name="year" aria-label="Start Year">
566
-							<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
567
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option>
566
+							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
567
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option>
568 568
 							<?php endfor; ?>
569 569
 						</select>
570
-						<span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?>&nbsp;</span>
570
+						<span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?>&nbsp;</span>
571 571
 						<span>&ndash;</span>
572 572
 						<select id="give-graphs-month-end" name="m_end" aria-label="End Month">
573
-							<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
574
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option>
573
+							<?php for ($i = 1; $i <= 12; $i++) : ?>
574
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option>
575 575
 							<?php endfor; ?>
576 576
 						</select>
577 577
 						<select id="give-graphs-day-end" name="day_end" aria-label="End Day">
578
-							<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
579
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option>
578
+							<?php for ($i = 1; $i <= 31; $i++) : ?>
579
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option>
580 580
 							<?php endfor; ?>
581 581
 						</select>
582 582
 						<select id="give-graphs-year-end" name="year_end" aria-label="End Year">
583
-							<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
584
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option>
583
+							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
584
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option>
585 585
 							<?php endfor; ?>
586 586
 						</select>
587 587
 					</div>
588 588
 
589
-					<input type="submit" class="button-secondary" value="<?php _e( 'Filter', 'give' ); ?>" />
589
+					<input type="submit" class="button-secondary" value="<?php _e('Filter', 'give'); ?>" />
590 590
 				</div>
591 591
 
592 592
 				<input type="hidden" name="give_action" value="filter_reports" />
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 	 *
600 600
 	 * @since 1.0
601 601
 	 */
602
-	do_action( 'give_report_graph_controls_after' );
602
+	do_action('give_report_graph_controls_after');
603 603
 }
604 604
 
605 605
 /**
@@ -615,66 +615,66 @@  discard block
 block discarded – undo
615 615
 function give_get_report_dates() {
616 616
 	$dates = array();
617 617
 
618
-	$current_time = current_time( 'timestamp' );
618
+	$current_time = current_time('timestamp');
619 619
 
620
-	$dates['range']    = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
621
-	$dates['year']     = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
622
-	$dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' );
623
-	$dates['m_start']  = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1;
624
-	$dates['m_end']    = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12;
625
-	$dates['day']      = isset( $_GET['day'] ) ? $_GET['day'] : 1;
626
-	$dates['day_end']  = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
620
+	$dates['range']    = isset($_GET['range']) ? $_GET['range'] : 'this_month';
621
+	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y');
622
+	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y');
623
+	$dates['m_start']  = isset($_GET['m_start']) ? $_GET['m_start'] : 1;
624
+	$dates['m_end']    = isset($_GET['m_end']) ? $_GET['m_end'] : 12;
625
+	$dates['day']      = isset($_GET['day']) ? $_GET['day'] : 1;
626
+	$dates['day_end']  = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
627 627
 
628 628
 	// Modify dates based on predefined ranges.
629
-	switch ( $dates['range'] ) :
629
+	switch ($dates['range']) :
630 630
 
631 631
 		case 'this_month':
632
-			$dates['m_start']  = date( 'n', $current_time );
633
-			$dates['m_end']    = date( 'n', $current_time );
632
+			$dates['m_start']  = date('n', $current_time);
633
+			$dates['m_end']    = date('n', $current_time);
634 634
 			$dates['day']      = 1;
635
-			$dates['day_end']  = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
636
-			$dates['year']     = date( 'Y' );
637
-			$dates['year_end'] = date( 'Y' );
635
+			$dates['day_end']  = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
636
+			$dates['year']     = date('Y');
637
+			$dates['year_end'] = date('Y');
638 638
 			break;
639 639
 
640 640
 		case 'last_month':
641
-			if ( date( 'n' ) == 1 ) {
641
+			if (date('n') == 1) {
642 642
 				$dates['m_start']  = 12;
643 643
 				$dates['m_end']    = 12;
644
-				$dates['year']     = date( 'Y', $current_time ) - 1;
645
-				$dates['year_end'] = date( 'Y', $current_time ) - 1;
644
+				$dates['year']     = date('Y', $current_time) - 1;
645
+				$dates['year_end'] = date('Y', $current_time) - 1;
646 646
 			} else {
647
-				$dates['m_start']  = date( 'n' ) - 1;
648
-				$dates['m_end']    = date( 'n' ) - 1;
647
+				$dates['m_start']  = date('n') - 1;
648
+				$dates['m_end']    = date('n') - 1;
649 649
 				$dates['year_end'] = $dates['year'];
650 650
 			}
651
-			$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
651
+			$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
652 652
 			break;
653 653
 
654 654
 		case 'today':
655
-			$dates['day']      = date( 'd', $current_time );
656
-			$dates['day_end']  = date( 'd', $current_time );
657
-			$dates['m_start']  = date( 'n', $current_time );
658
-			$dates['m_end']    = date( 'n', $current_time );
659
-			$dates['year']     = date( 'Y', $current_time );
660
-			$dates['year_end'] = date( 'Y', $current_time );
655
+			$dates['day']      = date('d', $current_time);
656
+			$dates['day_end']  = date('d', $current_time);
657
+			$dates['m_start']  = date('n', $current_time);
658
+			$dates['m_end']    = date('n', $current_time);
659
+			$dates['year']     = date('Y', $current_time);
660
+			$dates['year_end'] = date('Y', $current_time);
661 661
 			break;
662 662
 
663 663
 		case 'yesterday':
664
-			$year  = date( 'Y', $current_time );
665
-			$month = date( 'n', $current_time );
666
-			$day   = date( 'd', $current_time );
664
+			$year  = date('Y', $current_time);
665
+			$month = date('n', $current_time);
666
+			$day   = date('d', $current_time);
667 667
 
668
-			if ( $month == 1 && $day == 1 ) {
668
+			if ($month == 1 && $day == 1) {
669 669
 
670 670
 				$year -= 1;
671 671
 				$month = 12;
672
-				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
672
+				$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
673 673
 
674
-			} elseif ( $month > 1 && $day == 1 ) {
674
+			} elseif ($month > 1 && $day == 1) {
675 675
 
676 676
 				$month -= 1;
677
-				$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
677
+				$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
678 678
 
679 679
 			} else {
680 680
 
@@ -690,48 +690,48 @@  discard block
 block discarded – undo
690 690
 			break;
691 691
 
692 692
 		case 'this_week':
693
-			$dates['day']     = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;
694
-			$dates['day']    += get_option( 'start_of_week' );
693
+			$dates['day']     = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1;
694
+			$dates['day']    += get_option('start_of_week');
695 695
 			$dates['day_end'] = $dates['day'] + 6;
696
-			$dates['m_start'] = date( 'n', $current_time );
697
-			$dates['m_end']   = date( 'n', $current_time );
698
-			$dates['year']    = date( 'Y', $current_time );
696
+			$dates['m_start'] = date('n', $current_time);
697
+			$dates['m_end']   = date('n', $current_time);
698
+			$dates['year']    = date('Y', $current_time);
699 699
 			break;
700 700
 
701 701
 		case 'last_week':
702
-			$dates['day']     = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8;
703
-			$dates['day']    += get_option( 'start_of_week' );
702
+			$dates['day']     = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8;
703
+			$dates['day']    += get_option('start_of_week');
704 704
 			$dates['day_end'] = $dates['day'] + 6;
705
-			$dates['year']    = date( 'Y' );
706
-
707
-			if ( date( 'j', $current_time ) <= 7 ) {
708
-				$dates['m_start'] = date( 'n', $current_time ) - 1;
709
-				$dates['m_end']   = date( 'n', $current_time ) - 1;
710
-				if ( $dates['m_start'] <= 1 ) {
711
-					$dates['year']     = date( 'Y', $current_time ) - 1;
712
-					$dates['year_end'] = date( 'Y', $current_time ) - 1;
705
+			$dates['year']    = date('Y');
706
+
707
+			if (date('j', $current_time) <= 7) {
708
+				$dates['m_start'] = date('n', $current_time) - 1;
709
+				$dates['m_end']   = date('n', $current_time) - 1;
710
+				if ($dates['m_start'] <= 1) {
711
+					$dates['year']     = date('Y', $current_time) - 1;
712
+					$dates['year_end'] = date('Y', $current_time) - 1;
713 713
 				}
714 714
 			} else {
715
-				$dates['m_start'] = date( 'n', $current_time );
716
-				$dates['m_end']   = date( 'n', $current_time );
715
+				$dates['m_start'] = date('n', $current_time);
716
+				$dates['m_end']   = date('n', $current_time);
717 717
 			}
718 718
 			break;
719 719
 
720 720
 		case 'this_quarter':
721
-			$month_now     = date( 'n', $current_time );
722
-			$dates['year'] = date( 'Y', $current_time );
721
+			$month_now     = date('n', $current_time);
722
+			$dates['year'] = date('Y', $current_time);
723 723
 
724
-			if ( $month_now <= 3 ) {
724
+			if ($month_now <= 3) {
725 725
 
726 726
 				$dates['m_start'] = 1;
727 727
 				$dates['m_end']   = 4;
728 728
 
729
-			} elseif ( $month_now <= 6 ) {
729
+			} elseif ($month_now <= 6) {
730 730
 
731 731
 				$dates['m_start'] = 4;
732 732
 				$dates['m_end']   = 7;
733 733
 
734
-			} elseif ( $month_now <= 9 ) {
734
+			} elseif ($month_now <= 9) {
735 735
 
736 736
 				$dates['m_start'] = 7;
737 737
 				$dates['m_end']   = 10;
@@ -740,28 +740,28 @@  discard block
 block discarded – undo
740 740
 
741 741
 				$dates['m_start']  = 10;
742 742
 				$dates['m_end']    = 1;
743
-				$dates['year_end'] = date( 'Y', $current_time ) + 1;
743
+				$dates['year_end'] = date('Y', $current_time) + 1;
744 744
 
745 745
 			}
746 746
 			break;
747 747
 
748 748
 		case 'last_quarter':
749
-			$month_now         = date( 'n', $current_time );
750
-			$dates['year']     = date( 'Y', $current_time );
751
-			$dates['year_end'] = date( 'Y', $current_time );
749
+			$month_now         = date('n', $current_time);
750
+			$dates['year']     = date('Y', $current_time);
751
+			$dates['year_end'] = date('Y', $current_time);
752 752
 
753
-			if ( $month_now <= 3 ) {
753
+			if ($month_now <= 3) {
754 754
 
755 755
 				$dates['m_start'] = 10;
756 756
 				$dates['m_end']   = 1;
757
-				$dates['year']    = date( 'Y', $current_time ) - 1; // Previous year.
757
+				$dates['year']    = date('Y', $current_time) - 1; // Previous year.
758 758
 
759
-			} elseif ( $month_now <= 6 ) {
759
+			} elseif ($month_now <= 6) {
760 760
 
761 761
 				$dates['m_start'] = 1;
762 762
 				$dates['m_end']   = 4;
763 763
 
764
-			} elseif ( $month_now <= 9 ) {
764
+			} elseif ($month_now <= 9) {
765 765
 
766 766
 				$dates['m_start'] = 4;
767 767
 				$dates['m_end']   = 7;
@@ -777,20 +777,20 @@  discard block
 block discarded – undo
777 777
 		case 'this_year':
778 778
 			$dates['m_start']  = 1;
779 779
 			$dates['m_end']    = 12;
780
-			$dates['year']     = date( 'Y', $current_time );
781
-			$dates['year_end'] = date( 'Y', $current_time );
780
+			$dates['year']     = date('Y', $current_time);
781
+			$dates['year_end'] = date('Y', $current_time);
782 782
 			break;
783 783
 
784 784
 		case 'last_year':
785 785
 			$dates['m_start']  = 1;
786 786
 			$dates['m_end']    = 12;
787
-			$dates['year']     = date( 'Y', $current_time ) - 1;
788
-			$dates['year_end'] = date( 'Y', $current_time ) - 1;
787
+			$dates['year']     = date('Y', $current_time) - 1;
788
+			$dates['year_end'] = date('Y', $current_time) - 1;
789 789
 			break;
790 790
 
791 791
 	endswitch;
792 792
 
793
-	return apply_filters( 'give_report_dates', $dates );
793
+	return apply_filters('give_report_dates', $dates);
794 794
 }
795 795
 
796 796
 /**
@@ -801,18 +801,18 @@  discard block
 block discarded – undo
801 801
  *
802 802
  * @param $data
803 803
  */
804
-function give_parse_report_dates( $data ) {
804
+function give_parse_report_dates($data) {
805 805
 	$dates = give_get_report_dates();
806 806
 
807 807
 	$view = give_get_reporting_view();
808
-	$tab  = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
809
-	$id   = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
808
+	$tab  = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
809
+	$id   = isset($_GET['form-id']) ? $_GET['form-id'] : null;
810 810
 
811
-	wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) );
811
+	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id))));
812 812
 	give_die();
813 813
 }
814 814
 
815
-add_action( 'give_filter_reports', 'give_parse_report_dates' );
815
+add_action('give_filter_reports', 'give_parse_report_dates');
816 816
 
817 817
 
818 818
 /**
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 
836 836
 	echo Give()->tooltips->render_link(
837 837
 		array(
838
-			'label'       => esc_attr__( 'Clicking this will clear the reports cache.', 'give' ),
839
-			'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' . esc_html__( 'Refresh Report Data', 'give' ),
838
+			'label'       => esc_attr__('Clicking this will clear the reports cache.', 'give'),
839
+			'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>'.esc_html__('Refresh Report Data', 'give'),
840 840
 			'link'        => $url,
841 841
 			'position'    => 'left',
842 842
 			'attributes'  => array(
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 	);
847 847
 }
848 848
 
849
-add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );
849
+add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button');
850 850
 
851 851
 /**
852 852
  * Trigger the refresh of reports transients
@@ -857,20 +857,20 @@  discard block
 block discarded – undo
857 857
  *
858 858
  * @return void
859 859
  */
860
-function give_run_refresh_reports_transients( $data ) {
860
+function give_run_refresh_reports_transients($data) {
861 861
 
862
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) {
862
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) {
863 863
 		return;
864 864
 	}
865 865
 
866 866
 	// Monthly stats.
867
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
867
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
868 868
 
869 869
 	// Total earning.
870
-	delete_option( 'give_earnings_total' );
870
+	delete_option('give_earnings_total');
871 871
 
872 872
 	// @todo: Refresh only range related stat cache
873 873
 	give_delete_donation_stats();
874 874
 }
875 875
 
876
-add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' );
876
+add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients');
Please login to merge, or discard this patch.
includes/forms/functions.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  *
156 156
  * Used to redirect a user back to the donation form if there are errors present.
157 157
  *
158
- * @param array|string $args
158
+ * @param string $args
159 159
  *
160 160
  * @access public
161 161
  * @since  1.0
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
  * @since  1.0
302 302
  * @since  1.8.16 Add security check
303 303
  *
304
- * @return bool
304
+ * @return false|null
305 305
  */
306 306
 function give_listen_for_failed_payments() {
307 307
 
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
  * @since 2.2.0
1293 1293
  *
1294 1294
  * @param array|integer   $price_or_level_id Price level data.
1295
- * @param boolean|integer $form_id           Donation Form ID.
1295
+ * @param integer $form_id           Donation Form ID.
1296 1296
  *
1297 1297
  * @return boolean
1298 1298
  */
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
  *
1397 1397
  * @since 2.2.0
1398 1398
  *
1399
- * @return object
1399
+ * @return Give_Donor
1400 1400
  */
1401 1401
 function give_get_name_with_title_prefixes( $donor ) {
1402 1402
 
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
  *
1442 1442
  * @since 2.2.0
1443 1443
  *
1444
- * @return array
1444
+ * @return string|boolean
1445 1445
  */
1446 1446
 function give_get_default_title_prefixes() {
1447 1447
 	/**
Please login to merge, or discard this patch.
Spacing   +303 added lines, -305 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = give_get_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = give_get_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) {
75
-		$float_labels = give_get_option( 'floatlabels', 'disabled' );
74
+	if (empty($float_labels) || ('global' === $float_labels)) {
75
+		$float_labels = give_get_option('floatlabels', 'disabled');
76 76
 	}
77 77
 
78
-	return give_is_setting_enabled( $float_labels );
78
+	return give_is_setting_enabled($float_labels);
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options    = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url     = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url     = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 	$form_id = 0;
168 168
 
169 169
 	// Set the form_id.
170
-	if ( isset( $_POST['give-form-id'] ) ) {
171
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
170
+	if (isset($_POST['give-form-id'])) {
171
+		$form_id = sanitize_text_field($_POST['give-form-id']);
172 172
 	}
173 173
 
174 174
 	// Need a URL to continue. If none, redirect back to single form.
175
-	if ( empty( $url ) ) {
176
-		wp_safe_redirect( get_permalink( $form_id ) );
175
+	if (empty($url)) {
176
+		wp_safe_redirect(get_permalink($form_id));
177 177
 		give_die();
178 178
 	}
179 179
 
@@ -182,41 +182,41 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Set the $level_id.
185
-	if ( isset( $_POST['give-price-id'] ) ) {
186
-		$defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] );
185
+	if (isset($_POST['give-price-id'])) {
186
+		$defaults['level-id'] = sanitize_text_field($_POST['give-price-id']);
187 187
 	}
188 188
 
189 189
 	// Check for backward compatibility.
190
-	if ( is_string( $args ) ) {
191
-		$args = str_replace( '?', '', $args );
190
+	if (is_string($args)) {
191
+		$args = str_replace('?', '', $args);
192 192
 	}
193 193
 
194
-	$args = wp_parse_args( $args, $defaults );
194
+	$args = wp_parse_args($args, $defaults);
195 195
 
196 196
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
197
-	$url_data = wp_parse_url( $url );
197
+	$url_data = wp_parse_url($url);
198 198
 
199 199
 	// Check if an array to prevent notices before parsing.
200
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
201
-		parse_str( $url_data['query'], $query );
200
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
201
+		parse_str($url_data['query'], $query);
202 202
 
203 203
 		// Precaution: don't allow any CC info.
204
-		unset( $query['card_number'] );
205
-		unset( $query['card_cvc'] );
204
+		unset($query['card_number']);
205
+		unset($query['card_cvc']);
206 206
 
207 207
 	} else {
208 208
 		// No $url_data so pass empty array.
209 209
 		$query = array();
210 210
 	}
211 211
 
212
-	$new_query        = array_merge( $args, $query );
213
-	$new_query_string = http_build_query( $new_query );
212
+	$new_query        = array_merge($args, $query);
213
+	$new_query_string = http_build_query($new_query);
214 214
 
215 215
 	// Assemble URL parts.
216
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
216
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
217 217
 
218 218
 	// Redirect them.
219
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
219
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
220 220
 	give_die();
221 221
 
222 222
 }
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
  * @since       1.0
233 233
  * @return      string
234 234
  */
235
-function give_get_success_page_url( $query_string = null ) {
235
+function give_get_success_page_url($query_string = null) {
236 236
 
237
-	$success_page = give_get_option( 'success_page', 0 );
238
-	$success_page = get_permalink( $success_page );
237
+	$success_page = give_get_option('success_page', 0);
238
+	$success_page = get_permalink($success_page);
239 239
 
240
-	if ( $query_string ) {
240
+	if ($query_string) {
241 241
 		$success_page .= $query_string;
242 242
 	}
243 243
 
244
-	return apply_filters( 'give_success_page_url', $success_page );
244
+	return apply_filters('give_success_page_url', $success_page);
245 245
 
246 246
 }
247 247
 
@@ -254,32 +254,31 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return mixed Full URL to the Failed Donation Page, if present, home page if it doesn't exist.
256 256
  */
257
-function give_get_failed_transaction_uri( $extras = false ) {
257
+function give_get_failed_transaction_uri($extras = false) {
258 258
 	$give_options = give_get_settings();
259 259
 
260 260
 	// Remove question mark.
261
-	if ( 0 === strpos( $extras, '?' ) ) {
262
-		$extras = substr( $extras, 1 );
261
+	if (0 === strpos($extras, '?')) {
262
+		$extras = substr($extras, 1);
263 263
 	}
264 264
 
265
-	$extras_args = wp_parse_args( $extras );
265
+	$extras_args = wp_parse_args($extras);
266 266
 
267 267
 	// Set nonce if payment id exist in extra params.
268
-	if ( array_key_exists( 'payment-id', $extras_args ) ) {
269
-		$extras_args['_wpnonce'] = wp_create_nonce( "give-failed-donation-{$extras_args['payment-id']}" );
270
-		$extras                  = http_build_query( $extras_args );
268
+	if (array_key_exists('payment-id', $extras_args)) {
269
+		$extras_args['_wpnonce'] = wp_create_nonce("give-failed-donation-{$extras_args['payment-id']}");
270
+		$extras                  = http_build_query($extras_args);
271 271
 	}
272 272
 
273
-	$uri = ! empty( $give_options['failure_page'] ) ?
274
-		trailingslashit( get_permalink( $give_options['failure_page'] ) ) :
275
-		home_url();
273
+	$uri = ! empty($give_options['failure_page']) ?
274
+		trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
276 275
 
277 276
 
278
-	if ( $extras ) {
277
+	if ($extras) {
279 278
 		$uri .= "?{$extras}";
280 279
 	}
281 280
 
282
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
281
+	return apply_filters('give_get_failed_transaction_uri', $uri);
283 282
 }
284 283
 
285 284
 /**
@@ -290,9 +289,9 @@  discard block
 block discarded – undo
290 289
  */
291 290
 function give_is_failed_transaction_page() {
292 291
 	$give_options = give_get_settings();
293
-	$ret          = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
292
+	$ret          = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
294 293
 
295
-	return apply_filters( 'give_is_failure_page', $ret );
294
+	return apply_filters('give_is_failure_page', $ret);
296 295
 }
297 296
 
298 297
 /**
@@ -305,25 +304,25 @@  discard block
 block discarded – undo
305 304
  */
306 305
 function give_listen_for_failed_payments() {
307 306
 
308
-	$failed_page = give_get_option( 'failure_page', 0 );
309
-	$payment_id  = ! empty( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : 0;
310
-	$nonce       = ! empty( $_GET['_wpnonce'] ) ? give_clean( $_GET['_wpnonce'] ) : false;
307
+	$failed_page = give_get_option('failure_page', 0);
308
+	$payment_id  = ! empty($_GET['payment-id']) ? absint($_GET['payment-id']) : 0;
309
+	$nonce       = ! empty($_GET['_wpnonce']) ? give_clean($_GET['_wpnonce']) : false;
311 310
 
312 311
 	// Bailout.
313
-	if ( ! $failed_page || ! is_page( $failed_page ) || ! $payment_id || ! $nonce ) {
312
+	if ( ! $failed_page || ! is_page($failed_page) || ! $payment_id || ! $nonce) {
314 313
 		return false;
315 314
 	}
316 315
 
317 316
 	// Security check.
318
-	if ( ! wp_verify_nonce( $nonce, "give-failed-donation-{$payment_id}" ) ) {
319
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ) );
317
+	if ( ! wp_verify_nonce($nonce, "give-failed-donation-{$payment_id}")) {
318
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'));
320 319
 	}
321 320
 
322 321
 	// Set payment status to failure
323
-	give_update_payment_status( $payment_id, 'failed' );
322
+	give_update_payment_status($payment_id, 'failed');
324 323
 }
325 324
 
326
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
325
+add_action('template_redirect', 'give_listen_for_failed_payments');
327 326
 
328 327
 /**
329 328
  * Retrieve the Donation History page URI
@@ -336,9 +335,9 @@  discard block
 block discarded – undo
336 335
 function give_get_history_page_uri() {
337 336
 	$give_options = give_get_settings();
338 337
 
339
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
338
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
340 339
 
341
-	return apply_filters( 'give_get_history_page_uri', $history_page );
340
+	return apply_filters('give_get_history_page_uri', $history_page);
342 341
 }
343 342
 
344 343
 /**
@@ -351,11 +350,11 @@  discard block
 block discarded – undo
351 350
  * @since       1.0
352 351
  * @return      bool
353 352
  */
354
-function give_field_is_required( $field = '', $form_id ) {
353
+function give_field_is_required($field = '', $form_id) {
355 354
 
356
-	$required_fields = give_get_required_fields( $form_id );
355
+	$required_fields = give_get_required_fields($form_id);
357 356
 
358
-	return array_key_exists( $field, $required_fields );
357
+	return array_key_exists($field, $required_fields);
359 358
 }
360 359
 
361 360
 /**
@@ -372,12 +371,12 @@  discard block
 block discarded – undo
372 371
  *
373 372
  * @return void
374 373
  */
375
-function give_record_donation_in_log( $give_form_id = 0, $payment_id, $price_id = false, $donation_date = null ) {
374
+function give_record_donation_in_log($give_form_id = 0, $payment_id, $price_id = false, $donation_date = null) {
376 375
 	$log_data = array(
377 376
 		'log_parent'   => $payment_id,
378 377
 		'log_type'     => 'sale',
379
-		'log_date'     => isset( $donation_date ) ? $donation_date : null,
380
-		'log_date_gmt' => isset( $donation_date ) ? $donation_date : null,
378
+		'log_date'     => isset($donation_date) ? $donation_date : null,
379
+		'log_date_gmt' => isset($donation_date) ? $donation_date : null,
381 380
 	);
382 381
 
383 382
 	$log_meta = array(
@@ -385,7 +384,7 @@  discard block
 block discarded – undo
385 384
 		'price_id' => (int) $price_id,
386 385
 	);
387 386
 
388
-	Give()->logs->insert_log( $log_data, $log_meta );
387
+	Give()->logs->insert_log($log_data, $log_meta);
389 388
 }
390 389
 
391 390
 
@@ -399,13 +398,13 @@  discard block
 block discarded – undo
399 398
  *
400 399
  * @return bool|int
401 400
  */
402
-function give_increase_donation_count( $form_id = 0, $quantity = 1 ) {
401
+function give_increase_donation_count($form_id = 0, $quantity = 1) {
403 402
 	$quantity = (int) $quantity;
404 403
 
405 404
 	/** @var \Give_Donate_Form $form */
406
-	$form = new Give_Donate_Form( $form_id );
405
+	$form = new Give_Donate_Form($form_id);
407 406
 
408
-	return $form->increase_sales( $quantity );
407
+	return $form->increase_sales($quantity);
409 408
 }
410 409
 
411 410
 /**
@@ -418,13 +417,13 @@  discard block
 block discarded – undo
418 417
  *
419 418
  * @return bool|int
420 419
  */
421
-function give_decrease_donation_count( $form_id = 0, $quantity = 1 ) {
420
+function give_decrease_donation_count($form_id = 0, $quantity = 1) {
422 421
 	$quantity = (int) $quantity;
423 422
 
424 423
 	/** @var \Give_Donate_Form $form */
425
-	$form = new Give_Donate_Form( $form_id );
424
+	$form = new Give_Donate_Form($form_id);
426 425
 
427
-	return $form->decrease_sales( $quantity );
426
+	return $form->decrease_sales($quantity);
428 427
 }
429 428
 
430 429
 /**
@@ -440,11 +439,11 @@  discard block
 block discarded – undo
440 439
  *
441 440
  * @return bool|int
442 441
  */
443
-function give_increase_earnings( $give_form_id = 0, $amount, $payment_id = 0 ) {
442
+function give_increase_earnings($give_form_id = 0, $amount, $payment_id = 0) {
444 443
 	/** @var \Give_Donate_Form $form */
445
-	$form = new Give_Donate_Form( $give_form_id );
444
+	$form = new Give_Donate_Form($give_form_id);
446 445
 
447
-	return $form->increase_earnings( $amount, $payment_id );
446
+	return $form->increase_earnings($amount, $payment_id);
448 447
 }
449 448
 
450 449
 /**
@@ -462,11 +461,11 @@  discard block
 block discarded – undo
462 461
  *
463 462
  * @return bool|int
464 463
  */
465
-function give_decrease_form_earnings( $form_id = 0, $amount, $payment_id = 0 ) {
464
+function give_decrease_form_earnings($form_id = 0, $amount, $payment_id = 0) {
466 465
 	/** @var \Give_Donate_Form $form */
467
-	$form = new Give_Donate_Form( $form_id );
466
+	$form = new Give_Donate_Form($form_id);
468 467
 
469
-	return $form->decrease_earnings( $amount, $payment_id );
468
+	return $form->decrease_earnings($amount, $payment_id);
470 469
 }
471 470
 
472 471
 
@@ -479,15 +478,15 @@  discard block
 block discarded – undo
479 478
  *
480 479
  * @return int $earnings Earnings for a certain form
481 480
  */
482
-function give_get_form_earnings_stats( $form_id = 0 ) {
483
-	$give_form = new Give_Donate_Form( $form_id );
481
+function give_get_form_earnings_stats($form_id = 0) {
482
+	$give_form = new Give_Donate_Form($form_id);
484 483
 
485 484
 	/**
486 485
 	 * Filter the form earnings
487 486
 	 *
488 487
 	 * @since 1.8.17
489 488
 	 */
490
-	return apply_filters( 'give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form );
489
+	return apply_filters('give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form);
491 490
 }
492 491
 
493 492
 
@@ -500,8 +499,8 @@  discard block
 block discarded – undo
500 499
  *
501 500
  * @return int $sales Amount of sales for a certain form
502 501
  */
503
-function give_get_form_sales_stats( $give_form_id = 0 ) {
504
-	$give_form = new Give_Donate_Form( $give_form_id );
502
+function give_get_form_sales_stats($give_form_id = 0) {
503
+	$give_form = new Give_Donate_Form($give_form_id);
505 504
 
506 505
 	return $give_form->sales;
507 506
 }
@@ -516,16 +515,16 @@  discard block
 block discarded – undo
516 515
  *
517 516
  * @return float $sales Average monthly sales
518 517
  */
519
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
520
-	$sales        = give_get_form_sales_stats( $form_id );
521
-	$release_date = get_post_field( 'post_date', $form_id );
518
+function give_get_average_monthly_form_sales($form_id = 0) {
519
+	$sales        = give_get_form_sales_stats($form_id);
520
+	$release_date = get_post_field('post_date', $form_id);
522 521
 
523
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
522
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
524 523
 
525
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
524
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
526 525
 
527
-	if ( $months > 0 ) {
528
-		$sales = ( $sales / $months );
526
+	if ($months > 0) {
527
+		$sales = ($sales / $months);
529 528
 	}
530 529
 
531 530
 	return $sales;
@@ -541,16 +540,16 @@  discard block
 block discarded – undo
541 540
  *
542 541
  * @return float $earnings Average monthly earnings
543 542
  */
544
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
545
-	$earnings     = give_get_form_earnings_stats( $form_id );
546
-	$release_date = get_post_field( 'post_date', $form_id );
543
+function give_get_average_monthly_form_earnings($form_id = 0) {
544
+	$earnings     = give_get_form_earnings_stats($form_id);
545
+	$release_date = get_post_field('post_date', $form_id);
547 546
 
548
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
547
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
549 548
 
550
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
549
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
551 550
 
552
-	if ( $months > 0 ) {
553
-		$earnings = ( $earnings / $months );
551
+	if ($months > 0) {
552
+		$earnings = ($earnings / $months);
554 553
 	}
555 554
 
556 555
 	return $earnings < 0 ? 0 : $earnings;
@@ -571,34 +570,34 @@  discard block
 block discarded – undo
571 570
  *
572 571
  * @return string $price_name Name of the price option
573 572
  */
574
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true ) {
573
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true) {
575 574
 
576
-	$prices     = give_get_variable_prices( $form_id );
575
+	$prices     = give_get_variable_prices($form_id);
577 576
 	$price_name = '';
578 577
 
579
-	if ( false === $prices ) {
578
+	if (false === $prices) {
580 579
 		return $price_name;
581 580
 	}
582 581
 
583
-	foreach ( $prices as $price ) {
582
+	foreach ($prices as $price) {
584 583
 
585
-		if ( intval( $price['_give_id']['level_id'] ) === intval( $price_id ) ) {
584
+		if (intval($price['_give_id']['level_id']) === intval($price_id)) {
586 585
 
587
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
586
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
588 587
 			$price_fallback = $use_fallback ?
589 588
 				give_currency_filter(
590 589
 					give_format_amount(
591 590
 						$price['_give_amount'],
592
-						array( 'sanitize' => false )
591
+						array('sanitize' => false)
593 592
 					),
594
-					array( 'decode_currency' => true )
593
+					array('decode_currency' => true)
595 594
 				) : '';
596
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
595
+			$price_name = ! empty($price_text) ? $price_text : $price_fallback;
597 596
 
598 597
 		}
599 598
 	}
600 599
 
601
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
600
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
602 601
 }
603 602
 
604 603
 
@@ -612,25 +611,25 @@  discard block
 block discarded – undo
612 611
  *
613 612
  * @return string $range A fully formatted price range
614 613
  */
615
-function give_price_range( $form_id = 0, $formatted = true ) {
616
-	$low        = give_get_lowest_price_option( $form_id );
617
-	$high       = give_get_highest_price_option( $form_id );
618
-	$order_type = ! empty( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'asc';
614
+function give_price_range($form_id = 0, $formatted = true) {
615
+	$low        = give_get_lowest_price_option($form_id);
616
+	$high       = give_get_highest_price_option($form_id);
617
+	$order_type = ! empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc';
619 618
 
620 619
 	$range = sprintf(
621 620
 		'<span class="give_price_range_%1$s">%2$s</span><span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span><span class="give_price_range_%3$s">%4$s</span>',
622 621
 		'asc' === $order_type ? 'low' : 'high',
623
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ),
622
+		'asc' === $order_type ? give_currency_filter(give_format_amount($low, array('sanitize' => false))) : give_currency_filter(give_format_amount($high, array('sanitize' => false))),
624 623
 		'asc' === $order_type ? 'high' : 'low',
625
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) )
624
+		'asc' === $order_type ? give_currency_filter(give_format_amount($high, array('sanitize' => false))) : give_currency_filter(give_format_amount($low, array('sanitize' => false)))
626 625
 
627 626
 	);
628 627
 
629
-	if ( ! $formatted ) {
630
-		$range = wp_strip_all_tags( $range );
628
+	if ( ! $formatted) {
629
+		$range = wp_strip_all_tags($range);
631 630
 	}
632 631
 
633
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
632
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
634 633
 }
635 634
 
636 635
 
@@ -645,35 +644,35 @@  discard block
 block discarded – undo
645 644
  *
646 645
  * @return int ID of the lowest price
647 646
  */
648
-function give_get_lowest_price_id( $form_id = 0 ) {
647
+function give_get_lowest_price_id($form_id = 0) {
649 648
 
650
-	if ( empty( $form_id ) ) {
649
+	if (empty($form_id)) {
651 650
 		$form_id = get_the_ID();
652 651
 	}
653 652
 
654
-	if ( ! give_has_variable_prices( $form_id ) ) {
655
-		return give_get_form_price( $form_id );
653
+	if ( ! give_has_variable_prices($form_id)) {
654
+		return give_get_form_price($form_id);
656 655
 	}
657 656
 
658
-	$prices = give_get_variable_prices( $form_id );
657
+	$prices = give_get_variable_prices($form_id);
659 658
 
660 659
 	$min = $min_id = 0;
661 660
 
662
-	if ( ! empty( $prices ) ) {
661
+	if ( ! empty($prices)) {
663 662
 
664
-		foreach ( $prices as $key => $price ) {
663
+		foreach ($prices as $key => $price) {
665 664
 
666
-			if ( empty( $price['_give_amount'] ) ) {
665
+			if (empty($price['_give_amount'])) {
667 666
 				continue;
668 667
 			}
669 668
 
670
-			if ( ! isset( $min ) ) {
669
+			if ( ! isset($min)) {
671 670
 				$min = $price['_give_amount'];
672 671
 			} else {
673
-				$min = min( $min, $price['_give_amount'] );
672
+				$min = min($min, $price['_give_amount']);
674 673
 			}
675 674
 
676
-			if ( $price['_give_amount'] == $min ) {
675
+			if ($price['_give_amount'] == $min) {
677 676
 				$min_id = $price['_give_id']['level_id'];
678 677
 			}
679 678
 		}
@@ -691,22 +690,22 @@  discard block
 block discarded – undo
691 690
  *
692 691
  * @return float Amount of the lowest price
693 692
  */
694
-function give_get_lowest_price_option( $form_id = 0 ) {
695
-	if ( empty( $form_id ) ) {
693
+function give_get_lowest_price_option($form_id = 0) {
694
+	if (empty($form_id)) {
696 695
 		$form_id = get_the_ID();
697 696
 	}
698 697
 
699
-	if ( ! give_has_variable_prices( $form_id ) ) {
700
-		return give_get_form_price( $form_id );
698
+	if ( ! give_has_variable_prices($form_id)) {
699
+		return give_get_form_price($form_id);
701 700
 	}
702 701
 
703
-	if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) {
702
+	if ( ! ($low = get_post_meta($form_id, '_give_levels_minimum_amount', true))) {
704 703
 		// Backward compatibility.
705
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
706
-		$low    = ! empty( $prices ) ? min( $prices ) : 0;
704
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
705
+		$low    = ! empty($prices) ? min($prices) : 0;
707 706
 	}
708 707
 
709
-	return give_maybe_sanitize_amount( $low );
708
+	return give_maybe_sanitize_amount($low);
710 709
 }
711 710
 
712 711
 /**
@@ -718,23 +717,23 @@  discard block
 block discarded – undo
718 717
  *
719 718
  * @return float Amount of the highest price
720 719
  */
721
-function give_get_highest_price_option( $form_id = 0 ) {
720
+function give_get_highest_price_option($form_id = 0) {
722 721
 
723
-	if ( empty( $form_id ) ) {
722
+	if (empty($form_id)) {
724 723
 		$form_id = get_the_ID();
725 724
 	}
726 725
 
727
-	if ( ! give_has_variable_prices( $form_id ) ) {
728
-		return give_get_form_price( $form_id );
726
+	if ( ! give_has_variable_prices($form_id)) {
727
+		return give_get_form_price($form_id);
729 728
 	}
730 729
 
731
-	if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) {
730
+	if ( ! ($high = get_post_meta($form_id, '_give_levels_maximum_amount', true))) {
732 731
 		// Backward compatibility.
733
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
734
-		$high   = ! empty( $prices ) ? max( $prices ) : 0;
732
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
733
+		$high   = ! empty($prices) ? max($prices) : 0;
735 734
 	}
736 735
 
737
-	return give_maybe_sanitize_amount( $high );
736
+	return give_maybe_sanitize_amount($high);
738 737
 }
739 738
 
740 739
 /**
@@ -746,15 +745,15 @@  discard block
 block discarded – undo
746 745
  *
747 746
  * @return mixed string|int Price of the form
748 747
  */
749
-function give_get_form_price( $form_id = 0 ) {
748
+function give_get_form_price($form_id = 0) {
750 749
 
751
-	if ( empty( $form_id ) ) {
750
+	if (empty($form_id)) {
752 751
 		return false;
753 752
 	}
754 753
 
755
-	$form = new Give_Donate_Form( $form_id );
754
+	$form = new Give_Donate_Form($form_id);
756 755
 
757
-	return $form->__get( 'price' );
756
+	return $form->__get('price');
758 757
 }
759 758
 
760 759
 /**
@@ -766,13 +765,13 @@  discard block
 block discarded – undo
766 765
  *
767 766
  * @return mixed string|int Minimum price of the form
768 767
  */
769
-function give_get_form_minimum_price( $form_id = 0 ) {
768
+function give_get_form_minimum_price($form_id = 0) {
770 769
 
771
-	if ( empty( $form_id ) ) {
770
+	if (empty($form_id)) {
772 771
 		return false;
773 772
 	}
774 773
 
775
-	$form = new Give_Donate_Form( $form_id );
774
+	$form = new Give_Donate_Form($form_id);
776 775
 
777 776
 	return $form->get_minimum_price();
778 777
 
@@ -787,13 +786,13 @@  discard block
 block discarded – undo
787 786
  *
788 787
  * @return bool|float
789 788
  */
790
-function give_get_form_maximum_price( $form_id = 0 ) {
789
+function give_get_form_maximum_price($form_id = 0) {
791 790
 
792
-	if ( empty( $form_id ) ) {
791
+	if (empty($form_id)) {
793 792
 		return false;
794 793
 	}
795 794
 
796
-	$form = new Give_Donate_Form( $form_id );
795
+	$form = new Give_Donate_Form($form_id);
797 796
 
798 797
 	return $form->get_maximum_price();
799 798
 }
@@ -809,48 +808,48 @@  discard block
 block discarded – undo
809 808
  *
810 809
  * @return int $formatted_price
811 810
  */
812
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
811
+function give_price($form_id = 0, $echo = true, $price_id = false) {
813 812
 	$price = 0;
814 813
 
815
-	if ( empty( $form_id ) ) {
814
+	if (empty($form_id)) {
816 815
 		$form_id = get_the_ID();
817 816
 	}
818 817
 
819
-	if ( give_has_variable_prices( $form_id ) ) {
818
+	if (give_has_variable_prices($form_id)) {
820 819
 
821
-		$prices = give_get_variable_prices( $form_id );
820
+		$prices = give_get_variable_prices($form_id);
822 821
 
823
-		if ( false !== $price_id ) {
822
+		if (false !== $price_id) {
824 823
 
825 824
 			// loop through multi-prices to see which is default
826
-			foreach ( $prices as $price ) {
825
+			foreach ($prices as $price) {
827 826
 				// this is the default price
828
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
827
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
829 828
 					$price = (float) $price['_give_amount'];
830 829
 				};
831 830
 			}
832 831
 		} else {
833 832
 
834
-			$price = give_get_lowest_price_option( $form_id );
833
+			$price = give_get_lowest_price_option($form_id);
835 834
 		}
836 835
 	} else {
837 836
 
838
-		$price = give_get_form_price( $form_id );
837
+		$price = give_get_form_price($form_id);
839 838
 	}
840 839
 
841
-	$price           = apply_filters( 'give_form_price', give_maybe_sanitize_amount( $price ), $form_id );
842
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
843
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
840
+	$price           = apply_filters('give_form_price', give_maybe_sanitize_amount($price), $form_id);
841
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
842
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
844 843
 
845
-	if ( $echo ) {
844
+	if ($echo) {
846 845
 		echo $formatted_price;
847 846
 	} else {
848 847
 		return $formatted_price;
849 848
 	}
850 849
 }
851 850
 
852
-add_filter( 'give_form_price', 'give_format_amount', 10 );
853
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
851
+add_filter('give_form_price', 'give_format_amount', 10);
852
+add_filter('give_form_price', 'give_currency_filter', 20);
854 853
 
855 854
 
856 855
 /**
@@ -863,19 +862,19 @@  discard block
 block discarded – undo
863 862
  *
864 863
  * @return float $amount Amount of the price option
865 864
  */
866
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
867
-	$prices = give_get_variable_prices( $form_id );
865
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
866
+	$prices = give_get_variable_prices($form_id);
868 867
 
869 868
 	$amount = 0.00;
870 869
 
871
-	foreach ( $prices as $price ) {
872
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
873
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
870
+	foreach ($prices as $price) {
871
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
872
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
874 873
 			break;
875 874
 		};
876 875
 	}
877 876
 
878
-	return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id );
877
+	return apply_filters('give_get_price_option_amount', give_maybe_sanitize_amount($amount), $form_id, $price_id);
879 878
 }
880 879
 
881 880
 /**
@@ -887,13 +886,13 @@  discard block
 block discarded – undo
887 886
  *
888 887
  * @return mixed string|int Goal of the form
889 888
  */
890
-function give_get_form_goal( $form_id = 0 ) {
889
+function give_get_form_goal($form_id = 0) {
891 890
 
892
-	if ( empty( $form_id ) ) {
891
+	if (empty($form_id)) {
893 892
 		return false;
894 893
 	}
895 894
 
896
-	$form = new Give_Donate_Form( $form_id );
895
+	$form = new Give_Donate_Form($form_id);
897 896
 
898 897
 	return $form->goal;
899 898
 
@@ -908,13 +907,13 @@  discard block
 block discarded – undo
908 907
  *
909 908
  * @return mixed string|int Goal of the form
910 909
  */
911
-function give_get_form_goal_format( $form_id = 0 ) {
910
+function give_get_form_goal_format($form_id = 0) {
912 911
 
913
-	if ( empty( $form_id ) ) {
912
+	if (empty($form_id)) {
914 913
 		return false;
915 914
 	}
916 915
 
917
-	return give_get_meta( $form_id, '_give_goal_format', true );
916
+	return give_get_meta($form_id, '_give_goal_format', true);
918 917
 
919 918
 }
920 919
 
@@ -928,19 +927,19 @@  discard block
 block discarded – undo
928 927
  *
929 928
  * @return string $formatted_goal
930 929
  */
931
-function give_goal( $form_id = 0, $echo = true ) {
930
+function give_goal($form_id = 0, $echo = true) {
932 931
 
933
-	if ( empty( $form_id ) ) {
932
+	if (empty($form_id)) {
934 933
 		$form_id = get_the_ID();
935 934
 	}
936 935
 
937
-	$goal        = give_get_form_goal( $form_id );
938
-	$goal_format = give_get_form_goal_format( $form_id );
936
+	$goal        = give_get_form_goal($form_id);
937
+	$goal_format = give_get_form_goal_format($form_id);
939 938
 
940
-	if ( 'donation' === $goal_format ) {
939
+	if ('donation' === $goal_format) {
941 940
 		$goal = "{$goal} donations";
942 941
 	} else {
943
-		$goal = apply_filters( 'give_form_goal', give_maybe_sanitize_amount( $goal ), $form_id );
942
+		$goal = apply_filters('give_form_goal', give_maybe_sanitize_amount($goal), $form_id);
944 943
 	}
945 944
 
946 945
 	$formatted_goal = sprintf(
@@ -948,17 +947,17 @@  discard block
 block discarded – undo
948 947
 		$form_id,
949 948
 		$goal
950 949
 	);
951
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
950
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
952 951
 
953
-	if ( $echo ) {
952
+	if ($echo) {
954 953
 		echo $formatted_goal;
955 954
 	} else {
956 955
 		return $formatted_goal;
957 956
 	}
958 957
 }
959 958
 
960
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
961
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
959
+add_filter('give_form_goal', 'give_format_amount', 10);
960
+add_filter('give_form_goal', 'give_currency_filter', 20);
962 961
 
963 962
 
964 963
 /**
@@ -970,15 +969,15 @@  discard block
 block discarded – undo
970 969
  *
971 970
  * @return bool  $ret Whether or not the logged_in_only setting is set
972 971
  */
973
-function give_logged_in_only( $form_id ) {
972
+function give_logged_in_only($form_id) {
974 973
 	// If _give_logged_in_only is set to enable then guest can donate from that specific form.
975 974
 	// Otherwise it is member only donation form.
976
-	$val = give_get_meta( $form_id, '_give_logged_in_only', true );
977
-	$val = ! empty( $val ) ? $val : 'enabled';
975
+	$val = give_get_meta($form_id, '_give_logged_in_only', true);
976
+	$val = ! empty($val) ? $val : 'enabled';
978 977
 
979
-	$ret = ! give_is_setting_enabled( $val );
978
+	$ret = ! give_is_setting_enabled($val);
980 979
 
981
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
980
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
982 981
 }
983 982
 
984 983
 
@@ -991,11 +990,11 @@  discard block
 block discarded – undo
991 990
  *
992 991
  * @return string
993 992
  */
994
-function give_show_login_register_option( $form_id ) {
993
+function give_show_login_register_option($form_id) {
995 994
 
996
-	$show_register_form = give_get_meta( $form_id, '_give_show_register_form', true );
995
+	$show_register_form = give_get_meta($form_id, '_give_show_register_form', true);
997 996
 
998
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
997
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
999 998
 
1000 999
 }
1001 1000
 
@@ -1011,12 +1010,12 @@  discard block
 block discarded – undo
1011 1010
  *
1012 1011
  * @return array
1013 1012
  */
1014
-function _give_get_prefill_form_field_values( $form_id ) {
1013
+function _give_get_prefill_form_field_values($form_id) {
1015 1014
 	$logged_in_donor_info = array();
1016 1015
 
1017
-	if ( is_user_logged_in() ) :
1018
-		$donor_data    = get_userdata( get_current_user_id() );
1019
-		$donor         = new Give_Donor( get_current_user_id(), true );
1016
+	if (is_user_logged_in()) :
1017
+		$donor_data    = get_userdata(get_current_user_id());
1018
+		$donor         = new Give_Donor(get_current_user_id(), true);
1020 1019
 		$donor_address = $donor->get_donor_address();
1021 1020
 		$company_name  = $donor->get_company_name();
1022 1021
 
@@ -1028,7 +1027,7 @@  discard block
 block discarded – undo
1028 1027
 			'give_last'       => $donor_data->last_name,
1029 1028
 
1030 1029
 			// Title Prefix.
1031
-			'give_title'      => $donor->get_meta( '_give_donor_title_prefix', true ),
1030
+			'give_title'      => $donor->get_meta('_give_donor_title_prefix', true),
1032 1031
 
1033 1032
 			// Company name.
1034 1033
 			'company_name'    => $company_name,
@@ -1058,23 +1057,23 @@  discard block
 block discarded – undo
1058 1057
 
1059 1058
 	// Bailout: Auto fill form field values only form form which donor is donating.
1060 1059
 	if (
1061
-		empty( $_GET['form-id'] )
1060
+		empty($_GET['form-id'])
1062 1061
 		|| ! $form_id
1063
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
1062
+		|| ($form_id !== absint($_GET['form-id']))
1064 1063
 	) {
1065 1064
 		return $logged_in_donor_info;
1066 1065
 	}
1067 1066
 
1068 1067
 	// Get purchase data.
1069
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
1068
+	$give_purchase_data = Give()->session->get('give_purchase');
1070 1069
 
1071 1070
 	// Get donor info from form data.
1072
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
1071
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
1073 1072
 		? array()
1074 1073
 		: $give_purchase_data['post_data'];
1075 1074
 
1076 1075
 	// Output.
1077
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
1076
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
1078 1077
 }
1079 1078
 
1080 1079
 /**
@@ -1087,13 +1086,13 @@  discard block
 block discarded – undo
1087 1086
  *
1088 1087
  * @return int
1089 1088
  */
1090
-function give_get_form_donor_count( $form_id, $args = array() ) {
1089
+function give_get_form_donor_count($form_id, $args = array()) {
1091 1090
 	global $wpdb;
1092 1091
 
1093
-	$cache_key   = Give_Cache::get_key( "form_donor_count_{$form_id}", $args, false );
1094
-	$donor_count = absint( Give_Cache::get_db_query( $cache_key ) );
1092
+	$cache_key   = Give_Cache::get_key("form_donor_count_{$form_id}", $args, false);
1093
+	$donor_count = absint(Give_Cache::get_db_query($cache_key));
1095 1094
 
1096
-	if ( $form_id && ! $donor_count ) {
1095
+	if ($form_id && ! $donor_count) {
1097 1096
 		// Set arguments.
1098 1097
 		$args = wp_parse_args(
1099 1098
 			$args,
@@ -1103,7 +1102,7 @@  discard block
 block discarded – undo
1103 1102
 		);
1104 1103
 
1105 1104
 		$donation_meta_table  = Give()->payment_meta->table_name;
1106
-		$donation_id_col_name = Give()->payment_meta->get_meta_type() . '_id';
1105
+		$donation_id_col_name = Give()->payment_meta->get_meta_type().'_id';
1107 1106
 
1108 1107
 		$distinct = $args['unique'] ? 'DISTINCT meta_value' : 'meta_value';
1109 1108
 
@@ -1128,7 +1127,7 @@  discard block
 block discarded – undo
1128 1127
 			'publish'
1129 1128
 		);
1130 1129
 
1131
-		$donor_count = absint( $wpdb->get_var( $query ) );
1130
+		$donor_count = absint($wpdb->get_var($query));
1132 1131
 	}
1133 1132
 
1134 1133
 
@@ -1137,7 +1136,7 @@  discard block
 block discarded – undo
1137 1136
 	 *
1138 1137
 	 * @since 2.1.0
1139 1138
 	 */
1140
-	$donor_count = apply_filters( 'give_get_form_donor_count', $donor_count, $form_id, $args );
1139
+	$donor_count = apply_filters('give_get_form_donor_count', $donor_count, $form_id, $args);
1141 1140
 
1142 1141
 	return $donor_count;
1143 1142
 }
@@ -1151,33 +1150,33 @@  discard block
 block discarded – undo
1151 1150
  *
1152 1151
  * @return void
1153 1152
  */
1154
-function give_set_form_closed_status( $form_id ) {
1153
+function give_set_form_closed_status($form_id) {
1155 1154
 
1156 1155
 	// Bailout.
1157
-	if ( empty( $form_id ) ) {
1156
+	if (empty($form_id)) {
1158 1157
 		return;
1159 1158
 	}
1160 1159
 
1161 1160
 	$open_form       = false;
1162
-	$is_goal_enabled = give_is_setting_enabled( give_get_meta( $form_id, '_give_goal_option', true, 'disabled' ) );
1161
+	$is_goal_enabled = give_is_setting_enabled(give_get_meta($form_id, '_give_goal_option', true, 'disabled'));
1163 1162
 
1164 1163
 	// Proceed, if the form goal is enabled.
1165
-	if ( $is_goal_enabled ) {
1164
+	if ($is_goal_enabled) {
1166 1165
 
1167
-		$close_form_when_goal_achieved = give_is_setting_enabled( give_get_meta( $form_id, '_give_close_form_when_goal_achieved', true, 'disabled' ) );
1166
+		$close_form_when_goal_achieved = give_is_setting_enabled(give_get_meta($form_id, '_give_close_form_when_goal_achieved', true, 'disabled'));
1168 1167
 
1169 1168
 		// Proceed, if close form when goal achieved option is enabled.
1170
-		if ( $close_form_when_goal_achieved ) {
1169
+		if ($close_form_when_goal_achieved) {
1171 1170
 
1172
-			$form                = new Give_Donate_Form( $form_id );
1173
-			$goal_progress_stats = give_goal_progress_stats( $form );
1171
+			$form                = new Give_Donate_Form($form_id);
1172
+			$goal_progress_stats = give_goal_progress_stats($form);
1174 1173
 
1175 1174
 			// Verify whether the form is closed or not after processing data.
1176 1175
 			$closed = $goal_progress_stats['raw_goal'] <= $goal_progress_stats['raw_actual'];
1177 1176
 
1178 1177
 			// Update form meta if verified that the form is closed.
1179
-			if ( $closed ) {
1180
-				give_update_meta( $form_id, '_give_form_status', 'closed' );
1178
+			if ($closed) {
1179
+				give_update_meta($form_id, '_give_form_status', 'closed');
1181 1180
 			} else {
1182 1181
 				$open_form = true;
1183 1182
 			}
@@ -1189,8 +1188,8 @@  discard block
 block discarded – undo
1189 1188
 	}
1190 1189
 
1191 1190
 	// If $open_form is true, then update form status to open.
1192
-	if ( $open_form ) {
1193
-		give_update_meta( $form_id, '_give_form_status', 'open' );
1191
+	if ($open_form) {
1192
+		give_update_meta($form_id, '_give_form_status', 'open');
1194 1193
 	}
1195 1194
 }
1196 1195
 
@@ -1203,32 +1202,31 @@  discard block
 block discarded – undo
1203 1202
  *
1204 1203
  * @return string
1205 1204
  */
1206
-function give_admin_form_goal_stats( $form_id ) {
1205
+function give_admin_form_goal_stats($form_id) {
1207 1206
 
1208 1207
 	$html             = '';
1209
-	$goal_stats       = give_goal_progress_stats( $form_id );
1210
-	$percent_complete = round( ( $goal_stats['raw_actual'] / $goal_stats['raw_goal'] ), 3 ) * 100;
1208
+	$goal_stats       = give_goal_progress_stats($form_id);
1209
+	$percent_complete = round(($goal_stats['raw_actual'] / $goal_stats['raw_goal']), 3) * 100;
1211 1210
 
1212 1211
 	$html .= sprintf(
1213 1212
 		'<div class="give-admin-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="%1$s">
1214 1213
 <span style="width:%1$s%%;"></span>
1215 1214
 </div>',
1216
-		esc_attr( $goal_stats['progress'] )
1215
+		esc_attr($goal_stats['progress'])
1217 1216
 	);
1218 1217
 
1219 1218
 	$html .= sprintf(
1220
-		( 'percentage' !== $goal_stats['format'] ) ?
1221
-			'<div class="give-goal-text"><span>%1$s</span> %2$s <a href="%3$s">%4$s</a> %5$s ' :
1222
-			'<div class="give-goal-text"><a href="%3$s">%1$s </a>',
1223
-		( 'percentage' !== $goal_stats['format'] ) ? $goal_stats['actual'] : $percent_complete . '%',
1224
-		( 'percentage' !== $goal_stats['format'] ) ? __( 'of', 'give' ) : '',
1225
-		esc_url( admin_url( "post.php?post={$form_id}&action=edit&give_tab=donation_goal_options" ) ),
1219
+		('percentage' !== $goal_stats['format']) ?
1220
+			'<div class="give-goal-text"><span>%1$s</span> %2$s <a href="%3$s">%4$s</a> %5$s ' : '<div class="give-goal-text"><a href="%3$s">%1$s </a>',
1221
+		('percentage' !== $goal_stats['format']) ? $goal_stats['actual'] : $percent_complete.'%',
1222
+		('percentage' !== $goal_stats['format']) ? __('of', 'give') : '',
1223
+		esc_url(admin_url("post.php?post={$form_id}&action=edit&give_tab=donation_goal_options")),
1226 1224
 		$goal_stats['goal'],
1227
-		( 'donors' === $goal_stats['format'] ? __( 'Donors', 'give' ) : ( 'donation' === $goal_stats['format'] ? __( 'Donations', 'give' ) : '' ) )
1225
+		('donors' === $goal_stats['format'] ? __('Donors', 'give') : ('donation' === $goal_stats['format'] ? __('Donations', 'give') : ''))
1228 1226
 	);
1229 1227
 
1230
-	if ( $goal_stats['raw_actual'] >= $goal_stats['raw_goal'] ) {
1231
-		$html .= sprintf( '<span class="give-admin-goal-achieved"><span class="dashicons dashicons-star-filled"></span> %s</span>', __( 'Goal achieved', 'give' ) );
1228
+	if ($goal_stats['raw_actual'] >= $goal_stats['raw_goal']) {
1229
+		$html .= sprintf('<span class="give-admin-goal-achieved"><span class="dashicons dashicons-star-filled"></span> %s</span>', __('Goal achieved', 'give'));
1232 1230
 	}
1233 1231
 
1234 1232
 	$html .= '</div>';
@@ -1246,11 +1244,11 @@  discard block
 block discarded – undo
1246 1244
  *
1247 1245
  * @return null | array
1248 1246
  */
1249
-function give_form_get_default_level( $form_id ) {
1247
+function give_form_get_default_level($form_id) {
1250 1248
 	$default_level = null;
1251 1249
 
1252 1250
 	// If donation form has variable prices.
1253
-	if ( give_has_variable_prices( $form_id ) ) {
1251
+	if (give_has_variable_prices($form_id)) {
1254 1252
 		/**
1255 1253
 		 * Filter the variable pricing
1256 1254
 		 *
@@ -1262,12 +1260,12 @@  discard block
 block discarded – undo
1262 1260
 		 * @param array $prices Array of variable prices.
1263 1261
 		 * @param int   $form   Form ID.
1264 1262
 		 */
1265
-		$prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
1263
+		$prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
1266 1264
 
1267 1265
 		// Go through each of the level and get the default level id.
1268
-		foreach ( $prices as $level ) {
1266
+		foreach ($prices as $level) {
1269 1267
 			if (
1270
-				isset( $level['_give_default'] )
1268
+				isset($level['_give_default'])
1271 1269
 				&& $level['_give_default'] === 'default'
1272 1270
 			) {
1273 1271
 				$default_level = $level;
@@ -1283,7 +1281,7 @@  discard block
 block discarded – undo
1283 1281
 	 * @param array   $default_level Default level price data.
1284 1282
 	 * @param integer $form_id       Donation form ID.
1285 1283
 	 */
1286
-	return apply_filters( 'give_form_get_default_level', $default_level, $form_id );
1284
+	return apply_filters('give_form_get_default_level', $default_level, $form_id);
1287 1285
 }
1288 1286
 
1289 1287
 /**
@@ -1296,21 +1294,21 @@  discard block
 block discarded – undo
1296 1294
  *
1297 1295
  * @return boolean
1298 1296
  */
1299
-function give_is_default_level_id( $price_or_level_id, $form_id = 0 ) {
1297
+function give_is_default_level_id($price_or_level_id, $form_id = 0) {
1300 1298
 	$is_default = false;
1301 1299
 
1302 1300
 	if (
1303
-		! empty( $form_id )
1304
-		&& is_numeric( $price_or_level_id )
1301
+		! empty($form_id)
1302
+		&& is_numeric($price_or_level_id)
1305 1303
 	) {
1306 1304
 		// Get default level id.
1307
-		$form_price_data = give_form_get_default_level( $form_id );
1305
+		$form_price_data = give_form_get_default_level($form_id);
1308 1306
 
1309
-		$is_default = ! is_null( $form_price_data ) && ( $price_or_level_id === absint( $form_price_data['_give_id']['level_id'] ) );
1307
+		$is_default = ! is_null($form_price_data) && ($price_or_level_id === absint($form_price_data['_give_id']['level_id']));
1310 1308
 	}
1311 1309
 
1312
-	$is_default = false === $is_default && is_array( $price_or_level_id ) ?
1313
-		( isset( $price_or_level_id['_give_default'] ) && $price_or_level_id['_give_default'] === 'default' )
1310
+	$is_default = false === $is_default && is_array($price_or_level_id) ?
1311
+		(isset($price_or_level_id['_give_default']) && $price_or_level_id['_give_default'] === 'default')
1314 1312
 		: $is_default;
1315 1313
 
1316 1314
 	/**
@@ -1321,7 +1319,7 @@  discard block
 block discarded – undo
1321 1319
 	 * @param bool          $is_default        True if it is default price level id otherwise false.
1322 1320
 	 * @param array|integer $price_or_level_id Price Data.
1323 1321
 	 */
1324
-	return apply_filters( 'give_is_default_level_id', $is_default, $price_or_level_id );
1322
+	return apply_filters('give_is_default_level_id', $is_default, $price_or_level_id);
1325 1323
 }
1326 1324
 
1327 1325
 
@@ -1334,20 +1332,20 @@  discard block
 block discarded – undo
1334 1332
  *
1335 1333
  * @return mixed
1336 1334
  */
1337
-function give_get_name_title_prefixes( $form_id = 0 ) {
1335
+function give_get_name_title_prefixes($form_id = 0) {
1338 1336
 
1339
-	$name_title_prefix = give_is_name_title_prefix_enabled( $form_id );
1340
-	$title_prefixes    = give_get_option( 'title_prefixes', give_get_default_title_prefixes() );
1337
+	$name_title_prefix = give_is_name_title_prefix_enabled($form_id);
1338
+	$title_prefixes    = give_get_option('title_prefixes', give_get_default_title_prefixes());
1341 1339
 
1342 1340
 	// If form id exists, then fetch form specific title prefixes.
1343
-	if ( intval( $form_id ) > 0 && $name_title_prefix ) {
1341
+	if (intval($form_id) > 0 && $name_title_prefix) {
1344 1342
 
1345
-		$form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true );
1346
-		if ( 'global' !== $form_title_prefix ) {
1347
-			$form_title_prefixes = give_get_meta( $form_id, '_give_title_prefixes', true, give_get_default_title_prefixes() );
1343
+		$form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true);
1344
+		if ('global' !== $form_title_prefix) {
1345
+			$form_title_prefixes = give_get_meta($form_id, '_give_title_prefixes', true, give_get_default_title_prefixes());
1348 1346
 
1349 1347
 			// Check whether the form based title prefixes exists or not.
1350
-			if ( is_array( $form_title_prefixes ) && count( $form_title_prefixes ) > 0 ) {
1348
+			if (is_array($form_title_prefixes) && count($form_title_prefixes) > 0) {
1351 1349
 				$title_prefixes = $form_title_prefixes;
1352 1350
 			}
1353 1351
 		}
@@ -1366,22 +1364,22 @@  discard block
 block discarded – undo
1366 1364
  *
1367 1365
  * @return bool
1368 1366
  */
1369
-function give_is_name_title_prefix_enabled( $form_id = 0, $status = '' ) {
1370
-	if ( empty( $status ) ) {
1371
-		$status = array( 'required', 'optional' );
1367
+function give_is_name_title_prefix_enabled($form_id = 0, $status = '') {
1368
+	if (empty($status)) {
1369
+		$status = array('required', 'optional');
1372 1370
 	} else {
1373
-		$status = array( $status );
1371
+		$status = array($status);
1374 1372
 	}
1375 1373
 
1376
-	$title_prefix_status = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status );
1374
+	$title_prefix_status = give_is_setting_enabled(give_get_option('name_title_prefix'), $status);
1377 1375
 
1378
-	if ( intval( $form_id ) > 0 ) {
1379
-		$form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true );
1376
+	if (intval($form_id) > 0) {
1377
+		$form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true);
1380 1378
 
1381
-		if ( 'disabled' === $form_title_prefix ) {
1379
+		if ('disabled' === $form_title_prefix) {
1382 1380
 			$title_prefix_status = false;
1383
-		} elseif ( in_array( $form_title_prefix, $status, true ) ) {
1384
-			$title_prefix_status = give_is_setting_enabled( $form_title_prefix, $status );
1381
+		} elseif (in_array($form_title_prefix, $status, true)) {
1382
+			$title_prefix_status = give_is_setting_enabled($form_title_prefix, $status);
1385 1383
 		}
1386 1384
 	}
1387 1385
 
@@ -1398,18 +1396,18 @@  discard block
 block discarded – undo
1398 1396
  *
1399 1397
  * @return object
1400 1398
  */
1401
-function give_get_name_with_title_prefixes( $donor ) {
1399
+function give_get_name_with_title_prefixes($donor) {
1402 1400
 
1403 1401
 	// Prepare Give_Donor object, if $donor is numeric.
1404
-	if ( is_numeric( $donor ) ) {
1405
-		$donor = new Give_Donor( $donor );
1402
+	if (is_numeric($donor)) {
1403
+		$donor = new Give_Donor($donor);
1406 1404
 	}
1407 1405
 
1408
-	$title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true );
1406
+	$title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true);
1409 1407
 
1410 1408
 	// Update Donor name, if non empty title prefix.
1411
-	if ( ! empty( $title_prefix ) ) {
1412
-		$donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name );
1409
+	if ( ! empty($title_prefix)) {
1410
+		$donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name);
1413 1411
 	}
1414 1412
 
1415 1413
 	return $donor;
@@ -1425,15 +1423,15 @@  discard block
 block discarded – undo
1425 1423
  *
1426 1424
  * @return string
1427 1425
  */
1428
-function give_get_donor_name_with_title_prefixes( $title_prefix, $name ) {
1426
+function give_get_donor_name_with_title_prefixes($title_prefix, $name) {
1429 1427
 
1430 1428
 	$donor_name = $name;
1431 1429
 
1432
-	if ( ! empty( $title_prefix ) && ! empty( $name ) ) {
1430
+	if ( ! empty($title_prefix) && ! empty($name)) {
1433 1431
 		$donor_name = "{$title_prefix} {$name}";
1434 1432
 	}
1435 1433
 
1436
-	return trim( $donor_name );
1434
+	return trim($donor_name);
1437 1435
 }
1438 1436
 
1439 1437
 /**
@@ -1453,9 +1451,9 @@  discard block
 block discarded – undo
1453 1451
 	return apply_filters(
1454 1452
 		'give_get_default_title_prefixes',
1455 1453
 		array(
1456
-			'Mr.'  => __( 'Mr.', 'give' ),
1457
-			'Mrs.' => __( 'Mrs.', 'give' ),
1458
-			'Ms.'  => __( 'Ms.', 'give' ),
1454
+			'Mr.'  => __('Mr.', 'give'),
1455
+			'Mrs.' => __('Mrs.', 'give'),
1456
+			'Ms.'  => __('Ms.', 'give'),
1459 1457
 		)
1460 1458
 	);
1461 1459
 }
@@ -1469,25 +1467,25 @@  discard block
 block discarded – undo
1469 1467
  *
1470 1468
  * @return bool
1471 1469
  */
1472
-function give_is_name_title_prefix_required( $form_id = 0 ) {
1470
+function give_is_name_title_prefix_required($form_id = 0) {
1473 1471
 
1474 1472
 	// Bail out, if name title prefix is not enabled.
1475
-	if ( ! give_is_name_title_prefix_enabled( $form_id ) ) {
1473
+	if ( ! give_is_name_title_prefix_enabled($form_id)) {
1476 1474
 		return false;
1477 1475
 	}
1478 1476
 
1479
-	$status      = array( 'optional' );
1480
-	$is_optional = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status );
1477
+	$status      = array('optional');
1478
+	$is_optional = give_is_setting_enabled(give_get_option('name_title_prefix'), $status);
1481 1479
 
1482
-	if ( intval( $form_id ) > 0 ) {
1483
-		$form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true );
1480
+	if (intval($form_id) > 0) {
1481
+		$form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true);
1484 1482
 
1485
-		if ( 'required' === $form_title_prefix ) {
1483
+		if ('required' === $form_title_prefix) {
1486 1484
 			$is_optional = false;
1487
-		} elseif ( 'optional' === $form_title_prefix ) {
1485
+		} elseif ('optional' === $form_title_prefix) {
1488 1486
 			$is_optional = true;
1489 1487
 		}
1490 1488
 	}
1491 1489
 
1492
-	return ( ! $is_optional );
1490
+	return ( ! $is_optional);
1493 1491
 }
1494 1492
\ No newline at end of file
Please login to merge, or discard this patch.