Test Failed
Pull Request — master (#3256)
by Devin
07:52 queued 10s
created
includes/admin/emails/class-donor-register-email.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if access directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'Give_Donor_Register_Email' ) ) :
17
+if ( ! class_exists('Give_Donor_Register_Email')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_Donor_Register_Email
@@ -31,35 +31,35 @@  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'                    => 'donor-register',
36
-				'label'                 => __( 'User Registration Information', 'give' ),
37
-				'description'           => __( 'Sent to the donor when they register for an account on the site.', 'give' ),
36
+				'label'                 => __('User Registration Information', 'give'),
37
+				'description'           => __('Sent to the donor when they register for an account on the site.', 'give'),
38 38
 				'notification_status'   => 'enabled',
39 39
 				'email_tag_contex'      => 'donor',
40 40
 				'form_metabox_setting'  => false,
41
-				'recipient_group_name'  => __( 'Donor', 'give' ),
42
-				'email_tag_context'     => array( 'donor', 'general' ),
41
+				'recipient_group_name'  => __('Donor', 'give'),
42
+				'email_tag_context'     => array('donor', 'general'),
43 43
 				'default_email_subject' => sprintf(
44 44
 				/* translators: %s: site name */
45
-					esc_attr__( '[%s] Your username and password', 'give' ),
46
-					get_bloginfo( 'name' )
45
+					esc_attr__('[%s] Your username and password', 'give'),
46
+					get_bloginfo('name')
47 47
 				),
48 48
 				'default_email_message' => $this->get_default_email_message(),
49
-				'default_email_header'  => __( 'New User Registration', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('New User Registration', 'give'),
50
+			));
51 51
 
52 52
 			// Setup action hook.
53 53
 			add_action(
54 54
 				"give_{$this->config['id']}_email_notification",
55
-				array( $this, 'setup_email_notification' ),
55
+				array($this, 'setup_email_notification'),
56 56
 				10,
57 57
 				2
58 58
 			);
59 59
 
60 60
 			add_filter(
61 61
 				'give_email_preview_header',
62
-				array( $this, 'email_preview_header' ),
62
+				array($this, 'email_preview_header'),
63 63
 				10,
64 64
 				2
65 65
 			);
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 		 * @return string
75 75
 		 */
76 76
 		function get_default_email_message() {
77
-			$message = esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n";
77
+			$message = esc_attr__('Username: {username}', 'give')."\r\n\r\n";
78 78
 
79
-			$message .= __( 'To reset your password, simply click the link below which will take you to a web page where you can create a new password.', 'give' ) . "\r\n";
80
-			$message .= '{reset_password_link}' . "\r\n\r\n";
79
+			$message .= __('To reset your password, simply click the link below which will take you to a web page where you can create a new password.', 'give')."\r\n";
80
+			$message .= '{reset_password_link}'."\r\n\r\n";
81 81
 
82
-			$message .= __( 'After resetting password, Please login to your account with link below.', 'give' ) . "\r\n";
83
-			$message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login &raquo;', 'give' ) . '</a>' . "\r\n";
82
+			$message .= __('After resetting password, Please login to your account with link below.', 'give')."\r\n";
83
+			$message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login &raquo;', 'give').'</a>'."\r\n";
84 84
 
85 85
 			/**
86 86
 			 * Filter the default email message
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		 * @since 2.0
100 100
 		 */
101 101
 		public function setup_email_data() {
102
-			Give()->emails->__set( 'heading', $this->get_email_header() );
102
+			Give()->emails->__set('heading', $this->get_email_header());
103 103
 		}
104 104
 
105 105
 		/**
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 		 *
114 114
 		 * @return string
115 115
 		 */
116
-		public function setup_email_notification( $user_id, $user_data ) {
116
+		public function setup_email_notification($user_id, $user_data) {
117 117
 			$this->setup_email_data();
118 118
 
119 119
 			$this->recipient_email = $user_data['user_email'];
120
-			$this->send_email_notification( array(
120
+			$this->send_email_notification(array(
121 121
 				'user_id' => $user_id,
122
-			) );
122
+			));
123 123
 		}
124 124
 
125 125
 		/**
@@ -133,42 +133,42 @@  discard block
 block discarded – undo
133 133
 		 *
134 134
 		 * @return bool
135 135
 		 */
136
-		public function email_preview_header( $email_preview_header, $email ) {
136
+		public function email_preview_header($email_preview_header, $email) {
137 137
 			// Bailout.
138
-			if ( $this->config['id'] !== $email->config['id'] ) {
138
+			if ($this->config['id'] !== $email->config['id']) {
139 139
 				return $email_preview_header;
140 140
 			}
141 141
 
142 142
 			// Payment receipt switcher
143
-			$user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' );
143
+			$user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id');
144 144
 
145 145
 			// Get payments.
146 146
 			$donors  = new Give_API();
147
-			$donors  = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' );
147
+			$donors  = give_check_variable($donors->get_donors(), 'empty', array(), 'donors');
148 148
 			$options = array();
149 149
 
150 150
 			// Default option.
151
-			$options[0] = esc_html__( 'No donor(s) found.', 'give' );
151
+			$options[0] = esc_html__('No donor(s) found.', 'give');
152 152
 
153 153
 			// Provide nice human readable options.
154
-			if ( $donors ) {
155
-				$options[0] = esc_html__( '- Select a donor -', 'give' );
156
-				foreach ( $donors as $donor ) {
154
+			if ($donors) {
155
+				$options[0] = esc_html__('- Select a donor -', 'give');
156
+				foreach ($donors as $donor) {
157 157
 					// Exclude customers for which wp user not exist.
158
-					if ( ! $donor['info']['user_id'] ) {
158
+					if ( ! $donor['info']['user_id']) {
159 159
 						continue;
160 160
 					}
161
-					$options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] );
161
+					$options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']);
162 162
 				}
163 163
 			}
164 164
 
165
-			$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
165
+			$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
166 166
 			$query            = $request_url_data['query'];
167 167
 
168 168
 			// Remove user id query param if set from request url.
169
-			$query = remove_query_arg( array( 'user_id' ), $query );
169
+			$query = remove_query_arg(array('user_id'), $query);
170 170
 
171
-			$request_url = home_url( '/?' . str_replace( '', '', $query ) );
171
+			$request_url = home_url('/?'.str_replace('', '', $query));
172 172
 			?>
173 173
 
174 174
 			<!-- Start constructing HTML output.-->
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 				</script>
187 187
 
188 188
 				<label for="give_preview_email_user_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">
189
-					<?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?>
189
+					<?php echo esc_html__('Preview email with a donor:', 'give'); ?>
190 190
 				</label>
191 191
 
192 192
 				<?php
193 193
 				// The select field with 100 latest transactions
194
-				echo Give()->html->select( array(
194
+				echo Give()->html->select(array(
195 195
 					'name'             => 'preview_email_user_id',
196 196
 					'selected'         => $user_id,
197 197
 					'id'               => 'give_preview_email_user_id',
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 					'select_atts'      => 'onchange="change_preview()"',
202 202
 					'show_option_all'  => false,
203 203
 					'show_option_none' => false,
204
-				) );
204
+				));
205 205
 				?>
206 206
 			</div>
207 207
 			<?php
Please login to merge, or discard this patch.
includes/admin/emails/class-donation-receipt-email.php 1 patch
Spacing   +37 added lines, -37 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,9 +236,9 @@  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 );
241
-			Give()->emails->__set( 'heading', $this->get_email_header() );
239
+			Give()->emails->__set('from_name', $from_name);
240
+			Give()->emails->__set('from_email', $from_email);
241
+			Give()->emails->__set('heading', $this->get_email_header());
242 242
 
243 243
 			/**
244 244
 			 * Filters the donation receipt's email headers.
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 				$this->payment->payment_meta
256 256
 			);
257 257
 
258
-			Give()->emails->__set( 'headers', $headers );
258
+			Give()->emails->__set('headers', $headers);
259 259
 		}
260 260
 
261 261
 		/**
@@ -266,16 +266,16 @@  discard block
 block discarded – undo
266 266
 		 *
267 267
 		 * @param $payment_id
268 268
 		 */
269
-		public function send_donation_receipt( $payment_id ) {
270
-			$this->payment = new Give_Payment( $payment_id );
269
+		public function send_donation_receipt($payment_id) {
270
+			$this->payment = new Give_Payment($payment_id);
271 271
 
272 272
 			// Setup email data.
273 273
 			$this->setup_email_data();
274 274
 
275 275
 			// Send email.
276
-			$this->send_email_notification( array(
276
+			$this->send_email_notification(array(
277 277
 				'payment_id' => $this->payment->ID,
278
-			) );
278
+			));
279 279
 		}
280 280
 
281 281
 		/**
@@ -286,35 +286,35 @@  discard block
 block discarded – undo
286 286
 		 *
287 287
 		 * @param array $data
288 288
 		 */
289
-		public function resend_donation_receipt( $data ) {
290
-			$purchase_id = absint( $data['purchase_id'] );
289
+		public function resend_donation_receipt($data) {
290
+			$purchase_id = absint($data['purchase_id']);
291 291
 
292
-			if ( empty( $purchase_id ) ) {
292
+			if (empty($purchase_id)) {
293 293
 				return;
294 294
 			}
295 295
 
296 296
 			// Get donation payment information.
297
-			$this->payment = new Give_Payment( $purchase_id );
297
+			$this->payment = new Give_Payment($purchase_id);
298 298
 
299
-			if ( ! current_user_can( 'edit_give_payments', $this->payment->ID ) ) {
300
-				wp_die( esc_html__( 'You do not have permission to edit donations.', 'give' ), esc_html__( 'Error', 'give' ), array(
299
+			if ( ! current_user_can('edit_give_payments', $this->payment->ID)) {
300
+				wp_die(esc_html__('You do not have permission to edit donations.', 'give'), esc_html__('Error', 'give'), array(
301 301
 					'response' => 403,
302
-				) );
302
+				));
303 303
 			}
304 304
 
305 305
 			// Setup email data.
306 306
 			$this->setup_email_data();
307 307
 
308 308
 			// Send email.
309
-			$this->send_email_notification( array(
309
+			$this->send_email_notification(array(
310 310
 				'payment_id' => $this->payment->ID,
311
-			) );
311
+			));
312 312
 
313
-			wp_redirect( add_query_arg( array(
313
+			wp_redirect(add_query_arg(array(
314 314
 				'give-message' => 'email_sent',
315 315
 				'give-action'  => false,
316 316
 				'purchase_id'  => false,
317
-			) ) );
317
+			)));
318 318
 			exit;
319 319
 		}
320 320
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donor-register-email.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if access directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'Give_New_Donor_Register_Email' ) ) :
17
+if ( ! class_exists('Give_New_Donor_Register_Email')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_New_Donor_Register_Email
@@ -31,35 +31,35 @@  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'                    => 'new-donor-register',
36
-				'label'                 => __( 'New User Registration', 'give' ),
37
-				'description'           => __( 'Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give' ),
36
+				'label'                 => __('New User Registration', 'give'),
37
+				'description'           => __('Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give'),
38 38
 				'has_recipient_field'   => true,
39 39
 				'notification_status'   => 'enabled',
40 40
 				'has_preview_header'    => true,
41
-				'email_tag_context'     => array( 'donor', 'general' ),
41
+				'email_tag_context'     => array('donor', 'general'),
42 42
 				'form_metabox_setting'  => false,
43 43
 				'default_email_subject' => sprintf(
44 44
 					/* translators: %s: site name */
45
-					esc_attr__( '[%s] New User Registration', 'give' ),
46
-					get_bloginfo( 'name' )
45
+					esc_attr__('[%s] New User Registration', 'give'),
46
+					get_bloginfo('name')
47 47
 				),
48 48
 				'default_email_message' => $this->get_default_email_message(),
49
-				'default_email_header'  => __( 'New User Registration', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('New User Registration', 'give'),
50
+			));
51 51
 
52 52
 			// Setup action hook.
53 53
 			add_action(
54 54
 				"give_{$this->config['id']}_email_notification",
55
-				array( $this, 'setup_email_notification' ),
55
+				array($this, 'setup_email_notification'),
56 56
 				10,
57 57
 				2
58 58
 			);
59 59
 
60 60
 			add_filter(
61 61
 				'give_email_preview_header',
62
-				array( $this, 'email_preview_header' ),
62
+				array($this, 'email_preview_header'),
63 63
 				10,
64 64
 				2
65 65
 			);
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 		 * @return string
75 75
 		 */
76 76
 		function get_default_email_message() {
77
-			$message = esc_attr__( 'New user registration on your site {sitename}:', 'give' ) . "\r\n\r\n";
78
-			$message .= esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n";
79
-			$message .= esc_attr__( 'Email: {user_email}', 'give' ) . "\r\n";
77
+			$message = esc_attr__('New user registration on your site {sitename}:', 'give')."\r\n\r\n";
78
+			$message .= esc_attr__('Username: {username}', 'give')."\r\n\r\n";
79
+			$message .= esc_attr__('Email: {user_email}', 'give')."\r\n";
80 80
 
81 81
 			/**
82 82
 			 * Filter the default email message
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 * @since 2.0
97 97
 		 */
98 98
 		public function setup_email_data() {
99
-			Give()->emails->__set( 'heading', $this->get_email_header() );
99
+			Give()->emails->__set('heading', $this->get_email_header());
100 100
 		}
101 101
 
102 102
 
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 		 *
112 112
 		 * @return string
113 113
 		 */
114
-		public function setup_email_notification( $user_id, $user_data ) {
114
+		public function setup_email_notification($user_id, $user_data) {
115 115
 			$this->setup_email_data();
116 116
 
117
-			$this->send_email_notification( array(
117
+			$this->send_email_notification(array(
118 118
 				'user_id' => $user_id,
119
-			) );
119
+			));
120 120
 		}
121 121
 
122 122
 
@@ -130,42 +130,42 @@  discard block
 block discarded – undo
130 130
 		 * @param Give_New_Donor_Register_Email $email
131 131
 		 * @return string
132 132
 		 */
133
-		public function email_preview_header( $email_preview_header, $email ) {
133
+		public function email_preview_header($email_preview_header, $email) {
134 134
 			// Bailout.
135
-			if ( $this->config['id'] !== $email->config['id'] ) {
135
+			if ($this->config['id'] !== $email->config['id']) {
136 136
 				return $email_preview_header;
137 137
 			}
138 138
 
139 139
 			// Payment receipt switcher
140
-			$user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' );
140
+			$user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id');
141 141
 
142 142
 			// Get payments.
143 143
 			$donors  = new Give_API();
144
-			$donors  = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' );
144
+			$donors  = give_check_variable($donors->get_donors(), 'empty', array(), 'donors');
145 145
 			$options = array();
146 146
 
147 147
 			// Default option.
148
-			$options[0] = esc_html__( 'No donor(s) found.', 'give' );
148
+			$options[0] = esc_html__('No donor(s) found.', 'give');
149 149
 
150 150
 			// Provide nice human readable options.
151
-			if ( $donors ) {
152
-				$options[0] = esc_html__( '- Select a donor -', 'give' );
153
-				foreach ( $donors as $donor ) {
151
+			if ($donors) {
152
+				$options[0] = esc_html__('- Select a donor -', 'give');
153
+				foreach ($donors as $donor) {
154 154
 					// Exclude customers for which wp user not exist.
155
-					if ( ! $donor['info']['user_id'] ) {
155
+					if ( ! $donor['info']['user_id']) {
156 156
 						continue;
157 157
 					}
158
-					$options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] );
158
+					$options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']);
159 159
 				}
160 160
 			}
161 161
 
162
-			$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
162
+			$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
163 163
 			$query            = $request_url_data['query'];
164 164
 
165 165
 			// Remove user id query param if set from request url.
166
-			$query = remove_query_arg( array( 'user_id' ), $query );
166
+			$query = remove_query_arg(array('user_id'), $query);
167 167
 
168
-			$request_url = home_url( '/?' . str_replace( '', '', $query ) );
168
+			$request_url = home_url('/?'.str_replace('', '', $query));
169 169
 			?>
170 170
 			<script type="text/javascript">
171 171
 				function change_preview() {
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 			<div class="give_preview_email_user_id_main">
200 200
 
201 201
 				<label for="give_preview_email_user_id" class="give_preview_email_user_id_label">
202
-					<?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?>
202
+					<?php echo esc_html__('Preview email with a donor:', 'give'); ?>
203 203
 				</label>
204 204
 
205 205
 				<?php
206 206
 				// The select field with 100 latest transactions
207
-				echo Give()->html->select( array(
207
+				echo Give()->html->select(array(
208 208
 					'name'             => 'preview_email_user_id',
209 209
 					'selected'         => $user_id,
210 210
 					'id'               => 'give_preview_email_user_id',
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 					'select_atts'      => 'onchange="change_preview()"',
215 215
 					'show_option_all'  => false,
216 216
 					'show_option_none' => false,
217
-				) );
217
+				));
218 218
 				?>
219 219
 				<!-- Closing tag-->
220 220
 			</div>
Please login to merge, or discard this patch.
includes/admin/emails/class-offline-donation-instruction-email.php 1 patch
Spacing   +37 added lines, -37 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_Offline_Donation_Instruction_Email' ) ) :
19
+if ( ! class_exists('Give_Offline_Donation_Instruction_Email')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_Offline_Donation_Instruction_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'                           => 'offline-donation-instruction',
43
-				'label'                        => __( 'Offline Donation Instructions', 'give' ),
44
-				'description'                  => __( 'Sent to the donor when they submit an offline donation.', 'give' ),
45
-				'notification_status'          => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled',
43
+				'label'                        => __('Offline Donation Instructions', 'give'),
44
+				'description'                  => __('Sent to the donor when they submit an offline donation.', 'give'),
45
+				'notification_status'          => give_is_gateway_active('offline') ? 'enabled' : 'disabled',
46 46
 				'form_metabox_setting'         => true,
47 47
 				'notification_status_editable' => false,
48 48
 				'preview_email_tag_values'     => array(
49
-					'payment_method' => esc_html__( 'Offline', 'give' ),
49
+					'payment_method' => esc_html__('Offline', 'give'),
50 50
 				),
51
-				'default_email_subject'        => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
51
+				'default_email_subject'        => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
52 52
 				'default_email_message'        => give_get_default_offline_donation_email_content(),
53
-				'default_email_header'         => __( 'Offline Donation Instructions', 'give' ),
53
+				'default_email_header'         => __('Offline Donation Instructions', '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
 		/**
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 		 *
75 75
 		 * @return string
76 76
 		 */
77
-		public function get_email_message( $form_id = null ) {
77
+		public function get_email_message($form_id = null) {
78 78
 			$message = Give_Email_Notification_Util::get_value(
79 79
 				$this,
80
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
80
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
81 81
 				$form_id,
82 82
 				$this->config['default_email_message']
83 83
 			);
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @return string
108 108
 		 */
109
-		public function get_email_subject( $form_id = null ) {
109
+		public function get_email_subject($form_id = null) {
110 110
 			$subject = wp_strip_all_tags(
111 111
 				Give_Email_Notification_Util::get_value(
112 112
 					$this,
113
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
113
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
114 114
 					$form_id,
115 115
 					$this->config['default_email_subject']
116 116
 				)
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		 * @param int $form_id
140 140
 		 * @return array
141 141
 		 */
142
-		public function get_email_attachments( $form_id = null ) {
142
+		public function get_email_attachments($form_id = null) {
143 143
 			/**
144 144
 			 * Filter the attachments.
145 145
 			 * Note: This filter will deprecate soon.
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 				$this->payment->payment_meta
203 203
 			);
204 204
 
205
-			Give()->emails->__set( 'from_name', $from_name );
206
-			Give()->emails->__set( 'from_email', $from_email );
207
-			Give()->emails->__set( 'heading', $this->get_email_header() );
208
-			Give()->emails->__set( 'headers', apply_filters( 'give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta ) );
205
+			Give()->emails->__set('from_name', $from_name);
206
+			Give()->emails->__set('from_email', $from_email);
207
+			Give()->emails->__set('heading', $this->get_email_header());
208
+			Give()->emails->__set('headers', apply_filters('give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta));
209 209
 		}
210 210
 
211 211
 		/**
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 		 *
217 217
 		 * @param int $payment_id
218 218
 		 */
219
-		public function setup_email_notification( $payment_id ) {
220
-			$this->payment = new Give_Payment( $payment_id );
219
+		public function setup_email_notification($payment_id) {
220
+			$this->payment = new Give_Payment($payment_id);
221 221
 
222 222
 			// Exit if not donation was not with offline donation.
223
-			if ( 'offline' !== $this->payment->gateway ) {
223
+			if ('offline' !== $this->payment->gateway) {
224 224
 				return;
225 225
 			}
226 226
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 			$this->setup_email_data();
229 229
 
230 230
 			// Send email.
231
-			$this->send_email_notification( array(
231
+			$this->send_email_notification(array(
232 232
 				'payment_id' => $this->payment->ID,
233
-			) );
233
+			));
234 234
 		}
235 235
 
236 236
 		/**
@@ -242,18 +242,18 @@  discard block
 block discarded – undo
242 242
 		 * @param $update_options
243 243
 		 * @param $option_name
244 244
 		 */
245
-		public function set_notification_status( $update_options, $option_name ) {
245
+		public function set_notification_status($update_options, $option_name) {
246 246
 			// Get updated settings.
247 247
 			$update_options = give_get_settings();
248 248
 
249
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
249
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
250 250
 
251 251
 			if (
252
-				empty( $update_options["{$this->config['id']}_notification"] )
252
+				empty($update_options["{$this->config['id']}_notification"])
253 253
 				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
254 254
 			) {
255 255
 				$update_options["{$this->config['id']}_notification"] = $notification_status;
256
-				update_option( $option_name, $update_options );
256
+				update_option($option_name, $update_options);
257 257
 			}
258 258
 		}
259 259
 
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
 		 *
270 270
 		 * @return array
271 271
 		 */
272
-		public function add_metabox_setting_field( $settings, $form_id ) {
273
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
272
+		public function add_metabox_setting_field($settings, $form_id) {
273
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
274 274
 				$settings[] = array(
275 275
 					'id'     => $this->config['id'],
276 276
 					'title'  => $this->config['label'],
277
-					'fields' => $this->get_setting_fields( $form_id ),
277
+					'fields' => $this->get_setting_fields($form_id),
278 278
 				);
279 279
 			}
280 280
 
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donation-email.php 1 patch
Spacing   +25 added lines, -25 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,9 +212,9 @@  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 );
217
-			Give()->emails->__set( 'heading', $this->get_email_header() );
215
+			Give()->emails->__set('from_name', $from_name);
216
+			Give()->emails->__set('from_email', $from_email);
217
+			Give()->emails->__set('heading', $this->get_email_header());
218 218
 
219 219
 			/**
220 220
 			 * Filters the donation notification email headers.
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				$this->payment->payment_meta
229 229
 			);
230 230
 
231
-			Give()->emails->__set( 'headers', $headers );
231
+			Give()->emails->__set('headers', $headers);
232 232
 		}
233 233
 
234 234
 		/**
@@ -239,16 +239,16 @@  discard block
 block discarded – undo
239 239
 		 *
240 240
 		 * @param int $payment_id
241 241
 		 */
242
-		public function setup_email_notification( $payment_id ) {
243
-			$this->payment = new Give_Payment( $payment_id );
242
+		public function setup_email_notification($payment_id) {
243
+			$this->payment = new Give_Payment($payment_id);
244 244
 
245 245
 			// Set email data.
246 246
 			$this->setup_email_data();
247 247
 
248 248
 			// Send email.
249
-			$this->send_email_notification( array(
249
+			$this->send_email_notification(array(
250 250
 				'payment_id' => $payment_id,
251
-			) );
251
+			));
252 252
 		}
253 253
 	}
254 254
 
Please login to merge, or discard this patch.
includes/admin/emails/class-email-notification-table.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	 * @access public
37 37
 	 */
38 38
 	public function __construct() {
39
-		parent::__construct( array(
40
-			'singular' => __( 'Give Email Notification', 'give' ),
41
-			'plural'   => __( 'Give Email Notifications', 'give' ),
42
-		) );
39
+		parent::__construct(array(
40
+			'singular' => __('Give Email Notification', 'give'),
41
+			'plural'   => __('Give Email Notifications', 'give'),
42
+		));
43 43
 
44 44
 		$this->email_notifications = Give_Email_Notifications::get_instance();
45 45
 	}
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 2.0
61 61
 		 */
62
-		return apply_filters( 'give_email_notification_setting_columns', array(
63
-			'cb'         => __( 'Email Status', 'give' ),
64
-			'name'       => __( 'Email', 'give' ),
65
-			'email_type' => __( 'Content Type', 'give' ),
66
-			'recipient'  => __( 'Recipient(s)', 'give' ),
67
-			'setting'    => __( 'Edit Email', 'give' ),
68
-		) );
62
+		return apply_filters('give_email_notification_setting_columns', array(
63
+			'cb'         => __('Email Status', 'give'),
64
+			'name'       => __('Email', 'give'),
65
+			'email_type' => __('Content Type', 'give'),
66
+			'recipient'  => __('Recipient(s)', 'give'),
67
+			'setting'    => __('Edit Email', 'give'),
68
+		));
69 69
 	}
70 70
 
71 71
 	/**
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return  string
80 80
 	 */
81
-	public function column_name( $email ) {
82
-		$edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) );
83
-		$actions  = $this->get_row_actions( $email );
81
+	public function column_name($email) {
82
+		$edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id']));
83
+		$actions  = $this->get_row_actions($email);
84 84
 
85 85
 		ob_start();
86 86
 		?>
87 87
 		<a class="row-title" href="<?php echo $edit_url; ?>"><?php echo $email->config['label']; ?></a>
88 88
 
89
-		<?php if ( $desc = $email->config['description'] ) : ?>
90
-			<?php echo Give()->tooltips->render_help( esc_attr( $desc ) ); ?>
89
+		<?php if ($desc = $email->config['description']) : ?>
90
+			<?php echo Give()->tooltips->render_help(esc_attr($desc)); ?>
91 91
 		<?php endif; ?>
92 92
 
93
-		<?php echo $this->row_actions( $actions ); ?>
93
+		<?php echo $this->row_actions($actions); ?>
94 94
 		<?php
95 95
 		return ob_get_clean();
96 96
 	}
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return string
107 107
 	 */
108
-	public function column_recipient( $email ) {
108
+	public function column_recipient($email) {
109 109
 		ob_start();
110 110
 
111
-		if( Give_Email_Notification_Util::has_recipient_field( $email ) ) {
111
+		if (Give_Email_Notification_Util::has_recipient_field($email)) {
112 112
 			$recipients = $email->get_recipient();
113
-			if ( is_array( $recipients ) ) {
114
-				$recipients = implode( '<br>', $recipients );
113
+			if (is_array($recipients)) {
114
+				$recipients = implode('<br>', $recipients);
115 115
 			}
116 116
 
117 117
 			echo $recipients;
118 118
 
119
-		} elseif ( ! empty( $email->config['recipient_group_name'] ) ) {
119
+		} elseif ( ! empty($email->config['recipient_group_name'])) {
120 120
 			echo $email->config['recipient_group_name'];
121 121
 		}
122 122
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return string
135 135
 	 */
136
-	public function column_cb( $email ) {
136
+	public function column_cb($email) {
137 137
 		$notification_status  = $email->get_notification_status();
138
-		$user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable( $email );
139
-		$icon_classes         = Give_Email_Notification_Util::is_email_notification_active( $email )
138
+		$user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable($email);
139
+		$icon_classes         = Give_Email_Notification_Util::is_email_notification_active($email)
140 140
 			? 'dashicons dashicons-yes'
141 141
 			: 'dashicons dashicons-no-alt';
142 142
 		$attributes           = array(
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 			'data-edit'   => $user_can_edit_status,
147 147
 		);
148 148
 
149
-		if ( ! $user_can_edit_status ) {
150
-			$icon_classes         = 'dashicons dashicons-lock';
149
+		if ( ! $user_can_edit_status) {
150
+			$icon_classes = 'dashicons dashicons-lock';
151 151
 
152
-			$attributes['data-notice'] = esc_attr( $email->config['notices']['non-notification-status-editable'] );
152
+			$attributes['data-notice'] = esc_attr($email->config['notices']['non-notification-status-editable']);
153 153
 		}
154 154
 
155 155
 		$html = sprintf(
156 156
 			'<span %1$s><i class="%2$s"></i></span></span><span class="spinner"></span>',
157
-			give_get_attribute_str( $attributes ),
157
+			give_get_attribute_str($attributes),
158 158
 			$icon_classes
159 159
 		);
160 160
 
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string
174 174
 	 */
175
-	public function column_email_type( Give_Email_Notification $email ) {
175
+	public function column_email_type(Give_Email_Notification $email) {
176 176
 		$email_content_type_label = apply_filters(
177 177
 			"give_email_list_render_{$email->config['id']}_email_content_type",
178
-			Give_Email_Notification_Util::get_formatted_email_type( $email->config['content_type'] ),
178
+			Give_Email_Notification_Util::get_formatted_email_type($email->config['content_type']),
179 179
 			$email
180 180
 		);
181 181
 
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return string
194 194
 	 */
195
-	public function column_setting( Give_Email_Notification $email ) {
196
-		return Give()->tooltips->render_link( array(
197
-			'label'       => __( 'Edit', 'give' ) . " {$email->config['label']}",
195
+	public function column_setting(Give_Email_Notification $email) {
196
+		return Give()->tooltips->render_link(array(
197
+			'label'       => __('Edit', 'give')." {$email->config['label']}",
198 198
 			'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>',
199
-			'link'        => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) ),
199
+			'link'        => esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id'])),
200 200
 			'attributes'  => array(
201 201
 				'class' => 'button button-small',
202 202
 			),
203
-		) );
203
+		));
204 204
 	}
205 205
 
206 206
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @return array
216 216
 	 */
217
-	private function get_row_actions( $email ) {
218
-		$edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails&section=' . $email->config['id'] ) );
217
+	private function get_row_actions($email) {
218
+		$edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails&section='.$email->config['id']));
219 219
 
220 220
 		/**
221 221
 		 * Filter the row actions
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$row_actions = apply_filters(
228 228
 			'give_email_notification_row_actions',
229 229
 			array(
230
-				'edit' => "<a href=\"{$edit_url}\">" . __( 'Edit', 'give' ) . '</a>',
230
+				'edit' => "<a href=\"{$edit_url}\">".__('Edit', 'give').'</a>',
231 231
 			),
232 232
 			$email
233 233
 		);
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
 		$hidden                = array();
249 249
 		$email_notifications   = array();
250 250
 		$sortable              = $this->get_sortable_columns();
251
-		$this->_column_headers = array( $columns, $hidden, $sortable, $this->get_primary_column_name() );
251
+		$this->_column_headers = array($columns, $hidden, $sortable, $this->get_primary_column_name());
252 252
 
253 253
 		// Set email notifications.
254 254
 		/* @var Give_Email_Notification $email_notification */
255
-		foreach ( $this->email_notifications->get_email_notifications() as $email_notification ) {
256
-			if ( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email_notification ) ) {
255
+		foreach ($this->email_notifications->get_email_notifications() as $email_notification) {
256
+			if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email_notification)) {
257 257
 				$email_notifications[] = $email_notification;
258 258
 			}
259 259
 		}
260 260
 
261
-		$totalItems  = count( $email_notifications );
261
+		$totalItems  = count($email_notifications);
262 262
 		$this->items = $email_notifications;
263
-		$this->set_pagination_args( array(
263
+		$this->set_pagination_args(array(
264 264
 			'total_items' => $totalItems,
265 265
 			'per_page'    => $this->per_page,
266
-		) );
266
+		));
267 267
 	}
268 268
 
269 269
 	/**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @access public
274 274
 	 */
275 275
 	public function no_items() {
276
-		_e( 'No give email notification found.', 'give' );
276
+		_e('No give email notification found.', 'give');
277 277
 	}
278 278
 
279 279
 	/**
Please login to merge, or discard this patch.
includes/admin/emails/abstract-email-notification.php 1 patch
Spacing   +160 added lines, -161 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_Email_Notification' ) ) :
19
+if ( ! class_exists('Give_Email_Notification')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_Email_Notification
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 		 *
95 95
 		 * @return Give_Email_Notification
96 96
 		 */
97
-		public static function get_instance( $email_notification_id = '' ) {
97
+		public static function get_instance($email_notification_id = '') {
98 98
 			$class = '';
99 99
 
100
-			if ( ! empty( $email_notification_id ) ) {
100
+			if ( ! empty($email_notification_id)) {
101 101
 				/* @var Give_Email_Notification $class */
102
-				foreach ( self::$singleton as $class ) {
103
-					if ( $email_notification_id === $class->config['id'] ) {
104
-						$class = get_class( $class );
102
+				foreach (self::$singleton as $class) {
103
+					if ($email_notification_id === $class->config['id']) {
104
+						$class = get_class($class);
105 105
 						break;
106 106
 					}
107 107
 				}
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 				$class = get_called_class();
110 110
 			}
111 111
 
112
-			if ( ! empty( $class ) && ( ! array_key_exists( $class, self::$singleton ) || is_null( self::$singleton[ $class ] ) ) ) {
113
-				self::$singleton[ $class ] = new $class();
112
+			if ( ! empty($class) && ( ! array_key_exists($class, self::$singleton) || is_null(self::$singleton[$class]))) {
113
+				self::$singleton[$class] = new $class();
114 114
 			}
115 115
 
116
-			return ( isset( self::$singleton[ $class ] ) ? self::$singleton[ $class ] : null );
116
+			return (isset(self::$singleton[$class]) ? self::$singleton[$class] : null);
117 117
 		}
118 118
 
119 119
 		/**
@@ -124,35 +124,35 @@  discard block
 block discarded – undo
124 124
 		 *
125 125
 		 * @param array $config
126 126
 		 */
127
-		public function load( $config ) {
127
+		public function load($config) {
128 128
 			// Set notification configuration.
129
-			$this->config = wp_parse_args( $config, $this->config );
129
+			$this->config = wp_parse_args($config, $this->config);
130 130
 
131 131
 			// Set email preview header status.
132 132
 			$this->config['has_preview_header'] = $this->config['has_preview'] && $this->config['has_preview_header'] ? true : false;
133 133
 
134 134
 			// Set email content type
135
-			$this->config['content_type'] = empty( $this->config['content_type'] ) || ! in_array( $this->config['content_type'], array(
135
+			$this->config['content_type'] = empty($this->config['content_type']) || ! in_array($this->config['content_type'], array(
136 136
 				'text/html',
137 137
 				'text/plain',
138
-			) )
138
+			))
139 139
 				? Give()->emails->get_content_type()
140 140
 				: $this->config['content_type'];
141
-			$this->config['content_type'] = give_get_option( Give_Email_Setting_Field::get_prefix( $this ) . 'email_content_type', $this->config['content_type'] );
141
+			$this->config['content_type'] = give_get_option(Give_Email_Setting_Field::get_prefix($this).'email_content_type', $this->config['content_type']);
142 142
 
143 143
 			// Set email template type.
144
-			$this->config['email_template'] = empty( $this->config['email_template'] )
145
-				? give_get_option( 'email_template' )
144
+			$this->config['email_template'] = empty($this->config['email_template'])
145
+				? give_get_option('email_template')
146 146
 				: $this->config['email_template'];
147 147
 
148 148
 			// Set recipient group name.
149
-			$this->config['recipient_group_name'] = empty( $this->config['recipient_group_name'] )
150
-				? ( ! Give_Email_Notification_Util::has_recipient_field( $this ) ? __( 'Donor', 'give' ) : '' )
149
+			$this->config['recipient_group_name'] = empty($this->config['recipient_group_name'])
150
+				? ( ! Give_Email_Notification_Util::has_recipient_field($this) ? __('Donor', 'give') : '')
151 151
 				: $this->config['recipient_group_name'];
152 152
 
153 153
 			// Non notification status editable notice.
154
-			$this->config['notices']['non-notification-status-editable'] = empty( $this->config['notices']['non-notification-status-editable'] )
155
-				? __( 'You can not edit notification status from here.', 'give' )
154
+			$this->config['notices']['non-notification-status-editable'] = empty($this->config['notices']['non-notification-status-editable'])
155
+				? __('You can not edit notification status from here.', 'give')
156 156
 				: $this->config['notices']['non-notification-status-editable'];
157 157
 
158 158
 			/**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			 * @param                         array                   Give_Email_Notification::config
164 164
 			 * @param Give_Email_Notification $this
165 165
 			 */
166
-			$this->config = apply_filters( 'give_email_api_notification_config', $this->config, $this );
166
+			$this->config = apply_filters('give_email_api_notification_config', $this->config, $this);
167 167
 
168 168
 			// Setup filters.
169 169
 			$this->setup_filters();
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		 */
179 179
 		private function setup_filters() {
180 180
 			// Apply filter only for current email notification section.
181
-			if ( give_get_current_setting_section() === $this->config['id'] ) {
181
+			if (give_get_current_setting_section() === $this->config['id']) {
182 182
 				// Initialize email context for email notification.
183 183
 				$this->config['email_tag_context'] = apply_filters(
184 184
 					"give_{$this->config['id']}_email_tag_context",
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 			}
189 189
 
190 190
 			// Setup setting fields.
191
-			if( $this->config['show_on_emails_setting_page'] ) {
192
-				add_filter( 'give_get_settings_emails', array( $this, 'add_setting_fields' ), 10, 2 );
191
+			if ($this->config['show_on_emails_setting_page']) {
192
+				add_filter('give_get_settings_emails', array($this, 'add_setting_fields'), 10, 2);
193 193
 			}
194 194
 
195
-			if ( $this->config['form_metabox_setting'] && ! empty( $this->config['form_metabox_id'] ) ) {
195
+			if ($this->config['form_metabox_setting'] && ! empty($this->config['form_metabox_id'])) {
196 196
 				add_filter(
197 197
 					$this->config['form_metabox_id'],
198
-					array( $this, 'add_metabox_setting_field' ),
198
+					array($this, 'add_metabox_setting_field'),
199 199
 					10,
200 200
 					2
201 201
 				);
202 202
 			}
203 203
 
204
-			if( $this->config['has_recipient_field'] ) {
204
+			if ($this->config['has_recipient_field']) {
205 205
 				add_action(
206 206
 						"give_save__give_{$this->config['id']}_recipient",
207
-						array( $this, 'validate_form_recipient_field_value' ),
207
+						array($this, 'validate_form_recipient_field_value'),
208 208
 						10,
209 209
 						3
210 210
 				);
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 		 *
254 254
 		 * @return array
255 255
 		 */
256
-		public function add_section( $sections ) {
257
-			$sections[ $this->config['id'] ] = $this->config['label'];
256
+		public function add_section($sections) {
257
+			$sections[$this->config['id']] = $this->config['label'];
258 258
 
259 259
 			return $sections;
260 260
 		}
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		 *
269 269
 		 * @return bool
270 270
 		 */
271
-		public function hide_section( $hide_section ) {
271
+		public function hide_section($hide_section) {
272 272
 			$hide_section = true;
273 273
 
274 274
 			return $hide_section;
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 		 *
285 285
 		 * @return  array
286 286
 		 */
287
-		public function add_setting_fields( $settings ) {
288
-			if ( $this->config['id'] === give_get_current_setting_section() ) {
287
+		public function add_setting_fields($settings) {
288
+			if ($this->config['id'] === give_get_current_setting_section()) {
289 289
 				$settings = $this->get_setting_fields();
290 290
 			}
291 291
 
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 		 *
304 304
 		 * @return array
305 305
 		 */
306
-		public function get_setting_fields( $form_id = null ) {
307
-			return Give_Email_Setting_Field::get_setting_fields( $this, $form_id );
306
+		public function get_setting_fields($form_id = null) {
307
+			return Give_Email_Setting_Field::get_setting_fields($this, $form_id);
308 308
 		}
309 309
 
310 310
 
@@ -319,13 +319,13 @@  discard block
 block discarded – undo
319 319
 		 *
320 320
 		 * @return array
321 321
 		 */
322
-		public function add_metabox_setting_field( $settings, $form_id ) {
322
+		public function add_metabox_setting_field($settings, $form_id) {
323 323
 
324
-			if( Give_Email_Notification_Util::is_email_notification_active( $this ) ) {
324
+			if (Give_Email_Notification_Util::is_email_notification_active($this)) {
325 325
 				$settings[] = array(
326 326
 					'id'     => $this->config['id'],
327 327
 					'title'  => $this->config['label'],
328
-					'fields' => $this->get_setting_fields( $form_id ),
328
+					'fields' => $this->get_setting_fields($form_id),
329 329
 				);
330 330
 			}
331 331
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		 *
344 344
 		 * @return array
345 345
 		 */
346
-		public function get_extra_setting_fields( $form_id = null ) {
346
+		public function get_extra_setting_fields($form_id = null) {
347 347
 			return array();
348 348
 		}
349 349
 
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
 		 *
361 361
 		 * @return string|array
362 362
 		 */
363
-		public function get_recipient( $form_id = null ) {
364
-			if ( empty( $this->recipient_email ) && $this->config['has_recipient_field'] ) {
363
+		public function get_recipient($form_id = null) {
364
+			if (empty($this->recipient_email) && $this->config['has_recipient_field']) {
365 365
 				$this->recipient_email = Give_Email_Notification_Util::get_value(
366 366
 						$this,
367
-						Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'recipient',
367
+						Give_Email_Setting_Field::get_prefix($this, $form_id).'recipient',
368 368
 						$form_id
369 369
 				);
370 370
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 				 * @since 1.0
376 376
 				 * @deprecated 2.0
377 377
 				 */
378
-				$this->recipient_email = apply_filters( 'give_admin_notice_emails', $this->recipient_email, $this, $form_id );
378
+				$this->recipient_email = apply_filters('give_admin_notice_emails', $this->recipient_email, $this, $form_id);
379 379
 			}
380 380
 
381 381
 			/**
@@ -405,10 +405,10 @@  discard block
 block discarded – undo
405 405
 		 *
406 406
 		 * @return bool
407 407
 		 */
408
-		public function get_notification_status( $form_id = null ) {
409
-			$notification_status = empty( $form_id )
410
-				? give_get_option( "{$this->config['id']}_notification", $this->config['notification_status'] )
411
-				: give_get_meta( $form_id, Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'notification', true, 'global' );
408
+		public function get_notification_status($form_id = null) {
409
+			$notification_status = empty($form_id)
410
+				? give_get_option("{$this->config['id']}_notification", $this->config['notification_status'])
411
+				: give_get_meta($form_id, Give_Email_Setting_Field::get_prefix($this, $form_id).'notification', true, 'global');
412 412
 
413 413
 			/**
414 414
 			 * Filter the notification status.
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 		 *
434 434
 		 * @return string
435 435
 		 */
436
-		function get_email_subject( $form_id = null ) {
436
+		function get_email_subject($form_id = null) {
437 437
 			$subject = wp_strip_all_tags(
438 438
 				Give_Email_Notification_Util::get_value(
439 439
 					$this,
440
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
440
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
441 441
 					$form_id,
442 442
 					$this->config['default_email_subject']
443 443
 				)
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 		 *
467 467
 		 * @return string
468 468
 		 */
469
-		public function get_email_message( $form_id = null ) {
469
+		public function get_email_message($form_id = null) {
470 470
 			$message = Give_Email_Notification_Util::get_value(
471 471
 				$this,
472
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
472
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
473 473
 				$form_id,
474 474
 				$this->config['default_email_message']
475 475
 			);
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 		 *
497 497
 		 * @return string
498 498
 		 */
499
-		public function get_email_header( $form_id = null ) {
499
+		public function get_email_header($form_id = null) {
500 500
 			$header = Give_Email_Notification_Util::get_value(
501 501
 				$this,
502
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_header',
502
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_header',
503 503
 				$form_id,
504 504
 				$this->config['default_email_header']
505 505
 			);
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
 		 *
528 528
 		 * @return string
529 529
 		 */
530
-		public function get_email_content_type( $form_id ) {
530
+		public function get_email_content_type($form_id) {
531 531
 			$content_type = Give_Email_Notification_Util::get_value(
532 532
 				$this,
533
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_content_type',
533
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_content_type',
534 534
 				$form_id,
535 535
 				$this->config['content_type']
536 536
 			);
@@ -558,15 +558,14 @@  discard block
 block discarded – undo
558 558
 		 *
559 559
 		 * @return string
560 560
 		 */
561
-		public function get_email_template( $form_id ) {
562
-			$email_template = give_get_meta( $form_id, '_give_email_template', true );
561
+		public function get_email_template($form_id) {
562
+			$email_template = give_get_meta($form_id, '_give_email_template', true);
563 563
 			$email_template = Give_Email_Notification_Util::get_value(
564 564
 				$this,
565
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) .'email_template',
565
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_template',
566 566
 				$form_id,
567
-				! empty( $email_template ) && Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ?
568
-					$email_template :
569
-					$this->config['email_template']
567
+				! empty($email_template) && Give_Email_Notification_Util::can_use_form_email_options($this, $form_id) ?
568
+					$email_template : $this->config['email_template']
570 569
 			);
571 570
 
572 571
 			/**
@@ -593,34 +592,34 @@  discard block
 block discarded – undo
593 592
 		 *
594 593
 		 * @return array
595 594
 		 */
596
-		public function get_allowed_email_tags( $formatted = false ) {
595
+		public function get_allowed_email_tags($formatted = false) {
597 596
 			// Get all email tags.
598 597
 			$email_tags = Give()->email_tags->get_tags();
599 598
 
600 599
 			// Skip if all email template tags context setup exit.
601
-			if ( $this->config['email_tag_context'] && 'all' !== $this->config['email_tag_context'] ) {
602
-				if ( is_array( $this->config['email_tag_context'] ) ) {
603
-					foreach ( $email_tags as $index => $email_tag ) {
604
-						if ( in_array( $email_tag['context'], $this->config['email_tag_context'] ) ) {
600
+			if ($this->config['email_tag_context'] && 'all' !== $this->config['email_tag_context']) {
601
+				if (is_array($this->config['email_tag_context'])) {
602
+					foreach ($email_tags as $index => $email_tag) {
603
+						if (in_array($email_tag['context'], $this->config['email_tag_context'])) {
605 604
 							continue;
606 605
 						}
607 606
 
608
-						unset( $email_tags[ $index ] );
607
+						unset($email_tags[$index]);
609 608
 					}
610 609
 				} else {
611
-					foreach ( $email_tags as $index => $email_tag ) {
612
-						if ( $this->config['email_tag_context'] === $email_tag['context'] ) {
610
+					foreach ($email_tags as $index => $email_tag) {
611
+						if ($this->config['email_tag_context'] === $email_tag['context']) {
613 612
 							continue;
614 613
 						}
615 614
 
616
-						unset( $email_tags[ $index ] );
615
+						unset($email_tags[$index]);
617 616
 					}
618 617
 				}
619 618
 			}
620 619
 
621
-			if ( count( $email_tags ) && $formatted ) : ob_start() ?>
620
+			if (count($email_tags) && $formatted) : ob_start() ?>
622 621
 				<ul class="give-email-tags-wrap">
623
-					<?php foreach ( $email_tags as $email_tag ) : ?>
622
+					<?php foreach ($email_tags as $email_tag) : ?>
624 623
 						<li class="give_<?php echo $email_tag['tag']; ?>_tag">
625 624
 							<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?>
626 625
 						</li>
@@ -643,8 +642,8 @@  discard block
 block discarded – undo
643 642
 		 *
644 643
 		 * @return array|string
645 644
 		 */
646
-		public function get_preview_email_recipient( $form_id = null ) {
647
-			$recipients = $this->get_recipient( $form_id );
645
+		public function get_preview_email_recipient($form_id = null) {
646
+			$recipients = $this->get_recipient($form_id);
648 647
 
649 648
 			/**
650 649
 			 * Filter the preview email recipients.
@@ -654,7 +653,7 @@  discard block
 block discarded – undo
654 653
 			 * @param string|array            $recipients List of recipients.
655 654
 			 * @param Give_Email_Notification $this
656 655
 			 */
657
-			$recipients = apply_filters( 'give_get_preview_email_recipient', $recipients, $this, $form_id );
656
+			$recipients = apply_filters('give_get_preview_email_recipient', $recipients, $this, $form_id);
658 657
 
659 658
 			return $recipients;
660 659
 		}
@@ -669,13 +668,13 @@  discard block
 block discarded – undo
669 668
 		 *
670 669
 		 * @return array
671 670
 		 */
672
-		public function get_email_attachments( $form_id = null ) {
671
+		public function get_email_attachments($form_id = null) {
673 672
 			/**
674 673
 			 * Filter the attachment.
675 674
 			 *
676 675
 			 * @since 2.0
677 676
 			 */
678
-			return apply_filters( "give_{$this->config['id']}_get_email_attachments", array(), $this, $form_id );
677
+			return apply_filters("give_{$this->config['id']}_get_email_attachments", array(), $this, $form_id);
679 678
 		}
680 679
 
681 680
 
@@ -687,40 +686,40 @@  discard block
 block discarded – undo
687 686
 		 */
688 687
 		public function send_preview_email() {
689 688
 			// Get form id
690
-			$form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
689
+			$form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
691 690
 
692 691
 			// setup email data.
693 692
 			$this->setup_email_data();
694 693
 
695 694
 			$attachments  = $this->get_email_attachments();
696
-			$message      = $this->preview_email_template_tags( $this->get_email_message( $form_id ) );
697
-			$subject      = $this->preview_email_template_tags( $this->get_email_subject( $form_id ) );
698
-			$content_type = $this->get_email_content_type( $form_id );
695
+			$message      = $this->preview_email_template_tags($this->get_email_message($form_id));
696
+			$subject      = $this->preview_email_template_tags($this->get_email_subject($form_id));
697
+			$content_type = $this->get_email_content_type($form_id);
699 698
 
700 699
 			// Setup email content type.
701
-			Give()->emails->__set( 'content_type', $content_type );
702
-			Give()->emails->__set( 'html', true );
700
+			Give()->emails->__set('content_type', $content_type);
701
+			Give()->emails->__set('html', true);
703 702
 
704 703
 			// Setup email template
705
-			Give()->emails->__set( 'template', $this->get_email_template( $form_id ) );
704
+			Give()->emails->__set('template', $this->get_email_template($form_id));
706 705
 
707 706
 			// Set email header.
708
-			Give()->emails->__set( 'heading', $this->preview_email_template_tags( $this->get_email_header( $form_id ) ) );
707
+			Give()->emails->__set('heading', $this->preview_email_template_tags($this->get_email_header($form_id)));
709 708
 
710 709
 			// Format plain content type email.
711
-			if ( 'text/plain' === $content_type ) {
712
-				Give()->emails->__set( 'html', false );
713
-				Give()->emails->__set( 'template', 'none' );
714
-				$message = strip_tags( $message );
710
+			if ('text/plain' === $content_type) {
711
+				Give()->emails->__set('html', false);
712
+				Give()->emails->__set('template', 'none');
713
+				$message = strip_tags($message);
715 714
 			}
716 715
 
717
-			if ( Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ) {
716
+			if (Give_Email_Notification_Util::can_use_form_email_options($this, $form_id)) {
718 717
 				Give()->emails->form_id      = $form_id;
719
-				Give()->emails->from_name    = give_get_meta( $form_id, '_give_from_name', true );
720
-				Give()->emails->from_address = give_get_meta( $form_id, '_give_from_email', true );
718
+				Give()->emails->from_name    = give_get_meta($form_id, '_give_from_name', true);
719
+				Give()->emails->from_address = give_get_meta($form_id, '_give_from_email', true);
721 720
 			}
722 721
 
723
-			return Give()->emails->send( $this->get_preview_email_recipient( $form_id ), $subject, $message, $attachments );
722
+			return Give()->emails->send($this->get_preview_email_recipient($form_id), $subject, $message, $attachments);
724 723
 		}
725 724
 
726 725
 
@@ -741,7 +740,7 @@  discard block
 block discarded – undo
741 740
 		 *
742 741
 		 * @return bool
743 742
 		 */
744
-		public function send_email_notification( $email_tag_args = array() ) {
743
+		public function send_email_notification($email_tag_args = array()) {
745 744
 			// Add email content type email tags.
746 745
 			$email_tag_args['email_content_type'] = $this->config['content_type'];
747 746
 
@@ -750,16 +749,16 @@  discard block
 block discarded – undo
750 749
 			 *
751 750
 			 * @since 2.0
752 751
 			 */
753
-			$email_tag_args = apply_filters( "give_{$this->config['id']}_email_tag_args", $email_tag_args, $this );
752
+			$email_tag_args = apply_filters("give_{$this->config['id']}_email_tag_args", $email_tag_args, $this);
754 753
 
755 754
 			// Get form id.
756
-			$form_id = ! empty( $email_tag_args['form_id'] )
757
-				? absint( $email_tag_args['form_id'] )
758
-				: ( ! empty( $email_tag_args['payment_id'] ) ? give_get_payment_form_id( $email_tag_args['payment_id'] ) : null );
755
+			$form_id = ! empty($email_tag_args['form_id'])
756
+				? absint($email_tag_args['form_id'])
757
+				: ( ! empty($email_tag_args['payment_id']) ? give_get_payment_form_id($email_tag_args['payment_id']) : null);
759 758
 
760 759
 
761 760
 			// Do not send email if notification is disable.
762
-			if ( ! Give_Email_Notification_Util::is_email_notification_active( $this, $form_id ) ) {
761
+			if ( ! Give_Email_Notification_Util::is_email_notification_active($this, $form_id)) {
763 762
 				return false;
764 763
 			}
765 764
 
@@ -768,44 +767,44 @@  discard block
 block discarded – undo
768 767
 			 *
769 768
 			 * @since 2.0
770 769
 			 */
771
-			do_action( "give_{$this->config['id']}_email_send_before", $this, $form_id );
770
+			do_action("give_{$this->config['id']}_email_send_before", $this, $form_id);
772 771
 
773 772
 			$attachments  = $this->get_email_attachments();
774
-			$message      = give_do_email_tags( $this->get_email_message( $form_id ), $email_tag_args );
775
-			$subject      = give_do_email_tags( $this->get_email_subject( $form_id ), $email_tag_args );
776
-			$content_type = $this->get_email_content_type( $form_id );
773
+			$message      = give_do_email_tags($this->get_email_message($form_id), $email_tag_args);
774
+			$subject      = give_do_email_tags($this->get_email_subject($form_id), $email_tag_args);
775
+			$content_type = $this->get_email_content_type($form_id);
777 776
 
778 777
 			// Setup email content type.
779
-			Give()->emails->__set( 'content_type', $content_type );
780
-			Give()->emails->__set( 'html', true );
778
+			Give()->emails->__set('content_type', $content_type);
779
+			Give()->emails->__set('html', true);
781 780
 
782 781
 			// Set email template.
783
-			Give()->emails->__set( 'template', $this->get_email_template( $form_id ) );
782
+			Give()->emails->__set('template', $this->get_email_template($form_id));
784 783
 
785 784
 			// Set email header.
786
-			Give()->emails->__set( 'heading', give_do_email_tags( $this->get_email_header( $form_id ), $email_tag_args ) );
785
+			Give()->emails->__set('heading', give_do_email_tags($this->get_email_header($form_id), $email_tag_args));
787 786
 
788
-			if ( 'text/plain' === $content_type ) {
789
-				Give()->emails->__set( 'html', false );
790
-				Give()->emails->__set( 'template', 'none' );
791
-				$message = strip_tags( $message );
787
+			if ('text/plain' === $content_type) {
788
+				Give()->emails->__set('html', false);
789
+				Give()->emails->__set('template', 'none');
790
+				$message = strip_tags($message);
792 791
 			}
793 792
 
794
-			if ( Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ) {
793
+			if (Give_Email_Notification_Util::can_use_form_email_options($this, $form_id)) {
795 794
 				Give()->emails->form_id      = $form_id;
796
-				Give()->emails->from_name    = give_get_meta( $form_id, '_give_from_name', true );
797
-				Give()->emails->from_address = give_get_meta( $form_id, '_give_from_email', true );
795
+				Give()->emails->from_name    = give_get_meta($form_id, '_give_from_name', true);
796
+				Give()->emails->from_address = give_get_meta($form_id, '_give_from_email', true);
798 797
 			}
799 798
 
800 799
 			// Send email.
801
-			$email_status = Give()->emails->send( $this->get_recipient( $form_id ), $subject, $message, $attachments );
800
+			$email_status = Give()->emails->send($this->get_recipient($form_id), $subject, $message, $attachments);
802 801
 
803 802
 			/**
804 803
 			 * Fire action after after email send.
805 804
 			 *
806 805
 			 * @since 2.0
807 806
 			 */
808
-			do_action( "give_{$this->config['id']}_email_send_after", $email_status, $this, $form_id );
807
+			do_action("give_{$this->config['id']}_email_send_after", $email_status, $this, $form_id);
809 808
 
810 809
 			return $email_status;
811 810
 		}
@@ -820,67 +819,67 @@  discard block
 block discarded – undo
820 819
 		 *
821 820
 		 * @return string
822 821
 		 */
823
-		public function preview_email_template_tags( $message ) {
822
+		public function preview_email_template_tags($message) {
824 823
 			// Set Payment.
825
-			$payment_id = give_check_variable( give_clean( $_GET ), 'isset_empty', 0, 'preview_id' );
826
-			$payment    = $payment_id ? new Give_Payment( $payment_id ) : new stdClass();
824
+			$payment_id = give_check_variable(give_clean($_GET), 'isset_empty', 0, 'preview_id');
825
+			$payment    = $payment_id ? new Give_Payment($payment_id) : new stdClass();
827 826
 
828 827
 			// Set donor.
829 828
 			$user_id = $payment_id
830 829
 				? $payment->user_id
831
-				: give_check_variable( give_clean( $_GET ), 'isset_empty', 0, 'user_id' );
830
+				: give_check_variable(give_clean($_GET), 'isset_empty', 0, 'user_id');
832 831
 			$user_id = $user_id ? $user_id : wp_get_current_user()->ID;
833 832
 
834 833
 			// Set receipt.
835
-			$receipt_id = strtolower( md5( uniqid() ) );
834
+			$receipt_id = strtolower(md5(uniqid()));
836 835
 
837
-			$receipt_link_url = esc_url( add_query_arg( array(
836
+			$receipt_link_url = esc_url(add_query_arg(array(
838 837
 				'payment_key' => $receipt_id,
839
-			), give_get_history_page_uri() ) );
838
+			), give_get_history_page_uri()));
840 839
 
841 840
 			$receipt_link = sprintf(
842 841
 				'<a href="%1$s">%2$s</a>',
843 842
 				$receipt_link_url,
844
-				esc_html__( 'View the receipt in your browser &raquo;', 'give' )
843
+				esc_html__('View the receipt in your browser &raquo;', 'give')
845 844
 			);
846 845
 
847 846
 			// Set default values for tags.
848 847
 			$this->config['preview_email_tags_values'] = wp_parse_args(
849 848
 				$this->config['preview_email_tags_values'],
850 849
 				array(
851
-					'name'              => give_email_tag_first_name( array(
850
+					'name'              => give_email_tag_first_name(array(
852 851
 						'payment_id' => $payment_id,
853 852
 						'user_id'    => $user_id,
854
-					) ),
855
-					'fullname'          => give_email_tag_fullname( array(
853
+					)),
854
+					'fullname'          => give_email_tag_fullname(array(
856 855
 						'payment_id' => $payment_id,
857 856
 						'user_id'    => $user_id,
858
-					) ),
859
-					'username'          => give_email_tag_username( array(
857
+					)),
858
+					'username'          => give_email_tag_username(array(
860 859
 						'payment_id' => $payment_id,
861 860
 						'user_id'    => $user_id,
862
-					) ),
863
-					'user_email'        => give_email_tag_user_email( array(
861
+					)),
862
+					'user_email'        => give_email_tag_user_email(array(
864 863
 						'payment_id' => $payment_id,
865 864
 						'user_id'    => $user_id,
866
-					) ),
867
-					'payment_total'     => $payment_id ? give_email_tag_payment_total( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ),
868
-					'amount'            => $payment_id ? give_email_tag_amount( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ),
869
-					'price'             => $payment_id ? give_email_tag_price( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ),
870
-					'payment_method'    => $payment_id ? give_email_tag_payment_method( array( 'payment_id' => $payment_id ) ) : __( 'PayPal', 'give' ),
865
+					)),
866
+					'payment_total'     => $payment_id ? give_email_tag_payment_total(array('payment_id' => $payment_id)) : give_currency_filter('10.50'),
867
+					'amount'            => $payment_id ? give_email_tag_amount(array('payment_id' => $payment_id)) : give_currency_filter('10.50'),
868
+					'price'             => $payment_id ? give_email_tag_price(array('payment_id' => $payment_id)) : give_currency_filter('10.50'),
869
+					'payment_method'    => $payment_id ? give_email_tag_payment_method(array('payment_id' => $payment_id)) : __('PayPal', 'give'),
871 870
 					'receipt_id'        => $receipt_id,
872
-					'payment_id'        => $payment_id ? $payment_id : rand( 2000, 2050 ),
871
+					'payment_id'        => $payment_id ? $payment_id : rand(2000, 2050),
873 872
 					'receipt_link_url'  => $receipt_link_url,
874 873
 					'receipt_link'      => $receipt_link,
875
-					'date'              => $payment_id ? date( give_date_format(), strtotime( $payment->date ) ) : date( give_date_format(), current_time( 'timestamp' ) ),
876
-					'donation'          => $payment_id ? give_email_tag_donation( array( 'payment_id' => $payment_id ) ) : esc_html__( 'Sample Donation Form Title', 'give' ),
877
-					'form_title'        => $payment_id ? give_email_tag_form_title( array( 'payment_id' => $payment_id ) ) : esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ),
878
-					'sitename'          => $payment_id ? give_email_tag_sitename( array( 'payment_id' => $payment_id ) ) : get_bloginfo( 'name' ),
874
+					'date'              => $payment_id ? date(give_date_format(), strtotime($payment->date)) : date(give_date_format(), current_time('timestamp')),
875
+					'donation'          => $payment_id ? give_email_tag_donation(array('payment_id' => $payment_id)) : esc_html__('Sample Donation Form Title', 'give'),
876
+					'form_title'        => $payment_id ? give_email_tag_form_title(array('payment_id' => $payment_id)) : esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'),
877
+					'sitename'          => $payment_id ? give_email_tag_sitename(array('payment_id' => $payment_id)) : get_bloginfo('name'),
879 878
 					'pdf_receipt'       => sprintf(
880 879
 						'<a href="#">%s</a>',
881
-						__( 'Download Receipt', 'give' )
880
+						__('Download Receipt', 'give')
882 881
 					),
883
-					'billing_address'   => $payment_id ? give_email_tag_billing_address( array( 'payment_id' => $payment_id ) ) : '',
882
+					'billing_address'   => $payment_id ? give_email_tag_billing_address(array('payment_id' => $payment_id)) : '',
884 883
 					'email_access_link' => sprintf(
885 884
 						'<a href="%1$s">%2$s</a>',
886 885
 						add_query_arg(
@@ -889,20 +888,20 @@  discard block
 block discarded – undo
889 888
 							),
890 889
 							give_get_history_page_uri()
891 890
 						),
892
-						__( 'View your donation history &raquo;', 'give' )
891
+						__('View your donation history &raquo;', 'give')
893 892
 					),
894
-					'reset_password_link' => $user_id ? give_email_tag_reset_password_link( array( 'user_id' => $user_id ), $payment_id ) : '',
893
+					'reset_password_link' => $user_id ? give_email_tag_reset_password_link(array('user_id' => $user_id), $payment_id) : '',
895 894
 				)
896 895
 			);
897 896
 
898 897
 			// Decode tags.
899
-			foreach ( $this->config['preview_email_tags_values'] as $preview_tag => $value ) {
900
-				if ( isset( $this->config['preview_email_tags_values'][ $preview_tag ] ) ) {
901
-					$message = str_replace( "{{$preview_tag}}", $this->config['preview_email_tags_values'][ $preview_tag ], $message );
898
+			foreach ($this->config['preview_email_tags_values'] as $preview_tag => $value) {
899
+				if (isset($this->config['preview_email_tags_values'][$preview_tag])) {
900
+					$message = str_replace("{{$preview_tag}}", $this->config['preview_email_tags_values'][$preview_tag], $message);
902 901
 				}
903 902
 			}
904 903
 
905
-			return apply_filters( 'give_email_preview_template_tags', $message );
904
+			return apply_filters('give_email_preview_template_tags', $message);
906 905
 		}
907 906
 
908 907
 		/**
@@ -927,17 +926,17 @@  discard block
 block discarded – undo
927 926
 		 * @param $post_id
928 927
 		 *
929 928
 		 */
930
-		public function validate_form_recipient_field_value( $form_meta_key, $form_meta_value, $post_id ) {
929
+		public function validate_form_recipient_field_value($form_meta_key, $form_meta_value, $post_id) {
931 930
 			// Get valid emails.
932
-			$new_form_meta_value = array_filter( $form_meta_value, function ( $value ) {
933
-				return ! empty( $value['email'] ) && is_email( $value['email'] );
931
+			$new_form_meta_value = array_filter($form_meta_value, function($value) {
932
+				return ! empty($value['email']) && is_email($value['email']);
934 933
 			} );
935 934
 
936 935
 			// Remove duplicate emails from array.
937 936
 			$email_arr = array();
938
-			foreach ( $new_form_meta_value as $index => $email ) {
939
-				if( in_array( $email['email'], $email_arr  ) ) {
940
-					unset( $new_form_meta_value[$index] );
937
+			foreach ($new_form_meta_value as $index => $email) {
938
+				if (in_array($email['email'], $email_arr)) {
939
+					unset($new_form_meta_value[$index]);
941 940
 					continue;
942 941
 				}
943 942
 
@@ -946,25 +945,25 @@  discard block
 block discarded – undo
946 945
 
947 946
 			$update = false;
948 947
 
949
-			if ( empty( $new_form_meta_value ) ) {
948
+			if (empty($new_form_meta_value)) {
950 949
 				// Set default recipient.
951 950
 				$form_meta_value = array(
952 951
 					array(
953
-						'email' => get_bloginfo( 'admin_email' )
952
+						'email' => get_bloginfo('admin_email')
954 953
 					),
955 954
 				);
956 955
 
957 956
 				$update = true;
958 957
 
959
-			} elseif ( count( $new_form_meta_value ) !== count( $form_meta_value ) ) {
958
+			} elseif (count($new_form_meta_value) !== count($form_meta_value)) {
960 959
 				// Filter recipient emails.
961 960
 				$form_meta_value = $new_form_meta_value;
962 961
 
963 962
 				$update = true;
964 963
 			}
965 964
 
966
-			if( $update ) {
967
-				give_update_meta( $post_id, $form_meta_key, $form_meta_value );
965
+			if ($update) {
966
+				give_update_meta($post_id, $form_meta_key, $form_meta_value);
968 967
 			}
969 968
 		}
970 969
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-email-setting-field.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @return array
23 23
 	 */
24
-	public static function get_setting_fields( Give_Email_Notification $email, $form_id = null ) {
25
-		$setting_fields = self::get_default_setting_fields( $email, $form_id );
24
+	public static function get_setting_fields(Give_Email_Notification $email, $form_id = null) {
25
+		$setting_fields = self::get_default_setting_fields($email, $form_id);
26 26
 
27 27
 		// Recipient field.
28
-		$setting_fields[] = self::get_recipient_setting_field( $email, $form_id, Give_Email_Notification_Util::has_recipient_field( $email ) );
28
+		$setting_fields[] = self::get_recipient_setting_field($email, $form_id, Give_Email_Notification_Util::has_recipient_field($email));
29 29
 
30 30
 		// Add extra setting field.
31
-		if ( $extra_setting_field = $email->get_extra_setting_fields( $form_id ) ) {
32
-			$setting_fields = array_merge( $setting_fields, $extra_setting_field );
31
+		if ($extra_setting_field = $email->get_extra_setting_fields($form_id)) {
32
+			$setting_fields = array_merge($setting_fields, $extra_setting_field);
33 33
 		}
34 34
 
35 35
 		// Preview field.
36
-		if ( Give_Email_Notification_Util::has_preview( $email ) ) {
37
-			$setting_fields[] = self::get_preview_setting_field( $email, $form_id );
36
+		if (Give_Email_Notification_Util::has_preview($email)) {
37
+			$setting_fields[] = self::get_preview_setting_field($email, $form_id);
38 38
 		}
39 39
 
40
-		$setting_fields = self::add_section_end( $email, $setting_fields );
40
+		$setting_fields = self::add_section_end($email, $setting_fields);
41 41
 
42 42
 		/**
43 43
 		 * Filter the email notification settings.
44 44
 		 *
45 45
 		 * @since 2.0
46 46
 		 */
47
-		return apply_filters( 'give_email_notification_setting_fields', $setting_fields, $email, $form_id );
47
+		return apply_filters('give_email_notification_setting_fields', $setting_fields, $email, $form_id);
48 48
 	}
49 49
 
50 50
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return bool
60 60
 	 */
61
-	public static function has_section_end( $setting ) {
62
-		$last_field      = end( $setting );
61
+	public static function has_section_end($setting) {
62
+		$last_field      = end($setting);
63 63
 		$has_section_end = false;
64 64
 
65
-		if ( 'sectionend' === $last_field['type'] ) {
65
+		if ('sectionend' === $last_field['type']) {
66 66
 			$has_section_end = true;
67 67
 		}
68 68
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array
82 82
 	 */
83
-	public static function get_section_start( Give_Email_Notification $email, $form_id = null ) {
83
+	public static function get_section_start(Give_Email_Notification $email, $form_id = null) {
84 84
 		// Add section end field.
85 85
 		$setting = array(
86 86
 			'id'    => "give_title_email_settings_{$email->config['id']}",
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public static function add_section_end( Give_Email_Notification $email, $setting ) {
106
-		if ( ! self::has_section_end( $setting ) ) {
105
+	public static function add_section_end(Give_Email_Notification $email, $setting) {
106
+		if ( ! self::has_section_end($setting)) {
107 107
 			// Add section end field.
108 108
 			$setting[] = array(
109 109
 				'id'   => "give_title_email_settings_{$email->config['id']}",
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return array
127 127
 	 */
128
-	public static function get_default_setting_fields( Give_Email_Notification $email, $form_id = null ) {
129
-		$settings[] = self::get_section_start( $email, $form_id );
130
-		$settings[] = self::get_notification_status_field( $email, $form_id );
128
+	public static function get_default_setting_fields(Give_Email_Notification $email, $form_id = null) {
129
+		$settings[] = self::get_section_start($email, $form_id);
130
+		$settings[] = self::get_notification_status_field($email, $form_id);
131 131
 
132
-		if ( ! Give_Email_Notification_Util::is_notification_status_editable( $email ) ) {
133
-			if ( $form_id || give_is_add_new_form_page() ) {
132
+		if ( ! Give_Email_Notification_Util::is_notification_status_editable($email)) {
133
+			if ($form_id || give_is_add_new_form_page()) {
134 134
 				// Do not allow admin to disable notification on perform basis.
135
-				unset( $settings[1]['options']['disabled'] );
135
+				unset($settings[1]['options']['disabled']);
136 136
 			} else {
137 137
 				// Do not allow admin to edit notification status globally.
138
-				unset( $settings[1] );
138
+				unset($settings[1]);
139 139
 			}
140 140
 		}
141 141
 
142
-		$settings[] = self::get_email_subject_field( $email, $form_id );
143
-		$settings[] = self::get_email_header_field( $email, $form_id );
144
-		$settings[] = self::get_email_message_field( $email, $form_id );
142
+		$settings[] = self::get_email_subject_field($email, $form_id);
143
+		$settings[] = self::get_email_header_field($email, $form_id);
144
+		$settings[] = self::get_email_message_field($email, $form_id);
145 145
 
146
-		if ( Give_Email_Notification_Util::is_content_type_editable( $email ) ) {
147
-			$settings[] = self::get_email_content_type_field( $email, $form_id );
146
+		if (Give_Email_Notification_Util::is_content_type_editable($email)) {
147
+			$settings[] = self::get_email_content_type_field($email, $form_id);
148 148
 		}
149 149
 
150 150
 		return $settings;
@@ -161,31 +161,31 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return array
163 163
 	 */
164
-	public static function get_notification_status_field( Give_Email_Notification $email, $form_id = null ) {
164
+	public static function get_notification_status_field(Give_Email_Notification $email, $form_id = null) {
165 165
 		$option = array(
166
-			'enabled'  => __( 'Enabled', 'give' ),
167
-			'disabled' => __( 'Disabled', 'give' ),
166
+			'enabled'  => __('Enabled', 'give'),
167
+			'disabled' => __('Disabled', 'give'),
168 168
 		);
169 169
 
170 170
 		$default_value = $email->get_notification_status();
171 171
 
172 172
 		// Add global options.
173
-		if ( $form_id || give_is_add_new_form_page() ) {
173
+		if ($form_id || give_is_add_new_form_page()) {
174 174
 			$option = array(
175
-				'global'   => __( 'Global Options' ),
176
-				'enabled'  => __( 'Customize', 'give' ),
177
-				'disabled' => __( 'Disabled', 'give' ),
175
+				'global'   => __('Global Options'),
176
+				'enabled'  => __('Customize', 'give'),
177
+				'disabled' => __('Disabled', 'give'),
178 178
 			);
179 179
 
180 180
 			$default_value = 'global';
181 181
 		}
182 182
 
183
-		$description = isset( $_GET['page'] ) && 'give-settings' === $_GET['page'] ? __( 'Choose whether you want this email enabled or not.', 'give' ) : sprintf( __( 'Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails' ) );
183
+		$description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf(__('Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give'), admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails'));
184 184
 
185 185
 		return array(
186
-			'name'          => esc_html__( 'Notification', 'give' ),
186
+			'name'          => esc_html__('Notification', 'give'),
187 187
 			'desc'          => $description,
188
-			'id'            => self::get_prefix( $email, $form_id ) . 'notification',
188
+			'id'            => self::get_prefix($email, $form_id).'notification',
189 189
 			'type'          => 'radio_inline',
190 190
 			'default'       => $default_value,
191 191
 			'options'       => $option,
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return array
206 206
 	 */
207
-	public static function get_email_subject_field( Give_Email_Notification $email, $form_id = null ) {
207
+	public static function get_email_subject_field(Give_Email_Notification $email, $form_id = null) {
208 208
 		return array(
209
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_subject',
210
-			'name'    => esc_html__( 'Email Subject', 'give' ),
211
-			'desc'    => esc_html__( 'Enter the email subject line.', 'give' ),
209
+			'id'      => self::get_prefix($email, $form_id).'email_subject',
210
+			'name'    => esc_html__('Email Subject', 'give'),
211
+			'desc'    => esc_html__('Enter the email subject line.', 'give'),
212 212
 			'default' => $email->config['default_email_subject'],
213 213
 			'type'    => 'text',
214 214
 		);
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return array
226 226
 	 */
227
-	public static function get_email_header_field( Give_Email_Notification $email, $form_id = null ) {
227
+	public static function get_email_header_field(Give_Email_Notification $email, $form_id = null) {
228 228
 		return array(
229
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_header',
230
-			'name'    => esc_html__( 'Email Header', 'give' ),
231
-			'desc'    => esc_html__( 'Enter the email header that appears at the top of the email.', 'give' ),
229
+			'id'      => self::get_prefix($email, $form_id).'email_header',
230
+			'name'    => esc_html__('Email Header', 'give'),
231
+			'desc'    => esc_html__('Enter the email header that appears at the top of the email.', 'give'),
232 232
 			'default' => $email->config['default_email_header'],
233 233
 			'type'    => 'text',
234 234
 		);
@@ -245,28 +245,28 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @return array
247 247
 	 */
248
-	public static function get_email_message_field( Give_Email_Notification $email, $form_id = null ) {
249
-		$desc = esc_html__( 'Enter the email message.', 'give' );
248
+	public static function get_email_message_field(Give_Email_Notification $email, $form_id = null) {
249
+		$desc = esc_html__('Enter the email message.', 'give');
250 250
 
251
-		if ( $email_tag_list = $email->get_allowed_email_tags( true ) ) {
251
+		if ($email_tag_list = $email->get_allowed_email_tags(true)) {
252 252
 			$desc = sprintf(
253 253
 				'%1$s <br> %2$s: %3$s %4$s',
254
-				__( 'The email that is sent to users after completing a successful donation. HTML is accepted.', 'give' ),
255
-				__( 'Available template tags', 'give' ),
254
+				__('The email that is sent to users after completing a successful donation. HTML is accepted.', 'give'),
255
+				__('Available template tags', 'give'),
256 256
 				$email_tag_list,
257 257
 				sprintf(
258 258
 					'<br><a href="%1$s" target="_blank">%2$s</a> %3$s',
259
-					esc_url( 'http://docs.givewp.com/meta-email-tags' ),
260
-					__( 'See our documentation', 'give' ),
261
-					__( 'for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give' )
259
+					esc_url('http://docs.givewp.com/meta-email-tags'),
260
+					__('See our documentation', 'give'),
261
+					__('for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give')
262 262
 				)
263 263
 			);
264 264
 
265 265
 		}
266 266
 
267 267
 		return array(
268
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_message',
269
-			'name'    => esc_html__( 'Email message', 'give' ),
268
+			'id'      => self::get_prefix($email, $form_id).'email_message',
269
+			'name'    => esc_html__('Email message', 'give'),
270 270
 			'desc'    => $desc,
271 271
 			'type'    => 'wysiwyg',
272 272
 			'default' => $email->config['default_email_message'],
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @return array
286 286
 	 */
287
-	public static function get_email_content_type_field( Give_Email_Notification $email, $form_id = null ) {
287
+	public static function get_email_content_type_field(Give_Email_Notification $email, $form_id = null) {
288 288
 		return array(
289
-			'id'      => self::get_prefix( $email, $form_id ) . 'email_content_type',
290
-			'name'    => esc_html__( 'Email Content Type', 'give' ),
291
-			'desc'    => __( 'Choose email type.', 'give' ),
289
+			'id'      => self::get_prefix($email, $form_id).'email_content_type',
290
+			'name'    => esc_html__('Email Content Type', 'give'),
291
+			'desc'    => __('Choose email type.', 'give'),
292 292
 			'type'    => 'select',
293 293
 			'options' => array(
294
-				'text/html'  => Give_Email_Notification_Util::get_formatted_email_type( 'text/html' ),
295
-				'text/plain' => Give_Email_Notification_Util::get_formatted_email_type( 'text/plain' ),
294
+				'text/html'  => Give_Email_Notification_Util::get_formatted_email_type('text/html'),
295
+				'text/plain' => Give_Email_Notification_Util::get_formatted_email_type('text/plain'),
296 296
 			),
297 297
 			'default' => $email->config['content_type'],
298 298
 		);
@@ -312,29 +312,29 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return array
314 314
 	 */
315
-	public static function get_recipient_setting_field( Give_Email_Notification $email, $form_id = null, $edit_recipient = true ) {
315
+	public static function get_recipient_setting_field(Give_Email_Notification $email, $form_id = null, $edit_recipient = true) {
316 316
 		$recipient = array(
317
-			'id'               => self::get_prefix( $email, $form_id ) . 'recipient',
318
-			'name'             => esc_html__( 'Email Recipients', 'give' ),
319
-			'desc'             => __( 'Enter the email address(es) that should receive a notification.', 'give' ),
317
+			'id'               => self::get_prefix($email, $form_id).'recipient',
318
+			'name'             => esc_html__('Email Recipients', 'give'),
319
+			'desc'             => __('Enter the email address(es) that should receive a notification.', 'give'),
320 320
 			'type'             => 'email',
321
-			'default'          => get_bloginfo( 'admin_email' ),
321
+			'default'          => get_bloginfo('admin_email'),
322 322
 			'repeat'           => true,
323
-			'repeat_btn_title' => esc_html__( 'Add Recipient', 'give' ),
323
+			'repeat_btn_title' => esc_html__('Add Recipient', 'give'),
324 324
 		);
325 325
 
326
-		if ( $form_id || give_is_add_new_form_page() ) {
327
-			$recipient['name']    = __( 'Email', 'give' );
326
+		if ($form_id || give_is_add_new_form_page()) {
327
+			$recipient['name']    = __('Email', 'give');
328 328
 			$recipient['default'] = '';
329 329
 			$recipient['id']      = 'email';
330
-			$recipient['desc']    = __( 'Enter the email address that should receive a notification.', 'give' );
330
+			$recipient['desc']    = __('Enter the email address that should receive a notification.', 'give');
331 331
 
332 332
 			$recipient = array(
333
-				'id'      => self::get_prefix( $email, $form_id ) . 'recipient',
333
+				'id'      => self::get_prefix($email, $form_id).'recipient',
334 334
 				'type'    => 'group',
335 335
 				'options' => array(
336
-					'add_button'    => __( 'Add Email', 'give' ),
337
-					'header_title'  => __( 'Email Recipient', 'give' ),
336
+					'add_button'    => __('Add Email', 'give'),
337
+					'header_title'  => __('Email Recipient', 'give'),
338 338
 					'remove_button' => '<span class="dashicons dashicons-no"></span>',
339 339
 				),
340 340
 				'fields'  => array(
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
345 345
 
346 346
 		// Disable field if email donor has recipient field.
347 347
 		// @see https://github.com/WordImpress/Give/issues/2657
348
-		if ( ! $edit_recipient ) {
349
-			if ( 'group' == $recipient['type'] ) {
350
-				$recipient         = current( $recipient['fields'] );
348
+		if ( ! $edit_recipient) {
349
+			if ('group' == $recipient['type']) {
350
+				$recipient         = current($recipient['fields']);
351 351
 				$recipient['type'] = 'text';
352 352
 			}
353 353
 
354 354
 			$recipient['attributes']['disabled'] = 'disabled';
355 355
 			$recipient['value']                  = $recipient['default'] = '{donor_email}';
356 356
 			$recipient['repeat']                 = false;
357
-			$recipient['desc']                   = __( 'This email is automatically sent to the donor and the recipient cannot be customized.', 'give' );
357
+			$recipient['desc']                   = __('This email is automatically sent to the donor and the recipient cannot be customized.', 'give');
358 358
 		}
359 359
 
360 360
 		return $recipient;
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return array
373 373
 	 */
374
-	public static function get_preview_setting_field( Give_Email_Notification $email, $form_id = null ) {
374
+	public static function get_preview_setting_field(Give_Email_Notification $email, $form_id = null) {
375 375
 		return array(
376
-			'name' => __( 'Preview Email', 'give' ),
377
-			'desc' => __( 'Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.',
378
-				'give' ),
379
-			'id'   => self::get_prefix( $email, $form_id ) . 'preview_buttons',
376
+			'name' => __('Preview Email', 'give'),
377
+			'desc' => __('Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.',
378
+				'give'),
379
+			'id'   => self::get_prefix($email, $form_id).'preview_buttons',
380 380
 			'type' => 'email_preview_buttons',
381 381
 		);
382 382
 	}
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @return string
395 395
 	 */
396
-	public static function get_prefix( Give_Email_Notification $email, $form_id = null ) {
396
+	public static function get_prefix(Give_Email_Notification $email, $form_id = null) {
397 397
 		$meta_key = "{$email->config['id']}_";
398 398
 
399
-		if ( $form_id || give_is_add_new_form_page() ) {
399
+		if ($form_id || give_is_add_new_form_page()) {
400 400
 			$meta_key = "_give_{$email->config['id']}_";
401 401
 		}
402 402
 
Please login to merge, or discard this patch.
includes/admin/emails/class-new-offline-donation-email.php 1 patch
Spacing   +42 added lines, -42 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.
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 				)
241 241
 			);
242 242
 
243
-			Give()->emails->__set( 'heading', $this->get_email_header() );
243
+			Give()->emails->__set('heading', $this->get_email_header());
244 244
 		}
245 245
 
246 246
 		/**
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
 		 *
252 252
 		 * @param int $payment_id
253 253
 		 */
254
-		public function setup_email_notification( $payment_id ) {
255
-			$this->payment = new Give_Payment( $payment_id );
254
+		public function setup_email_notification($payment_id) {
255
+			$this->payment = new Give_Payment($payment_id);
256 256
 
257 257
 			// Exit if not donation was not with offline donation.
258
-			if ( 'offline' !== $this->payment->gateway ) {
258
+			if ('offline' !== $this->payment->gateway) {
259 259
 				return;
260 260
 			}
261 261
 
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 			$this->setup_email_data();
264 264
 
265 265
 			// Send email.
266
-			$this->send_email_notification( array(
266
+			$this->send_email_notification(array(
267 267
 				'payment_id' => $this->payment->ID,
268
-			) );
268
+			));
269 269
 		}
270 270
 
271 271
 		/**
@@ -277,18 +277,18 @@  discard block
 block discarded – undo
277 277
 		 * @param $update_options
278 278
 		 * @param $option_name
279 279
 		 */
280
-		public function set_notification_status( $update_options, $option_name ) {
280
+		public function set_notification_status($update_options, $option_name) {
281 281
 			// Get updated settings.
282 282
 			$update_options = give_get_settings();
283 283
 
284
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
284
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
285 285
 
286 286
 			if (
287
-				empty( $update_options[ "{$this->config['id']}_notification" ] )
288
-				|| $notification_status !== $update_options[ "{$this->config['id']}_notification" ]
287
+				empty($update_options["{$this->config['id']}_notification"])
288
+				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
289 289
 			) {
290
-				$update_options[ "{$this->config['id']}_notification" ] = $notification_status;
291
-				update_option( $option_name, $update_options );
290
+				$update_options["{$this->config['id']}_notification"] = $notification_status;
291
+				update_option($option_name, $update_options);
292 292
 			}
293 293
 		}
294 294
 
@@ -303,13 +303,13 @@  discard block
 block discarded – undo
303 303
 		 *
304 304
 		 * @return array
305 305
 		 */
306
-		public function add_metabox_setting_field( $settings, $form_id ) {
306
+		public function add_metabox_setting_field($settings, $form_id) {
307 307
 
308
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
308
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
309 309
 				$settings[] = array(
310 310
 					'id'     => $this->config['id'],
311 311
 					'title'  => $this->config['label'],
312
-					'fields' => $this->get_setting_fields( $form_id ),
312
+					'fields' => $this->get_setting_fields($form_id),
313 313
 				);
314 314
 			}
315 315
 
Please login to merge, or discard this patch.