Test Failed
Push — master ( 25adfe...70178c )
by Devin
01:46
created
includes/payments/actions.php 1 patch
Spacing   +57 added lines, -57 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
 
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return void
30 30
  */
31
-function give_complete_purchase( $payment_id, $new_status, $old_status ) {
31
+function give_complete_purchase($payment_id, $new_status, $old_status) {
32 32
 
33 33
 	// Make sure that payments are only completed once.
34
-	if ( $old_status == 'publish' || $old_status == 'complete' ) {
34
+	if ($old_status == 'publish' || $old_status == 'complete') {
35 35
 		return;
36 36
 	}
37 37
 
38 38
 	// Make sure the payment completion is only processed when new status is complete.
39
-	if ( $new_status != 'publish' && $new_status != 'complete' ) {
39
+	if ($new_status != 'publish' && $new_status != 'complete') {
40 40
 		return;
41 41
 	}
42 42
 
43
-	$payment = new Give_Payment( $payment_id );
43
+	$payment = new Give_Payment($payment_id);
44 44
 
45
-	$creation_date  = get_post_field( 'post_date', $payment_id, 'raw' );
45
+	$creation_date  = get_post_field('post_date', $payment_id, 'raw');
46 46
 	$payment_meta   = $payment->payment_meta;
47 47
 	$completed_date = $payment->completed_date;
48 48
 	$user_info      = $payment->user_info;
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @param int $payment_id The ID of the payment.
60 60
 	 */
61
-	do_action( 'give_pre_complete_donation', $payment_id );
61
+	do_action('give_pre_complete_donation', $payment_id);
62 62
 
63 63
 	// Ensure these actions only run once, ever.
64
-	if ( empty( $completed_date ) ) {
64
+	if (empty($completed_date)) {
65 65
 
66
-		give_record_donation_in_log( $form_id, $payment_id, $price_id, $creation_date );
66
+		give_record_donation_in_log($form_id, $payment_id, $price_id, $creation_date);
67 67
 
68 68
 		/**
69 69
 		 * Fires after logging donation record.
@@ -74,29 +74,29 @@  discard block
 block discarded – undo
74 74
 		 * @param int $payment_id The ID number of the payment.
75 75
 		 * @param array $payment_meta The payment meta.
76 76
 		 */
77
-		do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta );
77
+		do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta);
78 78
 
79 79
 	}
80 80
 
81 81
 	// Increase the earnings for this form ID.
82
-	give_increase_earnings( $form_id, $amount );
83
-	give_increase_donation_count( $form_id );
82
+	give_increase_earnings($form_id, $amount);
83
+	give_increase_donation_count($form_id);
84 84
 
85 85
 	// @todo: Refresh only range related stat cache
86 86
 	give_delete_donation_stats();
87 87
 
88 88
 	// Increase the donor's donation stats.
89
-	$donor = new Give_Donor( $donor_id );
89
+	$donor = new Give_Donor($donor_id);
90 90
 	$donor->increase_purchase_count();
91
-	$donor->increase_value( $amount );
91
+	$donor->increase_value($amount);
92 92
 
93
-	give_increase_total_earnings( $amount );
93
+	give_increase_total_earnings($amount);
94 94
 
95 95
 	// Ensure this action only runs once ever.
96
-	if ( empty( $completed_date ) ) {
96
+	if (empty($completed_date)) {
97 97
 
98 98
 		// Save the completed date.
99
-		$payment->completed_date = current_time( 'mysql' );
99
+		$payment->completed_date = current_time('mysql');
100 100
 		$payment->save();
101 101
 
102 102
 		/**
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @param int $payment_id The ID of the payment.
108 108
 		 */
109
-		do_action( 'give_complete_donation', $payment_id );
109
+		do_action('give_complete_donation', $payment_id);
110 110
 	}
111 111
 
112 112
 }
113 113
 
114
-add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 );
114
+add_action('give_update_payment_status', 'give_complete_purchase', 100, 3);
115 115
 
116 116
 
117 117
 /**
@@ -125,20 +125,20 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return void
127 127
  */
128
-function give_record_status_change( $payment_id, $new_status, $old_status ) {
128
+function give_record_status_change($payment_id, $new_status, $old_status) {
129 129
 
130 130
 	// Get the list of statuses so that status in the payment note can be translated.
131 131
 	$stati      = give_get_payment_statuses();
132
-	$old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
133
-	$new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
132
+	$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
133
+	$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
134 134
 
135 135
 	// translators: 1: old status 2: new status.
136
-	$status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status );
136
+	$status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status);
137 137
 
138
-	give_insert_payment_note( $payment_id, $status_change );
138
+	give_insert_payment_note($payment_id, $status_change);
139 139
 }
140 140
 
141
-add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 );
141
+add_action('give_update_payment_status', 'give_record_status_change', 100, 3);
142 142
 
143 143
 
144 144
 /**
@@ -154,25 +154,25 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @return void
156 156
  */
157
-function give_update_old_payments_with_totals( $data ) {
158
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) {
157
+function give_update_old_payments_with_totals($data) {
158
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
159 159
 		return;
160 160
 	}
161 161
 
162
-	if ( get_option( 'give_payment_totals_upgraded' ) ) {
162
+	if (get_option('give_payment_totals_upgraded')) {
163 163
 		return;
164 164
 	}
165 165
 
166
-	$payments = give_get_payments( array(
166
+	$payments = give_get_payments(array(
167 167
 		'offset' => 0,
168
-		'number' => - 1,
168
+		'number' => -1,
169 169
 		'mode'   => 'all',
170
-	) );
170
+	));
171 171
 
172
-	if ( $payments ) {
173
-		foreach ( $payments as $payment ) {
172
+	if ($payments) {
173
+		foreach ($payments as $payment) {
174 174
 
175
-			$payment = new Give_Payment( $payment->ID );
175
+			$payment = new Give_Payment($payment->ID);
176 176
 			$meta    = $payment->get_meta();
177 177
 
178 178
 			$payment->total = $meta['amount'];
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 		}
182 182
 	}
183 183
 
184
-	add_option( 'give_payment_totals_upgraded', 1 );
184
+	add_option('give_payment_totals_upgraded', 1);
185 185
 }
186 186
 
187
-add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' );
187
+add_action('give_upgrade_payments', 'give_update_old_payments_with_totals');
188 188
 
189 189
 /**
190 190
  * Mark Abandoned Donations
@@ -198,17 +198,17 @@  discard block
 block discarded – undo
198 198
 function give_mark_abandoned_donations() {
199 199
 	$args = array(
200 200
 		'status' => 'pending',
201
-		'number' => - 1,
201
+		'number' => -1,
202 202
 		'output' => 'give_payments',
203 203
 	);
204 204
 
205
-	add_filter( 'posts_where', 'give_filter_where_older_than_week' );
205
+	add_filter('posts_where', 'give_filter_where_older_than_week');
206 206
 
207
-	$payments = give_get_payments( $args );
207
+	$payments = give_get_payments($args);
208 208
 
209
-	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
209
+	remove_filter('posts_where', 'give_filter_where_older_than_week');
210 210
 
211
-	if ( $payments ) {
211
+	if ($payments) {
212 212
 		/**
213 213
 		 * Filter payment gateways:  Used to set payment gateways which can be skip while transferring pending payment to abandon.
214 214
 		 *
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 		 *
217 217
 		 * @param array $skip_payment_gateways Array of payment gateways
218 218
 		 */
219
-		$skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) );
219
+		$skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline'));
220 220
 
221
-		foreach ( $payments as $payment ) {
222
-			$gateway = give_get_payment_gateway( $payment );
221
+		foreach ($payments as $payment) {
222
+			$gateway = give_get_payment_gateway($payment);
223 223
 
224 224
 			// Skip payment gateways.
225
-			if ( in_array( $gateway, $skip_payment_gateways ) ) {
225
+			if (in_array($gateway, $skip_payment_gateways)) {
226 226
 				continue;
227 227
 			}
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	}
233 233
 }
234 234
 
235
-Give_Cron::add_weekly_event( 'give_mark_abandoned_donations' );
235
+Give_Cron::add_weekly_event('give_mark_abandoned_donations');
236 236
 
237 237
 
238 238
 /**
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
  *
245 245
  * @return void
246 246
  */
247
-function give_refresh_thismonth_stat_transients( $payment_ID ) {
247
+function give_refresh_thismonth_stat_transients($payment_ID) {
248 248
 	// Monthly stats.
249
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
249
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
250 250
 
251 251
 	// @todo: Refresh only range related stat cache
252 252
 	give_delete_donation_stats();
253 253
 }
254 254
 
255
-add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' );
255
+add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients');
256 256
 
257 257
 /*
258 258
  * Add meta in payment that store page id and page url.
@@ -264,18 +264,18 @@  discard block
 block discarded – undo
264 264
  *
265 265
  * @param {integer} $payment_id Payment id for which the meta value should be updated.
266 266
  */
267
-function give_payment_save_page_data( $payment_id ) {
268
-	$page_url = ( ! empty( $_REQUEST['give-current-url'] ) ? esc_url( $_REQUEST['give-current-url'] ) : false );
267
+function give_payment_save_page_data($payment_id) {
268
+	$page_url = ( ! empty($_REQUEST['give-current-url']) ? esc_url($_REQUEST['give-current-url']) : false);
269 269
 	// Check $page_url is not empty.
270
-	if ( $page_url ) {
271
-		update_post_meta( $payment_id, '_give_current_url', $page_url );
272
-		$page_id = url_to_postid( $page_url );
270
+	if ($page_url) {
271
+		update_post_meta($payment_id, '_give_current_url', $page_url);
272
+		$page_id = url_to_postid($page_url);
273 273
 		// Check $page_id is not empty.
274
-		if ( $page_id ) {
275
-			update_post_meta( $payment_id, '_give_current_page_id', $page_id );
274
+		if ($page_id) {
275
+			update_post_meta($payment_id, '_give_current_page_id', $page_id);
276 276
 		}
277 277
 	}
278 278
 }
279 279
 
280 280
 // Fire when payment is save.
281
-add_action( 'give_insert_payment', 'give_payment_save_page_data' );
282 281
\ No newline at end of file
282
+add_action('give_insert_payment', 'give_payment_save_page_data');
283 283
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return static
52 52
 	 */
53 53
 	public static function get_instance() {
54
-		if ( null === static::$instance ) {
54
+		if (null === static::$instance) {
55 55
 			self::$instance = new static();
56 56
 			self::$instance->setup();
57 57
 		}
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	 * @since 1.8.13
67 67
 	 */
68 68
 	private function setup() {
69
-		add_filter( 'cron_schedules', array( self::$instance, '__add_schedules' ) );
70
-		add_action( 'wp', array( self::$instance, '__schedule_events' ) );
69
+		add_filter('cron_schedules', array(self::$instance, '__add_schedules'));
70
+		add_action('wp', array(self::$instance, '__schedule_events'));
71 71
 
72 72
 		// Load async event only when cron is running.
73
-		if( defined( 'DOING_CRON' ) && DOING_CRON ) {
74
-			add_action( 'init', array( self::$instance, '__load_async_events' ) );
73
+		if (defined('DOING_CRON') && DOING_CRON) {
74
+			add_action('init', array(self::$instance, '__load_async_events'));
75 75
 		}
76 76
 	}
77 77
 
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
 	 * @since 1.8.13
83 83
 	 */
84 84
 	public function __load_async_events() {
85
-		$async_events = get_option( 'give_async_events', array() );
85
+		$async_events = get_option('give_async_events', array());
86 86
 
87 87
 		// Bailout.
88
-		if ( empty( $async_events ) ) {
88
+		if (empty($async_events)) {
89 89
 			return;
90 90
 		}
91 91
 
92
-		foreach ( $async_events as $index => $event ) {
92
+		foreach ($async_events as $index => $event) {
93 93
 			// Set cron name.
94 94
 			$cron_name = "give_async_scheduled_events_{$index}";
95 95
 
96 96
 			// Setup cron.
97
-			wp_schedule_single_event( current_time( 'timestamp', 1 ), $cron_name, $event['params'] );
97
+			wp_schedule_single_event(current_time('timestamp', 1), $cron_name, $event['params']);
98 98
 
99 99
 			// Add cron action.
100
-			add_action( $cron_name, $event['callback'], 10, count( $event['params'] ) );
101
-			add_action( $cron_name, array( $this, '__delete_async_events' ), 9999, 0 );
100
+			add_action($cron_name, $event['callback'], 10, count($event['params']));
101
+			add_action($cron_name, array($this, '__delete_async_events'), 9999, 0);
102 102
 		}
103 103
 	}
104 104
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 	 * @since 1.8.13
109 109
 	 */
110 110
 	public function __delete_async_events() {
111
-		$async_events    = get_option( 'give_async_events', array() );
112
-		$cron_name_parts = explode( '_', current_action() );
113
-		$cron_id         = end( $cron_name_parts );
111
+		$async_events    = get_option('give_async_events', array());
112
+		$cron_name_parts = explode('_', current_action());
113
+		$cron_id         = end($cron_name_parts);
114 114
 
115
-		if ( ! empty( $async_events[ $cron_id ] ) ) {
116
-			unset( $async_events[ $cron_id ] );
117
-			update_option( 'give_async_events', $async_events );
115
+		if ( ! empty($async_events[$cron_id])) {
116
+			unset($async_events[$cron_id]);
117
+			update_option('give_async_events', $async_events);
118 118
 		}
119 119
 	}
120 120
 
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return array            An array of non-default cron schedules.
130 130
 	 */
131
-	public function __add_schedules( $schedules = array() ) {
131
+	public function __add_schedules($schedules = array()) {
132 132
 		// Adds once weekly to the existing schedules.
133 133
 		$schedules['weekly'] = array(
134 134
 			'interval' => 604800,
135
-			'display'  => __( 'Once Weekly', 'give' ),
135
+			'display'  => __('Once Weekly', 'give'),
136 136
 		);
137 137
 
138 138
 		return $schedules;
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @return void
161 161
 	 */
162 162
 	private function weekly_events() {
163
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
164
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
163
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
164
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
165 165
 		}
166 166
 	}
167 167
 
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @return void
175 175
 	 */
176 176
 	private function daily_events() {
177
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
178
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
177
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
178
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
179 179
 		}
180 180
 	}
181 181
 
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @return string
191 191
 	 */
192
-	public static function get_cron_action( $type = 'weekly' ) {
193
-		switch ( $type ) {
192
+	public static function get_cron_action($type = 'weekly') {
193
+		switch ($type) {
194 194
 			case 'daily':
195 195
 				$cron_action = 'give_daily_scheduled_events';
196 196
 				break;
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 	 * @param        $action
213 213
 	 * @param string $type
214 214
 	 */
215
-	private static function add_event( $action, $type = 'weekly' ) {
216
-		$cron_event = self::get_cron_action( $type );
217
-		add_action( $cron_event, $action );
215
+	private static function add_event($action, $type = 'weekly') {
216
+		$cron_event = self::get_cron_action($type);
217
+		add_action($cron_event, $action);
218 218
 	}
219 219
 
220 220
 	/**
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @param $action
227 227
 	 */
228
-	public static function add_weekly_event( $action ) {
229
-		self::add_event( $action, 'weekly' );
228
+	public static function add_weekly_event($action) {
229
+		self::add_event($action, 'weekly');
230 230
 	}
231 231
 
232 232
 	/**
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @param $action
239 239
 	 */
240
-	public static function add_daily_event( $action ) {
241
-		self::add_event( $action, 'daily' );
240
+	public static function add_daily_event($action) {
241
+		self::add_event($action, 'daily');
242 242
 	}
243 243
 
244 244
 	/**
@@ -251,17 +251,17 @@  discard block
 block discarded – undo
251 251
 	 * @param string $action
252 252
 	 * @param array  $args
253 253
 	 */
254
-	public static function add_async_event( $action, $args = array() ) {
254
+	public static function add_async_event($action, $args = array()) {
255 255
 
256 256
 		// Cache async events.
257
-		$async_events             = get_option( 'give_async_events', array() );
258
-		$async_events[ uniqid() ] = array(
257
+		$async_events             = get_option('give_async_events', array());
258
+		$async_events[uniqid()] = array(
259 259
 			'callback' => $action,
260 260
 			'params'   => $args,
261 261
 		);
262 262
 
263 263
 
264
-		update_option( 'give_async_events', $async_events );
264
+		update_option('give_async_events', $async_events);
265 265
 	}
266 266
 }
267 267
 
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -62,50 +62,50 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return bool If the gravatar exists or not
64 64
 	 */
65
-	public function validate_gravatar( $id_or_email ) {
65
+	public function validate_gravatar($id_or_email) {
66 66
 		//id or email code borrowed from wp-includes/pluggable.php
67 67
 		$email = '';
68
-		if ( is_numeric( $id_or_email ) ) {
68
+		if (is_numeric($id_or_email)) {
69 69
 			$id   = (int) $id_or_email;
70
-			$user = get_userdata( $id );
71
-			if ( $user ) {
70
+			$user = get_userdata($id);
71
+			if ($user) {
72 72
 				$email = $user->user_email;
73 73
 			}
74
-		} elseif ( is_object( $id_or_email ) ) {
74
+		} elseif (is_object($id_or_email)) {
75 75
 			// No avatar for pingbacks or trackbacks
76
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
77
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
76
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
77
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
78 78
 				return false;
79 79
 			}
80 80
 
81
-			if ( ! empty( $id_or_email->user_id ) ) {
81
+			if ( ! empty($id_or_email->user_id)) {
82 82
 				$id   = (int) $id_or_email->user_id;
83
-				$user = get_userdata( $id );
84
-				if ( $user ) {
83
+				$user = get_userdata($id);
84
+				if ($user) {
85 85
 					$email = $user->user_email;
86 86
 				}
87
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
87
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
88 88
 				$email = $id_or_email->comment_author_email;
89 89
 			}
90 90
 		} else {
91 91
 			$email = $id_or_email;
92 92
 		}
93 93
 
94
-		$hashkey = md5( strtolower( trim( $email ) ) );
95
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
94
+		$hashkey = md5(strtolower(trim($email)));
95
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
96 96
 
97
-		$data = wp_cache_get( $hashkey );
98
-		if ( false === $data ) {
99
-			$response = wp_remote_head( $uri );
100
-			if ( is_wp_error( $response ) ) {
97
+		$data = wp_cache_get($hashkey);
98
+		if (false === $data) {
99
+			$response = wp_remote_head($uri);
100
+			if (is_wp_error($response)) {
101 101
 				$data = 'not200';
102 102
 			} else {
103 103
 				$data = $response['response']['code'];
104 104
 			}
105
-			wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
105
+			wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
106 106
 
107 107
 		}
108
-		if ( $data == '200' ) {
108
+		if ($data == '200') {
109 109
 			return true;
110 110
 		} else {
111 111
 			return false;
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return array        IDs if logs, false otherwise
124 124
 	 */
125
-	public function get_log_ids( $form_id = '' ) {
125
+	public function get_log_ids($form_id = '') {
126 126
 
127 127
 		// get Give_Logging class
128 128
 		global $give_logs;
129 129
 
130 130
 		// get log for this form
131
-		$logs = $give_logs->get_logs( $form_id );
131
+		$logs = $give_logs->get_logs($form_id);
132 132
 
133
-		if ( $logs ) {
133
+		if ($logs) {
134 134
 			$log_ids = array();
135 135
 
136 136
 			// make an array with all the donor IDs
137
-			foreach ( $logs as $log ) {
137
+			foreach ($logs as $log) {
138 138
 				$log_ids[] = $log->ID;
139 139
 			}
140 140
 
@@ -155,51 +155,51 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return mixed
157 157
 	 */
158
-	public function get_payment_ids( $form_id = '' ) {
158
+	public function get_payment_ids($form_id = '') {
159 159
 
160 160
 		$give_options = give_get_settings();
161 161
 
162
-		$log_ids = $this->get_log_ids( $form_id );
162
+		$log_ids = $this->get_log_ids($form_id);
163 163
 
164
-		if ( $log_ids ) {
164
+		if ($log_ids) {
165 165
 
166 166
 			$payment_ids = array();
167 167
 
168
-			foreach ( $log_ids as $id ) {
168
+			foreach ($log_ids as $id) {
169 169
 				// get the payment ID for each corresponding log ID
170
-				$payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true );
170
+				$payment_ids[] = give_get_meta($id, '_give_log_payment_id', true);
171 171
 			}
172 172
 
173 173
 			// remove donors who have donated more than once so we can have unique avatars
174 174
 			$unique_emails = array();
175 175
 
176
-			foreach ( $payment_ids as $key => $id ) {
176
+			foreach ($payment_ids as $key => $id) {
177 177
 
178
-				$email = give_get_meta( $id, '_give_payment_user_email', true );
178
+				$email = give_get_meta($id, '_give_payment_user_email', true);
179 179
 
180
-				if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) {
181
-					if ( ! $this->validate_gravatar( $email ) ) {
180
+				if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) {
181
+					if ( ! $this->validate_gravatar($email)) {
182 182
 						continue;
183 183
 					}
184 184
 				}
185 185
 
186
-				$unique_emails[ $id ] = give_get_meta( $id, '_give_payment_user_email', true );
186
+				$unique_emails[$id] = give_get_meta($id, '_give_payment_user_email', true);
187 187
 
188 188
 			}
189 189
 
190 190
 			$unique_ids = array();
191 191
 
192 192
 			// strip duplicate emails
193
-			$unique_emails = array_unique( $unique_emails );
193
+			$unique_emails = array_unique($unique_emails);
194 194
 
195 195
 			// convert the unique IDs back into simple array
196
-			foreach ( $unique_emails as $id => $email ) {
196
+			foreach ($unique_emails as $id => $email) {
197 197
 				$unique_ids[] = $id;
198 198
 			}
199 199
 
200 200
 			// randomize the payment IDs if enabled
201
-			if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) {
202
-				shuffle( $unique_ids );
201
+			if (isset($give_options['give_donors_gravatars_random_gravatars'])) {
202
+				shuffle($unique_ids);
203 203
 			}
204 204
 
205 205
 			// return our unique IDs
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string
222 222
 	 */
223
-	public function gravatars( $form_id = false, $title = '' ) {
223
+	public function gravatars($form_id = false, $title = '') {
224 224
 
225 225
 		// unique $payment_ids 
226
-		$payment_ids = $this->get_payment_ids( $form_id );
226
+		$payment_ids = $this->get_payment_ids($form_id);
227 227
 
228 228
 		$give_options = give_get_settings();
229 229
 
230 230
 		// return if no ID
231
-		if ( ! $form_id ) {
231
+		if ( ! $form_id) {
232 232
 			return;
233 233
 		}
234 234
 
235 235
 		// minimum amount of donations before showing gravatars
236 236
 		// if the number of items in array is not greater or equal to the number specified, then exit
237
-		if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) {
238
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) {
237
+		if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) {
238
+			if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) {
239 239
 				return;
240 240
 			}
241 241
 		}
@@ -246,28 +246,28 @@  discard block
 block discarded – undo
246 246
 		echo '<div id="give-purchase-gravatars">';
247 247
 
248 248
 
249
-		if ( isset ( $title ) ) {
249
+		if (isset ($title)) {
250 250
 
251
-			if ( $title ) {
252
-				echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' );
253
-			} elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) {
254
-				echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' );
251
+			if ($title) {
252
+				echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>');
253
+			} elseif (isset($give_options['give_donors_gravatars_heading'])) {
254
+				echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>');
255 255
 			}
256 256
 
257 257
 		}
258 258
 		echo '<ul class="give-purchase-gravatars-list">';
259 259
 		$i = 0;
260 260
 
261
-		if ( $payment_ids ) {
262
-			foreach ( $payment_ids as $id ) {
261
+		if ($payment_ids) {
262
+			foreach ($payment_ids as $id) {
263 263
 
264 264
 				// Give saves a blank option even when the control is turned off, hence the extra check
265
-				if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) {
265
+				if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) {
266 266
 					continue;
267 267
 				}
268 268
 
269 269
 				// get the payment meta
270
-				$payment_meta = give_get_meta( $id, '_give_payment_meta', true );
270
+				$payment_meta = give_get_meta($id, '_give_payment_meta', true);
271 271
 
272 272
 				$user_info = $payment_meta['user_info'];
273 273
 
@@ -275,21 +275,21 @@  discard block
 block discarded – undo
275 275
 				$name = $user_info['first_name'];
276 276
 
277 277
 				// get donor's email
278
-				$email = give_get_meta( $id, '_give_payment_user_email', true );
278
+				$email = give_get_meta($id, '_give_payment_user_email', true);
279 279
 
280 280
 				// set gravatar size and provide filter
281
-				$size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : '';
281
+				$size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : '';
282 282
 
283 283
 				// default image
284
-				$default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false );
284
+				$default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false);
285 285
 
286 286
 				// assemble output
287 287
 				$output .= '<li>';
288 288
 
289
-				$output .= get_avatar( $email, $size, $default_image, $name );
289
+				$output .= get_avatar($email, $size, $default_image, $name);
290 290
 				$output .= '</li>';
291 291
 
292
-				$i ++;
292
+				$i++;
293 293
 
294 294
 			} // end foreach
295 295
 		}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		echo '</ul>';
299 299
 		echo '</div>';
300 300
 
301
-		return apply_filters( 'give_donors_gravatars', ob_get_clean() );
301
+		return apply_filters('give_donors_gravatars', ob_get_clean());
302 302
 	}
303 303
 
304 304
 	/**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * @return void
311 311
 	 */
312 312
 	public function register_widget() {
313
-		register_widget( 'Give_Donors_Gravatars_Widget' );
313
+		register_widget('Give_Donors_Gravatars_Widget');
314 314
 	}
315 315
 
316 316
 	/**
@@ -324,19 +324,19 @@  discard block
 block discarded – undo
324 324
 	 *
325 325
 	 * @return string
326 326
 	 */
327
-	public function shortcode( $atts, $content = null ) {
327
+	public function shortcode($atts, $content = null) {
328 328
 
329
-		$atts = shortcode_atts( array(
329
+		$atts = shortcode_atts(array(
330 330
 			'id'    => '',
331 331
 			'title' => ''
332
-		), $atts, 'give_donors_gravatars' );
332
+		), $atts, 'give_donors_gravatars');
333 333
 
334 334
 		// if no ID is passed on single give_forms pages, get the correct ID
335
-		if ( is_singular( 'give_forms' ) ) {
335
+		if (is_singular('give_forms')) {
336 336
 			$id = get_the_ID();
337 337
 		}
338 338
 
339
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
339
+		$content = $this->gravatars($atts['id'], $atts['title']);
340 340
 
341 341
 		return $content;
342 342
 
@@ -352,56 +352,56 @@  discard block
 block discarded – undo
352 352
 	 *
353 353
 	 * @return array           Gravatar settings.
354 354
 	 */
355
-	public function settings( $settings ) {
355
+	public function settings($settings) {
356 356
 
357 357
 		$give_gravatar_settings = array(
358 358
 			array(
359
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
359
+				'name' => esc_html__('Donator Gravatars', 'give'),
360 360
 				'desc' => '<hr>',
361 361
 				'id'   => 'give_title',
362 362
 				'type' => 'give_title'
363 363
 			),
364 364
 			array(
365
-				'name' => esc_html__( 'Heading', 'give' ),
366
-				'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ),
365
+				'name' => esc_html__('Heading', 'give'),
366
+				'desc' => esc_html__('The heading to display above the Gravatars.', 'give'),
367 367
 				'type' => 'text',
368 368
 				'id'   => 'give_donors_gravatars_heading'
369 369
 			),
370 370
 			array(
371
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
372
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ),
371
+				'name'    => esc_html__('Gravatar Size', 'give'),
372
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'),
373 373
 				'type'    => 'text_small',
374 374
 				'id'      => 'give_donors_gravatars_gravatar_size',
375 375
 				'default' => '64'
376 376
 			),
377 377
 			array(
378
-				'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ),
379
-				'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ),
378
+				'name' => esc_html__('Minimum Unique Donations Required', 'give'),
379
+				'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'),
380 380
 				'type' => 'text_small',
381 381
 				'id'   => 'give_donors_gravatars_min_purchases_required',
382 382
 			),
383 383
 			array(
384
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
385
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
384
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
385
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
386 386
 				'type'    => 'text',
387 387
 				'id'      => 'give_donors_gravatars_maximum_number',
388 388
 				'default' => '20',
389 389
 			),
390 390
 			array(
391
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
392
-				'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ),
391
+				'name' => esc_html__('Gravatar Visibility', 'give'),
392
+				'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'),
393 393
 				'id'   => 'give_donors_gravatars_has_gravatar_account',
394 394
 				'type' => 'checkbox',
395 395
 			),
396 396
 			array(
397
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
398
-				'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ),
397
+				'name' => esc_html__('Randomize Gravatars', 'give'),
398
+				'desc' => esc_html__('Randomize the Gravatars.', 'give'),
399 399
 				'id'   => 'give_donors_gravatars_random_gravatars',
400 400
 				'type' => 'checkbox',
401 401
 			),
402 402
 		);
403 403
 
404
-		return array_merge( $settings, $give_gravatar_settings );
404
+		return array_merge($settings, $give_gravatar_settings);
405 405
 	}
406 406
 
407 407
 }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		// widget settings
428 428
 		$widget_ops = array(
429 429
 			'classname'   => 'give-donors-gravatars',
430
-			'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ),
430
+			'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'),
431 431
 		);
432 432
 
433 433
 		// widget control settings
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		// create the widget
441 441
 		parent::__construct(
442 442
 			'give_donors_gravatars_widget',
443
-			esc_html__( 'Give Donors Gravatars', 'give' ),
443
+			esc_html__('Give Donors Gravatars', 'give'),
444 444
 			$widget_ops,
445 445
 			$control_ops
446 446
 		);
@@ -460,29 +460,29 @@  discard block
 block discarded – undo
460 460
 	 *
461 461
 	 * @return void
462 462
 	 */
463
-	public function widget( $args, $instance ) {
463
+	public function widget($args, $instance) {
464 464
 
465 465
 		//@TODO: Don't extract it!!!
466
-		extract( $args );
466
+		extract($args);
467 467
 
468
-		if ( ! is_singular( 'give_forms' ) ) {
468
+		if ( ! is_singular('give_forms')) {
469 469
 			return;
470 470
 		}
471 471
 
472 472
 		// Variables from widget settings
473
-		$title = apply_filters( 'widget_title', $instance['title'] );
473
+		$title = apply_filters('widget_title', $instance['title']);
474 474
 
475 475
 		// Used by themes. Opens the widget
476 476
 		echo $before_widget;
477 477
 
478 478
 		// Display the widget title
479
-		if ( $title ) {
480
-			echo $before_title . $title . $after_title;
479
+		if ($title) {
480
+			echo $before_title.$title.$after_title;
481 481
 		}
482 482
 
483 483
 		$gravatars = new Give_Donors_Gravatars();
484 484
 
485
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
485
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
486 486
 
487 487
 		// Used by themes. Closes the widget
488 488
 		echo $after_widget;
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @return array Updated settings to save.
504 504
 	 */
505
-	public function update( $new_instance, $old_instance ) {
505
+	public function update($new_instance, $old_instance) {
506 506
 
507 507
 		$instance = $old_instance;
508 508
 
509
-		$instance['title'] = strip_tags( $new_instance['title'] );
509
+		$instance['title'] = strip_tags($new_instance['title']);
510 510
 
511 511
 		return $instance;
512 512
 
@@ -524,19 +524,19 @@  discard block
 block discarded – undo
524 524
 	 *
525 525
 	 * @return void
526 526
 	 */
527
-	public function form( $instance ) {
527
+	public function form($instance) {
528 528
 
529 529
 		// Set up some default widget settings.
530 530
 		$defaults = array(
531 531
 			'title' => '',
532 532
 		);
533 533
 
534
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
534
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
535 535
 
536 536
 		<!-- Title -->
537 537
 		<p>
538
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
539
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
538
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
539
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
540 540
 		</p>
541 541
 
542 542
 		<?php
Please login to merge, or discard this patch.
includes/template-functions.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @return string
22 22
  */
23 23
 function give_get_templates_dir() {
24
-	return GIVE_PLUGIN_DIR . 'templates';
24
+	return GIVE_PLUGIN_DIR.'templates';
25 25
 }
26 26
 
27 27
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function give_get_templates_url() {
34
-	return GIVE_PLUGIN_URL . 'templates';
34
+	return GIVE_PLUGIN_URL.'templates';
35 35
 }
36 36
 
37 37
 /**
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
  * @param string $template_path Template file path. Default is empty.
45 45
  * @param string $default_path  Default path. Default is empty.
46 46
  */
47
-function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
48
-	if ( ! empty( $args ) && is_array( $args ) ) {
49
-		extract( $args );
47
+function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
48
+	if ( ! empty($args) && is_array($args)) {
49
+		extract($args);
50 50
 	}
51 51
 
52
-	$template_names = array( $template_name . '.php' );
52
+	$template_names = array($template_name.'.php');
53 53
 
54
-	$located = give_locate_template( $template_names, $template_path, $default_path );
54
+	$located = give_locate_template($template_names, $template_path, $default_path);
55 55
 
56
-	if ( ! file_exists( $located ) ) {
56
+	if ( ! file_exists($located)) {
57 57
 		/* translators: %s: the template */
58
-		Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
58
+		Give()->notices->print_frontend_notice(sprintf(__('The %s template was not found.', 'give'), $located), true);
59 59
 
60 60
 		return;
61 61
 	}
62 62
 
63 63
 	// Allow 3rd party plugin filter template file from their plugin.
64
-	$located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
64
+	$located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path);
65 65
 
66 66
 	/**
67 67
 	 * Fires in give template, before the file is included.
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 * @param string $located       Template file filter by 3rd party plugin.
76 76
 	 * @param array  $args          Passed arguments.
77 77
 	 */
78
-	do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
78
+	do_action('give_before_template_part', $template_name, $template_path, $located, $args);
79 79
 
80
-	include( $located );
80
+	include($located);
81 81
 
82 82
 	/**
83 83
 	 * Fires in give template, after the file is included.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param string $located       Template file filter by 3rd party plugin.
92 92
 	 * @param array  $args          Passed arguments.
93 93
 	 */
94
-	do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
94
+	do_action('give_after_template_part', $template_name, $template_path, $located, $args);
95 95
 }
96 96
 
97 97
 /**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return string
109 109
  */
110
-function give_get_template_part( $slug, $name = null, $load = true ) {
110
+function give_get_template_part($slug, $name = null, $load = true) {
111 111
 
112 112
 	/**
113 113
 	 * Fires in give template part, before the template part is retrieved.
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 	 * @param string $slug Template part file slug {slug}.php.
120 120
 	 * @param string $name Template part file name {slug}-{name}.php.
121 121
 	 */
122
-	do_action( "get_template_part_{$slug}", $slug, $name );
122
+	do_action("get_template_part_{$slug}", $slug, $name);
123 123
 
124 124
 	// Setup possible parts
125 125
 	$templates = array();
126
-	if ( isset( $name ) ) {
127
-		$templates[] = $slug . '-' . $name . '.php';
126
+	if (isset($name)) {
127
+		$templates[] = $slug.'-'.$name.'.php';
128 128
 	}
129
-	$templates[] = $slug . '.php';
129
+	$templates[] = $slug.'.php';
130 130
 
131 131
 	// Allow template parts to be filtered
132
-	$templates = apply_filters( 'give_get_template_part', $templates, $slug, $name );
132
+	$templates = apply_filters('give_get_template_part', $templates, $slug, $name);
133 133
 
134 134
 	// Return the part that is found
135
-	return give_locate_template( $templates, $load, false );
135
+	return give_locate_template($templates, $load, false);
136 136
 }
137 137
 
138 138
 /**
@@ -153,37 +153,37 @@  discard block
 block discarded – undo
153 153
  *
154 154
  * @return string The template filename if one is located.
155 155
  */
156
-function give_locate_template( $template_names, $load = false, $require_once = true ) {
156
+function give_locate_template($template_names, $load = false, $require_once = true) {
157 157
 	// No file found yet
158 158
 	$located = false;
159 159
 
160 160
 	// Try to find a template file
161
-	foreach ( (array) $template_names as $template_name ) {
161
+	foreach ((array) $template_names as $template_name) {
162 162
 
163 163
 		// Continue if template is empty
164
-		if ( empty( $template_name ) ) {
164
+		if (empty($template_name)) {
165 165
 			continue;
166 166
 		}
167 167
 
168 168
 		// Trim off any slashes from the template name
169
-		$template_name = ltrim( $template_name, '/' );
169
+		$template_name = ltrim($template_name, '/');
170 170
 
171 171
 		// try locating this template file by looping through the template paths
172
-		foreach ( give_get_theme_template_paths() as $template_path ) {
172
+		foreach (give_get_theme_template_paths() as $template_path) {
173 173
 
174
-			if ( file_exists( $template_path . $template_name ) ) {
175
-				$located = $template_path . $template_name;
174
+			if (file_exists($template_path.$template_name)) {
175
+				$located = $template_path.$template_name;
176 176
 				break;
177 177
 			}
178 178
 		}
179 179
 
180
-		if ( $located ) {
180
+		if ($located) {
181 181
 			break;
182 182
 		}
183 183
 	}
184 184
 
185
-	if ( ( true == $load ) && ! empty( $located ) ) {
186
-		load_template( $located, $require_once );
185
+	if ((true == $load) && ! empty($located)) {
186
+		load_template($located, $require_once);
187 187
 	}
188 188
 
189 189
 	return $located;
@@ -200,17 +200,17 @@  discard block
 block discarded – undo
200 200
 	$template_dir = give_get_theme_template_dir_name();
201 201
 
202 202
 	$file_paths = array(
203
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
204
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
203
+		1   => trailingslashit(get_stylesheet_directory()).$template_dir,
204
+		10  => trailingslashit(get_template_directory()).$template_dir,
205 205
 		100 => give_get_templates_dir(),
206 206
 	);
207 207
 
208
-	$file_paths = apply_filters( 'give_template_paths', $file_paths );
208
+	$file_paths = apply_filters('give_template_paths', $file_paths);
209 209
 
210 210
 	// sort the file paths based on priority
211
-	ksort( $file_paths, SORT_NUMERIC );
211
+	ksort($file_paths, SORT_NUMERIC);
212 212
 
213
-	return array_map( 'trailingslashit', $file_paths );
213
+	return array_map('trailingslashit', $file_paths);
214 214
 }
215 215
 
216 216
 /**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
  * @return string
223 223
  */
224 224
 function give_get_theme_template_dir_name() {
225
-	return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) );
225
+	return trailingslashit(apply_filters('give_templates_dir', 'give'));
226 226
 }
227 227
 
228 228
 /**
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
  * @return void
233 233
  */
234 234
 function give_version_in_header() {
235
-	echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n";
235
+	echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n";
236 236
 }
237 237
 
238
-add_action( 'wp_head', 'give_version_in_header' );
238
+add_action('wp_head', 'give_version_in_header');
239 239
 
240 240
 /**
241 241
  * Determines if we're currently on the Donations History page.
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function give_is_donation_history_page() {
247 247
 
248
-	$ret = is_page( give_get_option( 'history_page' ) );
248
+	$ret = is_page(give_get_option('history_page'));
249 249
 
250
-	return apply_filters( 'give_is_donation_history_page', $ret );
250
+	return apply_filters('give_is_donation_history_page', $ret);
251 251
 }
252 252
 
253 253
 /**
@@ -259,25 +259,25 @@  discard block
 block discarded – undo
259 259
  *
260 260
  * @return array Modified array of classes
261 261
  */
262
-function give_add_body_classes( $class ) {
262
+function give_add_body_classes($class) {
263 263
 	$classes = (array) $class;
264 264
 
265
-	if ( give_is_success_page() ) {
265
+	if (give_is_success_page()) {
266 266
 		$classes[] = 'give-success';
267 267
 		$classes[] = 'give-page';
268 268
 	}
269 269
 
270
-	if ( give_is_failed_transaction_page() ) {
270
+	if (give_is_failed_transaction_page()) {
271 271
 		$classes[] = 'give-failed-transaction';
272 272
 		$classes[] = 'give-page';
273 273
 	}
274 274
 
275
-	if ( give_is_donation_history_page() ) {
275
+	if (give_is_donation_history_page()) {
276 276
 		$classes[] = 'give-donation-history';
277 277
 		$classes[] = 'give-page';
278 278
 	}
279 279
 
280
-	if ( give_is_test_mode() ) {
280
+	if (give_is_test_mode()) {
281 281
 		$classes[] = 'give-test-mode';
282 282
 		$classes[] = 'give-page';
283 283
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	/* @var WP_Theme $current_theme */
287 287
 	$current_theme = wp_get_theme();
288 288
 
289
-	switch ( $current_theme->get_template() ) {
289
+	switch ($current_theme->get_template()) {
290 290
 
291 291
 		case 'Divi':
292 292
 			$classes[] = 'give-divi';
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 
304 304
 	}
305 305
 
306
-	return array_unique( $classes );
306
+	return array_unique($classes);
307 307
 }
308 308
 
309
-add_filter( 'body_class', 'give_add_body_classes' );
309
+add_filter('body_class', 'give_add_body_classes');
310 310
 
311 311
 
312 312
 /**
@@ -322,22 +322,22 @@  discard block
 block discarded – undo
322 322
  *
323 323
  * @return array
324 324
  */
325
-function give_add_post_class( $classes, $class = '', $post_id = '' ) {
326
-	if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
325
+function give_add_post_class($classes, $class = '', $post_id = '') {
326
+	if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) {
327 327
 		return $classes;
328 328
 	}
329 329
 
330 330
 	//@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
331 331
 
332
-	if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
333
-		unset( $classes[ $key ] );
332
+	if (false !== ($key = array_search('hentry', $classes))) {
333
+		unset($classes[$key]);
334 334
 	}
335 335
 
336 336
 	return $classes;
337 337
 }
338 338
 
339 339
 
340
-add_filter( 'post_class', 'give_add_post_class', 20, 3 );
340
+add_filter('post_class', 'give_add_post_class', 20, 3);
341 341
 
342 342
 /**
343 343
  * Get the placeholder image URL for forms etc
@@ -347,74 +347,74 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function give_get_placeholder_img_src() {
349 349
 
350
-	$placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
350
+	$placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give'));
351 351
 
352
-	return apply_filters( 'give_placeholder_img_src', $placeholder_url );
352
+	return apply_filters('give_placeholder_img_src', $placeholder_url);
353 353
 }
354 354
 
355 355
 
356 356
 /**
357 357
  * Global
358 358
  */
359
-if ( ! function_exists( 'give_output_content_wrapper' ) ) {
359
+if ( ! function_exists('give_output_content_wrapper')) {
360 360
 
361 361
 	/**
362 362
 	 * Output the start of the page wrapper.
363 363
 	 */
364 364
 	function give_output_content_wrapper() {
365
-		give_get_template_part( 'global/wrapper-start' );
365
+		give_get_template_part('global/wrapper-start');
366 366
 	}
367 367
 }
368
-if ( ! function_exists( 'give_output_content_wrapper_end' ) ) {
368
+if ( ! function_exists('give_output_content_wrapper_end')) {
369 369
 
370 370
 	/**
371 371
 	 * Output the end of the page wrapper.
372 372
 	 */
373 373
 	function give_output_content_wrapper_end() {
374
-		give_get_template_part( 'global/wrapper-end' );
374
+		give_get_template_part('global/wrapper-end');
375 375
 	}
376 376
 }
377 377
 
378 378
 /**
379 379
  * Single Give Form
380 380
  */
381
-if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) {
381
+if ( ! function_exists('give_left_sidebar_pre_wrap')) {
382 382
 	function give_left_sidebar_pre_wrap() {
383
-		echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' );
383
+		echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">');
384 384
 	}
385 385
 }
386 386
 
387
-if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) {
387
+if ( ! function_exists('give_left_sidebar_post_wrap')) {
388 388
 	function give_left_sidebar_post_wrap() {
389
-		echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' );
389
+		echo apply_filters('give_left_sidebar_post_wrap', '</div>');
390 390
 	}
391 391
 }
392 392
 
393
-if ( ! function_exists( 'give_get_forms_sidebar' ) ) {
393
+if ( ! function_exists('give_get_forms_sidebar')) {
394 394
 	function give_get_forms_sidebar() {
395
-		give_get_template_part( 'single-give-form/sidebar' );
395
+		give_get_template_part('single-give-form/sidebar');
396 396
 	}
397 397
 }
398 398
 
399
-if ( ! function_exists( 'give_show_form_images' ) ) {
399
+if ( ! function_exists('give_show_form_images')) {
400 400
 
401 401
 	/**
402 402
 	 * Output the donation form featured image.
403 403
 	 */
404 404
 	function give_show_form_images() {
405
-		if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
406
-			give_get_template_part( 'single-give-form/featured-image' );
405
+		if (give_is_setting_enabled(give_get_option('form_featured_img'))) {
406
+			give_get_template_part('single-give-form/featured-image');
407 407
 		}
408 408
 	}
409 409
 }
410 410
 
411
-if ( ! function_exists( 'give_template_single_title' ) ) {
411
+if ( ! function_exists('give_template_single_title')) {
412 412
 
413 413
 	/**
414 414
 	 * Output the form title.
415 415
 	 */
416 416
 	function give_template_single_title() {
417
-		give_get_template_part( 'single-give-form/title' );
417
+		give_get_template_part('single-give-form/title');
418 418
 	}
419 419
 }
420 420
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
  * Conditional Functions
423 423
  */
424 424
 
425
-if ( ! function_exists( 'is_give_form' ) ) {
425
+if ( ! function_exists('is_give_form')) {
426 426
 
427 427
 	/**
428 428
 	 * is_give_form
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 	 * @return bool
435 435
 	 */
436 436
 	function is_give_form() {
437
-		return is_singular( array( 'give_form' ) );
437
+		return is_singular(array('give_form'));
438 438
 	}
439 439
 }
440 440
 
441
-if ( ! function_exists( 'is_give_category' ) ) {
441
+if ( ! function_exists('is_give_category')) {
442 442
 
443 443
 	/**
444 444
 	 * is_give_category
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @return bool
455 455
 	 */
456
-	function is_give_category( $term = '' ) {
457
-		return is_tax( 'give_forms_category', $term );
456
+	function is_give_category($term = '') {
457
+		return is_tax('give_forms_category', $term);
458 458
 	}
459 459
 }
460 460
 
461
-if ( ! function_exists( 'is_give_tag' ) ) {
461
+if ( ! function_exists('is_give_tag')) {
462 462
 
463 463
 	/**
464 464
 	 * is_give_tag
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
 	 *
474 474
 	 * @return bool
475 475
 	 */
476
-	function is_give_tag( $term = '' ) {
477
-		return is_tax( 'give_forms_tag', $term );
476
+	function is_give_tag($term = '') {
477
+		return is_tax('give_forms_tag', $term);
478 478
 	}
479 479
 }
480 480
 
481
-if ( ! function_exists( 'is_give_taxonomy' ) ) {
481
+if ( ! function_exists('is_give_taxonomy')) {
482 482
 
483 483
 	/**
484 484
 	 * is_give_taxonomy
@@ -490,6 +490,6 @@  discard block
 block discarded – undo
490 490
 	 * @return bool
491 491
 	 */
492 492
 	function is_give_taxonomy() {
493
-		return is_tax( get_object_taxonomies( 'give_form' ) );
493
+		return is_tax(get_object_taxonomies('give_form'));
494 494
 	}
495 495
 }
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -56,45 +56,45 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @return string $message Fully formatted message
58 58
  */
59
-function give_email_preview_template_tags( $message ) {
59
+function give_email_preview_template_tags($message) {
60 60
 
61
-	$price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) );
61
+	$price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false)));
62 62
 
63 63
 	$gateway = 'PayPal';
64 64
 
65
-	$receipt_id = strtolower( md5( uniqid() ) );
65
+	$receipt_id = strtolower(md5(uniqid()));
66 66
 
67
-	$payment_id = rand( 1, 100 );
67
+	$payment_id = rand(1, 100);
68 68
 
69
-	$receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) );
69
+	$receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url()));
70 70
 	$receipt_link     = sprintf(
71 71
 		'<a href="%1$s">%2$s</a>',
72 72
 		$receipt_link_url,
73
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
73
+		esc_html__('View the receipt in your browser &raquo;', 'give')
74 74
 	);
75 75
 
76 76
 	// Set user.
77 77
 	$user = wp_get_current_user();
78 78
 
79
-	$message = str_replace( '{name}', $user->display_name, $message );
80
-	$message = str_replace( '{fullname}', $user->display_name, $message );
81
-	$message = str_replace( '{username}', $user->user_login, $message );
82
-	$message = str_replace( '{user_email}', $user->user_email, $message );
83
-	$message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message );
84
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
85
-	$message = str_replace( '{amount}', $price, $message );
86
-	$message = str_replace( '{price}', $price, $message );
87
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
88
-	$message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message );
89
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
90
-	$message = str_replace( '{payment_method}', $gateway, $message );
91
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
92
-	$message = str_replace( '{payment_id}', $payment_id, $message );
93
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
94
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
95
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
96
-
97
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
79
+	$message = str_replace('{name}', $user->display_name, $message);
80
+	$message = str_replace('{fullname}', $user->display_name, $message);
81
+	$message = str_replace('{username}', $user->user_login, $message);
82
+	$message = str_replace('{user_email}', $user->user_email, $message);
83
+	$message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message);
84
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
85
+	$message = str_replace('{amount}', $price, $message);
86
+	$message = str_replace('{price}', $price, $message);
87
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
88
+	$message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message);
89
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
90
+	$message = str_replace('{payment_method}', $gateway, $message);
91
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
92
+	$message = str_replace('{payment_id}', $payment_id, $message);
93
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
94
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
95
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
96
+
97
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
98 98
 }
99 99
 
100 100
 /**
@@ -106,23 +106,23 @@  discard block
 block discarded – undo
106 106
  * @since  1.0
107 107
  * @return array|bool
108 108
  */
109
-function give_email_template_preview( $array ) {
109
+function give_email_template_preview($array) {
110 110
 
111
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
111
+	if ( ! current_user_can('manage_give_settings')) {
112 112
 		return false;
113 113
 	}
114 114
 	$custom_field = array(
115
-		'name' => esc_html__( 'Preview Email', 'give' ),
116
-		'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ),
115
+		'name' => esc_html__('Preview Email', 'give'),
116
+		'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'),
117 117
 		'id'   => 'give_email_preview_buttons',
118 118
 		'type' => 'email_preview_buttons',
119 119
 	);
120 120
 
121
-	return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) );
121
+	return give_settings_array_insert($array, 'donation_subject', array($custom_field));
122 122
 
123 123
 }
124 124
 
125
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
125
+add_filter('give_settings_emails', 'give_email_template_preview');
126 126
 
127 127
 /**
128 128
  * Output Email Template Preview Buttons.
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 function give_email_preview_buttons_callback() {
135 135
 	ob_start();
136 136
 	?>
137
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary"
138
-	   target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a>
139
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
137
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary"
138
+	   target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a>
139
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
140 140
 		'give_action'  => 'send_test_email',
141 141
 		'give-message' => 'sent-test-email',
142 142
 		'tag'          => 'emails',
143
-	) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>"
144
-	   class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a>
143
+	)), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>"
144
+	   class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a>
145 145
 	<?php
146 146
 	echo ob_get_clean();
147 147
 }
@@ -154,46 +154,46 @@  discard block
 block discarded – undo
154 154
  */
155 155
 function give_display_email_template_preview() {
156 156
 
157
-	if ( empty( $_GET['give_action'] ) ) {
157
+	if (empty($_GET['give_action'])) {
158 158
 		return;
159 159
 	}
160 160
 
161
-	if ( 'preview_email' !== $_GET['give_action'] ) {
161
+	if ('preview_email' !== $_GET['give_action']) {
162 162
 		return;
163 163
 	}
164 164
 
165
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
165
+	if ( ! current_user_can('manage_give_settings')) {
166 166
 		return;
167 167
 	}
168 168
 
169 169
 
170
-	Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' );
170
+	Give()->emails->heading = esc_html__('Donation Receipt', 'give');
171 171
 
172
-	$payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
172
+	$payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
173 173
 
174 174
 	echo give_get_preview_email_header();
175 175
 
176 176
 	//Are we previewing an actual payment?
177
-	if ( ! empty( $payment_id ) ) {
177
+	if ( ! empty($payment_id)) {
178 178
 
179
-		$content = give_get_email_body_content( $payment_id );
179
+		$content = give_get_email_body_content($payment_id);
180 180
 
181
-		$preview_content = give_do_email_tags( $content, $payment_id );
181
+		$preview_content = give_do_email_tags($content, $payment_id);
182 182
 
183 183
 	} else {
184 184
 
185 185
 		//No payment ID, use sample preview content
186
-		$preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
186
+		$preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
187 187
 	}
188 188
 
189 189
 
190
-	echo Give()->emails->build_email( $preview_content );
190
+	echo Give()->emails->build_email($preview_content);
191 191
 
192 192
 	exit;
193 193
 
194 194
 }
195 195
 
196
-add_action( 'init', 'give_display_email_template_preview' );
196
+add_action('init', 'give_display_email_template_preview');
197 197
 
198 198
 /**
199 199
  * Email Template Body.
@@ -205,18 +205,18 @@  discard block
 block discarded – undo
205 205
  *
206 206
  * @return string $email_body Body of the email
207 207
  */
208
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
208
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
209 209
 
210 210
 	$default_email_body = give_get_default_donation_receipt_email();
211 211
 
212
-	$email_content = give_get_option( 'donation_receipt' );
213
-	$email_content = ( $email_content ) ? stripslashes( $email_content ) : $default_email_body;
212
+	$email_content = give_get_option('donation_receipt');
213
+	$email_content = ($email_content) ? stripslashes($email_content) : $default_email_body;
214 214
 
215
-	$email_body = wpautop( $email_content );
215
+	$email_body = wpautop($email_content);
216 216
 
217
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
217
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
218 218
 
219
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
219
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
220 220
 }
221 221
 
222 222
 /**
@@ -229,35 +229,35 @@  discard block
 block discarded – undo
229 229
  *
230 230
  * @return string $email_body Body of the email
231 231
  */
232
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
232
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
233 233
 
234
-	$payment = new Give_Payment( $payment_id );
234
+	$payment = new Give_Payment($payment_id);
235 235
 
236
-	if ( $payment->user_id > 0 ) {
237
-		$user_data = get_userdata( $payment->user_id );
236
+	if ($payment->user_id > 0) {
237
+		$user_data = get_userdata($payment->user_id);
238 238
 		$name      = $user_data->display_name;
239
-	} elseif ( ! empty( $payment->first_name ) && ! empty( $payment->last_name ) ) {
240
-		$name = $payment->first_name . ' ' . $payment->last_name;
239
+	} elseif ( ! empty($payment->first_name) && ! empty($payment->last_name)) {
240
+		$name = $payment->first_name.' '.$payment->last_name;
241 241
 	} else {
242 242
 		$name = $payment->email;
243 243
 	}
244 244
 
245
-	$gateway = give_get_gateway_admin_label( $payment->gateway );
245
+	$gateway = give_get_gateway_admin_label($payment->gateway);
246 246
 
247
-	$default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n";
248
-	$default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n";
249
-	$default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n";
250
-	$default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
251
-	$default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
252
-	$default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n";
253
-	$default_email_body .= esc_html__( 'Thank you', 'give' );
247
+	$default_email_body = esc_html__('Hello', 'give')."\n\n";
248
+	$default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n";
249
+	$default_email_body .= esc_html__('Donation:', 'give')."\n\n";
250
+	$default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
251
+	$default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount($payment->total, array('sanitize' => false))), ENT_COMPAT, 'UTF-8')."\n";
252
+	$default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n";
253
+	$default_email_body .= esc_html__('Thank you', 'give');
254 254
 
255
-	$message = give_get_option( 'donation_notification' );
256
-	$message = isset( $message ) ? stripslashes( $message ) : $default_email_body;
255
+	$message = give_get_option('donation_notification');
256
+	$message = isset($message) ? stripslashes($message) : $default_email_body;
257 257
 
258
-	$email_body = give_do_email_tags( $message, $payment_id );
258
+	$email_body = give_do_email_tags($message, $payment_id);
259 259
 
260
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
260
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
261 261
 }
262 262
 
263 263
 /**
@@ -270,19 +270,19 @@  discard block
 block discarded – undo
270 270
  * @since  1.0
271 271
  */
272 272
 function give_render_receipt_in_browser() {
273
-	if ( ! isset( $_GET['payment_key'] ) ) {
274
-		wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
273
+	if ( ! isset($_GET['payment_key'])) {
274
+		wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
275 275
 	}
276 276
 
277
-	$key = urlencode( $_GET['payment_key'] );
277
+	$key = urlencode($_GET['payment_key']);
278 278
 
279 279
 	ob_start();
280 280
 	//Disallows caching of the page
281
-	header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
282
-	header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
283
-	header( "Cache-Control: post-check=0, pre-check=0", false );
284
-	header( "Pragma: no-cache" ); // HTTP/1.0
285
-	header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
281
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
282
+	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
283
+	header("Cache-Control: post-check=0, pre-check=0", false);
284
+	header("Pragma: no-cache"); // HTTP/1.0
285
+	header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past
286 286
 	?>
287 287
 	<!DOCTYPE html>
288 288
 	<html lang="en">
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 		 *
294 294
 		 * @since 1.0
295 295
 		 */
296
-		do_action( 'give_receipt_head' );
296
+		do_action('give_receipt_head');
297 297
 		?>
298 298
 	</head>
299
-	<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
299
+	<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
300 300
 
301 301
 	<div id="give_receipt_wrapper">
302 302
 		<?php
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 		 *
306 306
 		 * @since 1.0
307 307
 		 */
308
-		do_action( 'give_render_receipt_in_browser_before' );
308
+		do_action('give_render_receipt_in_browser_before');
309 309
 
310
-		echo do_shortcode( '[give_receipt payment_key=' . $key . ']' );
310
+		echo do_shortcode('[give_receipt payment_key='.$key.']');
311 311
 
312 312
 		/**
313 313
 		 * Fires in the receipt template after the content.
314 314
 		 *
315 315
 		 * @since 1.0
316 316
 		 */
317
-		do_action( 'give_render_receipt_in_browser_after' );
317
+		do_action('give_render_receipt_in_browser_after');
318 318
 		?>
319 319
 	</div>
320 320
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 *
325 325
 	 * @since 1.0
326 326
 	 */
327
-	do_action( 'give_receipt_footer' );
327
+	do_action('give_receipt_footer');
328 328
 	?>
329 329
 	</body>
330 330
 	</html>
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	die();
334 334
 }
335 335
 
336
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
336
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
337 337
 
338 338
 
339 339
 /**
@@ -348,29 +348,29 @@  discard block
 block discarded – undo
348 348
 
349 349
 	//Payment receipt switcher
350 350
 	$payment_count = give_count_payments()->publish;
351
-	$payment_id    = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
351
+	$payment_id    = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
352 352
 
353
-	if ( $payment_count <= 0 ) {
353
+	if ($payment_count <= 0) {
354 354
 		return false;
355 355
 	}
356 356
 
357 357
 	//Get payments.
358
-	$payments = new Give_Payments_Query( array(
358
+	$payments = new Give_Payments_Query(array(
359 359
 		'number' => 100,
360
-	) );
360
+	));
361 361
 	$payments = $payments->get_payments();
362 362
 	$options  = array();
363 363
 
364 364
 	//Provide nice human readable options.
365
-	if ( $payments ) {
366
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
367
-		foreach ( $payments as $payment ) {
365
+	if ($payments) {
366
+		$options[0] = esc_html__('- Select a donation -', 'give');
367
+		foreach ($payments as $payment) {
368 368
 
369
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
369
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
370 370
 
371 371
 		}
372 372
 	} else {
373
-		$options[0] = esc_html__( 'No donations found.', 'give' );
373
+		$options[0] = esc_html__('No donations found.', 'give');
374 374
 	}
375 375
 
376 376
 	//Start constructing HTML output.
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
 			        var selected_trans = transactions.options[transactions.selectedIndex];
384 384
 				        console.log(selected_trans);
385 385
 				        if (selected_trans){
386
-				            var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value;
386
+				            var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value;
387 387
 				                window.location = url_string;
388 388
 				        }
389 389
 				    }
390 390
 			    </script>';
391 391
 
392
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>';
392
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>';
393 393
 
394 394
 	//The select field with 100 latest transactions
395
-	$transaction_header .= Give()->html->select( array(
395
+	$transaction_header .= Give()->html->select(array(
396 396
 		'name'             => 'preview_email_payment_id',
397 397
 		'selected'         => $payment_id,
398 398
 		'id'               => 'give_preview_email_payment_id',
@@ -402,12 +402,12 @@  discard block
 block discarded – undo
402 402
 		'select_atts'      => 'onchange="change_preview()">',
403 403
 		'show_option_all'  => false,
404 404
 		'show_option_none' => false,
405
-	) );
405
+	));
406 406
 
407 407
 	//Closing tag
408 408
 	$transaction_header .= '</div>';
409 409
 
410
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
410
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
411 411
 
412 412
 }
413 413
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 function give_receipt_head_content() {
422 422
 
423 423
 	//Title.
424
-	$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';
424
+	$output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>';
425 425
 
426 426
 	//Meta.
427 427
 	$output .= '<meta charset="utf-8"/>
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
 		<meta name="robots" content="noindex, nofollow"/>';
436 436
 
437 437
 	//CSS
438
-	$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';
438
+	$output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">';
439 439
 
440
-	echo apply_filters( 'give_receipt_head_content', $output );
440
+	echo apply_filters('give_receipt_head_content', $output);
441 441
 
442 442
 }
443 443
 
444
-add_action( 'give_receipt_head', 'give_receipt_head_content' );
445 444
\ No newline at end of file
445
+add_action('give_receipt_head', 'give_receipt_head_content');
446 446
\ No newline at end of file
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load Give file.
18
-include_once( 'give.php' );
18
+include_once('give.php');
19 19
 
20 20
 global $wpdb, $wp_roles;
21 21
 
22 22
 
23
-if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) {
23
+if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) {
24 24
 
25 25
 	// Delete All the Custom Post Types.
26
-	$give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' );
27
-	$give_post_types = array( 'give_forms', 'give_payment', 'give_log' );
28
-	foreach ( $give_post_types as $post_type ) {
26
+	$give_taxonomies = array('form_category', 'form_tag', 'give_log_type');
27
+	$give_post_types = array('give_forms', 'give_payment', 'give_log');
28
+	foreach ($give_post_types as $post_type) {
29 29
 
30
-		$give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) );
31
-		$items           = get_posts( array(
30
+		$give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type));
31
+		$items           = get_posts(array(
32 32
 			'post_type'   => $post_type,
33 33
 			'post_status' => 'any',
34
-			'numberposts' => - 1,
34
+			'numberposts' => -1,
35 35
 			'fields'      => 'ids',
36
-		) );
36
+		));
37 37
 
38
-		if ( $items ) {
39
-			foreach ( $items as $item ) {
40
-				wp_delete_post( $item, true );
38
+		if ($items) {
39
+			foreach ($items as $item) {
40
+				wp_delete_post($item, true);
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45 45
 	// Delete All the Terms & Taxonomies.
46
-	foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) {
46
+	foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) {
47 47
 
48
-		$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
48
+		$terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
49 49
 
50 50
 		// Delete Terms.
51
-		if ( $terms ) {
52
-			foreach ( $terms as $term ) {
53
-				$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
54
-				$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
51
+		if ($terms) {
52
+			foreach ($terms as $term) {
53
+				$wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id));
54
+				$wpdb->delete($wpdb->terms, array('term_id' => $term->term_id));
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Delete Taxonomies.
59
-		$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
59
+		$wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s'));
60 60
 	}
61 61
 
62 62
 	// Delete the Plugin Pages.
63
-	$give_created_pages = array( 'success_page', 'failure_page', 'history_page' );
64
-	foreach ( $give_created_pages as $p ) {
65
-		$page = give_get_option( $p, false );
66
-		if ( $page ) {
67
-			wp_delete_post( $page, true );
63
+	$give_created_pages = array('success_page', 'failure_page', 'history_page');
64
+	foreach ($give_created_pages as $p) {
65
+		$page = give_get_option($p, false);
66
+		if ($page) {
67
+			wp_delete_post($page, true);
68 68
 		}
69 69
 	}
70 70
 
@@ -73,21 +73,21 @@  discard block
 block discarded – undo
73 73
 	Give()->roles->remove_caps();
74 74
 
75 75
 	// Delete the Roles.
76
-	$give_roles = array( 'give_manager', 'give_accountant', 'give_worker', 'give_donor' );
77
-	foreach ( $give_roles as $role ) {
78
-		remove_role( $role );
76
+	$give_roles = array('give_manager', 'give_accountant', 'give_worker', 'give_donor');
77
+	foreach ($give_roles as $role) {
78
+		remove_role($role);
79 79
 	}
80 80
 
81 81
 	// Remove all database tables.
82
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' );
83
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' );
84
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' );
82
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors');
83
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers');
84
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta');
85 85
 
86 86
 	// Cleanup Cron Events.
87
-	wp_clear_scheduled_hook( 'give_daily_scheduled_events' );
88
-	wp_clear_scheduled_hook( 'give_weekly_scheduled_events' );
89
-	wp_clear_scheduled_hook( 'give_daily_cron' );
90
-	wp_clear_scheduled_hook( 'give_weekly_cron' );
87
+	wp_clear_scheduled_hook('give_daily_scheduled_events');
88
+	wp_clear_scheduled_hook('give_weekly_scheduled_events');
89
+	wp_clear_scheduled_hook('give_daily_cron');
90
+	wp_clear_scheduled_hook('give_weekly_cron');
91 91
 
92 92
 	// Get all options.
93 93
 	$give_option_names = $wpdb->get_col(
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 		)
98 98
 	);
99 99
 
100
-	if ( ! empty( $give_option_names ) ) {
100
+	if ( ! empty($give_option_names)) {
101 101
 		// Convert option name to transient or option name.
102 102
 		$new_give_option_names = array();
103 103
 
104 104
 		// Delete all the Plugin Options.
105
-		foreach ( $give_option_names as $option ) {
106
-			if ( false !== strpos( $option, 'give_cache' ) ) {
107
-				Give_Cache::delete( $option );
105
+		foreach ($give_option_names as $option) {
106
+			if (false !== strpos($option, 'give_cache')) {
107
+				Give_Cache::delete($option);
108 108
 			} else {
109
-				delete_option( $option );
109
+				delete_option($option);
110 110
 			}
111 111
 		}
112 112
 	}
Please login to merge, or discard this patch.
includes/admin/reports/class-form-reports-table.php 1 patch
Spacing   +58 added lines, -58 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
 /**
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 		global $status, $page;
57 57
 
58 58
 		// Set parent defaults
59
-		parent::__construct( array(
60
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
61
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
59
+		parent::__construct(array(
60
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
61
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
62 62
 			'ajax'     => false                        // Does this table support ajax?
63
-		) );
63
+		));
64 64
 
65
-		add_action( 'give_report_view_actions', array( $this, 'category_filter' ) );
65
+		add_action('give_report_view_actions', array($this, 'category_filter'));
66 66
 		$this->query();
67 67
 
68 68
 	}
@@ -78,32 +78,32 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return string Column Name
80 80
 	 */
81
-	public function column_default( $item, $column_name ) {
82
-		switch ( $column_name ) {
81
+	public function column_default($item, $column_name) {
82
+		switch ($column_name) {
83 83
 			case 'title':
84
-				$title = empty( $item['title'] ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item['ID'] ) : $item['title'];
84
+				$title = empty($item['title']) ? sprintf(__('Untitled (#%s)', 'give'), $item['ID']) : $item['title'];
85 85
 
86 86
 				return sprintf(
87 87
 					'<a href="%s">%s</a>',
88
-					get_edit_post_link( $item['ID'] ),
88
+					get_edit_post_link($item['ID']),
89 89
 					$title
90 90
 				);
91 91
 			case 'sales':
92 92
 				return sprintf(
93 93
 					'<a href="%s">%s</a>',
94
-					admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . urlencode( $item['ID'] ) ),
94
+					admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.urlencode($item['ID'])),
95 95
 					$item['sales']
96 96
 				);
97 97
 			case 'earnings' :
98
-				return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) );
98
+				return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false)));
99 99
 			case 'average_sales' :
100
-				return round( $item[ $column_name ] );
100
+				return round($item[$column_name]);
101 101
 			case 'average_earnings' :
102
-				return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) );
102
+				return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false)));
103 103
 			case 'details' :
104
-				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>';
104
+				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>';
105 105
 			default:
106
-				return $item[ $column_name ];
106
+				return $item[$column_name];
107 107
 		}
108 108
 	}
109 109
 
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function get_columns() {
119 119
 		$columns = array(
120
-			'title'            => esc_html__( 'Form', 'give' ),
121
-			'sales'            => esc_html__( 'Donations', 'give' ),
122
-			'earnings'         => esc_html__( 'Income', 'give' ),
123
-			'average_sales'    => esc_html__( 'Monthly Average Donations', 'give' ),
124
-			'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ),
125
-			'details'          => esc_html__( 'Detailed Report', 'give' )
120
+			'title'            => esc_html__('Form', 'give'),
121
+			'sales'            => esc_html__('Donations', 'give'),
122
+			'earnings'         => esc_html__('Income', 'give'),
123
+			'average_sales'    => esc_html__('Monthly Average Donations', 'give'),
124
+			'average_earnings' => esc_html__('Monthly Average Income', 'give'),
125
+			'details'          => esc_html__('Detailed Report', 'give')
126 126
 		);
127 127
 
128 128
 		return $columns;
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function get_sortable_columns() {
140 140
 		return array(
141
-			'title'    => array( 'title', true ),
142
-			'sales'    => array( 'sales', false ),
143
-			'earnings' => array( 'earnings', false ),
141
+			'title'    => array('title', true),
142
+			'sales'    => array('sales', false),
143
+			'earnings' => array('earnings', false),
144 144
 		);
145 145
 	}
146 146
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @return int Current page number
154 154
 	 */
155 155
 	public function get_paged() {
156
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
156
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
157 157
 	}
158 158
 
159 159
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @return int Category ID
166 166
 	 */
167 167
 	public function get_category() {
168
-		return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0;
168
+		return isset($_GET['category']) ? absint($_GET['category']) : 0;
169 169
 	}
170 170
 
171 171
 	/**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return void
178 178
 	 */
179
-	public function bulk_actions( $which = '' ) {
179
+	public function bulk_actions($which = '') {
180 180
 
181 181
 	}
182 182
 
@@ -188,27 +188,27 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @param string $which
190 190
 	 */
191
-	protected function display_tablenav( $which ) {
191
+	protected function display_tablenav($which) {
192 192
 
193
-		if ( 'top' === $which ) {
194
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
193
+		if ('top' === $which) {
194
+			wp_nonce_field('bulk-'.$this->_args['plural']);
195 195
 		}
196 196
 		?>
197
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
197
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
198 198
 
199
-			<?php if ( 'top' === $which ) { ?>
199
+			<?php if ('top' === $which) { ?>
200 200
 				<h2 class="alignleft reports-earnings-title">
201
-					<?php esc_html_e( 'Donation Forms Report', 'give' ); ?>
201
+					<?php esc_html_e('Donation Forms Report', 'give'); ?>
202 202
 				</h2>
203 203
 			<?php } ?>
204 204
 
205 205
 			<div class="alignright tablenav-right">
206 206
 				<div class="actions bulkactions">
207
-					<?php $this->bulk_actions( $which ); ?>
207
+					<?php $this->bulk_actions($which); ?>
208 208
 				</div>
209 209
 				<?php
210
-				$this->extra_tablenav( $which );
211
-				$this->pagination( $which );
210
+				$this->extra_tablenav($which);
211
+				$this->pagination($which);
212 212
 				?>
213 213
 			</div>
214 214
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function category_filter() {
230 230
 
231
-		$categories = get_terms( 'form_category' );
232
-		if ( $categories && ! is_wp_error( $categories ) ) {
233
-			echo Give()->html->category_dropdown( 'category', $this->get_category() );
231
+		$categories = get_terms('form_category');
232
+		if ($categories && ! is_wp_error($categories)) {
233
+			echo Give()->html->category_dropdown('category', $this->get_category());
234 234
 		}
235 235
 	}
236 236
 
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function query() {
246 246
 
247
-		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title';
248
-		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
247
+		$orderby  = isset($_GET['orderby']) ? $_GET['orderby'] : 'title';
248
+		$order    = isset($_GET['order']) ? $_GET['order'] : 'DESC';
249 249
 		$category = $this->get_category();
250 250
 
251 251
 		$args = array(
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			'suppress_filters' => true
259 259
 		);
260 260
 
261
-		if ( ! empty( $category ) ) {
261
+		if ( ! empty($category)) {
262 262
 			$args['tax_query'] = array(
263 263
 				array(
264 264
 					'taxonomy' => 'form_category',
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			);
268 268
 		}
269 269
 
270
-		switch ( $orderby ) :
270
+		switch ($orderby) :
271 271
 			case 'title' :
272 272
 				$args['orderby'] = 'title';
273 273
 				break;
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 				break;
284 284
 		endswitch;
285 285
 
286
-		$args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this );
286
+		$args = apply_filters('give_form_reports_prepare_items_args', $args, $this);
287 287
 
288
-		$this->donation_forms = new WP_Query( $args );
288
+		$this->donation_forms = new WP_Query($args);
289 289
 
290 290
 		// Store total number of donation forms count.
291 291
 		$this->count = $this->donation_forms->found_posts;
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
 
306 306
 		$give_forms = $this->donation_forms->posts;
307 307
 
308
-		if ( $give_forms ) {
309
-			foreach ( $give_forms as $form ) {
308
+		if ($give_forms) {
309
+			foreach ($give_forms as $form) {
310 310
 				$reports_data[] = array(
311 311
 					'ID'               => $form,
312
-					'title'            => get_the_title( $form ),
313
-					'sales'            => give_get_form_sales_stats( $form ),
314
-					'earnings'         => give_get_form_earnings_stats( $form ),
315
-					'average_sales'    => give_get_average_monthly_form_sales( $form ),
316
-					'average_earnings' => give_get_average_monthly_form_earnings( $form )
312
+					'title'            => get_the_title($form),
313
+					'sales'            => give_get_form_sales_stats($form),
314
+					'earnings'         => give_get_form_earnings_stats($form),
315
+					'average_sales'    => give_get_average_monthly_form_sales($form),
316
+					'average_earnings' => give_get_average_monthly_form_earnings($form)
317 317
 				);
318 318
 			}
319 319
 		}
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
 		$columns = $this->get_columns();
339 339
 		$hidden = array(); // No hidden columns
340 340
 		$sortable = $this->get_sortable_columns();
341
-		$this->_column_headers = array( $columns, $hidden, $sortable );
341
+		$this->_column_headers = array($columns, $hidden, $sortable);
342 342
 		$this->items = $this->reports_data();
343 343
 		$total_items = $this->count;
344 344
 
345
-		$this->set_pagination_args( array(
345
+		$this->set_pagination_args(array(
346 346
 				'total_items' => $total_items,
347 347
 				'per_page'    => $this->per_page,
348
-				'total_pages' => ceil( $total_items / $this->per_page )
348
+				'total_pages' => ceil($total_items / $this->per_page)
349 349
 			)
350 350
 		);
351 351
 	}
Please login to merge, or discard this patch.
includes/admin/reports/class-gateways-reports-table.php 1 patch
Spacing   +38 added lines, -38 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 Payments', 'give' ),
85
-			'pending_sales'   => esc_attr__( 'Pending / Failed Payments', 'give' ),
86
-			'total_sales'     => esc_attr__( 'Total Payments', 'give' ),
87
-			'total_donations' => esc_attr__( 'Total Donated', 'give' )
83
+			'label'           => esc_attr__('Gateway', 'give'),
84
+			'complete_sales'  => esc_attr__('Complete Payments', 'give'),
85
+			'pending_sales'   => esc_attr__('Pending / Failed Payments', 'give'),
86
+			'total_sales'     => esc_attr__('Total Payments', '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
 	 */
100 100
 	public function get_sortable_columns() {
101 101
 		return array(
102
-			'total_donations' => array( 'total_donations', false )
102
+			'total_donations' => array('total_donations', false)
103 103
 		);
104 104
 	}
105 105
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @return int Current page number
113 113
 	 */
114 114
 	public function get_paged() {
115
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
115
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
116 116
 	}
117 117
 
118 118
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @since  1.0
124 124
 	 * @return void
125 125
 	 */
126
-	public function bulk_actions( $which = '' ) {
126
+	public function bulk_actions($which = '') {
127 127
 
128 128
 	}
129 129
 
@@ -135,27 +135,27 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @param string $which
137 137
 	 */
138
-	protected function display_tablenav( $which ) {
138
+	protected function display_tablenav($which) {
139 139
 
140
-		if ( 'top' === $which ) {
141
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
140
+		if ('top' === $which) {
141
+			wp_nonce_field('bulk-'.$this->_args['plural']);
142 142
 		}
143 143
 		?>
144
-		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
144
+		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>">
145 145
 
146
-			<?php if ( 'top' === $which ) { ?>
146
+			<?php if ('top' === $which) { ?>
147 147
 				<h2 class="alignleft reports-earnings-title">
148
-					<?php esc_html_e( 'Donation Methods Report', 'give' ); ?>
148
+					<?php esc_html_e('Donation Methods Report', 'give'); ?>
149 149
 				</h2>
150 150
 			<?php } ?>
151 151
 
152 152
 			<div class="alignright tablenav-right">
153 153
 				<div class="actions bulkactions">
154
-					<?php $this->bulk_actions( $which ); ?>
154
+					<?php $this->bulk_actions($which); ?>
155 155
 				</div>
156 156
 				<?php
157
-				$this->extra_tablenav( $which );
158
-				$this->pagination( $which );
157
+				$this->extra_tablenav($which);
158
+				$this->pagination($which);
159 159
 				?>
160 160
 			</div>
161 161
 
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * @return int
179 179
 	 */
180
-	public function give_sort_total_donations( $old_value, $new_value ) {
180
+	public function give_sort_total_donations($old_value, $new_value) {
181 181
 		// If no sort, default to label.
182
-		$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label';
182
+		$orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label';
183 183
 
184 184
 		//If no order, default to asc.
185
-		$order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc';
185
+		$order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
186 186
 
187 187
 		//Determine sort order.
188
-		$result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] );
188
+		$result = strcmp($old_value[$orderby], $new_value[$orderby]);
189 189
 
190
-		return ( $order === 'asc' ) ? $result : -$result;
190
+		return ($order === 'asc') ? $result : -$result;
191 191
 	}
192 192
 
193 193
 
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
 		$gateways     = give_get_payment_gateways();
205 205
 		$stats        = new Give_Payment_Stats();
206 206
 
207
-		foreach ( $gateways as $gateway_id => $gateway ) {
207
+		foreach ($gateways as $gateway_id => $gateway) {
208 208
 
209
-			$complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' );
210
-			$pending_count  = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) );
209
+			$complete_count = give_count_sales_by_gateway($gateway_id, 'publish');
210
+			$pending_count  = give_count_sales_by_gateway($gateway_id, array('pending', 'failed'));
211 211
 
212 212
 			$reports_data[] = array(
213 213
 				'ID'              => $gateway_id,
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				'complete_sales'  => $complete_count,
216 216
 				'pending_sales'   => $pending_count,
217 217
 				'total_sales'     => $complete_count + $pending_count,
218
-				'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ),
218
+				'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))),
219 219
 			);
220 220
 		}
221 221
 
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
 		$columns               = $this->get_columns();
237 237
 		$hidden                = array(); // No hidden columns
238 238
 		$sortable              = $this->get_sortable_columns();
239
-		$this->_column_headers = array( $columns, $hidden, $sortable );
239
+		$this->_column_headers = array($columns, $hidden, $sortable);
240 240
 		$this->items           = $this->reports_data();
241 241
 
242 242
 		// Sort Array when we are sorting data in array.
243
-		usort( $this->items, array( $this, 'give_sort_total_donations' ) );
243
+		usort($this->items, array($this, 'give_sort_total_donations'));
244 244
 
245 245
 	}
246 246
 }
Please login to merge, or discard this patch.
includes/admin/reports/class-give-graph.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
 	 * @param array $_data
82 82
 	 * @param array $options
83 83
 	 */
84
-	public function __construct( $_data, $options = array() ) {
84
+	public function __construct($_data, $options = array()) {
85 85
 
86
-		$this->data      = $_data;
86
+		$this->data = $_data;
87 87
 
88 88
 		// Generate unique ID
89
-		$this->id = md5( rand() );
89
+		$this->id = md5(rand());
90 90
 
91 91
 		// Setup default options;
92
-		$this->options = apply_filters( 'give_graph_args', array(
92
+		$this->options = apply_filters('give_graph_args', array(
93 93
 			'y_mode'          => null,
94 94
 			'x_mode'          => null,
95 95
 			'y_decimals'      => 0,
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 			'lines'           => false,
108 108
 			'points'          => true,
109 109
 			'dataType'        => array()
110
-		) );
110
+		));
111 111
 
112
-		$this->options = wp_parse_args( $options, $this->options );
112
+		$this->options = wp_parse_args($options, $this->options);
113 113
 	}
114 114
 
115 115
 	/**
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @since 1.0
122 122
 	 */
123
-	public function set( $key, $value ) {
124
-		$this->options[ $key ] = $value;
123
+	public function set($key, $value) {
124
+		$this->options[$key] = $value;
125 125
 	}
126 126
 
127 127
 	/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @since 1.0
133 133
 	 */
134
-	public function get( $key ) {
135
-		return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false;
134
+	public function get($key) {
135
+		return isset($this->options[$key]) ? $this->options[$key] : false;
136 136
 	}
137 137
 
138 138
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @since 1.0
142 142
 	 */
143 143
 	public function get_data() {
144
-		return apply_filters( 'give_get_graph_data', $this->data, $this );
144
+		return apply_filters('give_get_graph_data', $this->data, $this);
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function load_scripts() {
153 153
 		// Use minified libraries if SCRIPT_DEBUG is turned off
154
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
154
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
155 155
 
156
-		wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
157
-		wp_enqueue_script( 'jquery-flot-orderbars' );
156
+		wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
157
+		wp_enqueue_script('jquery-flot-orderbars');
158 158
 
159
-		wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
160
-		wp_enqueue_script( 'jquery-flot-time' );
159
+		wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
160
+		wp_enqueue_script('jquery-flot-time');
161 161
 
162
-		wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
163
-		wp_enqueue_script( 'jquery-flot-resize' );
162
+		wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
163
+		wp_enqueue_script('jquery-flot-resize');
164 164
 
165
-		wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION );
166
-		wp_enqueue_script( 'jquery-flot' );
165
+		wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION);
166
+		wp_enqueue_script('jquery-flot');
167 167
 
168 168
 	}
169 169
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 					[
191 191
 						<?php
192 192
 							$order = 0;
193
-							foreach( $this->get_data() as $label => $data ) :
193
+							foreach ($this->get_data() as $label => $data) :
194 194
 						?>
195 195
 						{
196
-							label : "<?php echo esc_attr( $label ); ?>",
197
-							id    : "<?php echo sanitize_key( $label ); ?>",
198
-							dataType  : '<?php echo ( ! empty( $this->options['dataType'][$order] ) ? $this->options['dataType'][$order] : 'count' ); ?>',
196
+							label : "<?php echo esc_attr($label); ?>",
197
+							id    : "<?php echo sanitize_key($label); ?>",
198
+							dataType  : '<?php echo ( ! empty($this->options['dataType'][$order]) ? $this->options['dataType'][$order] : 'count'); ?>',
199 199
 							// data format is: [ point on x, value on y ]
200
-							data  : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>],
200
+							data  : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>],
201 201
 							points: {
202 202
 								show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>,
203 203
 							},
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 								fill     : true,
213 213
 								fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]}
214 214
 							},
215
-							<?php if( $this->options[ 'multiple_y_axes' ] ) : ?>
215
+							<?php if ($this->options['multiple_y_axes']) : ?>
216 216
 							yaxis : <?php echo $yaxis_count; ?>
217 217
 							<?php endif; ?>
218 218
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 						grid: {
227 227
 							show           : true,
228 228
 							aboveData      : false,
229
-							color          : "<?php echo $this->options[ 'color' ]; ?>",
230
-							backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>",
231
-							borderColor    : "<?php echo $this->options[ 'bordercolor' ]; ?>",
232
-							borderWidth    : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>,
229
+							color          : "<?php echo $this->options['color']; ?>",
230
+							backgroundColor: "<?php echo $this->options['bgcolor']; ?>",
231
+							borderColor    : "<?php echo $this->options['bordercolor']; ?>",
232
+							borderWidth    : <?php echo absint($this->options['borderwidth']); ?>,
233 233
 							clickable      : false,
234 234
 							hoverable      : true
235 235
 						},
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 							mode        : "<?php echo $this->options['x_mode']; ?>",
241 241
 							timeFormat  : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
242 242
 							tickSize    : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>",
243
-							<?php if( $this->options['x_mode'] != 'time' ) : ?>
243
+							<?php if ($this->options['x_mode'] != 'time') : ?>
244 244
 							tickDecimals: <?php echo $this->options['x_decimals']; ?>
245 245
 							<?php endif; ?>
246 246
 						},
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 							min         : 0,
250 250
 							mode        : "<?php echo $this->options['y_mode']; ?>",
251 251
 							timeFormat  : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
252
-							<?php if( $this->options['y_mode'] != 'time' ) : ?>
252
+							<?php if ($this->options['y_mode'] != 'time') : ?>
253 253
 							tickDecimals: <?php echo $this->options['y_decimals']; ?>,
254 254
 							<?php endif; ?>
255 255
 							tickFormatter: function(val) {
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @param Give_Graph $this Graph object.
325 325
 		 */
326
-		do_action( 'give_before_graph', $this );
326
+		do_action('give_before_graph', $this);
327 327
 
328 328
 		// Build the graph.
329 329
 		echo $this->build_graph();
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @param Give_Graph $this Graph object.
337 337
 		 */
338
-		do_action( 'give_after_graph', $this );
338
+		do_action('give_after_graph', $this);
339 339
 	}
340 340
 
341 341
 }
Please login to merge, or discard this patch.