Test Failed
Push — master ( 3bffa6...6a44ef )
by Ravinder
08:43
created
uninstall.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load Give file.
18
-include_once( 'give.php' );
18
+include_once('give.php');
19 19
 
20 20
 global $wpdb, $wp_roles;
21 21
 
22 22
 
23
-if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) {
23
+if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) {
24 24
 
25 25
 	// Delete All the Custom Post Types.
26
-	$give_taxonomies = array( 'form_category', 'form_tag' );
27
-	$give_post_types = array( 'give_forms', 'give_payment' );
28
-	foreach ( $give_post_types as $post_type ) {
26
+	$give_taxonomies = array('form_category', 'form_tag');
27
+	$give_post_types = array('give_forms', 'give_payment');
28
+	foreach ($give_post_types as $post_type) {
29 29
 
30
-		$give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) );
31
-		$items           = get_posts( array(
30
+		$give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type));
31
+		$items           = get_posts(array(
32 32
 			'post_type'   => $post_type,
33 33
 			'post_status' => 'any',
34
-			'numberposts' => - 1,
34
+			'numberposts' => -1,
35 35
 			'fields'      => 'ids',
36
-		) );
36
+		));
37 37
 
38
-		if ( $items ) {
39
-			foreach ( $items as $item ) {
40
-				wp_delete_post( $item, true );
38
+		if ($items) {
39
+			foreach ($items as $item) {
40
+				wp_delete_post($item, true);
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45 45
 	// Delete All the Terms & Taxonomies.
46
-	foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) {
46
+	foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) {
47 47
 
48
-		$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
48
+		$terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
49 49
 
50 50
 		// Delete Terms.
51
-		if ( $terms ) {
52
-			foreach ( $terms as $term ) {
53
-				$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
54
-				$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
51
+		if ($terms) {
52
+			foreach ($terms as $term) {
53
+				$wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id));
54
+				$wpdb->delete($wpdb->terms, array('term_id' => $term->term_id));
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Delete Taxonomies.
59
-		$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
59
+		$wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s'));
60 60
 	}
61 61
 
62 62
 	// Delete the Plugin Pages.
63
-	$give_created_pages = array( 'success_page', 'failure_page', 'history_page' );
64
-	foreach ( $give_created_pages as $p ) {
65
-		$page = give_get_option( $p, false );
66
-		if ( $page ) {
67
-			wp_delete_post( $page, true );
63
+	$give_created_pages = array('success_page', 'failure_page', 'history_page');
64
+	foreach ($give_created_pages as $p) {
65
+		$page = give_get_option($p, false);
66
+		if ($page) {
67
+			wp_delete_post($page, true);
68 68
 		}
69 69
 	}
70 70
 
@@ -73,28 +73,28 @@  discard block
 block discarded – undo
73 73
 	Give()->roles->remove_caps();
74 74
 
75 75
 	// Delete the Roles.
76
-	$give_roles = array( 'give_manager', 'give_accountant', 'give_worker', 'give_donor' );
77
-	foreach ( $give_roles as $role ) {
78
-		remove_role( $role );
76
+	$give_roles = array('give_manager', 'give_accountant', 'give_worker', 'give_donor');
77
+	foreach ($give_roles as $role) {
78
+		remove_role($role);
79 79
 	}
80 80
 
81 81
 	// Remove all database tables.
82
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' );
83
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donormeta' );
84
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' );
85
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' );
86
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_paymentmeta' );
87
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_formmeta' );
88
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_logs' );
89
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_logmeta' );
90
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_sequential_ordering' );
91
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_sessions' );
82
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors');
83
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donormeta');
84
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers');
85
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta');
86
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_paymentmeta');
87
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_formmeta');
88
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_logs');
89
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_logmeta');
90
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_sequential_ordering');
91
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_sessions');
92 92
 
93 93
 	// Cleanup Cron Events.
94
-	wp_clear_scheduled_hook( 'give_daily_scheduled_events' );
95
-	wp_clear_scheduled_hook( 'give_weekly_scheduled_events' );
96
-	wp_clear_scheduled_hook( 'give_daily_cron' );
97
-	wp_clear_scheduled_hook( 'give_weekly_cron' );
94
+	wp_clear_scheduled_hook('give_daily_scheduled_events');
95
+	wp_clear_scheduled_hook('give_weekly_scheduled_events');
96
+	wp_clear_scheduled_hook('give_daily_cron');
97
+	wp_clear_scheduled_hook('give_weekly_cron');
98 98
 
99 99
 	// Get all options.
100 100
 	$give_option_names = $wpdb->get_col(
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
 		)
105 105
 	);
106 106
 
107
-	if ( ! empty( $give_option_names ) ) {
107
+	if ( ! empty($give_option_names)) {
108 108
 		// Convert option name to transient or option name.
109 109
 		$new_give_option_names = array();
110 110
 
111 111
 		// Delete all the Plugin Options.
112
-		foreach ( $give_option_names as $option ) {
113
-			if ( false !== strpos( $option, 'give_cache' ) ) {
114
-				Give_Cache::delete( $option );
112
+		foreach ($give_option_names as $option) {
113
+			if (false !== strpos($option, 'give_cache')) {
114
+				Give_Cache::delete($option);
115 115
 			} else {
116
-				delete_option( $option );
116
+				delete_option($option);
117 117
 			}
118 118
 		}
119 119
 	}
Please login to merge, or discard this patch.
includes/class-give-db-payment-meta.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 		global $wpdb;
52 52
 
53 53
 		// @todo: We leave $wpdb->paymentmeta for backward compatibility, use $wpdb->donationmeta instead. We can remove it after 2.1.3.
54
-		$wpdb->paymentmeta = $wpdb->donationmeta = $this->table_name = $wpdb->prefix . 'give_donationmeta';
54
+		$wpdb->paymentmeta = $wpdb->donationmeta = $this->table_name = $wpdb->prefix.'give_donationmeta';
55 55
 		$this->version     = '1.0';
56 56
 
57 57
 		// Backward compatibility.
58
-		if ( ! give_has_upgrade_completed( 'v220_rename_donation_meta_type' ) ) {
58
+		if ( ! give_has_upgrade_completed('v220_rename_donation_meta_type')) {
59 59
 			$this->meta_type = 'payment';
60
-			$wpdb->paymentmeta = $wpdb->donationmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta';
60
+			$wpdb->paymentmeta = $wpdb->donationmeta = $this->table_name = $wpdb->prefix.'give_paymentmeta';
61 61
 		}
62 62
 
63 63
 		$this->register_table();
@@ -90,6 +90,6 @@  discard block
 block discarded – undo
90 90
 	 * @return bool
91 91
 	 */
92 92
 	protected function is_custom_meta_table_active() {
93
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
93
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
94 94
 	}
95 95
 }
Please login to merge, or discard this patch.
includes/class-notices.php 1 patch
Spacing   +112 added lines, -113 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 	 * @since 1.8.9
54 54
 	 */
55 55
 	public function __construct() {
56
-		add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 );
57
-		add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) );
56
+		add_action('admin_notices', array($this, 'render_admin_notices'), 999);
57
+		add_action('give_dismiss_notices', array($this, 'dismiss_notices'));
58 58
 
59
-		add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 );
60
-		add_action( 'give_pre_form_output', array( $this, 'render_frontend_form_notices' ), 10, 1 );
61
-		add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) );
59
+		add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999);
60
+		add_action('give_pre_form_output', array($this, 'render_frontend_form_notices'), 10, 1);
61
+		add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices'));
62 62
 
63 63
 		/**
64 64
 		 * Backward compatibility for deprecated params.
65 65
 		 *
66 66
 		 * @since 1.8.14
67 67
 		 */
68
-		add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) );
69
-		add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) );
70
-		add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) );
68
+		add_filter('give_register_notice_args', array($this, 'bc_deprecated_params'));
69
+		add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params'));
70
+		add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array
82 82
 	 */
83
-	public function bc_deprecated_params( $args ) {
83
+	public function bc_deprecated_params($args) {
84 84
 		/**
85 85
 		 *  Param: auto_dismissible
86 86
 		 *  deprecated in 1.8.14
87 87
 		 *
88 88
 		 *  Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto
89 89
 		 */
90
-		if ( isset( $args['auto_dismissible'] ) ) {
91
-			if ( ! empty( $args['auto_dismissible'] ) ) {
90
+		if (isset($args['auto_dismissible'])) {
91
+			if ( ! empty($args['auto_dismissible'])) {
92 92
 				$args['dismissible'] = 'auto';
93 93
 			}
94 94
 			// unset auto_dismissible as it has been deprecated.
95
-			unset( $args['auto_dismissible'] );
95
+			unset($args['auto_dismissible']);
96 96
 		}
97 97
 
98 98
 		return $args;
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return bool
110 110
 	 */
111
-	public function register_notice( $notice_args ) {
111
+	public function register_notice($notice_args) {
112 112
 		// Bailout.
113
-		if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) {
113
+		if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) {
114 114
 			return false;
115 115
 		}
116 116
 
@@ -159,39 +159,39 @@  discard block
 block discarded – undo
159 159
 		 *
160 160
 		 * @since 1.8.14
161 161
 		 */
162
-		$notice_args = apply_filters( 'give_register_notice_args', $notice_args );
162
+		$notice_args = apply_filters('give_register_notice_args', $notice_args);
163 163
 
164 164
 		// Set extra dismiss links if any.
165
-		if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) {
165
+		if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) {
166 166
 
167
-			preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link );
167
+			preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link);
168 168
 
169
-			if ( ! empty( $extra_notice_dismiss_link ) ) {
170
-				$extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 );
171
-				foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) {
169
+			if ( ! empty($extra_notice_dismiss_link)) {
170
+				$extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3);
171
+				foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) {
172 172
 					// Create array og key ==> value by parsing query string created after renaming data attributes.
173
-					$data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array(
173
+					$data_attribute_query_str = str_replace(array('data-', '-', '"'), array(
174 174
 						'',
175 175
 						'_',
176 176
 						'',
177
-					), implode( '&', $extra_notice_dismiss_link ) );
177
+					), implode('&', $extra_notice_dismiss_link));
178 178
 
179
-					$notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str );
179
+					$notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str);
180 180
 				}
181 181
 			}
182 182
 		}
183 183
 
184 184
 
185
-		self::$notices[ $notice_args['id'] ] = $notice_args;
185
+		self::$notices[$notice_args['id']] = $notice_args;
186 186
 
187 187
 		// Auto set show param if not already set.
188
-		if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) {
189
-			self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true;
188
+		if ( ! isset(self::$notices[$notice_args['id']]['show'])) {
189
+			self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true;
190 190
 		}
191 191
 
192 192
 		// Auto set time interval for shortly.
193
-		if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) {
194
-			self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS;
193
+		if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) {
194
+			self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS;
195 195
 		}
196 196
 
197 197
 		return true;
@@ -205,51 +205,51 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function render_admin_notices() {
207 207
 		// Bailout.
208
-		if ( empty( self::$notices ) ) {
208
+		if (empty(self::$notices)) {
209 209
 			return;
210 210
 		}
211 211
 
212 212
 		$output = '';
213 213
 
214
-		foreach ( self::$notices as $notice_id => $notice ) {
214
+		foreach (self::$notices as $notice_id => $notice) {
215 215
 			// Check flag set to true to show notice.
216
-			if ( ! $notice['show'] ) {
216
+			if ( ! $notice['show']) {
217 217
 				continue;
218 218
 			}
219 219
 
220 220
 
221 221
 			// Render custom html.
222
-			if( ! empty( $notice['description_html'] ) ) {
222
+			if ( ! empty($notice['description_html'])) {
223 223
 				$output .= "{$notice['description_html']} \n";
224 224
 				continue;
225 225
 			}
226 226
 
227 227
 			// Check if notice dismissible or not.
228
-			if ( ! self::$has_auto_dismissible_notice ) {
229
-				self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] );
228
+			if ( ! self::$has_auto_dismissible_notice) {
229
+				self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']);
230 230
 			}
231 231
 
232 232
 			// Check if notice dismissible or not.
233
-			if ( ! self::$has_dismiss_interval_notice ) {
233
+			if ( ! self::$has_dismiss_interval_notice) {
234 234
 				self::$has_dismiss_interval_notice = $notice['dismiss_interval'];
235 235
 			}
236 236
 
237
-			$css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] );
237
+			$css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']);
238 238
 
239
-			$css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}";
240
-			$output    .= sprintf(
241
-				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n",
239
+			$css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}";
240
+			$output .= sprintf(
241
+				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n",
242 242
 				$css_id,
243 243
 				$css_class,
244
-				give_clean( $notice['dismissible'] ),
244
+				give_clean($notice['dismissible']),
245 245
 				$notice['dismissible_type'],
246 246
 				$notice['dismiss_interval'],
247 247
 				$notice['id'],
248
-				empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ),
248
+				empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"),
249 249
 				$notice['dismiss_interval_time']
250 250
 			);
251 251
 
252
-			$output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" );
252
+			$output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>");
253 253
 			$output .= "</div> \n";
254 254
 		}
255 255
 
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @param int $form_id
269 269
 	 */
270
-	public function render_frontend_notices( $form_id = 0 ) {
270
+	public function render_frontend_notices($form_id = 0) {
271 271
 		$errors = give_get_errors();
272 272
 
273
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0;
273
+		$request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0;
274 274
 
275 275
 		// Sanity checks first: Ensure that gateway returned errors display on the appropriate form.
276
-		if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
276
+		if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
277 277
 			return;
278 278
 		}
279 279
 
280
-		if ( $errors ) {
281
-			self::print_frontend_errors( $errors );
280
+		if ($errors) {
281
+			self::print_frontend_errors($errors);
282 282
 
283 283
 			give_clear_errors();
284 284
 		}
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @return void
297 297
 	 */
298
-	public function render_frontend_form_notices( $form_id ) {
299
-		$display_option = give_get_meta( $form_id, '_give_payment_display', true );
298
+	public function render_frontend_form_notices($form_id) {
299
+		$display_option = give_get_meta($form_id, '_give_payment_display', true);
300 300
 
301
-		if ( 'modal' === $display_option ) {
302
-			add_action( 'give_payment_mode_top', array( $this, 'render_frontend_notices' ) );
301
+		if ('modal' === $display_option) {
302
+			add_action('give_payment_mode_top', array($this, 'render_frontend_notices'));
303 303
 		} else {
304
-			add_action( 'give_pre_form', array( $this, 'render_frontend_notices' ), 11 );
304
+			add_action('give_pre_form', array($this, 'render_frontend_notices'), 11);
305 305
 		}
306 306
 	}
307 307
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 * @access private
313 313
 	 */
314 314
 	private function print_js() {
315
-		if ( self::$has_auto_dismissible_notice ) :
315
+		if (self::$has_auto_dismissible_notice) :
316 316
 			?>
317 317
 			<script>
318 318
 				jQuery(document).ready(function () {
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 			<?php
329 329
 		endif;
330 330
 
331
-		if ( self::$has_dismiss_interval_notice ) :
331
+		if (self::$has_dismiss_interval_notice) :
332 332
 			?>
333 333
 			<script>
334 334
 				jQuery(document).ready(function () {
@@ -407,36 +407,36 @@  discard block
 block discarded – undo
407 407
 	 * @access public
408 408
 	 */
409 409
 	public function dismiss_notices() {
410
-		$_post     = give_clean( $_POST );
411
-		$notice_id = esc_attr( $_post['notice_id'] );
410
+		$_post     = give_clean($_POST);
411
+		$notice_id = esc_attr($_post['notice_id']);
412 412
 
413 413
 		// Bailout.
414 414
 		if (
415
-			empty( $notice_id ) ||
416
-			empty( $_post['dismissible_type'] ) ||
417
-			empty( $_post['dismiss_interval'] ) ||
418
-			! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' )
415
+			empty($notice_id) ||
416
+			empty($_post['dismissible_type']) ||
417
+			empty($_post['dismiss_interval']) ||
418
+			! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce')
419 419
 		) {
420 420
 			wp_send_json_error();
421 421
 		}
422 422
 
423
-		$notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] );
424
-		if ( 'user' === $_post['dismissible_type'] ) {
423
+		$notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']);
424
+		if ('user' === $_post['dismissible_type']) {
425 425
 			$current_user = wp_get_current_user();
426
-			$notice_key   = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID );
426
+			$notice_key   = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID);
427 427
 		}
428 428
 
429
-		$notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null;
429
+		$notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null;
430 430
 
431 431
 		// Save option to hide notice.
432
-		Give_Cache::set( $notice_key, true, $notice_dismiss_time, true );
432
+		Give_Cache::set($notice_key, true, $notice_dismiss_time, true);
433 433
 
434 434
 		/**
435 435
 		 * Fire the action when notice dismissed
436 436
 		 *
437 437
 		 * @since 2.2.0
438 438
 		 */
439
-		do_action( 'give_notice_dismissed', $_post );
439
+		do_action('give_notice_dismissed', $_post);
440 440
 
441 441
 		wp_send_json_success();
442 442
 	}
@@ -454,18 +454,18 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @return string
456 456
 	 */
457
-	public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) {
457
+	public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) {
458 458
 		$notice_key = "_give_notice_{$notice_id}";
459 459
 
460
-		if ( ! empty( $dismiss_interval ) ) {
460
+		if ( ! empty($dismiss_interval)) {
461 461
 			$notice_key .= "_{$dismiss_interval}";
462 462
 		}
463 463
 
464
-		if ( $user_id ) {
464
+		if ($user_id) {
465 465
 			$notice_key .= "_{$user_id}";
466 466
 		}
467 467
 
468
-		$notice_key = sanitize_key( $notice_key );
468
+		$notice_key = sanitize_key($notice_key);
469 469
 
470 470
 		return $notice_key;
471 471
 	}
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 	 *
479 479
 	 * @return string
480 480
 	 */
481
-	public function get_dismiss_link( $notice_args ) {
481
+	public function get_dismiss_link($notice_args) {
482 482
 		$notice_args = wp_parse_args(
483 483
 			$notice_args,
484 484
 			array(
485
-				'title'                 => __( 'Click here', 'give' ),
485
+				'title'                 => __('Click here', 'give'),
486 486
 				'dismissible_type'      => '',
487 487
 				'dismiss_interval'      => '',
488 488
 				'dismiss_interval_time' => null,
@@ -509,31 +509,31 @@  discard block
 block discarded – undo
509 509
 	 *
510 510
 	 * @return bool|null
511 511
 	 */
512
-	public function is_notice_dismissed( $notice ) {
513
-		$notice_key          = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] );
512
+	public function is_notice_dismissed($notice) {
513
+		$notice_key          = $this->get_notice_key($notice['id'], $notice['dismiss_interval']);
514 514
 		$is_notice_dismissed = false;
515 515
 
516
-		if ( 'user' === $notice['dismissible_type'] ) {
516
+		if ('user' === $notice['dismissible_type']) {
517 517
 			$current_user = wp_get_current_user();
518
-			$notice_key   = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID );
518
+			$notice_key   = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID);
519 519
 		}
520 520
 
521
-		$notice_data = Give_Cache::get( $notice_key, true );
521
+		$notice_data = Give_Cache::get($notice_key, true);
522 522
 
523 523
 		// Find notice dismiss link status if notice has extra dismissible links.
524
-		if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) {
524
+		if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) {
525 525
 
526
-			foreach ( $notice['extra_links'] as $extra_link ) {
527
-				$new_notice_data = wp_parse_args( $extra_link, $notice );
528
-				unset( $new_notice_data['extra_links'] );
526
+			foreach ($notice['extra_links'] as $extra_link) {
527
+				$new_notice_data = wp_parse_args($extra_link, $notice);
528
+				unset($new_notice_data['extra_links']);
529 529
 
530
-				if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) {
530
+				if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) {
531 531
 					return $is_notice_dismissed;
532 532
 				}
533 533
 			}
534 534
 		}
535 535
 
536
-		$is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data );
536
+		$is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data);
537 537
 
538 538
 		return $is_notice_dismissed;
539 539
 	}
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 	 *
548 548
 	 * @param array $errors
549 549
 	 */
550
-	public static function print_frontend_errors( $errors ) {
550
+	public static function print_frontend_errors($errors) {
551 551
 		// Bailout.
552
-		if ( ! $errors ) {
552
+		if ( ! $errors) {
553 553
 			return;
554 554
 		}
555 555
 
@@ -564,37 +564,37 @@  discard block
 block discarded – undo
564 564
 		);
565 565
 
566 566
 		// Note: we will remove give_errors class in future.
567
-		$classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) );
567
+		$classes = apply_filters('give_error_class', array('give_notices', 'give_errors'));
568 568
 
569
-		echo sprintf( '<div class="%s">', implode( ' ', $classes ) );
569
+		echo sprintf('<div class="%s">', implode(' ', $classes));
570 570
 
571 571
 		// Loop error codes and display errors.
572
-		foreach ( $errors as $error_id => $error ) {
572
+		foreach ($errors as $error_id => $error) {
573 573
 			// Backward compatibility v<1.8.11
574
-			if ( is_string( $error ) ) {
574
+			if (is_string($error)) {
575 575
 				$error = array(
576 576
 					'message'     => $error,
577 577
 					'notice_args' => array(),
578 578
 				);
579 579
 			}
580 580
 
581
-			$notice_args = wp_parse_args( $error['notice_args'], $default_notice_args );
581
+			$notice_args = wp_parse_args($error['notice_args'], $default_notice_args);
582 582
 
583 583
 			/**
584 584
 			 * Filter to modify Frontend Errors args before errors is display.
585 585
 			 *
586 586
 			 * @since 1.8.14
587 587
 			 */
588
-			$notice_args = apply_filters( 'give_frontend_errors_args', $notice_args );
588
+			$notice_args = apply_filters('give_frontend_errors_args', $notice_args);
589 589
 
590 590
 			echo sprintf(
591 591
 				'<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d">
592 592
 						<p><strong>%4$s</strong>: %5$s</p>
593 593
 					</div>',
594 594
 				$error_id,
595
-				give_clean( $notice_args['dismissible'] ),
596
-				absint( $notice_args['dismiss_interval'] ),
597
-				esc_html__( 'Error', 'give' ),
595
+				give_clean($notice_args['dismissible']),
596
+				absint($notice_args['dismiss_interval']),
597
+				esc_html__('Error', 'give'),
598 598
 				$error['message']
599 599
 			);
600 600
 		}
@@ -616,8 +616,8 @@  discard block
 block discarded – undo
616 616
 	 *
617 617
 	 * @return  string
618 618
 	 */
619
-	public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) {
620
-		if ( empty( $message ) ) {
619
+	public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) {
620
+		if (empty($message)) {
621 621
 			return '';
622 622
 		}
623 623
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 			'dismiss_interval' => 5000,
633 633
 		);
634 634
 
635
-		$notice_args = wp_parse_args( $notice_args, $default_notice_args );
635
+		$notice_args = wp_parse_args($notice_args, $default_notice_args);
636 636
 
637 637
 		// Notice dismissible must be true for dismiss type.
638 638
 		$notice_args['dismiss_type'] = ! $notice_args['dismissible'] ? '' : $notice_args['dismiss_type'];
@@ -642,15 +642,14 @@  discard block
 block discarded – undo
642 642
 		 *
643 643
 		 * @since 1.8.14
644 644
 		 */
645
-		$notice_args = apply_filters( 'give_frontend_notice_args', $notice_args );
645
+		$notice_args = apply_filters('give_frontend_notice_args', $notice_args);
646 646
 
647 647
 		$close_icon = 'manual' === $notice_args['dismiss_type'] ?
648 648
 			sprintf(
649 649
 				'<img class="notice-dismiss give-notice-close" src="%s" />',
650
-				esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/close.svg' )
650
+				esc_url(GIVE_PLUGIN_URL.'assets/dist/images/close.svg')
651 651
 
652
-			) :
653
-			'';
652
+			) : '';
654 653
 
655 654
 		// Note: we will remove give_errors class in future.
656 655
 		$error = sprintf(
@@ -661,15 +660,15 @@  discard block
 block discarded – undo
661 660
 						%6$s
662 661
 					</div>',
663 662
 			$notice_type,
664
-			give_clean( $notice_args['dismissible'] ),
665
-			absint( $notice_args['dismiss_interval'] ),
666
-			give_clean( $notice_args['dismiss_type'] ),
663
+			give_clean($notice_args['dismissible']),
664
+			absint($notice_args['dismiss_interval']),
665
+			give_clean($notice_args['dismiss_type']),
667 666
 			$message,
668 667
 			$close_icon
669 668
 
670 669
 		);
671 670
 
672
-		if ( ! $echo ) {
671
+		if ( ! $echo) {
673 672
 			return $error;
674 673
 		}
675 674
 
@@ -689,24 +688,24 @@  discard block
 block discarded – undo
689 688
 	 *
690 689
 	 * @return string
691 690
 	 */
692
-	public function print_admin_notices( $notice_args = array() ) {
691
+	public function print_admin_notices($notice_args = array()) {
693 692
 		// Bailout.
694
-		if ( empty( $notice_args['description'] ) ) {
693
+		if (empty($notice_args['description'])) {
695 694
 			return '';
696 695
 		}
697 696
 
698
-		$defaults    = array(
697
+		$defaults = array(
699 698
 			'id'          => '',
700 699
 			'echo'        => true,
701 700
 			'notice_type' => 'warning',
702 701
 			'dismissible' => true,
703 702
 		);
704
-		$notice_args = wp_parse_args( $notice_args, $defaults );
703
+		$notice_args = wp_parse_args($notice_args, $defaults);
705 704
 
706 705
 		$output    = '';
707
-		$css_id    = ! empty( $notice_args['id'] ) ? $notice_args['id'] : uniqid( 'give-inline-notice-' );
706
+		$css_id    = ! empty($notice_args['id']) ? $notice_args['id'] : uniqid('give-inline-notice-');
708 707
 		$css_class = "notice-{$notice_args['notice_type']} give-notice notice inline";
709
-		$css_class .= ( $notice_args['dismissible'] ) ? ' is-dismissible' : '';
708
+		$css_class .= ($notice_args['dismissible']) ? ' is-dismissible' : '';
710 709
 		$output    .= sprintf(
711 710
 			'<div id="%1$s" class="%2$s"><p>%3$s</p></div>',
712 711
 			$css_id,
@@ -714,7 +713,7 @@  discard block
 block discarded – undo
714 713
 			$notice_args['description']
715 714
 		);
716 715
 
717
-		if ( ! $notice_args['echo'] ) {
716
+		if ( ! $notice_args['echo']) {
718 717
 			return $output;
719 718
 		}
720 719
 
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 	 * Instantiate the class
33 33
 	 */
34 34
 	public function __construct() {
35
-		$this->self = get_class( $this );
35
+		$this->self = get_class($this);
36 36
 
37 37
 		parent::__construct(
38
-			strtolower( $this->self ),
39
-			esc_html__( 'Give - Donation Form', 'give' ),
38
+			strtolower($this->self),
39
+			esc_html__('Give - Donation Form', 'give'),
40 40
 			array(
41
-				'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ),
41
+				'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give'),
42 42
 			)
43 43
 		);
44 44
 
45
-		add_action( 'widgets_init', array( $this, 'widget_init' ) );
46
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
45
+		add_action('widgets_init', array($this, 'widget_init'));
46
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
47 47
 	}
48 48
 
49 49
 	/**
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return void
55 55
 	 */
56
-	public function admin_widget_scripts( $hook ) {
56
+	public function admin_widget_scripts($hook) {
57 57
 
58 58
 		// Directories of assets.
59
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
60
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
61
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
59
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
60
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
61
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
62 62
 
63 63
 		// Use minified libraries if SCRIPT_DEBUG is turned off.
64
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
64
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
65 65
 
66 66
 		// Widget Script.
67
-		if ( 'widgets.php' === $hook ) {
67
+		if ('widgets.php' === $hook) {
68 68
 
69
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
69
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
70 70
 		}
71 71
 	}
72 72
 
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 *                        before_widget, and after_widget.
78 78
 	 * @param array $instance The settings for the particular instance of the widget.
79 79
 	 */
80
-	public function widget( $args, $instance ) {
81
-		$title   = ! empty( $instance['title'] ) ? $instance['title'] : '';
82
-		$title   = apply_filters( 'widget_title', $title, $instance, $this->id_base );
80
+	public function widget($args, $instance) {
81
+		$title   = ! empty($instance['title']) ? $instance['title'] : '';
82
+		$title   = apply_filters('widget_title', $title, $instance, $this->id_base);
83 83
 		$form_id = (int) $instance['id'];
84 84
 
85 85
 		echo $args['before_widget']; // XSS ok.
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 		 *
92 92
 		 * @since 1.0
93 93
 		 */
94
-		do_action( 'give_before_forms_widget', $form_id );
94
+		do_action('give_before_forms_widget', $form_id);
95 95
 
96
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; // XSS ok.
96
+		echo $title ? $args['before_title'].$title.$args['after_title'] : ''; // XSS ok.
97 97
 
98
-		give_get_donation_form( $instance );
98
+		give_get_donation_form($instance);
99 99
 
100 100
 		echo $args['after_widget']; // XSS ok.
101 101
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @since 1.0
108 108
 		 */
109
-		do_action( 'give_after_forms_widget', $form_id );
109
+		do_action('give_after_forms_widget', $form_id);
110 110
 	}
111 111
 
112 112
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param array $instance Current settings.
116 116
 	 */
117
-	public function form( $instance ) {
117
+	public function form($instance) {
118 118
 		$defaults = array(
119 119
 			'title'                 => '',
120 120
 			'id'                    => '',
@@ -124,74 +124,74 @@  discard block
 block discarded – undo
124 124
 			'continue_button_title' => '',
125 125
 		);
126 126
 
127
-		$instance = wp_parse_args( (array) $instance, $defaults );
127
+		$instance = wp_parse_args((array) $instance, $defaults);
128 128
 
129 129
 		// Backward compatibility: Set float labels as default if, it was set as empty previous.
130
-		$instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels'];
130
+		$instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels'];
131 131
 
132 132
 		// Query Give Forms.
133 133
 		$args = array(
134 134
 			'post_type'      => 'give_forms',
135
-			'posts_per_page' => - 1,
135
+			'posts_per_page' => -1,
136 136
 			'post_status'    => 'publish',
137 137
 		);
138 138
 
139
-		$give_forms = get_posts( $args );
139
+		$give_forms = get_posts($args);
140 140
 		?>
141 141
 		<div class="give_forms_widget_container">
142 142
 
143 143
 			<?php // Widget: widget Title. ?>
144 144
 			<p>
145
-				<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label>
146
-				<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /><br>
147
-				<small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
145
+				<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'give'); ?></label>
146
+				<input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" /><br>
147
+				<small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small>
148 148
 			</p>
149 149
 
150 150
 			<?php // Widget: Give Form. ?>
151 151
 			<p>
152
-				<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label>
153
-				<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
154
-					<option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option>
155
-					<?php foreach ( $give_forms as $give_form ) { ?>
152
+				<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label>
153
+				<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
154
+					<option value="current"><?php esc_html_e('- Select -', 'give'); ?></option>
155
+					<?php foreach ($give_forms as $give_form) { ?>
156 156
 						<?php /* translators: %s: Title */ ?>
157
-						<?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?>
158
-						<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo esc_html( $form_title ); ?></option>
157
+						<?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?>
158
+						<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo esc_html($form_title); ?></option>
159 159
 					<?php } ?>
160 160
 				</select><br>
161
-				<small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
161
+				<small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small>
162 162
 			</p>
163 163
 
164 164
 			<?php // Widget: Display Style. ?>
165 165
 			<p class="give_forms_display_style_setting_row">
166
-				<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br>
167
-				<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-onpage" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label>
168
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-reveal" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label>
169
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-modal"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-modal" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label>
170
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-button"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>-button" name="<?php echo esc_attr( $this->get_field_name( 'display_style' ) ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br>
166
+				<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br>
167
+				<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-onpage"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-onpage" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label>
168
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-reveal"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-reveal" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label>
169
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-modal"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-modal" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label>
170
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>-button"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('display_style')); ?>-button" name="<?php echo esc_attr($this->get_field_name('display_style')); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br>
171 171
 				<small class="give-field-description">
172
-					<?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?>
172
+					<?php echo esc_html__('Select a Give Form style.', 'give'); ?>
173 173
 				</small>
174 174
 			</p>
175 175
 
176 176
 			<?php // Widget: Continue Button Title. ?>
177 177
 			<p class="give_forms_continue_button_title_setting_row">
178
-				<label for="<?php echo esc_attr( $this->get_field_id( 'continue_button_title' ) ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label>
179
-				<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'continue_button_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'continue_button_title' ) ); ?>" value="<?php echo esc_attr( $instance['continue_button_title'] ); ?>" /><br>
180
-				<small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small>
178
+				<label for="<?php echo esc_attr($this->get_field_id('continue_button_title')); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label>
179
+				<input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('continue_button_title')); ?>" name="<?php echo esc_attr($this->get_field_name('continue_button_title')); ?>" value="<?php echo esc_attr($instance['continue_button_title']); ?>" /><br>
180
+				<small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small>
181 181
 			</p>
182 182
 
183 183
 			<?php // Widget: Floating Labels. ?>
184 184
 			<p>
185
-				<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br>
186
-				<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-global"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-global" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label>
187
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-enabled" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label>
188
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>-disabled" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br>
185
+				<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br>
186
+				<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-global"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-global" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label>
187
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-enabled"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-enabled" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label>
188
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-disabled"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>-disabled" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br>
189 189
 				<small class="give-field-description">
190 190
 					<?php
191 191
 					printf(
192 192
 						/* translators: %s: http://docs.givewp.com/form-floating-labels */
193
-						esc_html__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
194
-						esc_url( 'http://docs.givewp.com/form-floating-labels' )
193
+						esc_html__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
194
+						esc_url('http://docs.givewp.com/form-floating-labels')
195 195
 					);
196 196
 					?>
197 197
 					</small>
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 
200 200
 			<?php // Widget: Display Content. ?>
201 201
 			<p>
202
-				<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br>
203
-				<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-none"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-none" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label>
204
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-above"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-above" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label>
205
-				&nbsp;&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-below"><input type="radio" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>-below" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br>
206
-				<small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small>
202
+				<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br>
203
+				<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>-none"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('show_content')); ?>-none" name="<?php echo esc_attr($this->get_field_name('show_content')); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label>
204
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>-above"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('show_content')); ?>-above" name="<?php echo esc_attr($this->get_field_name('show_content')); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label>
205
+				&nbsp;&nbsp;<label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>-below"><input type="radio" class="widefat" id="<?php echo esc_attr($this->get_field_id('show_content')); ?>-below" name="<?php echo esc_attr($this->get_field_name('show_content')); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br>
206
+				<small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small>
207 207
 		</div>
208 208
 		<?php
209 209
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @return void
215 215
 	 */
216 216
 	public function widget_init() {
217
-		register_widget( $this->self );
217
+		register_widget($this->self);
218 218
 	}
219 219
 
220 220
 	/**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @return array
227 227
 	 */
228
-	public function update( $new_instance, $old_instance ) {
228
+	public function update($new_instance, $old_instance) {
229 229
 		$this->flush_widget_cache();
230 230
 
231 231
 		return $new_instance;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 * @return void
238 238
 	 */
239 239
 	public function flush_widget_cache() {
240
-		wp_cache_delete( $this->self, 'widget' );
240
+		wp_cache_delete($this->self, 'widget');
241 241
 	}
242 242
 }
243 243
 
Please login to merge, or discard this patch.
includes/admin/emails/class-offline-donation-instruction-email.php 1 patch
Spacing   +36 added lines, -36 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,9 +202,9 @@  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( '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('headers', apply_filters('give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta));
208 208
 		}
209 209
 
210 210
 		/**
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 		 *
216 216
 		 * @param int $payment_id
217 217
 		 */
218
-		public function setup_email_notification( $payment_id ) {
219
-			$this->payment = new Give_Payment( $payment_id );
218
+		public function setup_email_notification($payment_id) {
219
+			$this->payment = new Give_Payment($payment_id);
220 220
 
221 221
 			// Exit if not donation was not with offline donation.
222
-			if ( 'offline' !== $this->payment->gateway ) {
222
+			if ('offline' !== $this->payment->gateway) {
223 223
 				return;
224 224
 			}
225 225
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 			$this->setup_email_data();
228 228
 
229 229
 			// Send email.
230
-			$this->send_email_notification( array(
230
+			$this->send_email_notification(array(
231 231
 				'payment_id' => $this->payment->ID,
232
-			) );
232
+			));
233 233
 		}
234 234
 
235 235
 		/**
@@ -241,18 +241,18 @@  discard block
 block discarded – undo
241 241
 		 * @param $update_options
242 242
 		 * @param $option_name
243 243
 		 */
244
-		public function set_notification_status( $update_options, $option_name ) {
244
+		public function set_notification_status($update_options, $option_name) {
245 245
 			// Get updated settings.
246 246
 			$update_options = give_get_settings();
247 247
 
248
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
248
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
249 249
 
250 250
 			if (
251
-				empty( $update_options["{$this->config['id']}_notification"] )
251
+				empty($update_options["{$this->config['id']}_notification"])
252 252
 				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
253 253
 			) {
254 254
 				$update_options["{$this->config['id']}_notification"] = $notification_status;
255
-				update_option( $option_name, $update_options, false );
255
+				update_option($option_name, $update_options, false);
256 256
 			}
257 257
 		}
258 258
 
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 		 *
269 269
 		 * @return array
270 270
 		 */
271
-		public function add_metabox_setting_field( $settings, $form_id ) {
272
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
271
+		public function add_metabox_setting_field($settings, $form_id) {
272
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
273 273
 				$settings[] = array(
274 274
 					'id'     => $this->config['id'],
275 275
 					'title'  => $this->config['label'],
276
-					'fields' => $this->get_setting_fields( $form_id ),
276
+					'fields' => $this->get_setting_fields($form_id),
277 277
 				);
278 278
 			}
279 279
 
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donor-register-email.php 1 patch
Spacing   +34 added lines, -34 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
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 		 *
102 102
 		 * @return string
103 103
 		 */
104
-		public function setup_email_notification( $user_id, $user_data ) {
104
+		public function setup_email_notification($user_id, $user_data) {
105 105
 			$this->setup_email_data();
106 106
 
107
-			$this->send_email_notification( array(
107
+			$this->send_email_notification(array(
108 108
 				'user_id' => $user_id,
109
-			) );
109
+			));
110 110
 		}
111 111
 
112 112
 
@@ -120,42 +120,42 @@  discard block
 block discarded – undo
120 120
 		 * @param Give_New_Donor_Register_Email $email
121 121
 		 * @return string
122 122
 		 */
123
-		public function email_preview_header( $email_preview_header, $email ) {
123
+		public function email_preview_header($email_preview_header, $email) {
124 124
 			// Bailout.
125
-			if ( $this->config['id'] !== $email->config['id'] ) {
125
+			if ($this->config['id'] !== $email->config['id']) {
126 126
 				return $email_preview_header;
127 127
 			}
128 128
 
129 129
 			// Payment receipt switcher
130
-			$user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' );
130
+			$user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id');
131 131
 
132 132
 			// Get payments.
133 133
 			$donors  = new Give_API();
134
-			$donors  = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' );
134
+			$donors  = give_check_variable($donors->get_donors(), 'empty', array(), 'donors');
135 135
 			$options = array();
136 136
 
137 137
 			// Default option.
138
-			$options[0] = esc_html__( 'No donor(s) found.', 'give' );
138
+			$options[0] = esc_html__('No donor(s) found.', 'give');
139 139
 
140 140
 			// Provide nice human readable options.
141
-			if ( $donors ) {
142
-				$options[0] = esc_html__( '- Select a donor -', 'give' );
143
-				foreach ( $donors as $donor ) {
141
+			if ($donors) {
142
+				$options[0] = esc_html__('- Select a donor -', 'give');
143
+				foreach ($donors as $donor) {
144 144
 					// Exclude customers for which wp user not exist.
145
-					if ( ! $donor['info']['user_id'] ) {
145
+					if ( ! $donor['info']['user_id']) {
146 146
 						continue;
147 147
 					}
148
-					$options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] );
148
+					$options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']);
149 149
 				}
150 150
 			}
151 151
 
152
-			$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
152
+			$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
153 153
 			$query            = $request_url_data['query'];
154 154
 
155 155
 			// Remove user id query param if set from request url.
156
-			$query = remove_query_arg( array( 'user_id' ), $query );
156
+			$query = remove_query_arg(array('user_id'), $query);
157 157
 
158
-			$request_url = home_url( '/?' . str_replace( '', '', $query ) );
158
+			$request_url = home_url('/?'.str_replace('', '', $query));
159 159
 			?>
160 160
 			<script type="text/javascript">
161 161
 				function change_preview() {
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
 			<div class="give_preview_email_user_id_main">
190 190
 
191 191
 				<label for="give_preview_email_user_id" class="give_preview_email_user_id_label">
192
-					<?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?>
192
+					<?php echo esc_html__('Preview email with a donor:', 'give'); ?>
193 193
 				</label>
194 194
 
195 195
 				<?php
196 196
 				// The select field with 100 latest transactions
197
-				echo Give()->html->select( array(
197
+				echo Give()->html->select(array(
198 198
 					'name'             => 'preview_email_user_id',
199 199
 					'selected'         => $user_id,
200 200
 					'id'               => 'give_preview_email_user_id',
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 					'select_atts'      => 'onchange="change_preview()"',
205 205
 					'show_option_all'  => false,
206 206
 					'show_option_none' => false,
207
-				) );
207
+				));
208 208
 				?>
209 209
 				<!-- Closing tag-->
210 210
 			</div>
Please login to merge, or discard this patch.
includes/admin/emails/class-new-offline-donation-email.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if access directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19
-if ( ! class_exists( 'Give_New_Offline_Donation_Email' ) ) :
19
+if ( ! class_exists('Give_New_Offline_Donation_Email')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_New_Offline_Donation_Email
@@ -36,33 +36,33 @@  discard block
 block discarded – undo
36 36
 		 */
37 37
 		public function init() {
38 38
 			// Initialize empty payment.
39
-			$this->payment = new Give_Payment( 0 );
39
+			$this->payment = new Give_Payment(0);
40 40
 
41
-			$this->load( array(
41
+			$this->load(array(
42 42
 				'id'                           => 'new-offline-donation',
43
-				'label'                        => __( 'New Offline Donation', 'give' ),
44
-				'description'                  => __( 'Sent to designated recipient(s) for a new (pending) offline donation.', 'give' ),
43
+				'label'                        => __('New Offline Donation', 'give'),
44
+				'description'                  => __('Sent to designated recipient(s) for a new (pending) offline donation.', 'give'),
45 45
 				'has_recipient_field'          => true,
46
-				'notification_status'          => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled',
46
+				'notification_status'          => give_is_gateway_active('offline') ? 'enabled' : 'disabled',
47 47
 				'notification_status_editable' => false,
48 48
 				'preview_email_tags_values'    => array(
49
-					'payment_method' => esc_html__( 'Offline', 'give' ),
49
+					'payment_method' => esc_html__('Offline', 'give'),
50 50
 				),
51 51
 				'default_email_subject'        => $this->get_default_email_subject(),
52 52
 				'default_email_message'        => $this->get_default_email_message(),
53
-				'default_email_header'         => __( 'New Offline Donation!', 'give' ),
53
+				'default_email_header'         => __('New Offline Donation!', 'give'),
54 54
 				'notices' => array(
55 55
 					'non-notification-status-editable' => sprintf(
56 56
 						'%1$s <a href="%2$s">%3$s &raquo;</a>',
57
-						__( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ),
58
-						esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations') ),
59
-						__( 'Edit Setting', 'give' )
57
+						__('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'),
58
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations')),
59
+						__('Edit Setting', 'give')
60 60
 					)
61 61
 				),
62
-			) );
62
+			));
63 63
 
64
-			add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) );
65
-			add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
64
+			add_action('give_insert_payment', array($this, 'setup_email_notification'));
65
+			add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2);
66 66
 		}
67 67
 
68 68
 		/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			 */
82 82
 			$subject = apply_filters(
83 83
 				'give_offline_admin_donation_notification_subject',
84
-				__( 'New Pending Donation', 'give' )
84
+				__('New Pending Donation', 'give')
85 85
 			);
86 86
 
87 87
 			/**
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
 		 * @return string
107 107
 		 */
108 108
 		public function get_default_email_message() {
109
-			$message = __( 'Dear Admin,', 'give' ) . "\n\n";
110
-			$message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' ';
111
-			$message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
109
+			$message = __('Dear Admin,', 'give')."\n\n";
110
+			$message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' ';
111
+			$message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
112 112
 
113
-			$message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
114
-			$message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
113
+			$message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
114
+			$message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
115 115
 
116 116
 			$message .= sprintf(
117 117
 				'<a href="%1$s">%2$s</a>',
118
-				admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $this->payment->ID ),
119
-				__( 'Click Here to View and/or Update Donation Details', 'give' )
120
-			) . "\n\n";
118
+				admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$this->payment->ID),
119
+				__('Click Here to View and/or Update Donation Details', 'give')
120
+			)."\n\n";
121 121
 
122 122
 			/**
123 123
 			 * Filter the donation receipt email message
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 		 *
156 156
 		 * @return string
157 157
 		 */
158
-		public function get_email_message( $form_id = null ) {
158
+		public function get_email_message($form_id = null) {
159 159
 			$message = Give_Email_Notification_Util::get_value(
160 160
 				$this,
161
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
161
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
162 162
 				$form_id,
163 163
 				$this->config['default_email_message']
164 164
 			);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		 *
199 199
 		 * @return array
200 200
 		 */
201
-		public function get_email_attachments( $form_id = null ) {
201
+		public function get_email_attachments($form_id = null) {
202 202
 			/**
203 203
 			 * Filter the attachments.
204 204
 			 * Note: This filter will deprecate soon.
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 		 *
250 250
 		 * @param int $payment_id
251 251
 		 */
252
-		public function setup_email_notification( $payment_id ) {
253
-			$this->payment = new Give_Payment( $payment_id );
252
+		public function setup_email_notification($payment_id) {
253
+			$this->payment = new Give_Payment($payment_id);
254 254
 
255 255
 			// Exit if not donation was not with offline donation.
256
-			if ( 'offline' !== $this->payment->gateway ) {
256
+			if ('offline' !== $this->payment->gateway) {
257 257
 				return;
258 258
 			}
259 259
 
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 			$this->setup_email_data();
262 262
 
263 263
 			// Send email.
264
-			$this->send_email_notification( array(
264
+			$this->send_email_notification(array(
265 265
 				'payment_id' => $this->payment->ID,
266
-			) );
266
+			));
267 267
 		}
268 268
 
269 269
 		/**
@@ -275,18 +275,18 @@  discard block
 block discarded – undo
275 275
 		 * @param $update_options
276 276
 		 * @param $option_name
277 277
 		 */
278
-		public function set_notification_status( $update_options, $option_name ) {
278
+		public function set_notification_status($update_options, $option_name) {
279 279
 			// Get updated settings.
280 280
 			$update_options = give_get_settings();
281 281
 
282
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
282
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
283 283
 
284 284
 			if (
285
-				empty( $update_options[ "{$this->config['id']}_notification" ] )
286
-				|| $notification_status !== $update_options[ "{$this->config['id']}_notification" ]
285
+				empty($update_options["{$this->config['id']}_notification"])
286
+				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
287 287
 			) {
288
-				$update_options[ "{$this->config['id']}_notification" ] = $notification_status;
289
-				update_option( $option_name, $update_options, false );
288
+				$update_options["{$this->config['id']}_notification"] = $notification_status;
289
+				update_option($option_name, $update_options, false);
290 290
 			}
291 291
 		}
292 292
 
@@ -301,13 +301,13 @@  discard block
 block discarded – undo
301 301
 		 *
302 302
 		 * @return array
303 303
 		 */
304
-		public function add_metabox_setting_field( $settings, $form_id ) {
304
+		public function add_metabox_setting_field($settings, $form_id) {
305 305
 
306
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
306
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
307 307
 				$settings[] = array(
308 308
 					'id'     => $this->config['id'],
309 309
 					'title'  => $this->config['label'],
310
-					'fields' => $this->get_setting_fields( $form_id ),
310
+					'fields' => $this->get_setting_fields($form_id),
311 311
 				);
312 312
 			}
313 313
 
Please login to merge, or discard this patch.
includes/admin/emails/class-donation-receipt-email.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if access directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Donation_Receipt_Email' ) ) :
18
+if ( ! class_exists('Give_Donation_Receipt_Email')) :
19 19
 
20 20
 	/**
21 21
 	 * Give_Donation_Receipt_Email
@@ -35,22 +35,22 @@  discard block
 block discarded – undo
35 35
 		 */
36 36
 		public function init() {
37 37
 			// Initialize empty payment.
38
-			$this->payment = new Give_Payment( 0 );
38
+			$this->payment = new Give_Payment(0);
39 39
 
40
-			$this->load( array(
40
+			$this->load(array(
41 41
 				'id'                   => 'donation-receipt',
42
-				'label'                => __( 'Donation Receipt', 'give' ),
43
-				'description'          => __( 'Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give' ),
42
+				'label'                => __('Donation Receipt', 'give'),
43
+				'description'          => __('Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give'),
44 44
 				'notification_status'  => 'enabled',
45 45
 				'form_metabox_setting' => true,
46
-				'recipient_group_name' => __( 'Donor', 'give' ),
47
-				'default_email_subject' => esc_attr__( 'Donation Receipt', 'give' ),
46
+				'recipient_group_name' => __('Donor', 'give'),
47
+				'default_email_subject' => esc_attr__('Donation Receipt', 'give'),
48 48
 				'default_email_message' => give_get_default_donation_receipt_email(),
49
-				'default_email_header'  => __( 'Donation Receipt', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('Donation Receipt', 'give'),
50
+			));
51 51
 
52
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_donation_receipt' ) );
53
-			add_action( 'give_email_links', array( $this, 'resend_donation_receipt' ) );
52
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'send_donation_receipt'));
53
+			add_action('give_email_links', array($this, 'resend_donation_receipt'));
54 54
 		}
55 55
 
56 56
 		/**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		 * @param int $form_id
63 63
 		 * @return string
64 64
 		 */
65
-		public function get_email_subject( $form_id = null ) {
65
+		public function get_email_subject($form_id = null) {
66 66
 			$subject = wp_strip_all_tags(
67 67
 				Give_Email_Notification_Util::get_value(
68 68
 					$this,
69
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
69
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
70 70
 					$form_id,
71 71
 					$this->config['default_email_subject']
72 72
 				)
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 		 * @param int $form_id
110 110
 		 * @return string
111 111
 		 */
112
-		public function get_email_message( $form_id = null ) {
112
+		public function get_email_message($form_id = null) {
113 113
 			$message = Give_Email_Notification_Util::get_value(
114 114
 				$this,
115
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
115
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
116 116
 				$form_id,
117 117
 				$this->config['default_email_message']
118 118
 			);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			 * @since 1.0
125 125
 			 */
126 126
 			$message = apply_filters(
127
-				'give_donation_receipt_' . Give()->emails->get_template(),
127
+				'give_donation_receipt_'.Give()->emails->get_template(),
128 128
 				$message,
129 129
 				$this->payment->ID,
130 130
 				$this->payment->payment_meta
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		 * @param int $form_id
168 168
 		 * @return array
169 169
 		 */
170
-		public function get_email_attachments( $form_id = null) {
170
+		public function get_email_attachments($form_id = null) {
171 171
 			/**
172 172
 			 * Filter the attachments.
173 173
 			 * Note: this filter will deprecate soon.
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 				$this->payment->payment_meta
237 237
 			);
238 238
 
239
-			Give()->emails->__set( 'from_name', $from_name );
240
-			Give()->emails->__set( 'from_email', $from_email );
239
+			Give()->emails->__set('from_name', $from_name);
240
+			Give()->emails->__set('from_email', $from_email);
241 241
 
242 242
 			/**
243 243
 			 * Filters the donation receipt's email headers.
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				$this->payment->payment_meta
255 255
 			);
256 256
 
257
-			Give()->emails->__set( 'headers', $headers );
257
+			Give()->emails->__set('headers', $headers);
258 258
 		}
259 259
 
260 260
 		/**
@@ -265,16 +265,16 @@  discard block
 block discarded – undo
265 265
 		 *
266 266
 		 * @param $payment_id
267 267
 		 */
268
-		public function send_donation_receipt( $payment_id ) {
269
-			$this->payment = new Give_Payment( $payment_id );
268
+		public function send_donation_receipt($payment_id) {
269
+			$this->payment = new Give_Payment($payment_id);
270 270
 
271 271
 			// Setup email data.
272 272
 			$this->setup_email_data();
273 273
 
274 274
 			// Send email.
275
-			$this->send_email_notification( array(
275
+			$this->send_email_notification(array(
276 276
 				'payment_id' => $this->payment->ID,
277
-			) );
277
+			));
278 278
 		}
279 279
 
280 280
 		/**
@@ -285,35 +285,35 @@  discard block
 block discarded – undo
285 285
 		 *
286 286
 		 * @param array $data Donation details.
287 287
 		 */
288
-		public function resend_donation_receipt( $data ) {
289
-			$purchase_id = absint( $data['purchase_id'] );
288
+		public function resend_donation_receipt($data) {
289
+			$purchase_id = absint($data['purchase_id']);
290 290
 
291
-			if ( empty( $purchase_id ) ) {
291
+			if (empty($purchase_id)) {
292 292
 				return;
293 293
 			}
294 294
 
295 295
 			// Get donation payment information.
296
-			$this->payment = new Give_Payment( $purchase_id );
296
+			$this->payment = new Give_Payment($purchase_id);
297 297
 
298
-			if ( ! current_user_can( 'edit_give_payments', $this->payment->ID ) ) {
299
-				wp_die( esc_html__( 'You do not have permission to edit donations.', 'give' ), esc_html__( 'Error', 'give' ), array(
298
+			if ( ! current_user_can('edit_give_payments', $this->payment->ID)) {
299
+				wp_die(esc_html__('You do not have permission to edit donations.', 'give'), esc_html__('Error', 'give'), array(
300 300
 					'response' => 403,
301
-				) );
301
+				));
302 302
 			}
303 303
 
304 304
 			// Setup email data.
305 305
 			$this->setup_email_data();
306 306
 
307 307
 			// Send email.
308
-			$this->send_email_notification( array(
308
+			$this->send_email_notification(array(
309 309
 				'payment_id' => $this->payment->ID,
310
-			) );
310
+			));
311 311
 
312
-			wp_redirect( add_query_arg( array(
312
+			wp_redirect(add_query_arg(array(
313 313
 				'give-messages[]' => 'email-sent',
314 314
 				'give-action'     => false,
315 315
 				'purchase_id'     => false,
316
-			) ) );
316
+			)));
317 317
 			exit;
318 318
 		}
319 319
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-new-donation-email.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if access directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
20
-if ( ! class_exists( 'Give_New_Donation_Email' ) ) :
20
+if ( ! class_exists('Give_New_Donation_Email')) :
21 21
 
22 22
 	/**
23 23
 	 * Give_New_Donation_Email
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
 		 */
38 38
 		public function init() {
39 39
 			// Initialize empty payment.
40
-			$this->payment = new Give_Payment( 0 );
40
+			$this->payment = new Give_Payment(0);
41 41
 
42
-			$this->load( array(
42
+			$this->load(array(
43 43
 				'id'                    => 'new-donation',
44
-				'label'                 => __( 'New Donation', 'give' ),
45
-				'description'           => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ),
44
+				'label'                 => __('New Donation', 'give'),
45
+				'description'           => __('Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give'),
46 46
 				'has_recipient_field'   => true,
47 47
 				'notification_status'   => 'enabled',
48 48
 				'form_metabox_setting'  => true,
49
-				'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ),
49
+				'default_email_subject' => esc_attr__('New Donation - #{payment_id}', 'give'),
50 50
 				'default_email_message' => give_get_default_donation_notification_email(),
51
-				'default_email_header'  => __( 'New Donation!', 'give' ),
52
-			) );
51
+				'default_email_header'  => __('New Donation!', 'give'),
52
+			));
53 53
 
54
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ) );
54
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'));
55 55
 		}
56 56
 
57 57
 		/**
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		 *
65 65
 		 * @return string
66 66
 		 */
67
-		public function get_email_subject( $form_id = null ) {
67
+		public function get_email_subject($form_id = null) {
68 68
 			$subject = wp_strip_all_tags(
69 69
 				Give_Email_Notification_Util::get_value(
70 70
 					$this,
71
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
71
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
72 72
 					$form_id,
73 73
 					$this->config['default_email_subject']
74 74
 				)
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 			 *
81 81
 			 * @since 1.0
82 82
 			 */
83
-			$subject = apply_filters( 'give_admin_donation_notification_subject', $subject, $this->payment->ID );
83
+			$subject = apply_filters('give_admin_donation_notification_subject', $subject, $this->payment->ID);
84 84
 
85 85
 			/**
86 86
 			 * Filters the donation notification subject.
87 87
 			 *
88 88
 			 * @since 2.0
89 89
 			 */
90
-			$subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id );
90
+			$subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id);
91 91
 
92 92
 			return $subject;
93 93
 		}
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @return string
105 105
 		 */
106
-		public function get_email_message( $form_id = null ) {
106
+		public function get_email_message($form_id = null) {
107 107
 			$message = Give_Email_Notification_Util::get_value(
108 108
 				$this,
109
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
109
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
110 110
 				$form_id,
111 111
 				$this->config['default_email_message']
112 112
 			);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		 * @param int $form_id
150 150
 		 * @return array
151 151
 		 */
152
-		public function get_email_attachments( $form_id = null ) {
152
+		public function get_email_attachments($form_id = null) {
153 153
 			/**
154 154
 			 * Filters the donation notification email attachments.
155 155
 			 * By default, there is no attachment but plugins can hook in to provide one more multiple.
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 				$this->payment->payment_meta
213 213
 			);
214 214
 
215
-			Give()->emails->__set( 'from_name', $from_name );
216
-			Give()->emails->__set( 'from_email', $from_email );
215
+			Give()->emails->__set('from_name', $from_name);
216
+			Give()->emails->__set('from_email', $from_email);
217 217
 
218 218
 			/**
219 219
 			 * Filters the donation notification email headers.
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 				$this->payment->payment_meta
228 228
 			);
229 229
 
230
-			Give()->emails->__set( 'headers', $headers );
230
+			Give()->emails->__set('headers', $headers);
231 231
 		}
232 232
 
233 233
 		/**
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 		 *
239 239
 		 * @param int $payment_id
240 240
 		 */
241
-		public function setup_email_notification( $payment_id ) {
242
-			$this->payment = new Give_Payment( $payment_id );
241
+		public function setup_email_notification($payment_id) {
242
+			$this->payment = new Give_Payment($payment_id);
243 243
 
244 244
 			// Set email data.
245 245
 			$this->setup_email_data();
246 246
 
247 247
 			// Send email.
248
-			$this->send_email_notification( array(
248
+			$this->send_email_notification(array(
249 249
 				'payment_id' => $payment_id,
250
-			) );
250
+			));
251 251
 		}
252 252
 	}
253 253
 
Please login to merge, or discard this patch.