Completed
Push — master ( ace9ba...1ffdfe )
by Ravinder
12s
created
includes/admin/reporting/tools.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_tools_recount_stats_display() {
24 24
 
25
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
25
+	if ( ! current_user_can('manage_give_settings')) {
26 26
 		return;
27 27
 	}
28 28
 
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @since 1.5
33 33
 	 */
34
-	do_action( 'give_tools_recount_stats_before' );
34
+	do_action('give_tools_recount_stats_before');
35 35
 	?>
36 36
 	<div id="poststuff">
37 37
 		<div class="postbox">
38 38
 
39
-			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2>
39
+			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2>
40 40
 
41 41
 			<div class="inside recount-stats-controls">
42
-				<p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p>
42
+				<p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p>
43 43
 				<form method="post" id="give-tools-recount-form" class="give-export-form">
44 44
 
45
-					<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
45
+					<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
46 46
 
47 47
 					<select name="give-export-class" id="recount-stats-type">
48
-						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option>
49
-						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option>
50
-						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option>
51
-						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option>
52
-						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option>
53
-						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option>
54
-						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option>
48
+						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option>
49
+						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option>
50
+						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option>
51
+						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option>
52
+						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option>
53
+						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option>
54
+						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option>
55 55
 						<?php
56 56
 						/**
57 57
 						 * Fires in the recount stats selectbox.
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 						 *
61 61
 						 * @since 1.5
62 62
 						 */
63
-						do_action( 'give_recount_tool_options' );
63
+						do_action('give_recount_tool_options');
64 64
 						?>
65 65
 					</select>
66 66
 
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
 						<?php
69 69
 						$args = array(
70 70
 							'name'   => 'form_id',
71
-							'number' => - 1,
71
+							'number' => -1,
72 72
 							'chosen' => true,
73 73
 						);
74
-						echo Give()->html->forms_dropdown( $args );
74
+						echo Give()->html->forms_dropdown($args);
75 75
 						?>
76 76
 					</span>
77 77
 
78
-					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/>
78
+					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/>
79 79
 
80 80
 					<br/>
81 81
 
82 82
 					<span class="give-recount-stats-descriptions">
83
-						<span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span>
84
-						<span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span>
85
-						<span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span>
86
-						<span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span>
83
+						<span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span>
84
+						<span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span>
85
+						<span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span>
86
+						<span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span>
87 87
 						<?php
88 88
 						/**
89 89
 						 * Fires in the recount stats description area.
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 						 *
93 93
 						 * @since 1.5
94 94
 						 */
95
-						do_action( 'give_recount_tool_descriptions' );
95
+						do_action('give_recount_tool_descriptions');
96 96
 						?>
97
-						<span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span>
98
-						<span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span>
97
+						<span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span>
98
+						<span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span>
99 99
 					</span>
100 100
 
101 101
 					<span class="spinner"></span>
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				 *
110 110
 				 * @since 1.5
111 111
 				 */
112
-				do_action( 'give_tools_recount_forms' );
112
+				do_action('give_tools_recount_forms');
113 113
 				?>
114 114
 			</div><!-- .inside -->
115 115
 		</div><!-- .postbox -->
@@ -120,5 +120,5 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @since 1.5
122 122
 	 */
123
-	do_action( 'give_tools_recount_stats_after' );
123
+	do_action('give_tools_recount_stats_after');
124 124
 }
125 125
\ No newline at end of file
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return string $default_price
69 69
  */
70
-function give_get_default_multilevel_amount( $form_id ) {
70
+function give_get_default_multilevel_amount($form_id) {
71 71
 	$default_price = '1.00';
72
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
72
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
73 73
 
74
-	foreach ( $prices as $price ) {
74
+	foreach ($prices as $price) {
75 75
 
76
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
76
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
77 77
 			$default_price = $price['_give_amount'];
78 78
 		}
79 79
 
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
  * @return string $default_price
95 95
  * @since      1.0
96 96
  */
97
-function give_get_default_form_amount( $form_id ) {
97
+function give_get_default_form_amount($form_id) {
98 98
 
99
-	if ( give_has_variable_prices( $form_id ) ) {
99
+	if (give_has_variable_prices($form_id)) {
100 100
 
101
-		$default_amount = give_get_default_multilevel_amount( $form_id );
101
+		$default_amount = give_get_default_multilevel_amount($form_id);
102 102
 
103 103
 	} else {
104 104
 
105
-		$default_amount = get_post_meta( $form_id, '_give_set_price', true );
105
+		$default_amount = get_post_meta($form_id, '_give_set_price', true);
106 106
 
107 107
 	}
108 108
 
109
-	return apply_filters( 'give_default_form_amount', $default_amount );
109
+	return apply_filters('give_default_form_amount', $default_amount);
110 110
 
111 111
 }
112 112
 
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return bool
126 126
  */
127
-function give_is_custom_price_mode( $form_id = 0 ) {
127
+function give_is_custom_price_mode($form_id = 0) {
128 128
 
129
-	if ( empty( $form_id ) ) {
129
+	if (empty($form_id)) {
130 130
 		return false;
131 131
 	}
132 132
 
133
-	$form = new Give_Donate_Form( $form_id );
133
+	$form = new Give_Donate_Form($form_id);
134 134
 
135 135
 	return $form->is_custom_price_mode();
136 136
 }
137 137
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-roles.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @access public
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 );
38
+		add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4);
39 39
 	}
40 40
 
41 41
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function add_roles() {
52
-		add_role( 'give_manager', esc_html__( 'Give Manager', 'give' ), array(
52
+		add_role('give_manager', esc_html__('Give Manager', 'give'), array(
53 53
 			'read'                   => true,
54 54
 			'edit_posts'             => true,
55 55
 			'delete_posts'           => true,
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
 			'publish_posts'          => true,
79 79
 			'read_private_pages'     => true,
80 80
 			'read_private_posts'     => true
81
-		) );
81
+		));
82 82
 
83
-		add_role( 'give_accountant', esc_html__( 'Give Accountant', 'give' ), array(
83
+		add_role('give_accountant', esc_html__('Give Accountant', 'give'), array(
84 84
 			'read'         => true,
85 85
 			'edit_posts'   => false,
86 86
 			'delete_posts' => false
87
-		) );
87
+		));
88 88
 
89
-		add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array(
89
+		add_role('give_worker', esc_html__('Give Worker', 'give'), array(
90 90
 			'read'         => true,
91 91
 			'edit_posts'   => false,
92 92
 			'upload_files' => true,
93 93
 			'delete_posts' => false
94
-		) );
94
+		));
95 95
 
96 96
 	}
97 97
 
@@ -110,38 +110,38 @@  discard block
 block discarded – undo
110 110
 	public function add_caps() {
111 111
 		global $wp_roles;
112 112
 
113
-		if ( class_exists( 'WP_Roles' ) ) {
114
-			if ( ! isset( $wp_roles ) ) {
113
+		if (class_exists('WP_Roles')) {
114
+			if ( ! isset($wp_roles)) {
115 115
 				$wp_roles = new WP_Roles();
116 116
 			}
117 117
 		}
118 118
 
119
-		if ( is_object( $wp_roles ) ) {
120
-			$wp_roles->add_cap( 'give_manager', 'view_give_reports' );
121
-			$wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' );
122
-			$wp_roles->add_cap( 'give_manager', 'export_give_reports' );
123
-			$wp_roles->add_cap( 'give_manager', 'manage_give_settings' );
119
+		if (is_object($wp_roles)) {
120
+			$wp_roles->add_cap('give_manager', 'view_give_reports');
121
+			$wp_roles->add_cap('give_manager', 'view_give_sensitive_data');
122
+			$wp_roles->add_cap('give_manager', 'export_give_reports');
123
+			$wp_roles->add_cap('give_manager', 'manage_give_settings');
124 124
 
125
-			$wp_roles->add_cap( 'administrator', 'view_give_reports' );
126
-			$wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' );
127
-			$wp_roles->add_cap( 'administrator', 'export_give_reports' );
128
-			$wp_roles->add_cap( 'administrator', 'manage_give_settings' );
125
+			$wp_roles->add_cap('administrator', 'view_give_reports');
126
+			$wp_roles->add_cap('administrator', 'view_give_sensitive_data');
127
+			$wp_roles->add_cap('administrator', 'export_give_reports');
128
+			$wp_roles->add_cap('administrator', 'manage_give_settings');
129 129
 
130 130
 			// Add the main post type capabilities.
131 131
 			$capabilities = $this->get_core_caps();
132
-			foreach ( $capabilities as $cap_group ) {
133
-				foreach ( $cap_group as $cap ) {
134
-					$wp_roles->add_cap( 'administrator', $cap );
135
-					$wp_roles->add_cap( 'give_manager', $cap );
136
-					$wp_roles->add_cap( 'give_worker', $cap );
132
+			foreach ($capabilities as $cap_group) {
133
+				foreach ($cap_group as $cap) {
134
+					$wp_roles->add_cap('administrator', $cap);
135
+					$wp_roles->add_cap('give_manager', $cap);
136
+					$wp_roles->add_cap('give_worker', $cap);
137 137
 				}
138 138
 			}
139 139
 
140
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_forms' );
141
-			$wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' );
142
-			$wp_roles->add_cap( 'give_accountant', 'view_give_reports' );
143
-			$wp_roles->add_cap( 'give_accountant', 'export_give_reports' );
144
-			$wp_roles->add_cap( 'give_accountant', 'edit_give_payments' );
140
+			$wp_roles->add_cap('give_accountant', 'edit_give_forms');
141
+			$wp_roles->add_cap('give_accountant', 'read_private_give_forms');
142
+			$wp_roles->add_cap('give_accountant', 'view_give_reports');
143
+			$wp_roles->add_cap('give_accountant', 'export_give_reports');
144
+			$wp_roles->add_cap('give_accountant', 'edit_give_payments');
145 145
 
146 146
 		}
147 147
 	}
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 	public function get_core_caps() {
160 160
 		$capabilities = array();
161 161
 
162
-		$capability_types = array( 'give_form', 'give_payment' );
162
+		$capability_types = array('give_form', 'give_payment');
163 163
 
164
-		foreach ( $capability_types as $capability_type ) {
165
-			$capabilities[ $capability_type ] = array(
164
+		foreach ($capability_types as $capability_type) {
165
+			$capabilities[$capability_type] = array(
166 166
 				// Post type.
167 167
 				"edit_{$capability_type}",
168 168
 				"read_{$capability_type}",
@@ -208,22 +208,22 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @return array  $caps    Meta capabilities.
210 210
 	 */
211
-	public function meta_caps( $caps, $cap, $user_id, $args ) {
211
+	public function meta_caps($caps, $cap, $user_id, $args) {
212 212
 
213
-		switch ( $cap ) {
213
+		switch ($cap) {
214 214
 
215 215
 			case 'view_give_form_stats' :
216 216
 
217
-				if ( empty( $args[0] ) ) {
217
+				if (empty($args[0])) {
218 218
 					break;
219 219
 				}
220 220
 
221
-				$form = get_post( $args[0] );
222
-				if ( empty( $form ) ) {
221
+				$form = get_post($args[0]);
222
+				if (empty($form)) {
223 223
 					break;
224 224
 				}
225 225
 
226
-				if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) {
226
+				if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) {
227 227
 					$caps = array();
228 228
 				}
229 229
 
@@ -250,41 +250,41 @@  discard block
 block discarded – undo
250 250
 
251 251
 		global $wp_roles;
252 252
 
253
-		if ( class_exists( 'WP_Roles' ) ) {
254
-			if ( ! isset( $wp_roles ) ) {
253
+		if (class_exists('WP_Roles')) {
254
+			if ( ! isset($wp_roles)) {
255 255
 				$wp_roles = new WP_Roles();
256 256
 			}
257 257
 		}
258 258
 
259
-		if ( is_object( $wp_roles ) ) {
259
+		if (is_object($wp_roles)) {
260 260
 			// Give Manager Capabilities.
261
-			$wp_roles->remove_cap( 'give_manager', 'view_give_reports' );
262
-			$wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' );
263
-			$wp_roles->remove_cap( 'give_manager', 'export_give_reports' );
264
-			$wp_roles->remove_cap( 'give_manager', 'manage_give_settings' );
261
+			$wp_roles->remove_cap('give_manager', 'view_give_reports');
262
+			$wp_roles->remove_cap('give_manager', 'view_give_sensitive_data');
263
+			$wp_roles->remove_cap('give_manager', 'export_give_reports');
264
+			$wp_roles->remove_cap('give_manager', 'manage_give_settings');
265 265
 
266 266
 			// Site Administrator Capabilities.
267
-			$wp_roles->remove_cap( 'administrator', 'view_give_reports' );
268
-			$wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' );
269
-			$wp_roles->remove_cap( 'administrator', 'export_give_reports' );
270
-			$wp_roles->remove_cap( 'administrator', 'manage_give_settings' );
267
+			$wp_roles->remove_cap('administrator', 'view_give_reports');
268
+			$wp_roles->remove_cap('administrator', 'view_give_sensitive_data');
269
+			$wp_roles->remove_cap('administrator', 'export_give_reports');
270
+			$wp_roles->remove_cap('administrator', 'manage_give_settings');
271 271
 
272 272
 			// Remove the Main Post Type Capabilities.
273 273
 			$capabilities = $this->get_core_caps();
274 274
 
275
-			foreach ( $capabilities as $cap_group ) {
276
-				foreach ( $cap_group as $cap ) {
277
-					$wp_roles->remove_cap( 'give_manager', $cap );
278
-					$wp_roles->remove_cap( 'administrator', $cap );
279
-					$wp_roles->remove_cap( 'give_worker', $cap );
275
+			foreach ($capabilities as $cap_group) {
276
+				foreach ($cap_group as $cap) {
277
+					$wp_roles->remove_cap('give_manager', $cap);
278
+					$wp_roles->remove_cap('administrator', $cap);
279
+					$wp_roles->remove_cap('give_worker', $cap);
280 280
 				}
281 281
 			}
282 282
 
283 283
 			/** Give Accountant Capabilities */
284
-			$wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' );
285
-			$wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' );
286
-			$wp_roles->remove_cap( 'give_accountant', 'view_give_reports' );
287
-			$wp_roles->remove_cap( 'give_accountant', 'export_give_reports' );
284
+			$wp_roles->remove_cap('give_accountant', 'edit_give_forms');
285
+			$wp_roles->remove_cap('give_accountant', 'read_private_give_forms');
286
+			$wp_roles->remove_cap('give_accountant', 'view_give_reports');
287
+			$wp_roles->remove_cap('give_accountant', 'export_give_reports');
288 288
 
289 289
 		}
290 290
 	}
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30 30
 
31
-	$payment_data = give_get_payment_meta( $payment_id );
31
+	$payment_data = give_get_payment_meta($payment_id);
32 32
 
33
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
33
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
34 34
 
35 35
 	/**
36 36
 	 * Filters the from name.
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @since 1.0
42 42
 	 */
43
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
43
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
44 44
 
45
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
45
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
46 46
 
47 47
 	/**
48 48
 	 * Filters the from email.
@@ -52,19 +52,19 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @since 1.0
54 54
 	 */
55
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
55
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
56 56
 
57
-	$to_email = give_get_payment_user_email( $payment_id );
57
+	$to_email = give_get_payment_user_email($payment_id);
58 58
 
59
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
59
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
60 60
 
61 61
 	/**
62 62
 	 * Filters the donation email receipt subject.
63 63
 	 *
64 64
 	 * @since 1.0
65 65
 	 */
66
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
67
-	$subject = give_do_email_tags( $subject, $payment_id );
66
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
67
+	$subject = give_do_email_tags($subject, $payment_id);
68 68
 
69 69
 	/**
70 70
 	 * Filters the donation email receipt attachments. By default, there is no attachment but plugins can hook in to provide one more multiple for the donor. Examples would be a printable ticket or PDF receipt.
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @since 1.0
76 76
 	 */
77
-	$attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data );
78
-	$message     = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id );
77
+	$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
78
+	$message     = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
79 79
 
80 80
 	$emails = Give()->emails;
81 81
 
82
-	$emails->__set( 'from_name', $from_name );
83
-	$emails->__set( 'from_email', $from_email );
84
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
82
+	$emails->__set('from_name', $from_name);
83
+	$emails->__set('from_email', $from_email);
84
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
85 85
 
86 86
 	/**
87 87
 	 * Filters the donation receipt's email headers.
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @since 1.0
93 93
 	 */
94
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
95
-	$emails->__set( 'headers', $headers );
94
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
95
+	$emails->__set('headers', $headers);
96 96
 
97 97
 	//Send the donation receipt.
98
-	$emails->send( $to_email, $subject, $message, $attachments );
98
+	$emails->send($to_email, $subject, $message, $attachments);
99 99
 
100 100
 	//If admin notifications are on, send the admin notice.
101
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
101
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
102 102
 		/**
103 103
 		 * Fires in the donation email receipt.
104 104
 		 *
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		 * @param int $payment_id Payment id.
110 110
 		 * @param mixed $payment_data Payment meta data.
111 111
 		 */
112
-		do_action( 'give_admin_donation_email', $payment_id, $payment_data );
112
+		do_action('give_admin_donation_email', $payment_id, $payment_data);
113 113
 	}
114 114
 }
115 115
 
@@ -122,41 +122,41 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function give_email_test_donation_receipt() {
124 124
 
125
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
125
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
126 126
 
127 127
 	/**
128 128
 	 * Filters the from name.
129 129
 	 *
130 130
 	 * @since 1.7
131 131
 	 */
132
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, 0, array() );
132
+	$from_name = apply_filters('give_donation_from_name', $from_name, 0, array());
133 133
 
134
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
134
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
135 135
 
136 136
 	/**
137 137
 	 * Filters the from email.
138 138
 	 *
139 139
 	 * @since 1.7
140 140
 	 */
141
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, 0, array() );
141
+	$from_email = apply_filters('give_donation_from_address', $from_email, 0, array());
142 142
 
143
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
144
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 );
145
-	$subject = give_do_email_tags( $subject, 0 );
143
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
144
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
145
+	$subject = give_do_email_tags($subject, 0);
146 146
 
147
-	$attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() );
147
+	$attachments = apply_filters('give_receipt_attachments', array(), 0, array());
148 148
 
149
-	$message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
149
+	$message = give_email_preview_template_tags(give_get_email_body_content(0, array()));
150 150
 
151 151
 	$emails = Give()->emails;
152
-	$emails->__set( 'from_name', $from_name );
153
-	$emails->__set( 'from_email', $from_email );
154
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
152
+	$emails->__set('from_name', $from_name);
153
+	$emails->__set('from_email', $from_email);
154
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
155 155
 
156
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() );
157
-	$emails->__set( 'headers', $headers );
156
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
157
+	$emails->__set('headers', $headers);
158 158
 
159
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
159
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
160 160
 
161 161
 }
162 162
 
@@ -170,49 +170,49 @@  discard block
 block discarded – undo
170 170
  *
171 171
  * @return void
172 172
  */
173
-function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
173
+function give_admin_email_notice($payment_id = 0, $payment_data = array()) {
174 174
 
175
-	$payment_id = absint( $payment_id );
175
+	$payment_id = absint($payment_id);
176 176
 
177
-	if ( empty( $payment_id ) ) {
177
+	if (empty($payment_id)) {
178 178
 		return;
179 179
 	}
180 180
 
181
-	if ( ! give_get_payment_by( 'id', $payment_id ) ) {
181
+	if ( ! give_get_payment_by('id', $payment_id)) {
182 182
 		return;
183 183
 	}
184 184
 
185
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
185
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
186 186
 
187 187
 	/**
188 188
 	 * Filters the from name.
189 189
 	 *
190 190
 	 * @since 1.0
191 191
 	 */
192
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
192
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
193 193
 
194
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
194
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
195 195
 
196 196
 	/**
197 197
 	 * Filters the from email.
198 198
 	 *
199 199
 	 * @since 1.0
200 200
 	 */
201
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
201
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
202 202
 
203 203
 	/* translators: %s: payment id */
204
-	$subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) );
204
+	$subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id));
205 205
 
206 206
 	/**
207 207
 	 * Filters the donation notification subject.
208 208
 	 *
209 209
 	 * @since 1.0
210 210
 	 */
211
-	$subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
212
-	$subject = give_do_email_tags( $subject, $payment_id );
211
+	$subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
212
+	$subject = give_do_email_tags($subject, $payment_id);
213 213
 
214
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
215
-	$headers .= "Reply-To: " . $from_email . "\r\n";
214
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
215
+	$headers .= "Reply-To: ".$from_email."\r\n";
216 216
 	//$headers  .= "MIME-Version: 1.0\r\n";
217 217
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
218 218
 
@@ -221,28 +221,28 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @since 1.0
223 223
 	 */
224
-	$headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data );
224
+	$headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
225 225
 
226 226
 	/**
227 227
 	 * Filters the donation notification email attachments. By default, there is no attachment but plugins can hook in to provide one more multiple.
228 228
 	 *
229 229
 	 * @since 1.0
230 230
 	 */
231
-	$attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data );
231
+	$attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
232 232
 
233
-	$message = give_get_donation_notification_body_content( $payment_id, $payment_data );
233
+	$message = give_get_donation_notification_body_content($payment_id, $payment_data);
234 234
 
235 235
 	$emails = Give()->emails;
236
-	$emails->__set( 'from_name', $from_name );
237
-	$emails->__set( 'from_email', $from_email );
238
-	$emails->__set( 'headers', $headers );
239
-	$emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) );
236
+	$emails->__set('from_name', $from_name);
237
+	$emails->__set('from_email', $from_email);
238
+	$emails->__set('headers', $headers);
239
+	$emails->__set('heading', esc_html__('New Donation!', 'give'));
240 240
 
241
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
241
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
242 242
 
243 243
 }
244 244
 
245
-add_action( 'give_admin_donation_email', 'give_admin_email_notice', 10, 2 );
245
+add_action('give_admin_donation_email', 'give_admin_email_notice', 10, 2);
246 246
 
247 247
 /**
248 248
  * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings).
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
  */
253 253
 function give_get_admin_notice_emails() {
254 254
 
255
-	$email_option = give_get_option( 'admin_notice_emails' );
255
+	$email_option = give_get_option('admin_notice_emails');
256 256
 
257
-	$emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' );
258
-	$emails = array_map( 'trim', explode( "\n", $emails ) );
257
+	$emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email');
258
+	$emails = array_map('trim', explode("\n", $emails));
259 259
 
260
-	return apply_filters( 'give_admin_notice_emails', $emails );
260
+	return apply_filters('give_admin_notice_emails', $emails);
261 261
 }
262 262
 
263 263
 /**
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return mixed
271 271
  */
272
-function give_admin_notices_disabled( $payment_id = 0 ) {
272
+function give_admin_notices_disabled($payment_id = 0) {
273 273
 
274 274
 	return apply_filters(
275 275
 		'give_admin_notices_disabled',
276
-		! give_is_setting_enabled( give_get_option( 'admin_notices' ) ),
276
+		! give_is_setting_enabled(give_get_option('admin_notices')),
277 277
 		$payment_id
278 278
 	);
279 279
 }
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
  */
289 289
 function give_get_default_donation_notification_email() {
290 290
 
291
-	$default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n";
292
-	$default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
293
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
294
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
295
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
296
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
297
-	$default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n";
298
-	$default_email_body .= '{sitename}' . "\n";
291
+	$default_email_body = esc_html__('Hi there,', 'give')."\n\n";
292
+	$default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
293
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n";
294
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
295
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n";
296
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
297
+	$default_email_body .= esc_html__('Thank you,', 'give')."\n\n";
298
+	$default_email_body .= '{sitename}'."\n";
299 299
 
300
-	$custom_message = give_get_option( 'donation_notification' );
301
-	$message        = ! empty( $custom_message ) ? $custom_message : $default_email_body;
300
+	$custom_message = give_get_option('donation_notification');
301
+	$message        = ! empty($custom_message) ? $custom_message : $default_email_body;
302 302
 
303
-	return apply_filters( 'give_default_donation_notification_email', $message );
303
+	return apply_filters('give_default_donation_notification_email', $message);
304 304
 }
305 305
 
306 306
 
@@ -314,25 +314,25 @@  discard block
 block discarded – undo
314 314
  */
315 315
 function give_get_default_donation_receipt_email() {
316 316
 
317
-	$default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n";
318
-	$default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
319
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
320
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
321
-	$default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
322
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
323
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
324
-	$default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
325
-	$default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
326
-	$default_email_body .= '{receipt_link}' . "\n\n";
317
+	$default_email_body = esc_html__('Dear', 'give')." {name},\n\n";
318
+	$default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
319
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n";
320
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
321
+	$default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n";
322
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n";
323
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
324
+	$default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
325
+	$default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
326
+	$default_email_body .= '{receipt_link}'."\n\n";
327 327
 	$default_email_body .= "\n\n";
328
-	$default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n";
329
-	$default_email_body .= '{sitename}' . "\n";
328
+	$default_email_body .= esc_html__('Sincerely,', 'give')."\n";
329
+	$default_email_body .= '{sitename}'."\n";
330 330
 
331
-	$custom_message = give_get_option( 'donation_receipt' );
331
+	$custom_message = give_get_option('donation_receipt');
332 332
 
333
-	$message = ! empty( $custom_message ) ? $custom_message : $default_email_body;
333
+	$message = ! empty($custom_message) ? $custom_message : $default_email_body;
334 334
 
335
-	return apply_filters( 'give_default_donation_receipt_email', $message );
335
+	return apply_filters('give_default_donation_receipt_email', $message);
336 336
 }
337 337
 
338 338
 /**
@@ -344,19 +344,19 @@  discard block
 block discarded – undo
344 344
  *
345 345
  * @return array $email_names
346 346
  */
347
-function give_get_email_names( $user_info ) {
347
+function give_get_email_names($user_info) {
348 348
 	$email_names = array();
349
-	$user_info   = maybe_unserialize( $user_info );
349
+	$user_info   = maybe_unserialize($user_info);
350 350
 
351 351
 	$email_names['fullname'] = '';
352
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
353
-		$user_data               = get_userdata( $user_info['id'] );
352
+	if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
353
+		$user_data               = get_userdata($user_info['id']);
354 354
 		$email_names['name']     = $user_info['first_name'];
355
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
355
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
356 356
 		$email_names['username'] = $user_data->user_login;
357
-	} elseif ( isset( $user_info['first_name'] ) ) {
357
+	} elseif (isset($user_info['first_name'])) {
358 358
 		$email_names['name']     = $user_info['first_name'];
359
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
359
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
360 360
 		$email_names['username'] = $user_info['first_name'];
361 361
 	} else {
362 362
 		$email_names['name']     = $user_info['email'];
Please login to merge, or discard this patch.
includes/emails/class-give-email-tags.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly.
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 * @param string   $description Email tag description text
56 56
 	 * @param callable $func        Hook to run when email tag is found
57 57
 	 */
58
-	public function add( $tag, $description, $func ) {
59
-		if ( is_callable( $func ) ) {
60
-			$this->tags[ $tag ] = array(
58
+	public function add($tag, $description, $func) {
59
+		if (is_callable($func)) {
60
+			$this->tags[$tag] = array(
61 61
 				'tag'         => $tag,
62 62
 				'description' => $description,
63 63
 				'func'        => $func
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param string $tag Email tag to remove hook from
74 74
 	 */
75
-	public function remove( $tag ) {
76
-		unset( $this->tags[ $tag ] );
75
+	public function remove($tag) {
76
+		unset($this->tags[$tag]);
77 77
 	}
78 78
 
79 79
 	/**
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return bool
87 87
 	 */
88
-	public function email_tag_exists( $tag ) {
89
-		return array_key_exists( $tag, $this->tags );
88
+	public function email_tag_exists($tag) {
89
+		return array_key_exists($tag, $this->tags);
90 90
 	}
91 91
 
92 92
 	/**
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return string Content with email tags filtered out.
112 112
 	 */
113
-	public function do_tags( $content, $payment_id ) {
113
+	public function do_tags($content, $payment_id) {
114 114
 
115 115
 		// Check if there is at least one tag added.
116
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
116
+		if (empty($this->tags) || ! is_array($this->tags)) {
117 117
 			return $content;
118 118
 		}
119 119
 
120 120
 		$this->payment_id = $payment_id;
121 121
 
122
-		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content );
122
+		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content);
123 123
 
124 124
 		$this->payment_id = null;
125 125
 
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return mixed
137 137
 	 */
138
-	public function do_tag( $m ) {
138
+	public function do_tag($m) {
139 139
 
140 140
 		// Get tag
141 141
 		$tag = $m[1];
142 142
 
143 143
 		// Return tag if tag not set
144
-		if ( ! $this->email_tag_exists( $tag ) ) {
144
+		if ( ! $this->email_tag_exists($tag)) {
145 145
 			return $m[0];
146 146
 		}
147 147
 
148
-		return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag );
148
+		return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag);
149 149
 	}
150 150
 
151 151
 }
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
  * @param string   $description Description of the email tag added
160 160
  * @param callable $func        Hook to run when email tag is found
161 161
  */
162
-function give_add_email_tag( $tag, $description, $func ) {
163
-	Give()->email_tags->add( $tag, $description, $func );
162
+function give_add_email_tag($tag, $description, $func) {
163
+	Give()->email_tags->add($tag, $description, $func);
164 164
 }
165 165
 
166 166
 /**
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
  *
171 171
  * @param string $tag Email tag to remove hook from
172 172
  */
173
-function give_remove_email_tag( $tag ) {
174
-	Give()->email_tags->remove( $tag );
173
+function give_remove_email_tag($tag) {
174
+	Give()->email_tags->remove($tag);
175 175
 }
176 176
 
177 177
 /**
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
  *
184 184
  * @return bool
185 185
  */
186
-function give_email_tag_exists( $tag ) {
187
-	return Give()->email_tags->email_tag_exists( $tag );
186
+function give_email_tag_exists($tag) {
187
+	return Give()->email_tags->email_tag_exists($tag);
188 188
 }
189 189
 
190 190
 /**
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	$email_tags = give_get_email_tags();
212 212
 
213 213
 	ob_start();
214
-	if ( count( $email_tags ) > 0 ) : ?>
214
+	if (count($email_tags) > 0) : ?>
215 215
 		<div class="give-email-tags-wrap">
216
-			<?php foreach ( $email_tags as $email_tag ) : ?>
216
+			<?php foreach ($email_tags as $email_tag) : ?>
217 217
 				<span class="give_<?php echo $email_tag['tag']; ?>_tag">
218 218
 					<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?>
219 219
 				</span>
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
  *
236 236
  * @return string Content with email tags filtered out.
237 237
  */
238
-function give_do_email_tags( $content, $payment_id ) {
238
+function give_do_email_tags($content, $payment_id) {
239 239
 
240 240
 	// Replace all tags
241
-	$content = Give()->email_tags->do_tags( $content, $payment_id );
241
+	$content = Give()->email_tags->do_tags($content, $payment_id);
242 242
 
243
-	$content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id );
243
+	$content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id);
244 244
 
245 245
 	// Return content
246 246
 	return $content;
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 	 *
260 260
 	 * @since 1.0
261 261
 	 */
262
-	do_action( 'give_add_email_tags' );
262
+	do_action('give_add_email_tags');
263 263
 }
264 264
 
265
-add_action( 'init', 'give_load_email_tags', - 999 );
265
+add_action('init', 'give_load_email_tags', - 999);
266 266
 
267 267
 /**
268 268
  * Add default Give email template tags.
@@ -275,97 +275,97 @@  discard block
 block discarded – undo
275 275
 	$email_tags = array(
276 276
 		array(
277 277
 			'tag'         => 'donation',
278
-			'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ),
278
+			'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'),
279 279
 			'function'    => 'give_email_tag_donation'
280 280
 		),
281 281
 		array(
282 282
 			'tag'         => 'form_title',
283
-			'description' => esc_html__( 'The donation form name.', 'give' ),
283
+			'description' => esc_html__('The donation form name.', 'give'),
284 284
 			'function'    => 'give_email_tag_form_title'
285 285
 		),
286 286
 		array(
287 287
 			'tag'         => 'amount',
288
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
288
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
289 289
 			'function'    => 'give_email_tag_amount'
290 290
 		),
291 291
 		array(
292 292
 			'tag'         => 'price',
293
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
293
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
294 294
 			'function'    => 'give_email_tag_price'
295 295
 		),
296 296
 		array(
297 297
 			'tag'         => 'name',
298
-			'description' => esc_html__( 'The donor\'s first name.', 'give' ),
298
+			'description' => esc_html__('The donor\'s first name.', 'give'),
299 299
 			'function'    => 'give_email_tag_first_name'
300 300
 		),
301 301
 		array(
302 302
 			'tag'         => 'fullname',
303
-			'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ),
303
+			'description' => esc_html__('The donor\'s full name, first and last.', 'give'),
304 304
 			'function'    => 'give_email_tag_fullname'
305 305
 		),
306 306
 		array(
307 307
 			'tag'         => 'username',
308
-			'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
308
+			'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'),
309 309
 			'function'    => 'give_email_tag_username'
310 310
 		),
311 311
 		array(
312 312
 			'tag'         => 'user_email',
313
-			'description' => esc_html__( 'The donor\'s email address.', 'give' ),
313
+			'description' => esc_html__('The donor\'s email address.', 'give'),
314 314
 			'function'    => 'give_email_tag_user_email'
315 315
 		),
316 316
 		array(
317 317
 			'tag'         => 'billing_address',
318
-			'description' => esc_html__( 'The donor\'s billing address.', 'give' ),
318
+			'description' => esc_html__('The donor\'s billing address.', 'give'),
319 319
 			'function'    => 'give_email_tag_billing_address'
320 320
 		),
321 321
 		array(
322 322
 			'tag'         => 'date',
323
-			'description' => esc_html__( 'The date of the donation.', 'give' ),
323
+			'description' => esc_html__('The date of the donation.', 'give'),
324 324
 			'function'    => 'give_email_tag_date'
325 325
 		),
326 326
 		array(
327 327
 			'tag'         => 'payment_id',
328
-			'description' => esc_html__( 'The unique ID number for this donation.', 'give' ),
328
+			'description' => esc_html__('The unique ID number for this donation.', 'give'),
329 329
 			'function'    => 'give_email_tag_payment_id'
330 330
 		),
331 331
 		array(
332 332
 			'tag'         => 'receipt_id',
333
-			'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ),
333
+			'description' => esc_html__('The unique ID number for this donation receipt.', 'give'),
334 334
 			'function'    => 'give_email_tag_receipt_id'
335 335
 		),
336 336
 		array(
337 337
 			'tag'         => 'payment_method',
338
-			'description' => esc_html__( 'The method of payment used for this donation.', 'give' ),
338
+			'description' => esc_html__('The method of payment used for this donation.', 'give'),
339 339
 			'function'    => 'give_email_tag_payment_method'
340 340
 		),
341 341
 		array(
342 342
 			'tag'         => 'sitename',
343
-			'description' => esc_html__( 'The name of your site.', 'give' ),
343
+			'description' => esc_html__('The name of your site.', 'give'),
344 344
 			'function'    => 'give_email_tag_sitename'
345 345
 		),
346 346
 		array(
347 347
 			'tag'         => 'receipt_link',
348
-			'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
348
+			'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'),
349 349
 			'function'    => 'give_email_tag_receipt_link'
350 350
 		),
351 351
 		array(
352 352
 			'tag'         => 'receipt_link_url',
353
-			'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
353
+			'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'),
354 354
 			'function'    => 'give_email_tag_receipt_link_url'
355 355
 		),
356 356
 	);
357 357
 
358 358
 	// Apply give_email_tags filter
359
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
359
+	$email_tags = apply_filters('give_email_tags', $email_tags);
360 360
 
361 361
 	// Add email tags
362
-	foreach ( $email_tags as $email_tag ) {
363
-		give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] );
362
+	foreach ($email_tags as $email_tag) {
363
+		give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']);
364 364
 	}
365 365
 
366 366
 }
367 367
 
368
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
368
+add_action('give_add_email_tags', 'give_setup_email_tags');
369 369
 
370 370
 
371 371
 /**
@@ -377,15 +377,15 @@  discard block
 block discarded – undo
377 377
  *
378 378
  * @return string name
379 379
  */
380
-function give_email_tag_first_name( $payment_id ) {
381
-	$payment   = new Give_Payment( $payment_id );
380
+function give_email_tag_first_name($payment_id) {
381
+	$payment   = new Give_Payment($payment_id);
382 382
 	$user_info = $payment->user_info;
383 383
 
384
-	if ( empty( $user_info ) ) {
384
+	if (empty($user_info)) {
385 385
 		return '';
386 386
 	}
387 387
 
388
-	$email_name = give_get_email_names( $user_info );
388
+	$email_name = give_get_email_names($user_info);
389 389
 
390 390
 	return $email_name['name'];
391 391
 }
@@ -399,15 +399,15 @@  discard block
 block discarded – undo
399 399
  *
400 400
  * @return string fullname
401 401
  */
402
-function give_email_tag_fullname( $payment_id ) {
403
-	$payment   = new Give_Payment( $payment_id );
402
+function give_email_tag_fullname($payment_id) {
403
+	$payment   = new Give_Payment($payment_id);
404 404
 	$user_info = $payment->user_info;
405 405
 
406
-	if ( empty( $user_info ) ) {
406
+	if (empty($user_info)) {
407 407
 		return '';
408 408
 	}
409 409
 
410
-	$email_name = give_get_email_names( $user_info );
410
+	$email_name = give_get_email_names($user_info);
411 411
 
412 412
 	return $email_name['fullname'];
413 413
 }
@@ -421,15 +421,15 @@  discard block
 block discarded – undo
421 421
  *
422 422
  * @return string username.
423 423
  */
424
-function give_email_tag_username( $payment_id ) {
425
-	$payment   = new Give_Payment( $payment_id );
424
+function give_email_tag_username($payment_id) {
425
+	$payment   = new Give_Payment($payment_id);
426 426
 	$user_info = $payment->user_info;
427 427
 
428
-	if ( empty( $user_info ) ) {
428
+	if (empty($user_info)) {
429 429
 		return '';
430 430
 	}
431 431
 
432
-	$email_name = give_get_email_names( $user_info );
432
+	$email_name = give_get_email_names($user_info);
433 433
 
434 434
 	return $email_name['username'];
435 435
 }
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
  *
444 444
  * @return string user_email
445 445
  */
446
-function give_email_tag_user_email( $payment_id ) {
447
-	$payment = new Give_Payment( $payment_id );
446
+function give_email_tag_user_email($payment_id) {
447
+	$payment = new Give_Payment($payment_id);
448 448
 
449 449
 	return $payment->email;
450 450
 }
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
  *
459 459
  * @return string billing_address
460 460
  */
461
-function give_email_tag_billing_address( $payment_id ) {
462
-	$user_info    = give_get_payment_meta_user_info( $payment_id );
463
-	$user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array(
461
+function give_email_tag_billing_address($payment_id) {
462
+	$user_info    = give_get_payment_meta_user_info($payment_id);
463
+	$user_address = ! empty($user_info['address']) ? $user_info['address'] : array(
464 464
 		'line1'   => '',
465 465
 		'line2'   => '',
466 466
 		'city'    => '',
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 		'zip'     => ''
470 470
 	);
471 471
 
472
-	$return = $user_address['line1'] . "\n";
473
-	if ( ! empty( $user_address['line2'] ) ) {
474
-		$return .= $user_address['line2'] . "\n";
472
+	$return = $user_address['line1']."\n";
473
+	if ( ! empty($user_address['line2'])) {
474
+		$return .= $user_address['line2']."\n";
475 475
 	}
476
-	$return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n";
476
+	$return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n";
477 477
 	$return .= $user_address['country'];
478 478
 
479 479
 	return $return;
@@ -488,10 +488,10 @@  discard block
 block discarded – undo
488 488
  *
489 489
  * @return string date
490 490
  */
491
-function give_email_tag_date( $payment_id ) {
492
-	$payment = new Give_Payment( $payment_id );
491
+function give_email_tag_date($payment_id) {
492
+	$payment = new Give_Payment($payment_id);
493 493
 
494
-	return date_i18n( give_date_format(), strtotime( $payment->date ) );
494
+	return date_i18n(give_date_format(), strtotime($payment->date));
495 495
 }
496 496
 
497 497
 /**
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
  *
504 504
  * @return string amount
505 505
  */
506
-function give_email_tag_amount( $payment_id ) {
507
-	$payment     = new Give_Payment( $payment_id );
508
-	$give_amount = give_currency_filter( give_format_amount( $payment->total ), $payment->currency );
506
+function give_email_tag_amount($payment_id) {
507
+	$payment     = new Give_Payment($payment_id);
508
+	$give_amount = give_currency_filter(give_format_amount($payment->total), $payment->currency);
509 509
 
510
-	return html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' );
510
+	return html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8');
511 511
 }
512 512
 
513 513
 /**
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
  *
520 520
  * @return string price
521 521
  */
522
-function give_email_tag_price( $payment_id ) {
523
-	return give_email_tag_amount( $payment_id );
522
+function give_email_tag_price($payment_id) {
523
+	return give_email_tag_amount($payment_id);
524 524
 }
525 525
 
526 526
 /**
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
  *
533 533
  * @return int payment_id
534 534
  */
535
-function give_email_tag_payment_id( $payment_id ) {
536
-	$payment = new Give_Payment( $payment_id );
535
+function give_email_tag_payment_id($payment_id) {
536
+	$payment = new Give_Payment($payment_id);
537 537
 
538 538
 	return $payment->number;
539 539
 }
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
  *
548 548
  * @return string receipt_id
549 549
  */
550
-function give_email_tag_receipt_id( $payment_id ) {
551
-	$payment = new Give_Payment( $payment_id );
550
+function give_email_tag_receipt_id($payment_id) {
551
+	$payment = new Give_Payment($payment_id);
552 552
 
553 553
 	return $payment->key;
554 554
 }
@@ -562,14 +562,14 @@  discard block
 block discarded – undo
562 562
  *
563 563
  * @return string $form_title
564 564
  */
565
-function give_email_tag_donation( $payment_id ) {
566
-	$payment      = new Give_Payment( $payment_id );
565
+function give_email_tag_donation($payment_id) {
566
+	$payment      = new Give_Payment($payment_id);
567 567
 	$payment_meta = $payment->payment_meta;
568
-	$level_title  = give_has_variable_prices( $payment->form_id );
568
+	$level_title  = give_has_variable_prices($payment->form_id);
569 569
 	$separator    = $level_title ? '-' : '';
570
-	$form_title   = strip_tags( give_get_payment_form_title( $payment_meta, false, $separator ) );
570
+	$form_title   = strip_tags(give_get_payment_form_title($payment_meta, false, $separator));
571 571
 
572
-	return ! empty( $form_title ) ? $form_title : '';
572
+	return ! empty($form_title) ? $form_title : '';
573 573
 
574 574
 }
575 575
 
@@ -582,11 +582,11 @@  discard block
 block discarded – undo
582 582
  *
583 583
  * @return string $form_title
584 584
  */
585
-function give_email_tag_form_title( $payment_id ) {
586
-	$payment      = new Give_Payment( $payment_id );
585
+function give_email_tag_form_title($payment_id) {
586
+	$payment      = new Give_Payment($payment_id);
587 587
 	$payment_meta = $payment->payment_meta;
588 588
 
589
-	return isset( $payment_meta['form_title'] ) ? strip_tags( $payment_meta['form_title'] ) : '';
589
+	return isset($payment_meta['form_title']) ? strip_tags($payment_meta['form_title']) : '';
590 590
 
591 591
 }
592 592
 
@@ -599,10 +599,10 @@  discard block
 block discarded – undo
599 599
  *
600 600
  * @return string gateway
601 601
  */
602
-function give_email_tag_payment_method( $payment_id ) {
603
-	$payment = new Give_Payment( $payment_id );
602
+function give_email_tag_payment_method($payment_id) {
603
+	$payment = new Give_Payment($payment_id);
604 604
 
605
-	return give_get_gateway_checkout_label( $payment->gateway );
605
+	return give_get_gateway_checkout_label($payment->gateway);
606 606
 }
607 607
 
608 608
 /**
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
  *
615 615
  * @return string sitename
616 616
  */
617
-function give_email_tag_sitename( $payment_id ) {
618
-	return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
617
+function give_email_tag_sitename($payment_id) {
618
+	return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
619 619
 }
620 620
 
621 621
 /**
@@ -627,19 +627,19 @@  discard block
 block discarded – undo
627 627
  *
628 628
  * @return string receipt_link
629 629
  */
630
-function give_email_tag_receipt_link( $payment_id ) {
630
+function give_email_tag_receipt_link($payment_id) {
631 631
 
632
-	$receipt_url = esc_url( add_query_arg( array(
633
-		'payment_key' => give_get_payment_key( $payment_id ),
632
+	$receipt_url = esc_url(add_query_arg(array(
633
+		'payment_key' => give_get_payment_key($payment_id),
634 634
 		'give_action' => 'view_receipt'
635
-	), home_url() ) );
636
-	$formatted   = sprintf(
635
+	), home_url()));
636
+	$formatted = sprintf(
637 637
 		'<a href="%1$s">%2$s</a>',
638 638
 		$receipt_url,
639
-		esc_html__( 'View it in your browser', 'give' )
639
+		esc_html__('View it in your browser', 'give')
640 640
 	);
641 641
 
642
-	if ( give_get_option( 'email_template' ) !== 'none' ) {
642
+	if (give_get_option('email_template') !== 'none') {
643 643
 		return $formatted;
644 644
 	} else {
645 645
 		return $receipt_url;
@@ -658,12 +658,12 @@  discard block
 block discarded – undo
658 658
  *
659 659
  * @return string receipt_url
660 660
  */
661
-function give_email_tag_receipt_link_url( $payment_id ) {
661
+function give_email_tag_receipt_link_url($payment_id) {
662 662
 
663
-	$receipt_url = esc_url( add_query_arg( array(
664
-		'payment_key' => give_get_payment_key( $payment_id ),
663
+	$receipt_url = esc_url(add_query_arg(array(
664
+		'payment_key' => give_get_payment_key($payment_id),
665 665
 		'give_action' => 'view_receipt'
666
-	), home_url() ) );
666
+	), home_url()));
667 667
 
668 668
 	return $receipt_url;
669 669
 
Please login to merge, or discard this patch.
includes/payments/class-payments-query.php 1 patch
Spacing   +115 added lines, -115 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
 
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @param  $args array The array of arguments that can be passed in and used for setting up this payment query.
58 58
 	 */
59
-	public function __construct( $args = array() ) {
59
+	public function __construct($args = array()) {
60 60
 		$defaults = array(
61 61
 			'output'          => 'payments', // Use 'posts' to get standard post objects
62
-			'post_type'       => array( 'give_payment' ),
62
+			'post_type'       => array('give_payment'),
63 63
 			'start_date'      => false,
64 64
 			'end_date'        => false,
65 65
 			'number'          => 20,
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 			'give_forms'      => null,
80 80
 		);
81 81
 
82
-		$this->args = wp_parse_args( $args, $defaults );
82
+		$this->args = wp_parse_args($args, $defaults);
83 83
 
84 84
 		$this->init();
85 85
 	}
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	 * @param $query_var
94 94
 	 * @param $value
95 95
 	 */
96
-	public function __set( $query_var, $value ) {
97
-		if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) {
98
-			$this->args[ $query_var ][] = $value;
96
+	public function __set($query_var, $value) {
97
+		if (in_array($query_var, array('meta_query', 'tax_query'))) {
98
+			$this->args[$query_var][] = $value;
99 99
 		} else {
100
-			$this->args[ $query_var ] = $value;
100
+			$this->args[$query_var] = $value;
101 101
 		}
102 102
 	}
103 103
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @param $query_var
111 111
 	 */
112
-	public function __unset( $query_var ) {
113
-		unset( $this->args[ $query_var ] );
112
+	public function __unset($query_var) {
113
+		unset($this->args[$query_var]);
114 114
 	}
115 115
 
116 116
 	/**
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function init() {
125 125
 
126
-		add_action( 'give_pre_get_payments', array( $this, 'date_filter_pre' ) );
127
-		add_action( 'give_post_get_payments', array( $this, 'date_filter_post' ) );
128
-
129
-		add_action( 'give_pre_get_payments', array( $this, 'orderby' ) );
130
-		add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 );
131
-		add_action( 'give_pre_get_payments', array( $this, 'status' ) );
132
-		add_action( 'give_pre_get_payments', array( $this, 'month' ) );
133
-		add_action( 'give_pre_get_payments', array( $this, 'per_page' ) );
134
-		add_action( 'give_pre_get_payments', array( $this, 'page' ) );
135
-		add_action( 'give_pre_get_payments', array( $this, 'user' ) );
136
-		add_action( 'give_pre_get_payments', array( $this, 'search' ) );
137
-		add_action( 'give_pre_get_payments', array( $this, 'mode' ) );
138
-		add_action( 'give_pre_get_payments', array( $this, 'children' ) );
139
-		add_action( 'give_pre_get_payments', array( $this, 'give_forms' ) );
126
+		add_action('give_pre_get_payments', array($this, 'date_filter_pre'));
127
+		add_action('give_post_get_payments', array($this, 'date_filter_post'));
128
+
129
+		add_action('give_pre_get_payments', array($this, 'orderby'));
130
+		add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2);
131
+		add_action('give_pre_get_payments', array($this, 'status'));
132
+		add_action('give_pre_get_payments', array($this, 'month'));
133
+		add_action('give_pre_get_payments', array($this, 'per_page'));
134
+		add_action('give_pre_get_payments', array($this, 'page'));
135
+		add_action('give_pre_get_payments', array($this, 'user'));
136
+		add_action('give_pre_get_payments', array($this, 'search'));
137
+		add_action('give_pre_get_payments', array($this, 'mode'));
138
+		add_action('give_pre_get_payments', array($this, 'children'));
139
+		add_action('give_pre_get_payments', array($this, 'give_forms'));
140 140
 	}
141 141
 
142 142
 	/**
@@ -160,27 +160,27 @@  discard block
 block discarded – undo
160 160
 		 *
161 161
 		 * @param Give_Payments_Query $this Payments query object.
162 162
 		 */
163
-		do_action( 'give_pre_get_payments', $this );
163
+		do_action('give_pre_get_payments', $this);
164 164
 
165
-		$query = new WP_Query( $this->args );
165
+		$query = new WP_Query($this->args);
166 166
 
167 167
 		$custom_output = array(
168 168
 			'payments',
169 169
 			'give_payments',
170 170
 		);
171 171
 
172
-		if ( ! in_array( $this->args['output'], $custom_output ) ) {
172
+		if ( ! in_array($this->args['output'], $custom_output)) {
173 173
 			return $query->posts;
174 174
 		}
175 175
 
176
-		if ( $query->have_posts() ) {
177
-			while ( $query->have_posts() ) {
176
+		if ($query->have_posts()) {
177
+			while ($query->have_posts()) {
178 178
 				$query->the_post();
179 179
 
180 180
 				$payment_id = get_post()->ID;
181
-				$payment    = new Give_Payment( $payment_id );
181
+				$payment    = new Give_Payment($payment_id);
182 182
 
183
-				$this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this );
183
+				$this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this);
184 184
 			}
185 185
 
186 186
 			wp_reset_postdata();
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		 *
194 194
 		 * @param Give_Payments_Query $this Payments query object.
195 195
 		 */
196
-		do_action( 'give_post_get_payments', $this );
196
+		do_action('give_post_get_payments', $this);
197 197
 
198 198
 		return $this->payments;
199 199
 	}
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 	 * @return void
208 208
 	 */
209 209
 	public function date_filter_pre() {
210
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
210
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
211 211
 			return;
212 212
 		}
213 213
 
214
-		$this->setup_dates( $this->args['start_date'], $this->args['end_date'] );
214
+		$this->setup_dates($this->args['start_date'], $this->args['end_date']);
215 215
 
216
-		add_filter( 'posts_where', array( $this, 'payments_where' ) );
216
+		add_filter('posts_where', array($this, 'payments_where'));
217 217
 	}
218 218
 
219 219
 	/**
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
 	 * @return void
227 227
 	 */
228 228
 	public function date_filter_post() {
229
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
229
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
230 230
 			return;
231 231
 		}
232 232
 
233
-		remove_filter( 'posts_where', array( $this, 'payments_where' ) );
233
+		remove_filter('posts_where', array($this, 'payments_where'));
234 234
 	}
235 235
 
236 236
 	/**
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 * @return void
243 243
 	 */
244 244
 	public function status() {
245
-		if ( ! isset ( $this->args['status'] ) ) {
245
+		if ( ! isset ($this->args['status'])) {
246 246
 			return;
247 247
 		}
248 248
 
249
-		$this->__set( 'post_status', $this->args['status'] );
250
-		$this->__unset( 'status' );
249
+		$this->__set('post_status', $this->args['status']);
250
+		$this->__unset('status');
251 251
 	}
252 252
 
253 253
 	/**
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
 	 * @return void
260 260
 	 */
261 261
 	public function page() {
262
-		if ( ! isset ( $this->args['page'] ) ) {
262
+		if ( ! isset ($this->args['page'])) {
263 263
 			return;
264 264
 		}
265 265
 
266
-		$this->__set( 'paged', $this->args['page'] );
267
-		$this->__unset( 'page' );
266
+		$this->__set('paged', $this->args['page']);
267
+		$this->__unset('page');
268 268
 	}
269 269
 
270 270
 	/**
@@ -277,17 +277,17 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public function per_page() {
279 279
 
280
-		if ( ! isset( $this->args['number'] ) ) {
280
+		if ( ! isset($this->args['number'])) {
281 281
 			return;
282 282
 		}
283 283
 
284
-		if ( $this->args['number'] == - 1 ) {
285
-			$this->__set( 'nopaging', true );
284
+		if ($this->args['number'] == - 1) {
285
+			$this->__set('nopaging', true);
286 286
 		} else {
287
-			$this->__set( 'posts_per_page', $this->args['number'] );
287
+			$this->__set('posts_per_page', $this->args['number']);
288 288
 		}
289 289
 
290
-		$this->__unset( 'number' );
290
+		$this->__unset('number');
291 291
 	}
292 292
 
293 293
 	/**
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
 	 * @return void
300 300
 	 */
301 301
 	public function month() {
302
-		if ( ! isset ( $this->args['month'] ) ) {
302
+		if ( ! isset ($this->args['month'])) {
303 303
 			return;
304 304
 		}
305 305
 
306
-		$this->__set( 'monthnum', $this->args['month'] );
307
-		$this->__unset( 'month' );
306
+		$this->__set('monthnum', $this->args['month']);
307
+		$this->__unset('month');
308 308
 	}
309 309
 
310 310
 	/**
@@ -316,23 +316,23 @@  discard block
 block discarded – undo
316 316
 	 * @return void
317 317
 	 */
318 318
 	public function orderby() {
319
-		switch ( $this->args['orderby'] ) {
319
+		switch ($this->args['orderby']) {
320 320
 			case 'amount' :
321
-				$this->__set( 'orderby', 'meta_value_num' );
322
-				$this->__set( 'meta_key', '_give_payment_total' );
321
+				$this->__set('orderby', 'meta_value_num');
322
+				$this->__set('meta_key', '_give_payment_total');
323 323
 				break;
324 324
 
325 325
 			case 'status' :
326
-				$this->__set( 'orderby', 'post_status' );
326
+				$this->__set('orderby', 'post_status');
327 327
 				break;
328 328
 
329 329
 			case 'donation_form' :
330
-				$this->__set( 'orderby', 'meta_value' );
331
-				$this->__set( 'meta_key', '_give_payment_form_title' );
330
+				$this->__set('orderby', 'meta_value');
331
+				$this->__set('meta_key', '_give_payment_form_title');
332 332
 				break;
333 333
 
334 334
 			default :
335
-				$this->__set( 'orderby', $this->args['orderby'] );
335
+				$this->__set('orderby', $this->args['orderby']);
336 336
 				break;
337 337
 		}
338 338
 	}
@@ -349,15 +349,15 @@  discard block
 block discarded – undo
349 349
 	 *
350 350
 	 * @return mixed
351 351
 	 */
352
-	public function custom_orderby( $order, $query ) {
353
-		$post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] );
354
-		if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) {
352
+	public function custom_orderby($order, $query) {
353
+		$post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']);
354
+		if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) {
355 355
 			return $order;
356 356
 		}
357 357
 
358
-		switch ( $query->query['orderby'] ) {
358
+		switch ($query->query['orderby']) {
359 359
 			case 'post_status':
360
-				$order = 'wp_posts.post_status ' . strtoupper( $query->query['order'] );
360
+				$order = 'wp_posts.post_status '.strtoupper($query->query['order']);
361 361
 				break;
362 362
 		}
363 363
 
@@ -373,20 +373,20 @@  discard block
 block discarded – undo
373 373
 	 * @return void
374 374
 	 */
375 375
 	public function user() {
376
-		if ( is_null( $this->args['user'] ) ) {
376
+		if (is_null($this->args['user'])) {
377 377
 			return;
378 378
 		}
379 379
 
380
-		if ( is_numeric( $this->args['user'] ) ) {
380
+		if (is_numeric($this->args['user'])) {
381 381
 			$user_key = '_give_payment_user_id';
382 382
 		} else {
383 383
 			$user_key = '_give_payment_user_email';
384 384
 		}
385 385
 
386
-		$this->__set( 'meta_query', array(
386
+		$this->__set('meta_query', array(
387 387
 			'key'   => $user_key,
388 388
 			'value' => $this->args['user'],
389
-		) );
389
+		));
390 390
 	}
391 391
 
392 392
 	/**
@@ -399,33 +399,33 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	public function search() {
401 401
 
402
-		if ( ! isset( $this->args['s'] ) ) {
402
+		if ( ! isset($this->args['s'])) {
403 403
 			return;
404 404
 		}
405 405
 
406
-		$search = trim( $this->args['s'] );
406
+		$search = trim($this->args['s']);
407 407
 
408
-		if ( empty( $search ) ) {
408
+		if (empty($search)) {
409 409
 			return;
410 410
 		}
411 411
 
412
-		$is_email = is_email( $search ) || strpos( $search, '@' ) !== false;
413
-		$is_user  = strpos( $search, strtolower( 'user:' ) ) !== false;
412
+		$is_email = is_email($search) || strpos($search, '@') !== false;
413
+		$is_user  = strpos($search, strtolower('user:')) !== false;
414 414
 
415
-		if ( ! empty( $this->args['search_in_notes'] ) ) {
415
+		if ( ! empty($this->args['search_in_notes'])) {
416 416
 
417
-			$notes = give_get_payment_notes( 0, $search );
417
+			$notes = give_get_payment_notes(0, $search);
418 418
 
419
-			if ( ! empty( $notes ) ) {
419
+			if ( ! empty($notes)) {
420 420
 
421
-				$payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' );
421
+				$payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID');
422 422
 
423
-				$this->__set( 'post__in', $payment_ids );
423
+				$this->__set('post__in', $payment_ids);
424 424
 			}
425 425
 
426
-			$this->__unset( 's' );
426
+			$this->__unset('s');
427 427
 
428
-		} elseif ( $is_email || strlen( $search ) == 32 ) {
428
+		} elseif ($is_email || strlen($search) == 32) {
429 429
 
430 430
 			$key         = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key';
431 431
 			$search_meta = array(
@@ -434,19 +434,19 @@  discard block
 block discarded – undo
434 434
 				'compare' => 'LIKE',
435 435
 			);
436 436
 
437
-			$this->__set( 'meta_query', $search_meta );
438
-			$this->__unset( 's' );
437
+			$this->__set('meta_query', $search_meta);
438
+			$this->__unset('s');
439 439
 
440
-		} elseif ( $is_user ) {
440
+		} elseif ($is_user) {
441 441
 
442 442
 			$search_meta = array(
443 443
 				'key'   => '_give_payment_user_id',
444
-				'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ),
444
+				'value' => trim(str_replace('user:', '', strtolower($search))),
445 445
 			);
446 446
 
447
-			$this->__set( 'meta_query', $search_meta );
447
+			$this->__set('meta_query', $search_meta);
448 448
 
449
-			if ( give_get_option( 'enable_sequential' ) ) {
449
+			if (give_get_option('enable_sequential')) {
450 450
 
451 451
 				$search_meta = array(
452 452
 					'key'     => '_give_payment_number',
@@ -454,19 +454,19 @@  discard block
 block discarded – undo
454 454
 					'compare' => 'LIKE',
455 455
 				);
456 456
 
457
-				$this->__set( 'meta_query', $search_meta );
457
+				$this->__set('meta_query', $search_meta);
458 458
 
459 459
 				$this->args['meta_query']['relation'] = 'OR';
460 460
 
461 461
 			}
462 462
 
463
-			$this->__unset( 's' );
463
+			$this->__unset('s');
464 464
 
465 465
 		} elseif (
466
-			give_get_option( 'enable_sequential' ) &&
466
+			give_get_option('enable_sequential') &&
467 467
 			(
468
-				false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) ||
469
-				false !== strpos( $search, give_get_option( 'sequential_postfix' ) )
468
+				false !== strpos($search, give_get_option('sequential_prefix')) ||
469
+				false !== strpos($search, give_get_option('sequential_postfix'))
470 470
 			)
471 471
 		) {
472 472
 
@@ -476,29 +476,29 @@  discard block
 block discarded – undo
476 476
 				'compare' => 'LIKE',
477 477
 			);
478 478
 
479
-			$this->__set( 'meta_query', $search_meta );
480
-			$this->__unset( 's' );
479
+			$this->__set('meta_query', $search_meta);
480
+			$this->__unset('s');
481 481
 
482
-		} elseif ( is_numeric( $search ) ) {
482
+		} elseif (is_numeric($search)) {
483 483
 
484
-			$post = get_post( $search );
484
+			$post = get_post($search);
485 485
 
486
-			if ( is_object( $post ) && $post->post_type == 'give_payment' ) {
486
+			if (is_object($post) && $post->post_type == 'give_payment') {
487 487
 
488 488
 				$arr   = array();
489 489
 				$arr[] = $search;
490
-				$this->__set( 'post__in', $arr );
491
-				$this->__unset( 's' );
490
+				$this->__set('post__in', $arr);
491
+				$this->__unset('s');
492 492
 			}
493
-		} elseif ( '#' == substr( $search, 0, 1 ) ) {
493
+		} elseif ('#' == substr($search, 0, 1)) {
494 494
 
495
-			$search = str_replace( '#:', '', $search );
496
-			$search = str_replace( '#', '', $search );
497
-			$this->__set( 'give_forms', $search );
498
-			$this->__unset( 's' );
495
+			$search = str_replace('#:', '', $search);
496
+			$search = str_replace('#', '', $search);
497
+			$this->__set('give_forms', $search);
498
+			$this->__unset('s');
499 499
 
500 500
 		} else {
501
-			$this->__set( 's', $search );
501
+			$this->__set('s', $search);
502 502
 
503 503
 		}
504 504
 
@@ -513,16 +513,16 @@  discard block
 block discarded – undo
513 513
 	 * @return void
514 514
 	 */
515 515
 	public function mode() {
516
-		if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) {
517
-			$this->__unset( 'mode' );
516
+		if (empty($this->args['mode']) || $this->args['mode'] == 'all') {
517
+			$this->__unset('mode');
518 518
 
519 519
 			return;
520 520
 		}
521 521
 
522
-		$this->__set( 'meta_query', array(
522
+		$this->__set('meta_query', array(
523 523
 			'key'   => '_give_payment_mode',
524 524
 			'value' => $this->args['mode'],
525
-		) );
525
+		));
526 526
 	}
527 527
 
528 528
 	/**
@@ -534,10 +534,10 @@  discard block
 block discarded – undo
534 534
 	 * @return void
535 535
 	 */
536 536
 	public function children() {
537
-		if ( empty( $this->args['children'] ) ) {
538
-			$this->__set( 'post_parent', 0 );
537
+		if (empty($this->args['children'])) {
538
+			$this->__set('post_parent', 0);
539 539
 		}
540
-		$this->__unset( 'children' );
540
+		$this->__unset('children');
541 541
 	}
542 542
 
543 543
 	/**
@@ -550,25 +550,25 @@  discard block
 block discarded – undo
550 550
 	 */
551 551
 	public function give_forms() {
552 552
 
553
-		if ( empty( $this->args['give_forms'] ) ) {
553
+		if (empty($this->args['give_forms'])) {
554 554
 			return;
555 555
 		}
556 556
 
557 557
 		$compare = '=';
558 558
 
559
-		if ( is_array( $this->args['give_forms'] ) ) {
559
+		if (is_array($this->args['give_forms'])) {
560 560
 			$compare = 'IN';
561 561
 		}
562 562
 
563
-		$this->__set( 'meta_query', array(
563
+		$this->__set('meta_query', array(
564 564
 			array(
565 565
 				'key'     => '_give_payment_form_id',
566 566
 				'value'   => $this->args['give_forms'],
567 567
 				'compare' => $compare,
568 568
 			),
569
-		) );
569
+		));
570 570
 
571
-		$this->__unset( 'give_forms' );
571
+		$this->__unset('give_forms');
572 572
 
573 573
 	}
574 574
 
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-system-info.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_System_Info' ) ) :
16
+if ( ! class_exists('Give_Settings_System_Info')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_System_Info.
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'system-info';
46
-			$this->label = esc_html__( 'System Info', 'give' );
46
+			$this->label = esc_html__('System Info', 'give');
47 47
 
48
-			add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) );
48
+			add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-tools_settings_{$this->id}_page", array($this, 'output'));
50 50
 
51 51
 			// Do not use main form for this tab.
52
-			if( give_get_current_setting_tab() === $this->id ) {
53
-				add_action( "give-tools_open_form", '__return_empty_string' );
54
-				add_action( "give-tools_close_form", '__return_empty_string' );
52
+			if (give_get_current_setting_tab() === $this->id) {
53
+				add_action("give-tools_open_form", '__return_empty_string');
54
+				add_action("give-tools_close_form", '__return_empty_string');
55 55
 			}
56 56
 		}
57 57
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 		 * @param  array $pages Lst of pages.
63 63
 		 * @return array
64 64
 		 */
65
-		public function add_settings_page( $pages ) {
66
-			$pages[ $this->id ] = $this->label;
65
+		public function add_settings_page($pages) {
66
+			$pages[$this->id] = $this->label;
67 67
 
68 68
 			return $pages;
69 69
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		 */
77 77
 		public function output() {
78 78
 			$GLOBALS['give_hide_save_button'] = true;
79
-			include_once( 'views/html-admin-page-system-info.php' );
79
+			include_once('views/html-admin-page-system-info.php');
80 80
 		}
81 81
 	}
82 82
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-form-reports-table.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
55
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
55
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
56 56
 			'ajax'     => false                        // Does this table support ajax?
57
-		) );
57
+		));
58 58
 
59
-		add_action( 'give_report_view_actions', array( $this, 'category_filter' ) );
59
+		add_action('give_report_view_actions', array($this, 'category_filter'));
60 60
 		$this->query();
61 61
 
62 62
 	}
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string Column Name
74 74
 	 */
75
-	public function column_default( $item, $column_name ) {
76
-		switch ( $column_name ) {
75
+	public function column_default($item, $column_name) {
76
+		switch ($column_name) {
77 77
 			case 'earnings' :
78
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
78
+				return give_currency_filter(give_format_amount($item[$column_name]));
79 79
 			case 'average_sales' :
80
-				return round( $item[ $column_name ] );
80
+				return round($item[$column_name]);
81 81
 			case 'average_earnings' :
82
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
82
+				return give_currency_filter(give_format_amount($item[$column_name]));
83 83
 			case 'details' :
84
-				return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>';
84
+				return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>';
85 85
 			default:
86
-				return $item[ $column_name ];
86
+				return $item[$column_name];
87 87
 		}
88 88
 	}
89 89
 
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function get_columns() {
98 98
 		$columns = array(
99
-			'title'            => esc_html__( 'Form', 'give' ),
100
-			'sales'            => esc_html__( 'Donations', 'give' ),
101
-			'earnings'         => esc_html__( 'Income', 'give' ),
102
-			'average_sales'    => esc_html__( 'Monthly Average Donations', 'give' ),
103
-			'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ),
104
-			'details'          => esc_html__( 'Detailed Report', 'give' )
99
+			'title'            => esc_html__('Form', 'give'),
100
+			'sales'            => esc_html__('Donations', 'give'),
101
+			'earnings'         => esc_html__('Income', 'give'),
102
+			'average_sales'    => esc_html__('Monthly Average Donations', 'give'),
103
+			'average_earnings' => esc_html__('Monthly Average Income', 'give'),
104
+			'details'          => esc_html__('Detailed Report', 'give')
105 105
 		);
106 106
 
107 107
 		return $columns;
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function get_sortable_columns() {
118 118
 		return array(
119
-			'title'    => array( 'title', true ),
120
-			'sales'    => array( 'sales', false ),
121
-			'earnings' => array( 'earnings', false ),
119
+			'title'    => array('title', true),
120
+			'sales'    => array('sales', false),
121
+			'earnings' => array('earnings', false),
122 122
 		);
123 123
 	}
124 124
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @return int Current page number
131 131
 	 */
132 132
 	public function get_paged() {
133
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
133
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
134 134
 	}
135 135
 
136 136
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return int Category ID
143 143
 	 */
144 144
 	public function get_category() {
145
-		return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0;
145
+		return isset($_GET['category']) ? absint($_GET['category']) : 0;
146 146
 	}
147 147
 
148 148
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function get_total_forms() {
157 157
 		$total  = 0;
158
-		$counts = wp_count_posts( 'give_forms', 'readable' );
159
-		foreach ( $counts as $status => $count ) {
158
+		$counts = wp_count_posts('give_forms', 'readable');
159
+		foreach ($counts as $status => $count) {
160 160
 			$total += $count;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @since  1.0
171 171
 	 * @return void
172 172
 	 */
173
-	public function bulk_actions( $which = '' ) {
173
+	public function bulk_actions($which = '') {
174 174
 
175 175
 	}
176 176
 
@@ -182,27 +182,27 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @param string $which
184 184
 	 */
185
-	protected function display_tablenav( $which ) {
185
+	protected function display_tablenav($which) {
186 186
 
187
-		if ( 'top' === $which ) {
188
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
187
+		if ('top' === $which) {
188
+			wp_nonce_field('bulk-'.$this->_args['plural']);
189 189
 		}
190 190
 		?>
191
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
191
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
192 192
 
193
-			<?php if ( 'top' === $which ) { ?>
193
+			<?php if ('top' === $which) { ?>
194 194
 				<h3 class="alignleft reports-earnings-title">
195
-					<span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span>
195
+					<span><?php esc_html_e('Donation Forms Report', 'give'); ?></span>
196 196
 				</h3>
197 197
 			<?php } ?>
198 198
 
199 199
 			<div class="alignright tablenav-right">
200 200
 				<div class="actions bulkactions">
201
-					<?php $this->bulk_actions( $which ); ?>
201
+					<?php $this->bulk_actions($which); ?>
202 202
 				</div>
203 203
 				<?php
204
-				$this->extra_tablenav( $which );
205
-				$this->pagination( $which );
204
+				$this->extra_tablenav($which);
205
+				$this->pagination($which);
206 206
 				?>
207 207
 			</div>
208 208
 
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public function category_filter() {
224 224
 
225
-		$categories = get_terms( 'form_category' );
226
-		if ( $categories && ! is_wp_error( $categories ) ) {
227
-			echo Give()->html->category_dropdown( 'category', $this->get_category() );
225
+		$categories = get_terms('form_category');
226
+		if ($categories && ! is_wp_error($categories)) {
227
+			echo Give()->html->category_dropdown('category', $this->get_category());
228 228
 		}
229 229
 	}
230 230
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	public function query() {
240 240
 
241
-		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title';
242
-		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
241
+		$orderby  = isset($_GET['orderby']) ? $_GET['orderby'] : 'title';
242
+		$order    = isset($_GET['order']) ? $_GET['order'] : 'DESC';
243 243
 		$category = $this->get_category();
244 244
 
245 245
 		$args = array(
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			'suppress_filters' => true
253 253
 		);
254 254
 
255
-		if ( ! empty( $category ) ) {
255
+		if ( ! empty($category)) {
256 256
 			$args['tax_query'] = array(
257 257
 				array(
258 258
 					'taxonomy' => 'form_category',
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 			);
262 262
 		}
263 263
 
264
-		switch ( $orderby ) :
264
+		switch ($orderby) :
265 265
 			case 'title' :
266 266
 				$args['orderby'] = 'title';
267 267
 				break;
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
 				break;
278 278
 		endswitch;
279 279
 
280
-		$args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this );
280
+		$args = apply_filters('give_form_reports_prepare_items_args', $args, $this);
281 281
 
282
-		$this->products = new WP_Query( $args );
282
+		$this->products = new WP_Query($args);
283 283
 
284 284
 	}
285 285
 
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
 
296 296
 		$give_forms = $this->products->posts;
297 297
 
298
-		if ( $give_forms ) {
299
-			foreach ( $give_forms as $form ) {
298
+		if ($give_forms) {
299
+			foreach ($give_forms as $form) {
300 300
 				$reports_data[] = array(
301 301
 					'ID'               => $form,
302
-					'title'            => get_the_title( $form ),
303
-					'sales'            => give_get_form_sales_stats( $form ),
304
-					'earnings'         => give_get_form_earnings_stats( $form ),
305
-					'average_sales'    => give_get_average_monthly_form_sales( $form ),
306
-					'average_earnings' => give_get_average_monthly_form_earnings( $form )
302
+					'title'            => get_the_title($form),
303
+					'sales'            => give_get_form_sales_stats($form),
304
+					'earnings'         => give_get_form_earnings_stats($form),
305
+					'average_sales'    => give_get_average_monthly_form_sales($form),
306
+					'average_earnings' => give_get_average_monthly_form_earnings($form)
307 307
 				);
308 308
 			}
309 309
 		}
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
 		$sortable = $this->get_sortable_columns();
333 333
 
334
-		$this->_column_headers = array( $columns, $hidden, $sortable );
334
+		$this->_column_headers = array($columns, $hidden, $sortable);
335 335
 
336 336
 		$data = $this->reports_data();
337 337
 
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
 
340 340
 		$this->items = $data;
341 341
 
342
-		$this->set_pagination_args( array(
342
+		$this->set_pagination_args(array(
343 343
 				'total_items' => $total_items,
344 344
 				'per_page'    => $this->per_page,
345
-				'total_pages' => ceil( $total_items / $this->per_page )
345
+				'total_pages' => ceil($total_items / $this->per_page)
346 346
 			)
347 347
 		);
348 348
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateways-reports-table.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 
54 54
 	}
55 55
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
68
-		switch ( $column_name ) {
67
+	public function column_default($item, $column_name) {
68
+		switch ($column_name) {
69 69
 			default:
70
-				return $item[ $column_name ];
70
+				return $item[$column_name];
71 71
 		}
72 72
 	}
73 73
 
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function get_columns() {
82 82
 		$columns = array(
83
-			'label'           => esc_attr__( 'Gateway', 'give' ),
84
-			'complete_sales'  => esc_attr__( 'Complete Transactions', 'give' ),
85
-			'pending_sales'   => esc_attr__( 'Pending / Failed Transactions', 'give' ),
86
-			'total_sales'     => esc_attr__( 'Total Transactions', 'give' ),
87
-			'total_donations' => esc_attr__( 'Total Donated', 'give' )
83
+			'label'           => esc_attr__('Gateway', 'give'),
84
+			'complete_sales'  => esc_attr__('Complete Transactions', 'give'),
85
+			'pending_sales'   => esc_attr__('Pending / Failed Transactions', 'give'),
86
+			'total_sales'     => esc_attr__('Total Transactions', 'give'),
87
+			'total_donations' => esc_attr__('Total Donated', 'give')
88 88
 		);
89 89
 
90 90
 		return $columns;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return int Current page number
100 100
 	 */
101 101
 	public function get_paged() {
102
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
102
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
103 103
 	}
104 104
 
105 105
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @since  1.0
111 111
 	 * @return void
112 112
 	 */
113
-	public function bulk_actions( $which = '' ) {
113
+	public function bulk_actions($which = '') {
114 114
 
115 115
 	}
116 116
 
@@ -122,27 +122,27 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @param string $which
124 124
 	 */
125
-	protected function display_tablenav( $which ) {
125
+	protected function display_tablenav($which) {
126 126
 
127
-		if ( 'top' === $which ) {
128
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
127
+		if ('top' === $which) {
128
+			wp_nonce_field('bulk-'.$this->_args['plural']);
129 129
 		}
130 130
 		?>
131
-		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
131
+		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>">
132 132
 
133
-			<?php if ( 'top' === $which ) { ?>
133
+			<?php if ('top' === $which) { ?>
134 134
 				<h3 class="alignleft reports-earnings-title">
135
-					<span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span>
135
+					<span><?php esc_html_e('Donation Methods Report', 'give'); ?></span>
136 136
 				</h3>
137 137
 			<?php } ?>
138 138
 
139 139
 			<div class="alignright tablenav-right">
140 140
 				<div class="actions bulkactions">
141
-					<?php $this->bulk_actions( $which ); ?>
141
+					<?php $this->bulk_actions($which); ?>
142 142
 				</div>
143 143
 				<?php
144
-				$this->extra_tablenav( $which );
145
-				$this->pagination( $which );
144
+				$this->extra_tablenav($which);
145
+				$this->pagination($which);
146 146
 				?>
147 147
 			</div>
148 148
 
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
 		$gateways     = give_get_payment_gateways();
168 168
 		$stats        = new Give_Payment_Stats();
169 169
 
170
-		foreach ( $gateways as $gateway_id => $gateway ) {
170
+		foreach ($gateways as $gateway_id => $gateway) {
171 171
 
172
-			$complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' );
173
-			$pending_count  = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) );
172
+			$complete_count = give_count_sales_by_gateway($gateway_id, 'publish');
173
+			$pending_count  = give_count_sales_by_gateway($gateway_id, array('pending', 'failed'));
174 174
 
175 175
 			$reports_data[] = array(
176 176
 				'ID'              => $gateway_id,
177 177
 				'label'           => $gateway['admin_label'],
178
-				'complete_sales'  => give_format_amount( $complete_count, false ),
179
-				'pending_sales'   => give_format_amount( $pending_count, false ),
180
-				'total_sales'     => give_format_amount( $complete_count + $pending_count, false ),
181
-				'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) )
178
+				'complete_sales'  => give_format_amount($complete_count, false),
179
+				'pending_sales'   => give_format_amount($pending_count, false),
180
+				'total_sales'     => give_format_amount($complete_count + $pending_count, false),
181
+				'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id)))
182 182
 			);
183 183
 		}
184 184
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		$columns               = $this->get_columns();
201 201
 		$hidden                = array(); // No hidden columns
202 202
 		$sortable              = $this->get_sortable_columns();
203
-		$this->_column_headers = array( $columns, $hidden, $sortable );
203
+		$this->_column_headers = array($columns, $hidden, $sortable);
204 204
 		$this->items           = $this->reports_data();
205 205
 
206 206
 	}
Please login to merge, or discard this patch.